Auto merge of #101603 - matthiaskrgr:rollup-8y6kf20, r=matthiaskrgr

Rollup of 6 pull requests

Successful merges:

 - #99207 (Enable eager checks for memory sanitizer)
 - #101253 (fix the suggestion of format for asm_sub_register)
 - #101450 (Add `const_extern_fn` to 1.62 release notes.)
 - #101556 (Tweak future opaque ty pretty printing)
 - #101563 (Link UEFI target documentation from target list)
 - #101593 (Cleanup themes (tooltip))

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2022-09-09 06:24:25 +00:00
commit 4a09adf99f
25 changed files with 269 additions and 199 deletions

View file

@ -217,6 +217,7 @@ Language
- [Fix constants not getting dropped if part of a diverging expression][94775]
- [Support unit struct/enum variant in destructuring assignment][95380]
- [Remove mutable_borrow_reservation_conflict lint and allow the code pattern][96268]
- [`const` functions may now specify `extern "C"` or `extern "Rust"`][95346]
Compiler
--------
@ -306,6 +307,7 @@ and related tools.
[94872]: https://github.com/rust-lang/rust/pull/94872/
[95006]: https://github.com/rust-lang/rust/pull/95006/
[95035]: https://github.com/rust-lang/rust/pull/95035/
[95346]: https://github.com/rust-lang/rust/pull/95346/
[95372]: https://github.com/rust-lang/rust/pull/95372/
[95380]: https://github.com/rust-lang/rust/pull/95380/
[95431]: https://github.com/rust-lang/rust/pull/95431/

View file

@ -19,6 +19,7 @@
pub use rustc_target::abi::call::*;
use rustc_target::abi::{self, HasDataLayout, Int};
pub use rustc_target::spec::abi::Abi;
use rustc_target::spec::SanitizerSet;
use libc::c_uint;
use smallvec::SmallVec;
@ -90,6 +91,13 @@ fn should_use_mutable_noalias(cx: &CodegenCx<'_, '_>) -> bool {
if regular.contains(ArgAttribute::NoAliasMutRef) && should_use_mutable_noalias(cx) {
attrs.push(llvm::AttributeKind::NoAlias.create_attr(cx.llcx));
}
} else if cx.tcx.sess.opts.unstable_opts.sanitizer.contains(SanitizerSet::MEMORY) {
// If we're not optimising, *but* memory sanitizer is on, emit noundef, since it affects
// memory sanitizer's behavior.
if regular.contains(ArgAttribute::NoUndef) {
attrs.push(llvm::AttributeKind::NoUndef.create_attr(cx.llcx));
}
}
attrs

View file

@ -238,7 +238,6 @@ pub fn extract(attrs: &[ast::Attribute]) -> Option<(Symbol, Span)> {
Future, sym::future_trait, future_trait, Target::Trait, GenericRequirement::Exact(0);
GeneratorState, sym::generator_state, gen_state, Target::Enum, GenericRequirement::None;
Generator, sym::generator, gen_trait, Target::Trait, GenericRequirement::Minimum(1);
GeneratorReturn, sym::generator_return, generator_return, Target::AssocTy, GenericRequirement::None;
Unpin, sym::unpin, unpin_trait, Target::Trait, GenericRequirement::None;
Pin, sym::pin, pin_type, Target::Struct, GenericRequirement::None;

View file

@ -134,7 +134,12 @@ extern "C" LLVMPassRef LLVMRustCreateMemorySanitizerPass(int TrackOrigins, bool
const bool CompileKernel = false;
return wrap(createMemorySanitizerLegacyPassPass(
MemorySanitizerOptions{TrackOrigins, Recover, CompileKernel}));
#if LLVM_VERSION_GE(14, 0)
MemorySanitizerOptions{TrackOrigins, Recover, CompileKernel, /*EagerChecks=*/true}
#else
MemorySanitizerOptions{TrackOrigins, Recover, CompileKernel}
#endif
));
#else
report_fatal_error("Legacy PM not supported with LLVM 15");
#endif
@ -930,10 +935,18 @@ LLVMRustOptimizeWithNewPassManager(
if (SanitizerOptions) {
if (SanitizerOptions->SanitizeMemory) {
#if LLVM_VERSION_GE(14, 0)
MemorySanitizerOptions Options(
SanitizerOptions->SanitizeMemoryTrackOrigins,
SanitizerOptions->SanitizeMemoryRecover,
/*CompileKernel=*/false,
/*EagerChecks=*/true);
#else
MemorySanitizerOptions Options(
SanitizerOptions->SanitizeMemoryTrackOrigins,
SanitizerOptions->SanitizeMemoryRecover,
/*CompileKernel=*/false);
#endif
OptimizerLastEPCallbacks.push_back(
[Options](ModulePassManager &MPM, OptimizationLevel Level) {
#if LLVM_VERSION_GE(14, 0) && LLVM_VERSION_LT(16, 0)

View file

@ -922,12 +922,14 @@ fn pretty_print_opaque_impl_type(
// Skip printing `<[generator@] as Generator<_>>::Return` from async blocks,
// unless we can find out what generator return type it comes from.
let term = if let Some(ty) = term.skip_binder().ty()
&& let ty::Projection(ty::ProjectionTy { item_def_id, substs }) = ty.kind()
&& Some(*item_def_id) == tcx.lang_items().generator_return()
&& let ty::Projection(proj) = ty.kind()
&& let assoc = tcx.associated_item(proj.item_def_id)
&& assoc.trait_container(tcx) == tcx.lang_items().gen_trait()
&& assoc.name == rustc_span::sym::Return
{
if let ty::Generator(_, substs, _) = substs.type_at(0).kind() {
let return_ty = substs.as_generator().return_ty();
if !return_ty.is_ty_infer() {
if !return_ty.is_ty_var() {
return_ty.into()
} else {
continue;

View file

@ -763,7 +763,6 @@
gen_future,
gen_kill,
generator,
generator_return,
generator_state,
generators,
generic_arg_infer,

View file

@ -333,10 +333,10 @@ fn check_asm_operand_type(
let mut err = lint.build(msg);
err.span_label(expr.span, "for this argument");
err.help(&format!(
"use the `{suggested_modifier}` modifier to have the register formatted as `{suggested_result}`",
"use `{{{idx}:{suggested_modifier}}}` to have the register formatted as `{suggested_result}`",
));
err.help(&format!(
"or use the `{default_modifier}` modifier to keep the default formatting of `{default_result}`",
"or use `{{{idx}:{default_modifier}}}` to keep the default formatting of `{default_result}`",
));
err.emit();
},

View file

@ -83,7 +83,7 @@ pub trait Generator<R = ()> {
/// `return` statement or implicitly as the last expression of a generator
/// literal. For example futures would use this as `Result<T, E>` as it
/// represents a completed future.
#[lang = "generator_return"]
#[cfg_attr(bootstrap, lang = "generator_return")]
type Return;
/// Resumes the execution of this generator.

View file

@ -213,7 +213,7 @@ target | std | host | notes
[`aarch64-pc-windows-gnullvm`](platform-support/pc-windows-gnullvm.md) | ✓ | ✓ |
`aarch64-unknown-freebsd` | ✓ | ✓ | ARM64 FreeBSD
`aarch64-unknown-hermit` | ✓ | | ARM64 HermitCore
`aarch64-unknown-uefi` | * | | ARM64 UEFI
[`aarch64-unknown-uefi`](platform-support/unknown-uefi.md) | * | | ARM64 UEFI
`aarch64-unknown-linux-gnu_ilp32` | ✓ | ✓ | ARM64 Linux (ILP32 ABI)
`aarch64-unknown-netbsd` | ✓ | ✓ |
[`aarch64-unknown-openbsd`](platform-support/openbsd.md) | ✓ | ✓ | ARM64 OpenBSD
@ -250,7 +250,7 @@ target | std | host | notes
`i686-unknown-haiku` | ✓ | ✓ | 32-bit Haiku
`i686-unknown-netbsd` | ✓ | ✓ | NetBSD/i386 with SSE2
[`i686-unknown-openbsd`](platform-support/openbsd.md) | ✓ | ✓ | 32-bit OpenBSD
`i686-unknown-uefi` | * | | 32-bit UEFI
[`i686-unknown-uefi`](platform-support/unknown-uefi.md) | * | | 32-bit UEFI
`i686-uwp-windows-gnu` | ? | |
`i686-uwp-windows-msvc` | ? | |
`i686-wrs-vxworks` | ? | |
@ -307,7 +307,7 @@ target | std | host | notes
`x86_64-unknown-l4re-uclibc` | ? | |
`x86_64-unknown-none-linuxkernel` | * | | Linux kernel modules
[`x86_64-unknown-openbsd`](platform-support/openbsd.md) | ✓ | ✓ | 64-bit OpenBSD
`x86_64-unknown-uefi` | * | | 64-bit UEFI
[`x86_64-unknown-uefi`](platform-support/unknown-uefi.md) | * | | 64-bit UEFI
`x86_64-uwp-windows-gnu` | ✓ | |
`x86_64-uwp-windows-msvc` | ✓ | |
`x86_64-wrs-vxworks` | ? | |

View file

@ -1160,6 +1160,42 @@ pre.rust .question-mark {
font-weight: bold;
}
pre.compile_fail,
pre.should_panic {
border-left: 2px solid var(--codeblock-error-color);
}
pre.ignore {
border-left: 2px solid var(--codeblock-ignore-color);
}
pre.compile_fail:hover, .information:hover + .example-wrap pre.compile_fail,
pre.should_panic:hover, .information:hover + .example-wrap pre.should_panic {
border-left: 2px solid var(--codeblock-error-hover-color);
}
pre.ignore:hover, .information:hover + .example-wrap pre.ignore {
border-left: 2px solid var(--codeblock-ignore-hover-color);
}
.tooltip.compile_fail,
.tooltip.should_panic {
color: var(--codeblock-error-color);
}
.tooltip.ignore {
color: var(--codeblock-ignore-color);
}
.information > .compile_fail:hover,
.information > .should_panic:hover {
color: var(--codeblock-error-hover-color);
}
.information > .ignore:hover {
color: var(--codeblock-ignore-hover-color);
}
a.test-arrow {
display: inline-block;
visibility: hidden;

View file

@ -23,6 +23,10 @@ Original by Dempfi (https://github.com/dempfi/ayu)
--copy-path-button-color: #fff;
--copy-path-img-filter: invert(70%);
--copy-path-img-hover-filter: invert(100%);
--codeblock-error-hover-color: rgb(255, 0, 0);
--codeblock-error-color: rgba(255, 0, 0, .5);
--codeblock-ignore-hover-color: rgb(255, 142, 0);
--codeblock-ignore-color: rgba(255, 142, 0, .6);
}
.slider {
@ -244,54 +248,6 @@ a.test-arrow:hover {
border-right: 3px solid rgba(255, 180, 76, 0.85);
}
pre.compile_fail {
border-left: 2px solid rgba(255,0,0,.4);
}
pre.compile_fail:hover, .information:hover + pre.compile_fail {
border-left: 2px solid #f00;
}
pre.should_panic {
border-left: 2px solid rgba(255,0,0,.4);
}
pre.should_panic:hover, .information:hover + pre.should_panic {
border-left: 2px solid #f00;
}
pre.ignore {
border-left: 2px solid rgba(255,142,0,.6);
}
pre.ignore:hover, .information:hover + pre.ignore {
border-left: 2px solid #ff9200;
}
.tooltip.compile_fail {
color: rgba(255,0,0,.5);
}
.information > .compile_fail:hover {
color: #f00;
}
.tooltip.should_panic {
color: rgba(255,0,0,.5);
}
.information > .should_panic:hover {
color: #f00;
}
.tooltip.ignore {
color: rgba(255,142,0,.6);
}
.information > .ignore:hover {
color: #ff9200;
}
.search-failed a {
color: #39AFD7;
}

View file

@ -18,6 +18,10 @@
--copy-path-button-color: #999;
--copy-path-img-filter: invert(50%);
--copy-path-img-hover-filter: invert(65%);
--codeblock-error-hover-color: rgb(255, 0, 0);
--codeblock-error-color: rgba(255, 0, 0, .5);
--codeblock-ignore-hover-color: rgb(255, 142, 0);
--codeblock-ignore-color: rgba(255, 142, 0, .6);
}
.slider {
@ -194,54 +198,6 @@ a.test-arrow:hover{
border-right: 3px solid #bb7410;
}
pre.compile_fail {
border-left: 2px solid rgba(255,0,0,.8);
}
pre.compile_fail:hover, .information:hover + pre.compile_fail {
border-left: 2px solid #f00;
}
pre.should_panic {
border-left: 2px solid rgba(255,0,0,.8);
}
pre.should_panic:hover, .information:hover + pre.should_panic {
border-left: 2px solid #f00;
}
pre.ignore {
border-left: 2px solid rgba(255,142,0,.6);
}
pre.ignore:hover, .information:hover + pre.ignore {
border-left: 2px solid #ff9200;
}
.tooltip.compile_fail {
color: rgba(255,0,0,.8);
}
.information > .compile_fail:hover {
color: #f00;
}
.tooltip.should_panic {
color: rgba(255,0,0,.8);
}
.information > .should_panic:hover {
color: #f00;
}
.tooltip.ignore {
color: rgba(255,142,0,.6);
}
.information > .ignore:hover {
color: #ff9200;
}
.search-failed a {
color: #0089ff;
}

View file

@ -18,6 +18,10 @@
--copy-path-button-color: #999;
--copy-path-img-filter: invert(50%);
--copy-path-img-hover-filter: invert(35%);
--codeblock-error-hover-color: rgb(255, 0, 0);
--codeblock-error-color: rgba(255, 0, 0, .5);
--codeblock-ignore-hover-color: rgb(255, 142, 0);
--codeblock-ignore-color: rgba(255, 142, 0, .6);
}
.slider {
@ -180,54 +184,6 @@ a.test-arrow:hover{
border-right: 3px solid #AD7C37;
}
pre.compile_fail {
border-left: 2px solid rgba(255,0,0,.5);
}
pre.compile_fail:hover, .information:hover + pre.compile_fail {
border-left: 2px solid #f00;
}
pre.should_panic {
border-left: 2px solid rgba(255,0,0,.5);
}
pre.should_panic:hover, .information:hover + pre.should_panic {
border-left: 2px solid #f00;
}
pre.ignore {
border-left: 2px solid rgba(255,142,0,.6);
}
pre.ignore:hover, .information:hover + pre.ignore {
border-left: 2px solid #ff9200;
}
.tooltip.compile_fail {
color: rgba(255,0,0,.5);
}
.information > .compile_fail:hover {
color: #f00;
}
.tooltip.should_panic {
color: rgba(255,0,0,.5);
}
.information > .should_panic:hover {
color: #f00;
}
.tooltip.ignore {
color: rgba(255,142,0,.6);
}
.information > .ignore:hover {
color: #ff9200;
}
.search-failed a {
color: #3873AD;
}

View file

@ -1,9 +1,9 @@
// This test ensures that items and documentation code blocks are wrapped in <pre><code>
goto: file://|DOC_PATH|/test_docs/fn.foo.html
size: (1080, 600)
// There should be three doc codeblocks
// There should be four doc codeblocks.
// Check that their content is inside <pre><code>
assert-count: (".example-wrap pre > code", 3)
assert-count: (".example-wrap pre > code", 4)
// Check that function signature is inside <pre><code>
assert: "pre.rust.fn > code"

View file

@ -0,0 +1,96 @@
// Checking the colors of the codeblocks tooltips.
goto: file://|DOC_PATH|/test_docs/fn.foo.html
show-text: true
// Dark theme.
local-storage: {"rustdoc-theme": "dark", "rustdoc-use-system-theme": "false"}
reload:
// compile_fail block
assert-css: (".docblock .information .compile_fail", {"color": "rgba(255, 0, 0, 0.5)"})
assert-css: (".docblock .example-wrap .compile_fail", {"border-left": "2px solid rgba(255, 0, 0, 0.5)"})
move-cursor-to: ".docblock .information .compile_fail"
assert-css: (".docblock .information .compile_fail", {"color": "rgb(255, 0, 0)"})
assert-css: (".docblock .example-wrap .compile_fail", {"border-left": "2px solid rgb(255, 0, 0)"})
// should_panic block
assert-css: (".docblock .information .should_panic", {"color": "rgba(255, 0, 0, 0.5)"})
assert-css: (".docblock .example-wrap .should_panic", {"border-left": "2px solid rgba(255, 0, 0, 0.5)"})
move-cursor-to: ".docblock .information .should_panic"
assert-css: (".docblock .information .should_panic", {"color": "rgb(255, 0, 0)"})
assert-css: (".docblock .example-wrap .should_panic", {"border-left": "2px solid rgb(255, 0, 0)"})
// ignore block
assert-css: (".docblock .information .ignore", {"color": "rgba(255, 142, 0, 0.6)"})
assert-css: (".docblock .example-wrap .ignore", {"border-left": "2px solid rgba(255, 142, 0, 0.6)"})
move-cursor-to: ".docblock .information .ignore"
assert-css: (".docblock .information .ignore", {"color": "rgb(255, 142, 0)"})
assert-css: (".docblock .example-wrap .ignore", {"border-left": "2px solid rgb(255, 142, 0)"})
// Light theme.
local-storage: {"rustdoc-theme": "light"}
reload:
assert-css: (".docblock .information .compile_fail", {"color": "rgba(255, 0, 0, 0.5)"})
assert-css: (".docblock .example-wrap .compile_fail", {"border-left": "2px solid rgba(255, 0, 0, 0.5)"})
move-cursor-to: ".docblock .information .compile_fail"
assert-css: (".docblock .information .compile_fail", {"color": "rgb(255, 0, 0)"})
assert-css: (".docblock .example-wrap .compile_fail", {"border-left": "2px solid rgb(255, 0, 0)"})
// should_panic block
assert-css: (".docblock .information .should_panic", {"color": "rgba(255, 0, 0, 0.5)"})
assert-css: (".docblock .example-wrap .should_panic", {"border-left": "2px solid rgba(255, 0, 0, 0.5)"})
move-cursor-to: ".docblock .information .should_panic"
assert-css: (".docblock .information .should_panic", {"color": "rgb(255, 0, 0)"})
assert-css: (".docblock .example-wrap .should_panic", {"border-left": "2px solid rgb(255, 0, 0)"})
// ignore block
assert-css: (".docblock .information .ignore", {"color": "rgba(255, 142, 0, 0.6)"})
assert-css: (".docblock .example-wrap .ignore", {"border-left": "2px solid rgba(255, 142, 0, 0.6)"})
move-cursor-to: ".docblock .information .ignore"
assert-css: (".docblock .information .ignore", {"color": "rgb(255, 142, 0)"})
assert-css: (".docblock .example-wrap .ignore", {"border-left": "2px solid rgb(255, 142, 0)"})
// Ayu theme.
local-storage: {"rustdoc-theme": "ayu"}
reload:
assert-css: (".docblock .information .compile_fail", {"color": "rgba(255, 0, 0, 0.5)"})
assert-css: (".docblock .example-wrap .compile_fail", {"border-left": "2px solid rgba(255, 0, 0, 0.5)"})
move-cursor-to: ".docblock .information .compile_fail"
assert-css: (".docblock .information .compile_fail", {"color": "rgb(255, 0, 0)"})
assert-css: (".docblock .example-wrap .compile_fail", {"border-left": "2px solid rgb(255, 0, 0)"})
// should_panic block
assert-css: (".docblock .information .should_panic", {"color": "rgba(255, 0, 0, 0.5)"})
assert-css: (".docblock .example-wrap .should_panic", {"border-left": "2px solid rgba(255, 0, 0, 0.5)"})
move-cursor-to: ".docblock .information .should_panic"
assert-css: (".docblock .information .should_panic", {"color": "rgb(255, 0, 0)"})
assert-css: (".docblock .example-wrap .should_panic", {"border-left": "2px solid rgb(255, 0, 0)"})
// ignore block
assert-css: (".docblock .information .ignore", {"color": "rgba(255, 142, 0, 0.6)"})
assert-css: (".docblock .example-wrap .ignore", {"border-left": "2px solid rgba(255, 142, 0, 0.6)"})
move-cursor-to: ".docblock .information .ignore"
assert-css: (".docblock .information .ignore", {"color": "rgb(255, 142, 0)"})
assert-css: (".docblock .example-wrap .ignore", {"border-left": "2px solid rgb(255, 142, 0)"})

View file

@ -28,6 +28,12 @@
/// Let's say I'm just some text will ya?
/// ```
///
/// A failing to run one:
///
/// ```should_panic
/// panic!("tadam");
/// ```
///
/// An inlined `code`!
pub fn foo() {}

View file

@ -5,8 +5,8 @@ LL | asm!("{}", in(reg) 0u8);
| ^^ --- for this argument
|
= note: `#[warn(asm_sub_register)]` on by default
= help: use the `w` modifier to have the register formatted as `w0`
= help: or use the `x` modifier to keep the default formatting of `x0`
= help: use `{0:w}` to have the register formatted as `w0`
= help: or use `{0:x}` to keep the default formatting of `x0`
warning: formatting may not be suitable for sub-register argument
--> $DIR/type-check-3.rs:50:15
@ -14,8 +14,8 @@ warning: formatting may not be suitable for sub-register argument
LL | asm!("{}", in(reg) 0u16);
| ^^ ---- for this argument
|
= help: use the `w` modifier to have the register formatted as `w0`
= help: or use the `x` modifier to keep the default formatting of `x0`
= help: use `{0:w}` to have the register formatted as `w0`
= help: or use `{0:x}` to keep the default formatting of `x0`
warning: formatting may not be suitable for sub-register argument
--> $DIR/type-check-3.rs:52:15
@ -23,8 +23,8 @@ warning: formatting may not be suitable for sub-register argument
LL | asm!("{}", in(reg) 0i32);
| ^^ ---- for this argument
|
= help: use the `w` modifier to have the register formatted as `w0`
= help: or use the `x` modifier to keep the default formatting of `x0`
= help: use `{0:w}` to have the register formatted as `w0`
= help: or use `{0:x}` to keep the default formatting of `x0`
warning: formatting may not be suitable for sub-register argument
--> $DIR/type-check-3.rs:54:15
@ -32,8 +32,8 @@ warning: formatting may not be suitable for sub-register argument
LL | asm!("{}", in(reg) 0f32);
| ^^ ---- for this argument
|
= help: use the `w` modifier to have the register formatted as `w0`
= help: or use the `x` modifier to keep the default formatting of `x0`
= help: use `{0:w}` to have the register formatted as `w0`
= help: or use `{0:x}` to keep the default formatting of `x0`
warning: formatting may not be suitable for sub-register argument
--> $DIR/type-check-3.rs:57:15
@ -41,8 +41,8 @@ warning: formatting may not be suitable for sub-register argument
LL | asm!("{}", in(vreg) 0i16);
| ^^ ---- for this argument
|
= help: use the `h` modifier to have the register formatted as `h0`
= help: or use the `v` modifier to keep the default formatting of `v0`
= help: use `{0:h}` to have the register formatted as `h0`
= help: or use `{0:v}` to keep the default formatting of `v0`
warning: formatting may not be suitable for sub-register argument
--> $DIR/type-check-3.rs:59:15
@ -50,8 +50,8 @@ warning: formatting may not be suitable for sub-register argument
LL | asm!("{}", in(vreg) 0f32);
| ^^ ---- for this argument
|
= help: use the `s` modifier to have the register formatted as `s0`
= help: or use the `v` modifier to keep the default formatting of `v0`
= help: use `{0:s}` to have the register formatted as `s0`
= help: or use `{0:v}` to keep the default formatting of `v0`
warning: formatting may not be suitable for sub-register argument
--> $DIR/type-check-3.rs:61:15
@ -59,8 +59,8 @@ warning: formatting may not be suitable for sub-register argument
LL | asm!("{}", in(vreg) 0f64);
| ^^ ---- for this argument
|
= help: use the `d` modifier to have the register formatted as `d0`
= help: or use the `v` modifier to keep the default formatting of `v0`
= help: use `{0:d}` to have the register formatted as `d0`
= help: or use `{0:v}` to keep the default formatting of `v0`
warning: formatting may not be suitable for sub-register argument
--> $DIR/type-check-3.rs:63:15
@ -68,8 +68,8 @@ warning: formatting may not be suitable for sub-register argument
LL | asm!("{}", in(vreg_low16) 0f64);
| ^^ ---- for this argument
|
= help: use the `d` modifier to have the register formatted as `d0`
= help: or use the `v` modifier to keep the default formatting of `v0`
= help: use `{0:d}` to have the register formatted as `d0`
= help: or use `{0:v}` to keep the default formatting of `v0`
warning: formatting may not be suitable for sub-register argument
--> $DIR/type-check-3.rs:66:15
@ -77,8 +77,8 @@ warning: formatting may not be suitable for sub-register argument
LL | asm!("{0} {0}", in(reg) 0i16);
| ^^^ ^^^ ---- for this argument
|
= help: use the `w` modifier to have the register formatted as `w0`
= help: or use the `x` modifier to keep the default formatting of `x0`
= help: use `{0:w}` to have the register formatted as `w0`
= help: or use `{0:x}` to keep the default formatting of `x0`
warning: formatting may not be suitable for sub-register argument
--> $DIR/type-check-3.rs:68:15
@ -86,8 +86,8 @@ warning: formatting may not be suitable for sub-register argument
LL | asm!("{0} {0:x}", in(reg) 0i16);
| ^^^ ---- for this argument
|
= help: use the `w` modifier to have the register formatted as `w0`
= help: or use the `x` modifier to keep the default formatting of `x0`
= help: use `{0:w}` to have the register formatted as `w0`
= help: or use `{0:x}` to keep the default formatting of `x0`
error: type `i128` cannot be used with this register class
--> $DIR/type-check-3.rs:73:28

View file

@ -190,8 +190,8 @@ LL | asm!("{:foo}", in(reg) foo);
| ^^^^^^ --- for this argument
|
= note: `#[warn(asm_sub_register)]` on by default
= help: use the `w` modifier to have the register formatted as `w0`
= help: or use the `x` modifier to keep the default formatting of `x0`
= help: use `{0:w}` to have the register formatted as `w0`
= help: or use `{0:x}` to keep the default formatting of `x0`
error: aborting due to 21 previous errors; 1 warning emitted

View file

@ -190,8 +190,8 @@ LL | asm!("{:foo}", in(reg) foo);
| ^^^^^^ --- for this argument
|
= note: `#[warn(asm_sub_register)]` on by default
= help: use the `w` modifier to have the register formatted as `w0`
= help: or use the `x` modifier to keep the default formatting of `x0`
= help: use `{0:w}` to have the register formatted as `w0`
= help: or use `{0:x}` to keep the default formatting of `x0`
error: aborting due to 21 previous errors; 1 warning emitted

View file

@ -190,8 +190,8 @@ LL | asm!("{:foo}", in(reg) foo);
| ^^^^^^ --- for this argument
|
= note: `#[warn(asm_sub_register)]` on by default
= help: use the `e` modifier to have the register formatted as `eax`
= help: or use the `r` modifier to keep the default formatting of `rax`
= help: use `{0:e}` to have the register formatted as `eax`
= help: or use `{0:r}` to keep the default formatting of `rax`
error: aborting due to 21 previous errors; 1 warning emitted

View file

@ -190,8 +190,8 @@ LL | asm!("{:foo}", in(reg) foo);
| ^^^^^^ --- for this argument
|
= note: `#[warn(asm_sub_register)]` on by default
= help: use the `e` modifier to have the register formatted as `eax`
= help: or use the `r` modifier to keep the default formatting of `rax`
= help: use `{0:e}` to have the register formatted as `eax`
= help: or use `{0:r}` to keep the default formatting of `rax`
error: aborting due to 21 previous errors; 1 warning emitted

View file

@ -45,8 +45,8 @@ LL | asm!("{0} {0}", in(reg) 0i16);
| ^^^ ^^^ ---- for this argument
|
= note: `#[warn(asm_sub_register)]` on by default
= help: use the `x` modifier to have the register formatted as `ax`
= help: or use the `r` modifier to keep the default formatting of `rax`
= help: use `{0:x}` to have the register formatted as `ax`
= help: or use `{0:r}` to keep the default formatting of `rax`
warning: formatting may not be suitable for sub-register argument
--> $DIR/type-check-3.rs:36:15
@ -54,8 +54,8 @@ warning: formatting may not be suitable for sub-register argument
LL | asm!("{0} {0:x}", in(reg) 0i16);
| ^^^ ---- for this argument
|
= help: use the `x` modifier to have the register formatted as `ax`
= help: or use the `r` modifier to keep the default formatting of `rax`
= help: use `{0:x}` to have the register formatted as `ax`
= help: or use `{0:r}` to keep the default formatting of `rax`
warning: formatting may not be suitable for sub-register argument
--> $DIR/type-check-3.rs:38:15
@ -63,8 +63,8 @@ warning: formatting may not be suitable for sub-register argument
LL | asm!("{}", in(reg) 0i32);
| ^^ ---- for this argument
|
= help: use the `e` modifier to have the register formatted as `eax`
= help: or use the `r` modifier to keep the default formatting of `rax`
= help: use `{0:e}` to have the register formatted as `eax`
= help: or use `{0:r}` to keep the default formatting of `rax`
warning: formatting may not be suitable for sub-register argument
--> $DIR/type-check-3.rs:41:15
@ -72,8 +72,8 @@ warning: formatting may not be suitable for sub-register argument
LL | asm!("{}", in(ymm_reg) 0i64);
| ^^ ---- for this argument
|
= help: use the `x` modifier to have the register formatted as `xmm0`
= help: or use the `y` modifier to keep the default formatting of `ymm0`
= help: use `{0:x}` to have the register formatted as `xmm0`
= help: or use `{0:y}` to keep the default formatting of `ymm0`
error: type `i8` cannot be used with this register class
--> $DIR/type-check-3.rs:52:28

View file

@ -0,0 +1,38 @@
// needs-sanitizer-support
// needs-sanitizer-memory
// min-llvm-version: 14.0.0
//
// revisions: unoptimized optimized
//
// [optimized]compile-flags: -Z sanitizer=memory -Zsanitizer-memory-track-origins -O
// [unoptimized]compile-flags: -Z sanitizer=memory -Zsanitizer-memory-track-origins
//
// run-fail
// error-pattern: MemorySanitizer: use-of-uninitialized-value
// error-pattern: Uninitialized value was created by an allocation
// error-pattern: in the stack frame of function 'random'
//
// This test case intentionally limits the usage of the std,
// since it will be linked with an uninstrumented version of it.
#![feature(core_intrinsics)]
#![feature(start)]
#![feature(bench_black_box)]
use std::hint::black_box;
use std::mem::MaybeUninit;
#[inline(never)]
#[no_mangle]
#[allow(invalid_value)]
fn random() -> char {
let r = unsafe { MaybeUninit::uninit().assume_init() };
// Avoid optimizing everything out.
black_box(r)
}
#[start]
fn main(_: isize, _: *const *const u8) -> isize {
random();
0
}

View file

@ -1,7 +1,10 @@
// needs-sanitizer-support
// needs-sanitizer-memory
//
// compile-flags: -Z sanitizer=memory -Zsanitizer-memory-track-origins -O
// revisions: unoptimized optimized
//
// [optimized]compile-flags: -Z sanitizer=memory -Zsanitizer-memory-track-origins -O
// [unoptimized]compile-flags: -Z sanitizer=memory -Zsanitizer-memory-track-origins
//
// run-fail
// error-pattern: MemorySanitizer: use-of-uninitialized-value
@ -22,9 +25,9 @@
#[inline(never)]
#[no_mangle]
fn random() -> [isize; 32] {
let r = unsafe { MaybeUninit::uninit().assume_init() };
let r = MaybeUninit::uninit();
// Avoid optimizing everything out.
black_box(r)
unsafe { std::intrinsics::volatile_load(r.as_ptr()) }
}
#[inline(never)]
@ -39,6 +42,6 @@ fn xor(a: &[isize]) -> isize {
#[start]
fn main(_: isize, _: *const *const u8) -> isize {
let r = random();
let r = black_box(random as fn() -> [isize; 32])();
xor(&r)
}

View file

@ -91,7 +91,7 @@ LL | pub const fn from_generator<T>(gen: T) -> impl Future<Output = T::Return>
| ------------------------------- the found opaque type
|
= note: expected struct `Pin<Box<(dyn Future<Output = i32> + Send + 'static)>>`
found opaque type `impl Future`
found opaque type `impl Future<Output = {integer}>`
help: you need to pin and box this expression
|
LL ~ Box::pin(async {