Skip to content

Rollup of 6 pull requests #101603

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Sep 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
--------
Expand Down Expand Up @@ -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/
Expand Down
8 changes: 8 additions & 0 deletions compiler/rustc_codegen_llvm/src/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use rustc_target::abi::call::ArgAbi;
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;
Expand Down Expand Up @@ -90,6 +91,13 @@ fn get_attrs<'ll>(this: &ArgAttributes, cx: &CodegenCx<'ll, '_>) -> SmallVec<[&'
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
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_hir/src/lang_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,6 @@ language_item_table! {
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;

Expand Down
15 changes: 14 additions & 1 deletion compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
8 changes: 5 additions & 3 deletions compiler/rustc_middle/src/ty/print/pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -916,12 +916,14 @@ pub trait PrettyPrinter<'tcx>:
// 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;
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_span/src/symbol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,6 @@ symbols! {
gen_future,
gen_kill,
generator,
generator_return,
generator_state,
generators,
generic_arg_infer,
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_typeck/src/check/intrinsicck.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,10 +333,10 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> {
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();
},
Expand Down
2 changes: 1 addition & 1 deletion library/core/src/ops/generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions src/doc/rustc/src/platform-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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` | ? | |
Expand Down Expand Up @@ -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` | ? | |
Expand Down
36 changes: 36 additions & 0 deletions src/librustdoc/html/static/css/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
52 changes: 4 additions & 48 deletions src/librustdoc/html/static/css/themes/ayu.css
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
}
Expand Down
52 changes: 4 additions & 48 deletions src/librustdoc/html/static/css/themes/dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
}
Expand Down
52 changes: 4 additions & 48 deletions src/librustdoc/html/static/css/themes/light.css
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
}
Expand Down
Loading