mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-28 02:57:37 +00:00
Auto merge of #91338 - matthiaskrgr:rollup-46ry8wi, r=matthiaskrgr
Rollup of 3 pull requests Successful merges: - #90131 (Fix a format_args span to be expansion) - #90832 (Add 1.57.0 release notes) - #90833 (Emit LLVM optimization remarks when enabled with `-Cremark`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
a19e748baa
114
RELEASES.md
114
RELEASES.md
@ -1,3 +1,117 @@
|
||||
Version 1.57.0 (2021-12-02)
|
||||
==========================
|
||||
|
||||
Language
|
||||
--------
|
||||
|
||||
- [Macro attributes may follow `#[derive]` and will see the original (pre-`cfg`) input.][87220]
|
||||
- [Accept curly-brace macros in expressions, like `m!{ .. }.method()` and `m!{ .. }?`.][88690]
|
||||
- [Allow panicking in constant evaluation.][89508]
|
||||
|
||||
Compiler
|
||||
--------
|
||||
|
||||
- [Create more accurate debuginfo for vtables.][89597]
|
||||
- [Add `armv6k-nintendo-3ds` at Tier 3\*.][88529]
|
||||
- [Add `armv7-unknown-linux-uclibceabihf` at Tier 3\*.][88952]
|
||||
- [Add `m68k-unknown-linux-gnu` at Tier 3\*.][88321]
|
||||
- [Add SOLID targets at Tier 3\*:][86191] `aarch64-kmc-solid_asp3`, `armv7a-kmc-solid_asp3-eabi`, `armv7a-kmc-solid_asp3-eabihf`
|
||||
|
||||
\* Refer to Rust's [platform support page][platform-support-doc] for more
|
||||
information on Rust's tiered platform support.
|
||||
|
||||
Libraries
|
||||
---------
|
||||
|
||||
- [Avoid allocations and copying in `Vec::leak`][89337]
|
||||
- [Add `#[repr(i8)]` to `Ordering`][89507]
|
||||
- [Optimize `File::read_to_end` and `read_to_string`][89582]
|
||||
- [Update to Unicode 14.0][89614]
|
||||
- [Many more functions are marked `#[must_use]`][89692], producing a warning
|
||||
when ignoring their return value. This helps catch mistakes such as expecting
|
||||
a function to mutate a value in place rather than return a new value.
|
||||
|
||||
Stabilised APIs
|
||||
---------------
|
||||
|
||||
- [`[T; N]::as_mut_slice`][`array::as_mut_slice`]
|
||||
- [`[T; N]::as_slice`][`array::as_slice`]
|
||||
- [`collections::TryReserveError`]
|
||||
- [`HashMap::try_reserve`]
|
||||
- [`HashSet::try_reserve`]
|
||||
- [`String::try_reserve`]
|
||||
- [`String::try_reserve_exact`]
|
||||
- [`Vec::try_reserve`]
|
||||
- [`Vec::try_reserve_exact`]
|
||||
- [`VecDeque::try_reserve`]
|
||||
- [`VecDeque::try_reserve_exact`]
|
||||
- [`Iterator::map_while`]
|
||||
- [`iter::MapWhile`]
|
||||
- [`proc_macro::is_available`]
|
||||
- [`Command::get_program`]
|
||||
- [`Command::get_args`]
|
||||
- [`Command::get_envs`]
|
||||
- [`Command::get_current_dir`]
|
||||
- [`CommandArgs`]
|
||||
- [`CommandEnvs`]
|
||||
|
||||
These APIs are now usable in const contexts:
|
||||
|
||||
- [`hint::unreachable_unchecked`]
|
||||
|
||||
Cargo
|
||||
-----
|
||||
|
||||
- [Stabilize custom profiles][cargo/9943]
|
||||
|
||||
Compatibility notes
|
||||
-------------------
|
||||
|
||||
Internal changes
|
||||
----------------
|
||||
These changes provide no direct user facing benefits, but represent significant
|
||||
improvements to the internals and overall performance of rustc
|
||||
and related tools.
|
||||
|
||||
- [Added an experimental backend for codegen with `libgccjit`.][87260]
|
||||
|
||||
[86191]: https://github.com/rust-lang/rust/pull/86191/
|
||||
[87220]: https://github.com/rust-lang/rust/pull/87220/
|
||||
[87260]: https://github.com/rust-lang/rust/pull/87260/
|
||||
[88243]: https://github.com/rust-lang/rust/pull/88243/
|
||||
[88321]: https://github.com/rust-lang/rust/pull/88321/
|
||||
[88529]: https://github.com/rust-lang/rust/pull/88529/
|
||||
[88690]: https://github.com/rust-lang/rust/pull/88690/
|
||||
[88952]: https://github.com/rust-lang/rust/pull/88952/
|
||||
[89337]: https://github.com/rust-lang/rust/pull/89337/
|
||||
[89507]: https://github.com/rust-lang/rust/pull/89507/
|
||||
[89508]: https://github.com/rust-lang/rust/pull/89508/
|
||||
[89582]: https://github.com/rust-lang/rust/pull/89582/
|
||||
[89597]: https://github.com/rust-lang/rust/pull/89597/
|
||||
[89614]: https://github.com/rust-lang/rust/pull/89614/
|
||||
[89692]: https://github.com/rust-lang/rust/issues/89692/
|
||||
[cargo/9943]: https://github.com/rust-lang/cargo/pull/9943/
|
||||
[`array::as_mut_slice`]: https://doc.rust-lang.org/std/primitive.array.html#method.as_mut_slice
|
||||
[`array::as_slice`]: https://doc.rust-lang.org/std/primitive.array.html#method.as_slice
|
||||
[`collections::TryReserveError`]: https://doc.rust-lang.org/std/collections/struct.TryReserveError.html
|
||||
[`HashMap::try_reserve`]: https://doc.rust-lang.org/std/collections/hash_map/struct.HashMap.html#method.try_reserve
|
||||
[`HashSet::try_reserve`]: https://doc.rust-lang.org/std/collections/hash_set/struct.HashSet.html#method.try_reserve
|
||||
[`String::try_reserve`]: https://doc.rust-lang.org/alloc/string/struct.String.html#method.try_reserve
|
||||
[`String::try_reserve_exact`]: https://doc.rust-lang.org/alloc/string/struct.String.html#method.try_reserve_exact
|
||||
[`Vec::try_reserve`]: https://doc.rust-lang.org/std/vec/struct.Vec.html#method.try_reserve
|
||||
[`Vec::try_reserve_exact`]: https://doc.rust-lang.org/std/vec/struct.Vec.html#method.try_reserve_exact
|
||||
[`VecDeque::try_reserve`]: https://doc.rust-lang.org/std/collections/struct.VecDeque.html#method.try_reserve
|
||||
[`VecDeque::try_reserve_exact`]: https://doc.rust-lang.org/std/collections/struct.VecDeque.html#method.try_reserve_exact
|
||||
[`Iterator::map_while`]: https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.map_while
|
||||
[`iter::MapWhile`]: https://doc.rust-lang.org/std/iter/struct.MapWhile.html
|
||||
[`proc_macro::is_available`]: https://doc.rust-lang.org/proc_macro/fn.is_available.html
|
||||
[`Command::get_program`]: https://doc.rust-lang.org/std/process/struct.Command.html#method.get_program
|
||||
[`Command::get_args`]: https://doc.rust-lang.org/std/process/struct.Command.html#method.get_args
|
||||
[`Command::get_envs`]: https://doc.rust-lang.org/std/process/struct.Command.html#method.get_envs
|
||||
[`Command::get_current_dir`]: https://doc.rust-lang.org/std/process/struct.Command.html#method.get_current_dir
|
||||
[`CommandArgs`]: https://doc.rust-lang.org/std/process/struct.CommandArgs.html
|
||||
[`CommandEnvs`]: https://doc.rust-lang.org/std/process/struct.CommandEnvs.html
|
||||
|
||||
Version 1.56.1 (2021-11-01)
|
||||
===========================
|
||||
|
||||
|
@ -769,7 +769,10 @@ impl<'a, 'b> Context<'a, 'b> {
|
||||
for arg_ty in self.arg_unique_types[i].iter() {
|
||||
args.push(Context::format_arg(self.ecx, self.macsp, e.span, arg_ty, i));
|
||||
}
|
||||
heads.push(self.ecx.expr_addr_of(e.span, e));
|
||||
// use the arg span for `&arg` so that borrowck errors
|
||||
// point to the specific expression passed to the macro
|
||||
// (the span is otherwise unavailable in MIR)
|
||||
heads.push(self.ecx.expr_addr_of(e.span.with_ctxt(self.macsp.ctxt()), e));
|
||||
}
|
||||
for pos in self.count_args {
|
||||
let index = match pos {
|
||||
|
@ -259,6 +259,7 @@ pub(crate) fn save_temp_bitcode(
|
||||
pub struct DiagnosticHandlers<'a> {
|
||||
data: *mut (&'a CodegenContext<LlvmCodegenBackend>, &'a Handler),
|
||||
llcx: &'a llvm::Context,
|
||||
old_handler: Option<&'a llvm::DiagnosticHandler>,
|
||||
}
|
||||
|
||||
impl<'a> DiagnosticHandlers<'a> {
|
||||
@ -267,12 +268,35 @@ impl<'a> DiagnosticHandlers<'a> {
|
||||
handler: &'a Handler,
|
||||
llcx: &'a llvm::Context,
|
||||
) -> Self {
|
||||
let remark_passes_all: bool;
|
||||
let remark_passes: Vec<CString>;
|
||||
match &cgcx.remark {
|
||||
Passes::All => {
|
||||
remark_passes_all = true;
|
||||
remark_passes = Vec::new();
|
||||
}
|
||||
Passes::Some(passes) => {
|
||||
remark_passes_all = false;
|
||||
remark_passes =
|
||||
passes.iter().map(|name| CString::new(name.as_str()).unwrap()).collect();
|
||||
}
|
||||
};
|
||||
let remark_passes: Vec<*const c_char> =
|
||||
remark_passes.iter().map(|name: &CString| name.as_ptr()).collect();
|
||||
let data = Box::into_raw(Box::new((cgcx, handler)));
|
||||
unsafe {
|
||||
let old_handler = llvm::LLVMRustContextGetDiagnosticHandler(llcx);
|
||||
llvm::LLVMRustContextConfigureDiagnosticHandler(
|
||||
llcx,
|
||||
diagnostic_handler,
|
||||
data.cast(),
|
||||
remark_passes_all,
|
||||
remark_passes.as_ptr(),
|
||||
remark_passes.len(),
|
||||
);
|
||||
llvm::LLVMRustSetInlineAsmDiagnosticHandler(llcx, inline_asm_handler, data.cast());
|
||||
llvm::LLVMContextSetDiagnosticHandler(llcx, diagnostic_handler, data.cast());
|
||||
DiagnosticHandlers { data, llcx, old_handler }
|
||||
}
|
||||
DiagnosticHandlers { data, llcx }
|
||||
}
|
||||
}
|
||||
|
||||
@ -281,7 +305,7 @@ impl<'a> Drop for DiagnosticHandlers<'a> {
|
||||
use std::ptr::null_mut;
|
||||
unsafe {
|
||||
llvm::LLVMRustSetInlineAsmDiagnosticHandler(self.llcx, inline_asm_handler, null_mut());
|
||||
llvm::LLVMContextSetDiagnosticHandler(self.llcx, diagnostic_handler, null_mut());
|
||||
llvm::LLVMRustContextSetDiagnosticHandler(self.llcx, self.old_handler);
|
||||
drop(Box::from_raw(self.data));
|
||||
}
|
||||
}
|
||||
@ -337,13 +361,8 @@ unsafe extern "C" fn diagnostic_handler(info: &DiagnosticInfo, user: *mut c_void
|
||||
|
||||
if enabled {
|
||||
diag_handler.note_without_error(&format!(
|
||||
"optimization {} for {} at {}:{}:{}: {}",
|
||||
opt.kind.describe(),
|
||||
opt.pass_name,
|
||||
opt.filename,
|
||||
opt.line,
|
||||
opt.column,
|
||||
opt.message
|
||||
"{}:{}:{}: {}: {}",
|
||||
opt.filename, opt.line, opt.column, opt.pass_name, opt.message,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
@ -675,8 +675,12 @@ pub struct OperandBundleDef<'a>(InvariantOpaque<'a>);
|
||||
#[repr(C)]
|
||||
pub struct Linker<'a>(InvariantOpaque<'a>);
|
||||
|
||||
pub type DiagnosticHandler = unsafe extern "C" fn(&DiagnosticInfo, *mut c_void);
|
||||
pub type InlineAsmDiagHandler = unsafe extern "C" fn(&SMDiagnostic, *const c_void, c_uint);
|
||||
extern "C" {
|
||||
pub type DiagnosticHandler;
|
||||
}
|
||||
|
||||
pub type DiagnosticHandlerTy = unsafe extern "C" fn(&DiagnosticInfo, *mut c_void);
|
||||
pub type InlineAsmDiagHandlerTy = unsafe extern "C" fn(&SMDiagnostic, *const c_void, c_uint);
|
||||
|
||||
pub mod coverageinfo {
|
||||
use super::coverage_map;
|
||||
@ -2289,12 +2293,6 @@ extern "C" {
|
||||
#[allow(improper_ctypes)]
|
||||
pub fn LLVMRustWriteTwineToString(T: &Twine, s: &RustString);
|
||||
|
||||
pub fn LLVMContextSetDiagnosticHandler(
|
||||
C: &Context,
|
||||
Handler: DiagnosticHandler,
|
||||
DiagnosticContext: *mut c_void,
|
||||
);
|
||||
|
||||
#[allow(improper_ctypes)]
|
||||
pub fn LLVMRustUnpackOptimizationDiagnostic(
|
||||
DI: &'a DiagnosticInfo,
|
||||
@ -2324,7 +2322,7 @@ extern "C" {
|
||||
|
||||
pub fn LLVMRustSetInlineAsmDiagnosticHandler(
|
||||
C: &Context,
|
||||
H: InlineAsmDiagHandler,
|
||||
H: InlineAsmDiagHandlerTy,
|
||||
CX: *mut c_void,
|
||||
);
|
||||
|
||||
@ -2439,4 +2437,19 @@ extern "C" {
|
||||
mod_id: *const c_char,
|
||||
data: &ThinLTOData,
|
||||
);
|
||||
|
||||
pub fn LLVMRustContextGetDiagnosticHandler(Context: &Context) -> Option<&DiagnosticHandler>;
|
||||
pub fn LLVMRustContextSetDiagnosticHandler(
|
||||
context: &Context,
|
||||
diagnostic_handler: Option<&DiagnosticHandler>,
|
||||
);
|
||||
pub fn LLVMRustContextConfigureDiagnosticHandler(
|
||||
context: &Context,
|
||||
diagnostic_handler_callback: DiagnosticHandlerTy,
|
||||
diagnostic_handler_context: *mut c_void,
|
||||
remark_all_passes: bool,
|
||||
remark_passes: *const *const c_char,
|
||||
remark_passes_len: usize,
|
||||
);
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "LLVMWrapper.h"
|
||||
#include "llvm/IR/DebugInfoMetadata.h"
|
||||
#include "llvm/IR/DiagnosticHandler.h"
|
||||
#include "llvm/IR/DiagnosticInfo.h"
|
||||
#include "llvm/IR/DiagnosticPrinter.h"
|
||||
#include "llvm/IR/GlobalVariable.h"
|
||||
@ -1177,10 +1178,13 @@ static LLVMRustDiagnosticKind toRust(DiagnosticKind Kind) {
|
||||
case DK_SampleProfile:
|
||||
return LLVMRustDiagnosticKind::SampleProfile;
|
||||
case DK_OptimizationRemark:
|
||||
case DK_MachineOptimizationRemark:
|
||||
return LLVMRustDiagnosticKind::OptimizationRemark;
|
||||
case DK_OptimizationRemarkMissed:
|
||||
case DK_MachineOptimizationRemarkMissed:
|
||||
return LLVMRustDiagnosticKind::OptimizationRemarkMissed;
|
||||
case DK_OptimizationRemarkAnalysis:
|
||||
case DK_MachineOptimizationRemarkAnalysis:
|
||||
return LLVMRustDiagnosticKind::OptimizationRemarkAnalysis;
|
||||
case DK_OptimizationRemarkAnalysisFPCommute:
|
||||
return LLVMRustDiagnosticKind::OptimizationRemarkAnalysisFPCommute;
|
||||
@ -1783,3 +1787,92 @@ extern "C" LLVMRustResult LLVMRustWriteImportLibrary(
|
||||
return LLVMRustResult::Success;
|
||||
}
|
||||
}
|
||||
|
||||
// Transfers ownership of DiagnosticHandler unique_ptr to the caller.
|
||||
extern "C" DiagnosticHandler *
|
||||
LLVMRustContextGetDiagnosticHandler(LLVMContextRef C) {
|
||||
std::unique_ptr<DiagnosticHandler> DH = unwrap(C)->getDiagnosticHandler();
|
||||
return DH.release();
|
||||
}
|
||||
|
||||
// Sets unique_ptr to object of DiagnosticHandler to provide custom diagnostic
|
||||
// handling. Ownership of the handler is moved to the LLVMContext.
|
||||
extern "C" void LLVMRustContextSetDiagnosticHandler(LLVMContextRef C,
|
||||
DiagnosticHandler *DH) {
|
||||
unwrap(C)->setDiagnosticHandler(std::unique_ptr<DiagnosticHandler>(DH));
|
||||
}
|
||||
|
||||
using LLVMDiagnosticHandlerTy = DiagnosticHandler::DiagnosticHandlerTy;
|
||||
|
||||
// Configures a diagnostic handler that invokes provided callback when a
|
||||
// backend needs to emit a diagnostic.
|
||||
//
|
||||
// When RemarkAllPasses is true, remarks are enabled for all passes. Otherwise
|
||||
// the RemarkPasses array specifies individual passes for which remarks will be
|
||||
// enabled.
|
||||
extern "C" void LLVMRustContextConfigureDiagnosticHandler(
|
||||
LLVMContextRef C, LLVMDiagnosticHandlerTy DiagnosticHandlerCallback,
|
||||
void *DiagnosticHandlerContext, bool RemarkAllPasses,
|
||||
const char * const * RemarkPasses, size_t RemarkPassesLen) {
|
||||
|
||||
class RustDiagnosticHandler final : public DiagnosticHandler {
|
||||
public:
|
||||
RustDiagnosticHandler(LLVMDiagnosticHandlerTy DiagnosticHandlerCallback,
|
||||
void *DiagnosticHandlerContext,
|
||||
bool RemarkAllPasses,
|
||||
std::vector<std::string> RemarkPasses)
|
||||
: DiagnosticHandlerCallback(DiagnosticHandlerCallback),
|
||||
DiagnosticHandlerContext(DiagnosticHandlerContext),
|
||||
RemarkAllPasses(RemarkAllPasses),
|
||||
RemarkPasses(RemarkPasses) {}
|
||||
|
||||
virtual bool handleDiagnostics(const DiagnosticInfo &DI) override {
|
||||
if (DiagnosticHandlerCallback) {
|
||||
DiagnosticHandlerCallback(DI, DiagnosticHandlerContext);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isAnalysisRemarkEnabled(StringRef PassName) const override {
|
||||
return isRemarkEnabled(PassName);
|
||||
}
|
||||
|
||||
bool isMissedOptRemarkEnabled(StringRef PassName) const override {
|
||||
return isRemarkEnabled(PassName);
|
||||
}
|
||||
|
||||
bool isPassedOptRemarkEnabled(StringRef PassName) const override {
|
||||
return isRemarkEnabled(PassName);
|
||||
}
|
||||
|
||||
bool isAnyRemarkEnabled() const override {
|
||||
return RemarkAllPasses || !RemarkPasses.empty();
|
||||
}
|
||||
|
||||
private:
|
||||
bool isRemarkEnabled(StringRef PassName) const {
|
||||
if (RemarkAllPasses)
|
||||
return true;
|
||||
|
||||
for (auto &Pass : RemarkPasses)
|
||||
if (Pass == PassName)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
LLVMDiagnosticHandlerTy DiagnosticHandlerCallback = nullptr;
|
||||
void *DiagnosticHandlerContext = nullptr;
|
||||
|
||||
bool RemarkAllPasses = false;
|
||||
std::vector<std::string> RemarkPasses;
|
||||
};
|
||||
|
||||
std::vector<std::string> Passes;
|
||||
for (size_t I = 0; I != RemarkPassesLen; ++I)
|
||||
Passes.push_back(RemarkPasses[I]);
|
||||
|
||||
unwrap(C)->setDiagnosticHandler(std::make_unique<RustDiagnosticHandler>(
|
||||
DiagnosticHandlerCallback, DiagnosticHandlerContext, RemarkAllPasses, Passes));
|
||||
}
|
||||
|
@ -3,6 +3,8 @@ error[E0381]: borrow of possibly-uninitialized variable: `i`
|
||||
|
|
||||
LL | println!("{}", i);
|
||||
| ^ use of possibly-uninitialized `i`
|
||||
|
|
||||
= note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -3,6 +3,8 @@ error[E0381]: borrow of possibly-uninitialized variable: `x`
|
||||
|
|
||||
LL | println!("{}", x);
|
||||
| ^ use of possibly-uninitialized `x`
|
||||
|
|
||||
= note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -3,6 +3,8 @@ error[E0381]: borrow of possibly-uninitialized variable: `x`
|
||||
|
|
||||
LL | println!("{}", x);
|
||||
| ^ use of possibly-uninitialized `x`
|
||||
|
|
||||
= note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -3,6 +3,8 @@ error[E0381]: borrow of possibly-uninitialized variable: `i`
|
||||
|
|
||||
LL | println!("{}", i);
|
||||
| ^ use of possibly-uninitialized `i`
|
||||
|
|
||||
= note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -3,6 +3,8 @@ error[E0381]: borrow of possibly-uninitialized variable: `v`
|
||||
|
|
||||
LL | println!("{}", v);
|
||||
| ^ use of possibly-uninitialized `v`
|
||||
|
|
||||
= note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -3,12 +3,16 @@ error[E0381]: borrow of possibly-uninitialized variable: `x`
|
||||
|
|
||||
LL | println!("{}", x);
|
||||
| ^ use of possibly-uninitialized `x`
|
||||
|
|
||||
= note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0381]: borrow of possibly-uninitialized variable: `x`
|
||||
--> $DIR/issue-24267-flow-exit.rs:18:20
|
||||
|
|
||||
LL | println!("{}", x);
|
||||
| ^ use of possibly-uninitialized `x`
|
||||
|
|
||||
= note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -81,6 +81,8 @@ LL | println!("{}", arr[3]);
|
||||
...
|
||||
LL | c();
|
||||
| - mutable borrow later used here
|
||||
|
|
||||
= note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0502]: cannot borrow `arr` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/arrays.rs:73:24
|
||||
|
@ -25,6 +25,8 @@ LL | println!("{}", e.0.0.m.x);
|
||||
LL |
|
||||
LL | c();
|
||||
| - mutable borrow later used here
|
||||
|
|
||||
= note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0506]: cannot assign to `e.0.0.m.x` because it is borrowed
|
||||
--> $DIR/box.rs:55:5
|
||||
|
@ -8,6 +8,7 @@ LL | println!("{}", foo.x);
|
||||
= 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 #82523 <https://github.com/rust-lang/rust/issues/82523>
|
||||
= note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
|
||||
= note: this warning originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
warning: 1 warning emitted
|
||||
|
||||
|
@ -13,6 +13,8 @@ LL | println!("{:?}", p);
|
||||
LL |
|
||||
LL | c();
|
||||
| - mutable borrow later used here
|
||||
|
|
||||
= note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -14,6 +14,7 @@ note: this function takes ownership of the receiver `self`, which moves `some_ve
|
||||
|
|
||||
LL | fn into_iter(self) -> Self::IntoIter;
|
||||
| ^^^^
|
||||
= note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -28,6 +28,7 @@ LL | println!("{}", FOO);
|
||||
|
|
||||
= 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 #71800 <https://github.com/rust-lang/rust/issues/71800>
|
||||
= note: this warning originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to previous error; 2 warnings emitted
|
||||
|
||||
|
@ -39,6 +39,7 @@ LL | println!("{} {}", X, Y);
|
||||
|
|
||||
= 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 #71800 <https://github.com/rust-lang/rust/issues/71800>
|
||||
= note: this warning originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/issue-43197.rs:16:26
|
||||
@ -54,6 +55,7 @@ LL | println!("{} {}", X, Y);
|
||||
|
|
||||
= 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 #71800 <https://github.com/rust-lang/rust/issues/71800>
|
||||
= note: this warning originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to 2 previous errors; 4 warnings emitted
|
||||
|
||||
|
@ -10,6 +10,8 @@ LL | println!("{}", x);
|
||||
| ^ second borrow occurs here
|
||||
LL | Pin::new(&mut b).resume(());
|
||||
| ------ first borrow later used here
|
||||
|
|
||||
= note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -8,6 +8,8 @@ LL | let mut s_copy = s;
|
||||
...
|
||||
LL | println!("{}", s);
|
||||
| ^ value borrowed here after move
|
||||
|
|
||||
= note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -12,6 +12,8 @@ LL | println!("{:?}", heap);
|
||||
...
|
||||
LL | };
|
||||
| - ... and the mutable borrow might be used here, when that temporary is dropped and runs the destructor for type `(Option<PeekMut<'_, i32>>, ())`
|
||||
|
|
||||
= note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -18,6 +18,7 @@ LL | println!("Size: {}", std::mem::size_of::<[u8; u64::MAX as usize]>());
|
||||
= note: `#[deny(const_err)]` 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 #71800 <https://github.com/rust-lang/rust/issues/71800>
|
||||
= note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -28,6 +28,8 @@ LL | println!("{}", y);
|
||||
| ^ value borrowed here after move
|
||||
LL | while true { while true { while true { x = y; x.clone(); } } }
|
||||
| - value moved here, in previous iteration of loop
|
||||
|
|
||||
= note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to previous error; 3 warnings emitted
|
||||
|
||||
|
@ -8,6 +8,8 @@ LL | let y = x;
|
||||
LL |
|
||||
LL | println!("{}", *x);
|
||||
| ^^ value borrowed here after move
|
||||
|
|
||||
= note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -7,6 +7,8 @@ LL | send(ch, message);
|
||||
| ------- value moved here
|
||||
LL | println!("{}", message);
|
||||
| ^^^^^^^ value borrowed here after move
|
||||
|
|
||||
= note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -3,6 +3,8 @@ error[E0381]: borrow of possibly-uninitialized variable: `x`
|
||||
|
|
||||
LL | println!("{:?}", x);
|
||||
| ^ use of possibly-uninitialized `x`
|
||||
|
|
||||
= note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -10,6 +10,8 @@ LL | println!("{}", x);
|
||||
LL | });
|
||||
LL | println!("{}", x);
|
||||
| ^ value borrowed here after move
|
||||
|
|
||||
= note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
19
src/test/ui/optimization-remark.rs
Normal file
19
src/test/ui/optimization-remark.rs
Normal file
@ -0,0 +1,19 @@
|
||||
// build-pass
|
||||
// ignore-pass
|
||||
// no-system-llvm
|
||||
// revisions: all inline
|
||||
// compile-flags: --crate-type=lib -Cdebuginfo=1 -Copt-level=2
|
||||
// [all] compile-flags: -Cremark=all
|
||||
// [inline] compile-flags: -Cremark=inline
|
||||
// error-pattern: inline: f not inlined into g
|
||||
// dont-check-compiler-stderr
|
||||
|
||||
#[no_mangle]
|
||||
#[inline(never)]
|
||||
pub fn f() {
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub fn g() {
|
||||
f();
|
||||
}
|
@ -21,6 +21,8 @@ LL | ::std::mem::drop(x);
|
||||
LL | };
|
||||
LL | println!("{}", x);
|
||||
| ^ value borrowed here after move
|
||||
|
|
||||
= note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0506]: cannot assign to `i` because it is borrowed
|
||||
--> $DIR/try-block-maybe-bad-lifetime.rs:40:9
|
||||
|
@ -7,6 +7,8 @@ LL | let _y = x;
|
||||
| - value moved here
|
||||
LL | println!("{}", x);
|
||||
| ^ value borrowed here after move
|
||||
|
|
||||
= note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -13,6 +13,7 @@ note: this function takes ownership of the receiver `self`, which moves `start`
|
||||
|
|
||||
LL | fn make_string_bar(mut self) -> Mine{
|
||||
| ^^^^
|
||||
= note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user