1
Fork 0

Auto merge of #137030 - matthiaskrgr:rollup-267aumr, r=matthiaskrgr

Rollup of 9 pull requests

Successful merges:

 - #135778 (account for `c_enum_min_bits` in `multiple-reprs` UI test)
 - #136052 (Correct comment for FreeBSD and DragonFly BSD in unix/thread)
 - #136886 (Remove the common prelude module)
 - #136956 (add vendor directory to .gitignore)
 - #136958 (Fix presentation of purely "additive" replacement suggestion parts)
 - #136967 (Use `slice::fill` in `io::Repeat` implementation)
 - #136976 (alloc boxed: docs: use MaybeUninit::write instead of as_mut_ptr)
 - #137007 (Emit MIR for each bit with on `dont_reset_cast_kind_without_updating_operand`)
 - #137008 (Move code into `rustc_mir_transform`)

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2025-02-14 17:17:45 +00:00
commit d8810e3e2d
189 changed files with 1068 additions and 1104 deletions

2
.gitignore vendored
View file

@ -54,6 +54,8 @@ no_llvm_build
/library/target
/src/bootstrap/target
/src/tools/x/target
# Created by `x vendor`
/vendor
# Created by default with `src/ci/docker/run.sh`
/obj/
# Created by nix dev shell / .envrc

View file

@ -1976,13 +1976,16 @@ impl HumanEmitter {
Some(Style::HeaderMsg),
);
let other_suggestions = suggestions.len().saturating_sub(MAX_SUGGESTIONS);
let mut row_num = 2;
for (i, (complete, parts, highlights, _)) in
suggestions.iter().enumerate().take(MAX_SUGGESTIONS)
suggestions.into_iter().enumerate().take(MAX_SUGGESTIONS)
{
debug!(?complete, ?parts, ?highlights);
let has_deletion = parts.iter().any(|p| p.is_deletion(sm) || p.is_replacement(sm));
let has_deletion =
parts.iter().any(|p| p.is_deletion(sm) || p.is_destructive_replacement(sm));
let is_multiline = complete.lines().count() > 1;
if i == 0 {
@ -2167,7 +2170,7 @@ impl HumanEmitter {
self.draw_code_line(
&mut buffer,
&mut row_num,
highlight_parts,
&highlight_parts,
line_pos + line_start,
line,
show_code_change,
@ -2213,7 +2216,12 @@ impl HumanEmitter {
if let DisplaySuggestion::Diff | DisplaySuggestion::Underline | DisplaySuggestion::Add =
show_code_change
{
for part in parts {
for mut part in parts {
// If this is a replacement of, e.g. `"a"` into `"ab"`, adjust the
// suggestion and snippet to look as if we just suggested to add
// `"b"`, which is typically much easier for the user to understand.
part.trim_trivial_replacements(sm);
let snippet = if let Ok(snippet) = sm.span_to_snippet(part.span) {
snippet
} else {
@ -2376,9 +2384,12 @@ impl HumanEmitter {
row_num = row + 1;
}
}
if suggestions.len() > MAX_SUGGESTIONS {
let others = suggestions.len() - MAX_SUGGESTIONS;
let msg = format!("and {} other candidate{}", others, pluralize!(others));
if other_suggestions > 0 {
let msg = format!(
"and {} other candidate{}",
other_suggestions,
pluralize!(other_suggestions)
);
buffer.puts(row_num, max_line_num_len + 3, &msg, Style::NoStyle);
}

View file

@ -230,10 +230,40 @@ impl SubstitutionPart {
!self.snippet.is_empty() && self.replaces_meaningful_content(sm)
}
/// Whether this is a replacement that overwrites source with a snippet
/// in a way that isn't a superset of the original string. For example,
/// replacing "abc" with "abcde" is not destructive, but replacing it
/// it with "abx" is, since the "c" character is lost.
pub fn is_destructive_replacement(&self, sm: &SourceMap) -> bool {
self.is_replacement(sm)
&& !sm.span_to_snippet(self.span).is_ok_and(|snippet| {
self.snippet.trim_start().starts_with(snippet.trim_start())
|| self.snippet.trim_end().ends_with(snippet.trim_end())
})
}
fn replaces_meaningful_content(&self, sm: &SourceMap) -> bool {
sm.span_to_snippet(self.span)
.map_or(!self.span.is_empty(), |snippet| !snippet.trim().is_empty())
}
/// Try to turn a replacement into an addition when the span that is being
/// overwritten matches either the prefix or suffix of the replacement.
fn trim_trivial_replacements(&mut self, sm: &SourceMap) {
if self.snippet.is_empty() {
return;
}
let Ok(snippet) = sm.span_to_snippet(self.span) else {
return;
};
if self.snippet.starts_with(&snippet) {
self.span = self.span.shrink_to_hi();
self.snippet = self.snippet[snippet.len()..].to_string();
} else if self.snippet.ends_with(&snippet) {
self.span = self.span.shrink_to_lo();
self.snippet = self.snippet[..self.snippet.len() - snippet.len()].to_string();
}
}
}
impl CodeSuggestion {

View file

@ -49,7 +49,6 @@ pub mod generic_graphviz;
pub mod graphviz;
pub mod interpret;
pub mod mono;
pub mod patch;
pub mod pretty;
mod query;
mod statement;

View file

@ -3,7 +3,26 @@ use rustc_middle::mir::{self, Body, Location, Terminator, TerminatorKind};
use tracing::debug;
use super::move_paths::{InitKind, LookupResult, MoveData, MovePathIndex};
use crate::elaborate_drops::DropFlagState;
/// The value of an inserted drop flag.
#[derive(Debug, PartialEq, Eq, Copy, Clone)]
pub enum DropFlagState {
/// The tracked value is initialized and needs to be dropped when leaving its scope.
Present,
/// The tracked value is uninitialized or was moved out of and does not need to be dropped when
/// leaving its scope.
Absent,
}
impl DropFlagState {
pub fn value(self) -> bool {
match self {
DropFlagState::Present => true,
DropFlagState::Absent => false,
}
}
}
pub fn move_path_children_matching<'tcx, F>(
move_data: &MoveData<'tcx>,

View file

@ -9,7 +9,7 @@ use rustc_middle::ty::util::Discr;
use rustc_middle::ty::{self, TyCtxt};
use tracing::{debug, instrument};
use crate::elaborate_drops::DropFlagState;
use crate::drop_flag_effects::DropFlagState;
use crate::framework::SwitchIntTarget;
use crate::move_paths::{HasMoveData, InitIndex, InitKind, LookupResult, MoveData, MovePathIndex};
use crate::{

View file

@ -15,7 +15,7 @@ use rustc_middle::ty;
// Please change the public `use` directives cautiously, as they might be used by external tools.
// See issue #120130.
pub use self::drop_flag_effects::{
drop_flag_effects_for_function_entry, drop_flag_effects_for_location,
DropFlagState, drop_flag_effects_for_function_entry, drop_flag_effects_for_location,
move_path_children_matching, on_all_children_bits, on_lookup_result_bits,
};
pub use self::framework::{
@ -26,7 +26,6 @@ use self::move_paths::MoveData;
pub mod debuginfo;
mod drop_flag_effects;
pub mod elaborate_drops;
mod errors;
mod framework;
pub mod impls;

View file

@ -1,8 +1,8 @@
use rustc_middle::mir::patch::MirPatch;
use rustc_middle::mir::*;
use rustc_middle::ty::{self, TyCtxt};
use tracing::debug;
use crate::patch::MirPatch;
use crate::util;
/// This pass moves values being dropped that are within a packed

View file

@ -1,8 +1,9 @@
use rustc_middle::mir::patch::MirPatch;
use rustc_middle::mir::visit::MutVisitor;
use rustc_middle::mir::*;
use rustc_middle::ty::TyCtxt;
use crate::patch::MirPatch;
pub(super) struct Subtyper;
struct SubTypeChecker<'a, 'tcx> {

View file

@ -1061,9 +1061,8 @@ fn insert_switch<'tcx>(
}
fn elaborate_coroutine_drops<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
use rustc_middle::mir::patch::MirPatch;
use rustc_mir_dataflow::elaborate_drops::{Unwind, elaborate_drop};
use crate::elaborate_drop::{Unwind, elaborate_drop};
use crate::patch::MirPatch;
use crate::shim::DropShimElaborator;
// Note that `elaborate_drops` only drops the upvars of a coroutine, and

View file

@ -1,9 +1,10 @@
use rustc_middle::mir::patch::MirPatch;
use rustc_middle::mir::visit::NonUseContext::VarDebugInfo;
use rustc_middle::mir::visit::{MutVisitor, PlaceContext};
use rustc_middle::mir::*;
use rustc_middle::ty::TyCtxt;
use crate::patch::MirPatch;
pub(super) struct Derefer;
struct DerefChecker<'a, 'tcx> {

View file

@ -1,11 +1,11 @@
use std::fmt::Debug;
use rustc_middle::mir::patch::MirPatch;
use rustc_middle::mir::*;
use rustc_middle::ty::{Ty, TyCtxt};
use tracing::trace;
use super::simplify::simplify_cfg;
use crate::patch::MirPatch;
/// This pass optimizes something like
/// ```ignore (syntax-highlighting-only)

View file

@ -4,12 +4,13 @@
use rustc_abi::FieldIdx;
use rustc_hir::def_id::DefId;
use rustc_middle::mir::patch::MirPatch;
use rustc_middle::mir::visit::MutVisitor;
use rustc_middle::mir::*;
use rustc_middle::span_bug;
use rustc_middle::ty::{Ty, TyCtxt};
use crate::patch::MirPatch;
/// Constructs the types used when accessing a Box's pointer
fn build_ptr_tys<'tcx>(
tcx: TyCtxt<'tcx>,

View file

@ -3,7 +3,6 @@ use std::{fmt, iter, mem};
use rustc_abi::{FIRST_VARIANT, FieldIdx, VariantIdx};
use rustc_hir::lang_items::LangItem;
use rustc_index::Idx;
use rustc_middle::mir::patch::MirPatch;
use rustc_middle::mir::*;
use rustc_middle::span_bug;
use rustc_middle::ty::adjustment::PointerCoercion;
@ -13,29 +12,11 @@ use rustc_span::DUMMY_SP;
use rustc_span::source_map::Spanned;
use tracing::{debug, instrument};
/// The value of an inserted drop flag.
#[derive(Debug, PartialEq, Eq, Copy, Clone)]
pub enum DropFlagState {
/// The tracked value is initialized and needs to be dropped when leaving its scope.
Present,
/// The tracked value is uninitialized or was moved out of and does not need to be dropped when
/// leaving its scope.
Absent,
}
impl DropFlagState {
pub fn value(self) -> bool {
match self {
DropFlagState::Present => true,
DropFlagState::Absent => false,
}
}
}
use crate::patch::MirPatch;
/// Describes how/if a value should be dropped.
#[derive(Debug)]
pub enum DropStyle {
pub(crate) enum DropStyle {
/// The value is already dead at the drop location, no drop will be executed.
Dead,
@ -56,7 +37,7 @@ pub enum DropStyle {
/// Which drop flags to affect/check with an operation.
#[derive(Debug)]
pub enum DropFlagMode {
pub(crate) enum DropFlagMode {
/// Only affect the top-level drop flag, not that of any contained fields.
Shallow,
/// Affect all nested drop flags in addition to the top-level one.
@ -65,7 +46,7 @@ pub enum DropFlagMode {
/// Describes if unwinding is necessary and where to unwind to if a panic occurs.
#[derive(Copy, Clone, Debug)]
pub enum Unwind {
pub(crate) enum Unwind {
/// Unwind to this block.
To(BasicBlock),
/// Already in an unwind path, any panic will cause an abort.
@ -98,7 +79,7 @@ impl Unwind {
}
}
pub trait DropElaborator<'a, 'tcx>: fmt::Debug {
pub(crate) trait DropElaborator<'a, 'tcx>: fmt::Debug {
/// The type representing paths that can be moved out of.
///
/// Users can move out of individual fields of a struct, such as `a.b.c`. This type is used to
@ -177,7 +158,7 @@ where
/// value.
///
/// When this returns, the MIR patch in the `elaborator` contains the necessary changes.
pub fn elaborate_drop<'b, 'tcx, D>(
pub(crate) fn elaborate_drop<'b, 'tcx, D>(
elaborator: &mut D,
source_info: SourceInfo,
place: Place<'tcx>,

View file

@ -3,21 +3,20 @@ use std::fmt;
use rustc_abi::{FieldIdx, VariantIdx};
use rustc_index::IndexVec;
use rustc_index::bit_set::DenseBitSet;
use rustc_middle::mir::patch::MirPatch;
use rustc_middle::mir::*;
use rustc_middle::ty::{self, TyCtxt};
use rustc_mir_dataflow::elaborate_drops::{
DropElaborator, DropFlagMode, DropFlagState, DropStyle, Unwind, elaborate_drop,
};
use rustc_mir_dataflow::impls::{MaybeInitializedPlaces, MaybeUninitializedPlaces};
use rustc_mir_dataflow::move_paths::{LookupResult, MoveData, MovePathIndex};
use rustc_mir_dataflow::{
Analysis, MoveDataTypingEnv, ResultsCursor, on_all_children_bits, on_lookup_result_bits,
Analysis, DropFlagState, MoveDataTypingEnv, ResultsCursor, on_all_children_bits,
on_lookup_result_bits,
};
use rustc_span::Span;
use tracing::{debug, instrument};
use crate::deref_separator::deref_finder;
use crate::elaborate_drop::{DropElaborator, DropFlagMode, DropStyle, Unwind, elaborate_drop};
use crate::patch::MirPatch;
/// During MIR building, Drop terminators are inserted in every place where a drop may occur.
/// However, in this phase, the presence of these terminators does not guarantee that a destructor

View file

@ -49,10 +49,12 @@ mod check_pointers;
mod cost_checker;
mod cross_crate_inline;
mod deduce_param_attrs;
mod elaborate_drop;
mod errors;
mod ffi_unwind_calls;
mod lint;
mod lint_tail_expr_drop_order;
mod patch;
mod shim;
mod ssa;

View file

@ -2,7 +2,6 @@ use std::iter;
use rustc_abi::Integer;
use rustc_index::IndexSlice;
use rustc_middle::mir::patch::MirPatch;
use rustc_middle::mir::*;
use rustc_middle::ty::layout::{IntegerExt, TyAndLayout};
use rustc_middle::ty::{self, ScalarInt, Ty, TyCtxt};
@ -10,6 +9,7 @@ use rustc_type_ir::TyKind::*;
use tracing::instrument;
use super::simplify::simplify_cfg;
use crate::patch::MirPatch;
pub(super) struct MatchBranchSimplification;

View file

@ -1,11 +1,13 @@
use rustc_index::{Idx, IndexVec};
use rustc_middle::mir::*;
use rustc_middle::ty::Ty;
use rustc_span::Span;
use tracing::debug;
use crate::mir::*;
/// This struct represents a patch to MIR, which can add
/// new statements and basic blocks and patch over block
/// terminators.
pub struct MirPatch<'tcx> {
pub(crate) struct MirPatch<'tcx> {
patch_map: IndexVec<BasicBlock, Option<TerminatorKind<'tcx>>>,
new_blocks: Vec<BasicBlockData<'tcx>>,
new_statements: Vec<(Location, StatementKind<'tcx>)>,
@ -22,7 +24,7 @@ pub struct MirPatch<'tcx> {
}
impl<'tcx> MirPatch<'tcx> {
pub fn new(body: &Body<'tcx>) -> Self {
pub(crate) fn new(body: &Body<'tcx>) -> Self {
let mut result = MirPatch {
patch_map: IndexVec::from_elem(None, &body.basic_blocks),
new_blocks: vec![],
@ -69,7 +71,7 @@ impl<'tcx> MirPatch<'tcx> {
result
}
pub fn resume_block(&mut self) -> BasicBlock {
pub(crate) fn resume_block(&mut self) -> BasicBlock {
if let Some(bb) = self.resume_block {
return bb;
}
@ -86,7 +88,7 @@ impl<'tcx> MirPatch<'tcx> {
bb
}
pub fn unreachable_cleanup_block(&mut self) -> BasicBlock {
pub(crate) fn unreachable_cleanup_block(&mut self) -> BasicBlock {
if let Some(bb) = self.unreachable_cleanup_block {
return bb;
}
@ -103,7 +105,7 @@ impl<'tcx> MirPatch<'tcx> {
bb
}
pub fn unreachable_no_cleanup_block(&mut self) -> BasicBlock {
pub(crate) fn unreachable_no_cleanup_block(&mut self) -> BasicBlock {
if let Some(bb) = self.unreachable_no_cleanup_block {
return bb;
}
@ -120,7 +122,7 @@ impl<'tcx> MirPatch<'tcx> {
bb
}
pub fn terminate_block(&mut self, reason: UnwindTerminateReason) -> BasicBlock {
pub(crate) fn terminate_block(&mut self, reason: UnwindTerminateReason) -> BasicBlock {
if let Some((cached_bb, cached_reason)) = self.terminate_block
&& reason == cached_reason
{
@ -139,19 +141,11 @@ impl<'tcx> MirPatch<'tcx> {
bb
}
pub fn is_patched(&self, bb: BasicBlock) -> bool {
pub(crate) fn is_patched(&self, bb: BasicBlock) -> bool {
self.patch_map[bb].is_some()
}
pub fn terminator_loc(&self, body: &Body<'tcx>, bb: BasicBlock) -> Location {
let offset = match bb.index().checked_sub(body.basic_blocks.len()) {
Some(index) => self.new_blocks[index].statements.len(),
None => body[bb].statements.len(),
};
Location { block: bb, statement_index: offset }
}
pub fn new_local_with_info(
pub(crate) fn new_local_with_info(
&mut self,
ty: Ty<'tcx>,
span: Span,
@ -165,14 +159,14 @@ impl<'tcx> MirPatch<'tcx> {
Local::new(index)
}
pub fn new_temp(&mut self, ty: Ty<'tcx>, span: Span) -> Local {
pub(crate) fn new_temp(&mut self, ty: Ty<'tcx>, span: Span) -> Local {
let index = self.next_local;
self.next_local += 1;
self.new_locals.push(LocalDecl::new(ty, span));
Local::new(index)
}
pub fn new_block(&mut self, data: BasicBlockData<'tcx>) -> BasicBlock {
pub(crate) fn new_block(&mut self, data: BasicBlockData<'tcx>) -> BasicBlock {
let block = BasicBlock::new(self.patch_map.len());
debug!("MirPatch: new_block: {:?}: {:?}", block, data);
self.new_blocks.push(data);
@ -180,22 +174,22 @@ impl<'tcx> MirPatch<'tcx> {
block
}
pub fn patch_terminator(&mut self, block: BasicBlock, new: TerminatorKind<'tcx>) {
pub(crate) fn patch_terminator(&mut self, block: BasicBlock, new: TerminatorKind<'tcx>) {
assert!(self.patch_map[block].is_none());
debug!("MirPatch: patch_terminator({:?}, {:?})", block, new);
self.patch_map[block] = Some(new);
}
pub fn add_statement(&mut self, loc: Location, stmt: StatementKind<'tcx>) {
pub(crate) fn add_statement(&mut self, loc: Location, stmt: StatementKind<'tcx>) {
debug!("MirPatch: add_statement({:?}, {:?})", loc, stmt);
self.new_statements.push((loc, stmt));
}
pub fn add_assign(&mut self, loc: Location, place: Place<'tcx>, rv: Rvalue<'tcx>) {
pub(crate) fn add_assign(&mut self, loc: Location, place: Place<'tcx>, rv: Rvalue<'tcx>) {
self.add_statement(loc, StatementKind::Assign(Box::new((place, rv))));
}
pub fn apply(self, body: &mut Body<'tcx>) {
pub(crate) fn apply(self, body: &mut Body<'tcx>) {
debug!(
"MirPatch: {:?} new temps, starting from index {}: {:?}",
self.new_locals.len(),
@ -241,14 +235,14 @@ impl<'tcx> MirPatch<'tcx> {
}
}
pub fn source_info_for_index(data: &BasicBlockData<'_>, loc: Location) -> SourceInfo {
fn source_info_for_index(data: &BasicBlockData<'_>, loc: Location) -> SourceInfo {
match data.statements.get(loc.statement_index) {
Some(stmt) => stmt.source_info,
None => data.terminator().source_info,
}
}
pub fn source_info_for_location(&self, body: &Body<'tcx>, loc: Location) -> SourceInfo {
pub(crate) fn source_info_for_location(&self, body: &Body<'tcx>, loc: Location) -> SourceInfo {
let data = match loc.block.index().checked_sub(body.basic_blocks.len()) {
Some(new) => &self.new_blocks[new],
None => &body[loc.block],

View file

@ -1,10 +1,11 @@
use rustc_index::bit_set::DenseBitSet;
use rustc_middle::mir::patch::MirPatch;
use rustc_middle::mir::*;
use rustc_middle::ty::TyCtxt;
use rustc_target::spec::PanicStrategy;
use tracing::debug;
use crate::patch::MirPatch;
/// A pass that removes noop landing pads and replaces jumps to them with
/// `UnwindAction::Continue`. This is important because otherwise LLVM generates
/// terrible code for these.

View file

@ -6,7 +6,6 @@ use rustc_hir as hir;
use rustc_hir::def_id::DefId;
use rustc_hir::lang_items::LangItem;
use rustc_index::{Idx, IndexVec};
use rustc_middle::mir::patch::MirPatch;
use rustc_middle::mir::*;
use rustc_middle::query::Providers;
use rustc_middle::ty::adjustment::PointerCoercion;
@ -14,11 +13,12 @@ use rustc_middle::ty::{
self, CoroutineArgs, CoroutineArgsExt, EarlyBinder, GenericArgs, Ty, TyCtxt,
};
use rustc_middle::{bug, span_bug};
use rustc_mir_dataflow::elaborate_drops::{self, DropElaborator, DropFlagMode, DropStyle};
use rustc_span::source_map::Spanned;
use rustc_span::{DUMMY_SP, Span};
use tracing::{debug, instrument};
use crate::elaborate_drop::{DropElaborator, DropFlagMode, DropStyle, Unwind, elaborate_drop};
use crate::patch::MirPatch;
use crate::{
abort_unwinding_calls, add_call_guards, add_moves_for_packed_drops, deref_separator, inline,
instsimplify, mentioned_items, pass_manager as pm, remove_noop_landing_pads, simplify,
@ -283,13 +283,13 @@ fn build_drop_shim<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId, ty: Option<Ty<'tcx>>)
DropShimElaborator { body: &body, patch: MirPatch::new(&body), tcx, typing_env };
let dropee = tcx.mk_place_deref(dropee_ptr);
let resume_block = elaborator.patch.resume_block();
elaborate_drops::elaborate_drop(
elaborate_drop(
&mut elaborator,
source_info,
dropee,
(),
return_block,
elaborate_drops::Unwind::To(resume_block),
Unwind::To(resume_block),
START_BLOCK,
);
elaborator.patch

View file

@ -4,13 +4,14 @@ use rustc_hir::LangItem;
use rustc_index::IndexVec;
use rustc_index::bit_set::{DenseBitSet, GrowableBitSet};
use rustc_middle::bug;
use rustc_middle::mir::patch::MirPatch;
use rustc_middle::mir::visit::*;
use rustc_middle::mir::*;
use rustc_middle::ty::{self, Ty, TyCtxt};
use rustc_mir_dataflow::value_analysis::{excluded_locals, iter_fields};
use tracing::{debug, instrument};
use crate::patch::MirPatch;
pub(super) struct ScalarReplacementOfAggregates;
impl<'tcx> crate::MirPass<'tcx> for ScalarReplacementOfAggregates {

View file

@ -3,7 +3,6 @@
use rustc_abi::Variants;
use rustc_data_structures::fx::FxHashSet;
use rustc_middle::bug;
use rustc_middle::mir::patch::MirPatch;
use rustc_middle::mir::{
BasicBlock, BasicBlockData, BasicBlocks, Body, Local, Operand, Rvalue, StatementKind,
TerminatorKind,
@ -12,6 +11,8 @@ use rustc_middle::ty::layout::TyAndLayout;
use rustc_middle::ty::{Ty, TyCtxt};
use tracing::trace;
use crate::patch::MirPatch;
pub(super) struct UnreachableEnumBranching;
fn get_discriminant_local(terminator: &TerminatorKind<'_>) -> Option<Local> {

View file

@ -6,10 +6,11 @@ use rustc_abi::Size;
use rustc_data_structures::fx::FxHashSet;
use rustc_middle::bug;
use rustc_middle::mir::interpret::Scalar;
use rustc_middle::mir::patch::MirPatch;
use rustc_middle::mir::*;
use rustc_middle::ty::{self, TyCtxt};
use crate::patch::MirPatch;
pub(super) struct UnreachablePropagation;
impl crate::MirPass<'_> for UnreachablePropagation {

View file

@ -280,13 +280,9 @@ impl<T> Box<T> {
///
/// ```
/// let mut five = Box::<u32>::new_uninit();
///
/// let five = unsafe {
/// // Deferred initialization:
/// five.as_mut_ptr().write(5);
///
/// five.assume_init()
/// };
/// // Deferred initialization:
/// five.write(5);
/// let five = unsafe { five.assume_init() };
///
/// assert_eq!(*five, 5)
/// ```
@ -367,13 +363,9 @@ impl<T> Box<T> {
/// #![feature(allocator_api)]
///
/// let mut five = Box::<u32>::try_new_uninit()?;
///
/// let five = unsafe {
/// // Deferred initialization:
/// five.as_mut_ptr().write(5);
///
/// five.assume_init()
/// };
/// // Deferred initialization:
/// five.write(5);
/// let five = unsafe { five.assume_init() };
///
/// assert_eq!(*five, 5);
/// # Ok::<(), std::alloc::AllocError>(())
@ -435,10 +427,8 @@ impl<T, A: Allocator> Box<T, A> {
A: Allocator,
{
let mut boxed = Self::new_uninit_in(alloc);
unsafe {
boxed.as_mut_ptr().write(x);
boxed.assume_init()
}
boxed.write(x);
unsafe { boxed.assume_init() }
}
/// Allocates memory in the given allocator then places `x` into it,
@ -463,10 +453,8 @@ impl<T, A: Allocator> Box<T, A> {
A: Allocator,
{
let mut boxed = Self::try_new_uninit_in(alloc)?;
unsafe {
boxed.as_mut_ptr().write(x);
Ok(boxed.assume_init())
}
boxed.write(x);
unsafe { Ok(boxed.assume_init()) }
}
/// Constructs a new box with uninitialized contents in the provided allocator.
@ -479,13 +467,9 @@ impl<T, A: Allocator> Box<T, A> {
/// use std::alloc::System;
///
/// let mut five = Box::<u32, _>::new_uninit_in(System);
///
/// let five = unsafe {
/// // Deferred initialization:
/// five.as_mut_ptr().write(5);
///
/// five.assume_init()
/// };
/// // Deferred initialization:
/// five.write(5);
/// let five = unsafe { five.assume_init() };
///
/// assert_eq!(*five, 5)
/// ```
@ -517,13 +501,9 @@ impl<T, A: Allocator> Box<T, A> {
/// use std::alloc::System;
///
/// let mut five = Box::<u32, _>::try_new_uninit_in(System)?;
///
/// let five = unsafe {
/// // Deferred initialization:
/// five.as_mut_ptr().write(5);
///
/// five.assume_init()
/// };
/// // Deferred initialization:
/// five.write(5);
/// let five = unsafe { five.assume_init() };
///
/// assert_eq!(*five, 5);
/// # Ok::<(), std::alloc::AllocError>(())
@ -669,15 +649,11 @@ impl<T> Box<[T]> {
///
/// ```
/// let mut values = Box::<[u32]>::new_uninit_slice(3);
///
/// let values = unsafe {
/// // Deferred initialization:
/// values[0].as_mut_ptr().write(1);
/// values[1].as_mut_ptr().write(2);
/// values[2].as_mut_ptr().write(3);
///
/// values.assume_init()
/// };
/// // Deferred initialization:
/// values[0].write(1);
/// values[1].write(2);
/// values[2].write(3);
/// let values = unsafe {values.assume_init() };
///
/// assert_eq!(*values, [1, 2, 3])
/// ```
@ -722,13 +698,11 @@ impl<T> Box<[T]> {
/// #![feature(allocator_api)]
///
/// let mut values = Box::<[u32]>::try_new_uninit_slice(3)?;
/// let values = unsafe {
/// // Deferred initialization:
/// values[0].as_mut_ptr().write(1);
/// values[1].as_mut_ptr().write(2);
/// values[2].as_mut_ptr().write(3);
/// values.assume_init()
/// };
/// // Deferred initialization:
/// values[0].write(1);
/// values[1].write(2);
/// values[2].write(3);
/// let values = unsafe { values.assume_init() };
///
/// assert_eq!(*values, [1, 2, 3]);
/// # Ok::<(), std::alloc::AllocError>(())
@ -814,15 +788,11 @@ impl<T, A: Allocator> Box<[T], A> {
/// use std::alloc::System;
///
/// let mut values = Box::<[u32], _>::new_uninit_slice_in(3, System);
///
/// let values = unsafe {
/// // Deferred initialization:
/// values[0].as_mut_ptr().write(1);
/// values[1].as_mut_ptr().write(2);
/// values[2].as_mut_ptr().write(3);
///
/// values.assume_init()
/// };
/// // Deferred initialization:
/// values[0].write(1);
/// values[1].write(2);
/// values[2].write(3);
/// let values = unsafe { values.assume_init() };
///
/// assert_eq!(*values, [1, 2, 3])
/// ```
@ -873,13 +843,11 @@ impl<T, A: Allocator> Box<[T], A> {
/// use std::alloc::System;
///
/// let mut values = Box::<[u32], _>::try_new_uninit_slice_in(3, System)?;
/// let values = unsafe {
/// // Deferred initialization:
/// values[0].as_mut_ptr().write(1);
/// values[1].as_mut_ptr().write(2);
/// values[2].as_mut_ptr().write(3);
/// values.assume_init()
/// };
/// // Deferred initialization:
/// values[0].write(1);
/// values[1].write(2);
/// values[2].write(3);
/// let values = unsafe { values.assume_init() };
///
/// assert_eq!(*values, [1, 2, 3]);
/// # Ok::<(), std::alloc::AllocError>(())
@ -959,13 +927,9 @@ impl<T, A: Allocator> Box<mem::MaybeUninit<T>, A> {
///
/// ```
/// let mut five = Box::<u32>::new_uninit();
///
/// let five: Box<u32> = unsafe {
/// // Deferred initialization:
/// five.as_mut_ptr().write(5);
///
/// five.assume_init()
/// };
/// // Deferred initialization:
/// five.write(5);
/// let five: Box<u32> = unsafe { five.assume_init() };
///
/// assert_eq!(*five, 5)
/// ```
@ -1030,15 +994,11 @@ impl<T, A: Allocator> Box<[mem::MaybeUninit<T>], A> {
///
/// ```
/// let mut values = Box::<[u32]>::new_uninit_slice(3);
///
/// let values = unsafe {
/// // Deferred initialization:
/// values[0].as_mut_ptr().write(1);
/// values[1].as_mut_ptr().write(2);
/// values[2].as_mut_ptr().write(3);
///
/// values.assume_init()
/// };
/// // Deferred initialization:
/// values[0].write(1);
/// values[1].write(2);
/// values[2].write(3);
/// let values = unsafe { values.assume_init() };
///
/// assert_eq!(*values, [1, 2, 3])
/// ```

View file

@ -9,16 +9,7 @@
#![stable(feature = "core_prelude", since = "1.4.0")]
mod common;
/// The first version of the prelude of The Rust Standard Library.
///
/// See the [module-level documentation](self) for more.
#[stable(feature = "rust1", since = "1.0.0")]
pub mod v1 {
#[stable(feature = "rust1", since = "1.0.0")]
pub use super::common::*;
}
pub mod v1;
/// The 2015 version of the core prelude.
///
@ -64,7 +55,8 @@ pub mod rust_2021 {
#[stable(feature = "prelude_2024", since = "1.85.0")]
pub mod rust_2024 {
#[stable(feature = "rust1", since = "1.0.0")]
pub use super::common::*;
#[doc(no_inline)]
pub use super::v1::*;
#[stable(feature = "prelude_2021", since = "1.55.0")]
#[doc(no_inline)]

View file

@ -1,7 +1,9 @@
//! Items common to the prelude of all editions.
//! The first version of the core prelude.
//!
//! See the [module-level documentation](super) for more.
#![stable(feature = "core_prelude", since = "1.4.0")]
// No formatting: this file is nothing but re-exports, and their order is worth preserving.
#![cfg_attr(rustfmt, rustfmt::skip)]

View file

@ -7,6 +7,7 @@ use crate::fmt;
use crate::io::{
self, BorrowedCursor, BufRead, IoSlice, IoSliceMut, Read, Seek, SeekFrom, SizeHint, Write,
};
use crate::mem::MaybeUninit;
/// `Empty` ignores any data written via [`Write`], and will always be empty
/// (returning zero bytes) when read via [`Read`].
@ -182,35 +183,26 @@ pub const fn repeat(byte: u8) -> Repeat {
impl Read for Repeat {
#[inline]
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
for slot in &mut *buf {
*slot = self.byte;
}
buf.fill(self.byte);
Ok(buf.len())
}
#[inline]
fn read_exact(&mut self, buf: &mut [u8]) -> io::Result<()> {
for slot in &mut *buf {
*slot = self.byte;
}
buf.fill(self.byte);
Ok(())
}
#[inline]
fn read_buf(&mut self, mut buf: BorrowedCursor<'_>) -> io::Result<()> {
// SAFETY: No uninit bytes are being written
for slot in unsafe { buf.as_mut() } {
slot.write(self.byte);
}
let remaining = buf.capacity();
// SAFETY: the entire unfilled portion of buf has been initialized
unsafe {
buf.advance_unchecked(remaining);
}
// SAFETY: No uninit bytes are being written.
MaybeUninit::fill(unsafe { buf.as_mut() }, self.byte);
// SAFETY: the entire unfilled portion of buf has been initialized.
unsafe { buf.advance_unchecked(buf.capacity()) };
Ok(())
}
#[inline]
fn read_buf_exact(&mut self, buf: BorrowedCursor<'_>) -> io::Result<()> {
self.read_buf(buf)
}

View file

@ -302,6 +302,7 @@
#![feature(link_cfg)]
#![feature(linkage)]
#![feature(macro_metavar_expr_concat)]
#![feature(maybe_uninit_fill)]
#![feature(min_specialization)]
#![feature(must_not_suspend)]
#![feature(needs_panic_runtime)]

View file

@ -111,16 +111,7 @@
#![stable(feature = "rust1", since = "1.0.0")]
mod common;
/// The first version of the prelude of The Rust Standard Library.
///
/// See the [module-level documentation](self) for more.
#[stable(feature = "rust1", since = "1.0.0")]
pub mod v1 {
#[stable(feature = "rust1", since = "1.0.0")]
pub use super::common::*;
}
pub mod v1;
/// The 2015 version of the prelude of The Rust Standard Library.
///
@ -162,7 +153,8 @@ pub mod rust_2021 {
#[stable(feature = "prelude_2024", since = "1.85.0")]
pub mod rust_2024 {
#[stable(feature = "rust1", since = "1.0.0")]
pub use super::common::*;
#[doc(no_inline)]
pub use super::v1::*;
#[stable(feature = "prelude_2024", since = "1.85.0")]
#[doc(no_inline)]

View file

@ -1,7 +1,9 @@
//! Items common to the prelude of all editions.
//! The first version of the prelude of The Rust Standard Library.
//!
//! See the [module-level documentation](super) for more.
#![stable(feature = "rust1", since = "1.0.0")]
// No formatting: this file is nothing but re-exports, and their order is worth preserving.
#![cfg_attr(rustfmt, rustfmt::skip)]

View file

@ -144,7 +144,7 @@ impl Thread {
const TASK_COMM_LEN: usize = 16;
let name = truncate_cstr::<{ TASK_COMM_LEN }>(name);
} else {
// FreeBSD, DragonFly, FreeBSD and NuttX do not enforce length limits.
// FreeBSD, DragonFly BSD and NuttX do not enforce length limits.
}
};
// Available since glibc 2.12, musl 1.1.16, and uClibc 1.0.20 for Linux,

View file

@ -8,8 +8,7 @@ LL | true
= help: to override `-D warnings` add `#[allow(clippy::implicit_return)]`
help: add `return` as shown
|
LL - true
LL + return true
LL | return true
|
error: missing `return` statement
@ -20,9 +19,8 @@ LL | if true { true } else { false }
|
help: add `return` as shown
|
LL - if true { true } else { false }
LL + if true { return true } else { false }
|
LL | if true { return true } else { false }
| ++++++
error: missing `return` statement
--> tests/ui/implicit_return.rs:19:29
@ -32,9 +30,8 @@ LL | if true { true } else { false }
|
help: add `return` as shown
|
LL - if true { true } else { false }
LL + if true { true } else { return false }
|
LL | if true { true } else { return false }
| ++++++
error: missing `return` statement
--> tests/ui/implicit_return.rs:25:17
@ -44,9 +41,8 @@ LL | true => false,
|
help: add `return` as shown
|
LL - true => false,
LL + true => return false,
|
LL | true => return false,
| ++++++
error: missing `return` statement
--> tests/ui/implicit_return.rs:26:20
@ -56,9 +52,8 @@ LL | false => { true },
|
help: add `return` as shown
|
LL - false => { true },
LL + false => { return true },
|
LL | false => { return true },
| ++++++
error: missing `return` statement
--> tests/ui/implicit_return.rs:39:9
@ -104,9 +99,8 @@ LL | let _ = || { true };
|
help: add `return` as shown
|
LL - let _ = || { true };
LL + let _ = || { return true };
|
LL | let _ = || { return true };
| ++++++
error: missing `return` statement
--> tests/ui/implicit_return.rs:73:16
@ -116,9 +110,8 @@ LL | let _ = || true;
|
help: add `return` as shown
|
LL - let _ = || true;
LL + let _ = || return true;
|
LL | let _ = || return true;
| ++++++
error: missing `return` statement
--> tests/ui/implicit_return.rs:81:5
@ -128,8 +121,7 @@ LL | format!("test {}", "test")
|
help: add `return` as shown
|
LL - format!("test {}", "test")
LL + return format!("test {}", "test")
LL | return format!("test {}", "test")
|
error: missing `return` statement
@ -140,8 +132,7 @@ LL | m!(true, false)
|
help: add `return` as shown
|
LL - m!(true, false)
LL + return m!(true, false)
LL | return m!(true, false)
|
error: missing `return` statement
@ -191,8 +182,7 @@ LL | true
|
help: add `return` as shown
|
LL - true
LL + return true
LL | return true
|
error: aborting due to 16 previous errors

View file

@ -68,9 +68,8 @@ LL | MAX;
|
help: use the associated constant instead
|
LL - MAX;
LL + u32::MAX;
|
LL | u32::MAX;
| +++++
error: usage of a legacy numeric method
--> tests/ui/legacy_numeric_constants.rs:49:10

View file

@ -1,5 +1,6 @@
// skip-filecheck
//@ compile-flags: -Zmir-enable-passes=+Inline,+GVN --crate-type lib
// EMIT_MIR_FOR_EACH_BIT_WIDTH
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// EMIT_MIR dont_reset_cast_kind_without_updating_operand.test.GVN.diff

View file

@ -0,0 +1,180 @@
- // MIR for `test` before GVN
+ // MIR for `test` after GVN
fn test() -> () {
let mut _0: ();
let _1: &std::boxed::Box<()>;
let _2: &std::boxed::Box<()>;
let _3: std::boxed::Box<()>;
let mut _6: *const ();
let mut _8: *const [()];
let mut _9: std::boxed::Box<()>;
let mut _10: *const ();
let mut _23: usize;
scope 1 {
debug vp_ctx => _1;
let _4: *const ();
scope 2 {
debug slf => _10;
let _5: *const [()];
scope 3 {
debug bytes => _5;
let _7: *mut ();
scope 4 {
debug _x => _7;
}
scope 18 (inlined foo) {
}
}
scope 16 (inlined slice_from_raw_parts::<()>) {
scope 17 (inlined std::ptr::from_raw_parts::<[()], ()>) {
}
}
}
}
scope 5 (inlined Box::<()>::new) {
let mut _11: usize;
let mut _12: usize;
let mut _13: *mut u8;
scope 6 (inlined alloc::alloc::exchange_malloc) {
let _14: std::alloc::Layout;
let mut _15: std::result::Result<std::ptr::NonNull<[u8]>, std::alloc::AllocError>;
let mut _16: isize;
let mut _18: !;
scope 7 {
let _17: std::ptr::NonNull<[u8]>;
scope 8 {
scope 11 (inlined NonNull::<[u8]>::as_mut_ptr) {
scope 12 (inlined NonNull::<[u8]>::as_non_null_ptr) {
scope 13 (inlined NonNull::<[u8]>::cast::<u8>) {
let mut _22: *mut [u8];
scope 14 (inlined NonNull::<[u8]>::as_ptr) {
}
}
}
scope 15 (inlined NonNull::<u8>::as_ptr) {
}
}
}
scope 10 (inlined <std::alloc::Global as Allocator>::allocate) {
}
}
scope 9 (inlined Layout::from_size_align_unchecked) {
let mut _19: bool;
let _20: ();
let mut _21: std::ptr::Alignment;
}
}
}
bb0: {
StorageLive(_1);
- StorageLive(_2);
+ nop;
StorageLive(_3);
StorageLive(_11);
StorageLive(_12);
StorageLive(_13);
- _11 = SizeOf(());
- _12 = AlignOf(());
+ _11 = const 0_usize;
+ _12 = const 1_usize;
StorageLive(_14);
StorageLive(_16);
StorageLive(_17);
StorageLive(_19);
_19 = const false;
- switchInt(move _19) -> [0: bb6, otherwise: bb5];
+ switchInt(const false) -> [0: bb6, otherwise: bb5];
}
bb1: {
StorageDead(_3);
StorageDead(_1);
return;
}
bb2: {
unreachable;
}
bb3: {
- _18 = handle_alloc_error(move _14) -> unwind unreachable;
+ _18 = handle_alloc_error(const Layout {{ size: 0_usize, align: std::ptr::Alignment(std::ptr::alignment::AlignmentEnum::_Align1Shl0) }}) -> unwind unreachable;
}
bb4: {
_17 = copy ((_15 as Ok).0: std::ptr::NonNull<[u8]>);
StorageLive(_22);
_22 = copy _17 as *mut [u8] (Transmute);
_13 = copy _22 as *mut u8 (PtrToPtr);
StorageDead(_22);
StorageDead(_15);
StorageDead(_17);
StorageDead(_16);
StorageDead(_14);
_3 = ShallowInitBox(move _13, ());
StorageDead(_13);
StorageDead(_12);
StorageDead(_11);
_2 = &_3;
_1 = copy _2;
- StorageDead(_2);
+ nop;
StorageLive(_4);
- _9 = deref_copy _3;
+ _9 = copy _3;
_10 = copy ((_9.0: std::ptr::Unique<()>).0: std::ptr::NonNull<()>) as *const () (Transmute);
_4 = copy _10;
- StorageLive(_5);
+ nop;
StorageLive(_6);
- _6 = copy _4;
+ _6 = copy _10;
StorageLive(_23);
_23 = const 1_usize;
- _5 = *const [()] from (copy _6, copy _23);
+ _5 = *const [()] from (copy _10, const 1_usize);
StorageDead(_23);
StorageDead(_6);
StorageLive(_7);
StorageLive(_8);
_8 = copy _5;
- _7 = copy _8 as *mut () (PtrToPtr);
+ _7 = copy _5 as *mut () (PtrToPtr);
StorageDead(_8);
StorageDead(_7);
- StorageDead(_5);
+ nop;
StorageDead(_4);
drop(_3) -> [return: bb1, unwind unreachable];
}
bb5: {
- _20 = Layout::from_size_align_unchecked::precondition_check(copy _11, copy _12) -> [return: bb6, unwind unreachable];
+ _20 = Layout::from_size_align_unchecked::precondition_check(const 0_usize, const 1_usize) -> [return: bb6, unwind unreachable];
}
bb6: {
StorageDead(_19);
StorageLive(_21);
- _21 = copy _12 as std::ptr::Alignment (Transmute);
- _14 = Layout { size: copy _11, align: move _21 };
+ _21 = const std::ptr::Alignment(std::ptr::alignment::AlignmentEnum::_Align1Shl0);
+ _14 = const Layout {{ size: 0_usize, align: std::ptr::Alignment(std::ptr::alignment::AlignmentEnum::_Align1Shl0) }};
StorageDead(_21);
StorageLive(_15);
- _15 = std::alloc::Global::alloc_impl(const alloc::alloc::exchange_malloc::promoted[0], copy _14, const false) -> [return: bb7, unwind unreachable];
+ _15 = std::alloc::Global::alloc_impl(const alloc::alloc::exchange_malloc::promoted[0], const Layout {{ size: 0_usize, align: std::ptr::Alignment(std::ptr::alignment::AlignmentEnum::_Align1Shl0) }}, const false) -> [return: bb7, unwind unreachable];
}
bb7: {
_16 = discriminant(_15);
switchInt(move _16) -> [0: bb4, 1: bb3, otherwise: bb2];
}
+ }
+
+ ALLOC0 (size: 16, align: 8) {
+ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
}

View file

@ -0,0 +1,88 @@
- // MIR for `test` before GVN
+ // MIR for `test` after GVN
fn test() -> () {
let mut _0: ();
let _1: &std::boxed::Box<()>;
let _2: &std::boxed::Box<()>;
let _3: std::boxed::Box<()>;
let mut _6: *const ();
let mut _8: *const [()];
let mut _9: std::boxed::Box<()>;
let mut _10: *const ();
let mut _11: usize;
scope 1 {
debug vp_ctx => _1;
let _4: *const ();
scope 2 {
debug slf => _10;
let _5: *const [()];
scope 3 {
debug bytes => _5;
let _7: *mut ();
scope 4 {
debug _x => _7;
}
scope 7 (inlined foo) {
}
}
scope 5 (inlined slice_from_raw_parts::<()>) {
scope 6 (inlined std::ptr::from_raw_parts::<[()], ()>) {
}
}
}
}
bb0: {
StorageLive(_1);
- StorageLive(_2);
+ nop;
StorageLive(_3);
_3 = Box::<()>::new(const ()) -> [return: bb1, unwind continue];
}
bb1: {
_2 = &_3;
_1 = copy _2;
- StorageDead(_2);
+ nop;
StorageLive(_4);
- _9 = deref_copy _3;
+ _9 = copy _3;
_10 = copy ((_9.0: std::ptr::Unique<()>).0: std::ptr::NonNull<()>) as *const () (Transmute);
_4 = copy _10;
- StorageLive(_5);
+ nop;
StorageLive(_6);
- _6 = copy _4;
+ _6 = copy _10;
StorageLive(_11);
_11 = const 1_usize;
- _5 = *const [()] from (copy _6, copy _11);
+ _5 = *const [()] from (copy _10, const 1_usize);
StorageDead(_11);
StorageDead(_6);
StorageLive(_7);
StorageLive(_8);
_8 = copy _5;
- _7 = copy _8 as *mut () (PtrToPtr);
+ _7 = copy _5 as *mut () (PtrToPtr);
StorageDead(_8);
StorageDead(_7);
- StorageDead(_5);
+ nop;
StorageDead(_4);
drop(_3) -> [return: bb2, unwind: bb3];
}
bb2: {
StorageDead(_3);
StorageDead(_1);
return;
}
bb3 (cleanup): {
resume;
}
}

View file

@ -9,7 +9,7 @@ const EXPECTED = [
{
'query': 'prelude::vec',
'others': [
{ 'path': 'std::prelude::rust_2024', 'name': 'Vec' },
{ 'path': 'std::prelude::v1', 'name': 'Vec' },
],
},
{

View file

@ -134,9 +134,8 @@ LL | type Baz = T;
| --- required by a bound in this associated type
help: consider further restricting type parameter `T` with trait `Clone`
|
LL - Self::Baz: Clone,
LL + Self::Baz: Clone, T: std::clone::Clone
|
LL | Self::Baz: Clone, T: std::clone::Clone
| ++++++++++++++++++++
error: aborting due to 8 previous errors

View file

@ -134,9 +134,8 @@ LL | type Baz = T;
| --- required by a bound in this associated type
help: consider further restricting type parameter `T` with trait `Clone`
|
LL - Self::Baz: Clone,
LL + Self::Baz: Clone, T: std::clone::Clone
|
LL | Self::Baz: Clone, T: std::clone::Clone
| ++++++++++++++++++++
error: aborting due to 8 previous errors

View file

@ -13,9 +13,8 @@ LL | impl<T: NotNull> IntoNullable for T {
| unsatisfied trait bound introduced here
help: consider extending the `where` clause, but there might be an alternative better way to express this requirement
|
LL - Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>,
LL + Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, <Col as Expression>::SqlType: NotNull
|
LL | Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, <Col as Expression>::SqlType: NotNull
| +++++++++++++++++++++++++++++++++++++
error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
--> $DIR/issue-38821.rs:40:1
@ -38,9 +37,8 @@ LL | impl<T: NotNull> IntoNullable for T {
| unsatisfied trait bound introduced here
help: consider extending the `where` clause, but there might be an alternative better way to express this requirement
|
LL - Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>,
LL + Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, <Col as Expression>::SqlType: NotNull
|
LL | Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, <Col as Expression>::SqlType: NotNull
| +++++++++++++++++++++++++++++++++++++
error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
--> $DIR/issue-38821.rs:23:10

View file

@ -12,9 +12,8 @@ LL | type Size: Add<Output = Self::Size>;
| ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Encoder::Size`
help: consider further restricting the associated type
|
LL - T: SubEncoder,
LL + T: SubEncoder, <T as SubEncoder>::ActualSize: Add
|
LL | T: SubEncoder, <T as SubEncoder>::ActualSize: Add
| ++++++++++++++++++++++++++++++++++
error: aborting due to 1 previous error

View file

@ -12,9 +12,8 @@ LL | type Size: Add<Output = Self::Size>;
| ^^^^^^^^^^^^^^^^^^^ required by this bound in `Encoder::Size`
help: consider further restricting the associated type
|
LL - T: SubEncoder,
LL + T: SubEncoder, <T as SubEncoder>::ActualSize: Add
|
LL | T: SubEncoder, <T as SubEncoder>::ActualSize: Add
| ++++++++++++++++++++++++++++++++++
error: aborting due to 1 previous error

View file

@ -35,9 +35,8 @@ LL | x.inser();
|
help: there is a method `insert` with a similar name
|
LL - x.inser();
LL + x.insert();
|
LL | x.insert();
| +
error[E0599]: no method named `foo` found for struct `rustc_confusables_across_crate::BTreeSet` in the current scope
--> $DIR/rustc_confusables.rs:15:7

View file

@ -38,9 +38,8 @@ LL | let mut x = VecDeque::new();
| ----- earlier `x` shadowed here with type `VecDeque`
help: you might have meant to use `push_back`
|
LL - x.push(1);
LL + x.push_back(1);
|
LL | x.push_back(1);
| +++++
error[E0599]: no method named `length` found for struct `Vec<{integer}>` in the current scope
--> $DIR/rustc_confusables_std_cases.rs:15:7
@ -98,9 +97,8 @@ note: method defined here
--> $SRC_DIR/alloc/src/string.rs:LL:COL
help: you might have meant to use `push_str`
|
LL - String::new().push("");
LL + String::new().push_str("");
|
LL | String::new().push_str("");
| ++++
error[E0599]: no method named `append` found for struct `String` in the current scope
--> $DIR/rustc_confusables_std_cases.rs:24:19

View file

@ -8,9 +8,8 @@ LL | self.layers.iter().fold(0, |result, mut layer| result + layer.proce
|
help: you may want to use `iter_mut` here
|
LL - self.layers.iter().fold(0, |result, mut layer| result + layer.process())
LL + self.layers.iter_mut().fold(0, |result, mut layer| result + layer.process())
|
LL | self.layers.iter_mut().fold(0, |result, mut layer| result + layer.process())
| ++++
error: aborting due to 1 previous error

View file

@ -8,9 +8,8 @@ LL | vec.iter().flat_map(|container| container.things()).cloned().co
|
help: you may want to use `iter_mut` here
|
LL - vec.iter().flat_map(|container| container.things()).cloned().collect::<Vec<PathBuf>>();
LL + vec.iter_mut().flat_map(|container| container.things()).cloned().collect::<Vec<PathBuf>>();
|
LL | vec.iter_mut().flat_map(|container| container.things()).cloned().collect::<Vec<PathBuf>>();
| ++++
error: aborting due to 1 previous error

View file

@ -8,9 +8,8 @@ LL | v.iter().for_each(|a| a.double());
|
help: you may want to use `iter_mut` here
|
LL - v.iter().for_each(|a| a.double());
LL + v.iter_mut().for_each(|a| a.double());
|
LL | v.iter_mut().for_each(|a| a.double());
| ++++
error[E0596]: cannot borrow `*a` as mutable, as it is behind a `&` reference
--> $DIR/issue-62387-suggest-iter-mut.rs:25:39
@ -22,9 +21,8 @@ LL | v.iter().rev().rev().for_each(|a| a.double());
|
help: you may want to use `iter_mut` here
|
LL - v.iter().rev().rev().for_each(|a| a.double());
LL + v.iter_mut().rev().rev().for_each(|a| a.double());
|
LL | v.iter_mut().rev().rev().for_each(|a| a.double());
| ++++
error: aborting due to 2 previous errors

View file

@ -63,9 +63,8 @@ LL | self , ... , self , self , ... ) where F : FnOnce ( & 'a & 'b usize
|
help: a trait with a similar name exists
|
LL - self , ... , self , self , ... ) where F : FnOnce ( & 'a & 'b usize ) {
LL + self , ... , self , self , ... ) where Fn : FnOnce ( & 'a & 'b usize ) {
|
LL | self , ... , self , self , ... ) where Fn : FnOnce ( & 'a & 'b usize ) {
| +
help: you might be missing a type parameter
|
LL | fn ordering4 < 'a , 'b, F > ( a : , self , self , self ,

View file

@ -16,9 +16,8 @@ LL | cbor_map! { #[cfg(test)] 4};
= note: this error originates in the macro `cbor_map` (in Nightly builds, run with -Z macro-backtrace for more info)
help: you must specify a concrete type for this numeric value, like `i32`
|
LL - cbor_map! { #[cfg(test)] 4};
LL + cbor_map! { #[cfg(test)] 4_i32};
|
LL | cbor_map! { #[cfg(test)] 4_i32};
| ++++
error: aborting due to 2 previous errors

View file

@ -17,9 +17,8 @@ LL | #[cfg(featur = "foo")]
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
help: there is a config with a similar name and value
|
LL - #[cfg(featur = "foo")]
LL + #[cfg(feature = "foo")]
|
LL | #[cfg(feature = "foo")]
| +
warning: unexpected `cfg` condition name: `featur`
--> $DIR/diagnotics.rs:17:7

View file

@ -19,9 +19,8 @@ LL | #[cfg(featur = "foo")]
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
help: there is a config with a similar name and value
|
LL - #[cfg(featur = "foo")]
LL + #[cfg(feature = "foo")]
|
LL | #[cfg(feature = "foo")]
| +
warning: unexpected `cfg` condition name: `featur`
--> $DIR/diagnotics.rs:17:7

View file

@ -108,9 +108,8 @@ LL | let PAT = v1;
= note: the matched value is of type `u32`
help: introduce a variable instead
|
LL - let PAT = v1;
LL + let PAT_var = v1;
|
LL | let PAT_var = v1;
| ++++
error: aborting due to 7 previous errors

View file

@ -8,9 +8,8 @@ LL | V(x) = func_arg;
|
help: consider dereferencing to access the inner value using the Deref trait
|
LL - V(x) = func_arg;
LL + V(x) = &*func_arg;
|
LL | V(x) = &*func_arg;
| ++
error: aborting due to 1 previous error

View file

@ -15,9 +15,8 @@ LL | _func: F,
|
help: a trait with a similar name exists
|
LL - _func: F,
LL + _func: Fn,
|
LL | _func: Fn,
| +
help: you might be missing a type parameter
|
LL | struct Map2<Segment2, F> {

View file

@ -8,9 +8,8 @@ LL | fn poll(self, _: &mut Context<'_>) -> Poll<()> {
found signature `fn(MyFuture, &mut Context<'_>) -> Poll<_>`
help: change the self-receiver type to match the trait
|
LL - fn poll(self, _: &mut Context<'_>) -> Poll<()> {
LL + fn poll(self: Pin<&mut MyFuture>, _: &mut Context<'_>) -> Poll<()> {
|
LL | fn poll(self: Pin<&mut MyFuture>, _: &mut Context<'_>) -> Poll<()> {
| ++++++++++++++++++++
error[E0053]: method `foo` has an incompatible type for trait
--> $DIR/bad-self-type.rs:22:18

View file

@ -14,9 +14,8 @@ LL | [(); N + 1]:,
| ^^^^^ required by this bound in `bar`
help: try adding a `where` bound
|
LL - [(); M + 1]:,
LL + [(); M + 1]:, [(); N + 1]:
|
LL | [(); M + 1]:, [(); N + 1]:
| ++++++++++++
error: aborting due to 1 previous error

View file

@ -14,9 +14,8 @@ LL | [(); N + 1]:,
| ^^^^^ required by this bound in `bar`
help: try adding a `where` bound
|
LL - [(); both(N + 1, M + 1)]:,
LL + [(); both(N + 1, M + 1)]:, [(); N + 1]:
|
LL | [(); both(N + 1, M + 1)]:, [(); N + 1]:
| ++++++++++++
error: aborting due to 1 previous error

View file

@ -16,9 +16,8 @@ LL | fn assert_impl<T: Trait>() {}
| ^^^^^ required by this bound in `assert_impl`
help: try adding a `where` bound
|
LL - EvaluatableU128<{N as u128}>:, {
LL + EvaluatableU128<{N as u128}>:, [(); { O as u128 } as usize]: {
|
LL | EvaluatableU128<{N as u128}>:, [(); { O as u128 } as usize]: {
| +++++++++++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/abstract-const-as-cast-3.rs:17:5
@ -52,9 +51,8 @@ LL | fn assert_impl<T: Trait>() {}
| ^^^^^ required by this bound in `assert_impl`
help: try adding a `where` bound
|
LL - EvaluatableU128<{N as u128}>:, {
LL + EvaluatableU128<{N as u128}>:, [(); { O as u128 } as usize]: {
|
LL | EvaluatableU128<{N as u128}>:, [(); { O as u128 } as usize]: {
| +++++++++++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/abstract-const-as-cast-3.rs:20:5
@ -116,9 +114,8 @@ LL | fn assert_impl<T: Trait>() {}
| ^^^^^ required by this bound in `assert_impl`
help: try adding a `where` bound
|
LL - EvaluatableU128<{N as _}>:, {
LL + EvaluatableU128<{N as _}>:, [(); { O as u128 } as usize]: {
|
LL | EvaluatableU128<{N as _}>:, [(); { O as u128 } as usize]: {
| +++++++++++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/abstract-const-as-cast-3.rs:35:5
@ -152,9 +149,8 @@ LL | fn assert_impl<T: Trait>() {}
| ^^^^^ required by this bound in `assert_impl`
help: try adding a `where` bound
|
LL - EvaluatableU128<{N as _}>:, {
LL + EvaluatableU128<{N as _}>:, [(); { O as u128 } as usize]: {
|
LL | EvaluatableU128<{N as _}>:, [(); { O as u128 } as usize]: {
| +++++++++++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/abstract-const-as-cast-3.rs:38:5

View file

@ -6,9 +6,8 @@ LL | bar::<{ T::ASSOC }>();
|
help: try adding a `where` bound
|
LL - fn foo<T: Trait, U: Trait>() where [(); U::ASSOC]:, {
LL + fn foo<T: Trait, U: Trait>() where [(); U::ASSOC]:, [(); { T::ASSOC }]: {
|
LL | fn foo<T: Trait, U: Trait>() where [(); U::ASSOC]:, [(); { T::ASSOC }]: {
| +++++++++++++++++++
error: aborting due to 1 previous error

View file

@ -26,9 +26,8 @@ LL | foo::<_, L>([(); L + 1 + L]);
|
help: try adding a `where` bound
|
LL - [(); (L - 1) + 1 + L]:,
LL + [(); (L - 1) + 1 + L]:, [(); L + 1 + L]:
|
LL | [(); (L - 1) + 1 + L]:, [(); L + 1 + L]:
| ++++++++++++++++
error: unconstrained generic constant
--> $DIR/issue_114151.rs:17:17

View file

@ -15,9 +15,8 @@ LL | foo::<_, L>([(); L + 1 + L]);
|
help: try adding a `where` bound
|
LL - [(); (L - 1) + 1 + L]:,
LL + [(); (L - 1) + 1 + L]:, [(); L + 1 + L]:
|
LL | [(); (L - 1) + 1 + L]:, [(); L + 1 + L]:
| ++++++++++++++++
error: aborting due to 2 previous errors

View file

@ -9,9 +9,8 @@ LL | let f: F = async { 1 };
|
help: a trait with a similar name exists
|
LL - let f: F = async { 1 };
LL + let f: Fn = async { 1 };
|
LL | let f: Fn = async { 1 };
| +
help: you might be missing a type parameter
|
LL | fn f<T, F>(

View file

@ -12,9 +12,8 @@ LL | let a = 4;
= note: the matched value is of type `u8`
help: introduce a variable instead
|
LL - let a = 4;
LL + let a_var = 4;
|
LL | let a_var = 4;
| ++++
error[E0005]: refutable pattern in local binding
--> $DIR/const-pattern-irrefutable.rs:28:9
@ -48,9 +47,8 @@ LL | let d = (4, 4);
= note: the matched value is of type `(u8, u8)`
help: introduce a variable instead
|
LL - let d = (4, 4);
LL + let d_var = (4, 4);
|
LL | let d_var = (4, 4);
| ++++
error[E0005]: refutable pattern in local binding
--> $DIR/const-pattern-irrefutable.rs:36:9
@ -71,9 +69,8 @@ LL | struct S {
= note: the matched value is of type `S`
help: introduce a variable instead
|
LL - let e = S {
LL + let e_var = S {
|
LL | let e_var = S {
| ++++
error: aborting due to 4 previous errors

View file

@ -10,9 +10,8 @@ LL | const CRATE: Crate = Crate { fiel: () };
= note: this error originates in the macro `environment` (in Nightly builds, run with -Z macro-backtrace for more info)
help: a field with a similar name exists
|
LL - const CRATE: Crate = Crate { fiel: () };
LL + const CRATE: Crate = Crate { field: () };
|
LL | const CRATE: Crate = Crate { field: () };
| +
error[E0609]: no field `field` on type `Compound`
--> $DIR/dont-suggest-hygienic-fields.rs:24:16

View file

@ -11,9 +11,8 @@ LL | struct DropMe<T: Copy>(T);
| ^^^^ required by this bound in `DropMe`
help: consider further restricting type parameter `T` with trait `Copy`
|
LL - [T; 1]: Copy, // But `[T; 1]: Copy` does not imply `T: Copy`
LL + [T; 1]: Copy, T: std::marker::Copy // But `[T; 1]: Copy` does not imply `T: Copy`
|
LL | [T; 1]: Copy, T: std::marker::Copy // But `[T; 1]: Copy` does not imply `T: Copy`
| ++++++++++++++++++++
error[E0277]: the trait bound `T: Copy` is not satisfied
--> $DIR/explicit-drop-bounds.rs:32:18
@ -28,9 +27,8 @@ LL | struct DropMe<T: Copy>(T);
| ^^^^ required by this bound in `DropMe`
help: consider further restricting type parameter `T` with trait `Copy`
|
LL - [T; 1]: Copy, // But `[T; 1]: Copy` does not imply `T: Copy`
LL + [T; 1]: Copy, T: std::marker::Copy // But `[T; 1]: Copy` does not imply `T: Copy`
|
LL | [T; 1]: Copy, T: std::marker::Copy // But `[T; 1]: Copy` does not imply `T: Copy`
| ++++++++++++++++++++
error: aborting due to 2 previous errors

View file

@ -67,9 +67,8 @@ LL | fn wants_write(_: impl Write) {}
| ^^^^^ required by this bound in `wants_write`
help: consider changing this borrow's mutability
|
LL - wants_write(&[0u8][..]);
LL + wants_write(&mut [0u8][..]);
|
LL | wants_write(&mut [0u8][..]);
| +++
error: aborting due to 4 previous errors

View file

@ -14,9 +14,8 @@ LL | pub struct XEmpty2;
|
help: use struct literal syntax instead
|
LL - let e1 = Empty1;
LL + let e1 = Empty1 {};
|
LL | let e1 = Empty1 {};
| ++
help: a unit struct with a similar name exists
|
LL - let e1 = Empty1;
@ -38,9 +37,8 @@ LL | pub struct XEmpty2;
|
help: use struct literal syntax instead
|
LL - let xe1 = XEmpty1;
LL + let xe1 = XEmpty1 {};
|
LL | let xe1 = XEmpty1 {};
| ++
help: a unit struct with a similar name exists
|
LL - let xe1 = XEmpty1;
@ -127,9 +125,8 @@ LL | let xe3 = XE::Empty3;
|
help: there is a variant with a similar name
|
LL - let xe3 = XE::Empty3;
LL + let xe3 = XE::XEmpty3;
|
LL | let xe3 = XE::XEmpty3;
| +
error[E0599]: no variant or associated item named `Empty3` found for enum `empty_struct::XE` in the current scope
--> $DIR/empty-struct-braces-expr.rs:26:19

View file

@ -46,9 +46,8 @@ LL | XEmpty5(),
|
help: use the tuple variant pattern syntax instead
|
LL - XE::XEmpty5 => (),
LL + XE::XEmpty5() => (),
|
LL | XE::XEmpty5() => (),
| ++
help: a unit variant with a similar name exists
|
LL - XE::XEmpty5 => (),

View file

@ -30,9 +30,8 @@ LL | use env;
|
help: consider importing this module instead
|
LL - use env;
LL + use std::env;
|
LL | use std::env;
| +++++
error: aborting due to 4 previous errors

View file

@ -6,19 +6,16 @@ LL | Dog { age: x } => {}
|
help: include the missing field in the pattern
|
LL - Dog { age: x } => {}
LL + Dog { age: x, name } => {}
|
LL | Dog { age: x, name } => {}
| ++++++
help: if you don't care about this missing field, you can explicitly ignore it
|
LL - Dog { age: x } => {}
LL + Dog { age: x, name: _ } => {}
|
LL | Dog { age: x, name: _ } => {}
| +++++++++
help: or always ignore missing fields here
|
LL - Dog { age: x } => {}
LL + Dog { age: x, .. } => {}
|
LL | Dog { age: x, .. } => {}
| ++++
error[E0027]: pattern does not mention field `age`
--> $DIR/E0027.rs:15:9

View file

@ -11,9 +11,8 @@ LL + extern fn none_fn(x: bool) -> i32 { <body> }
|
help: if you meant to declare an externally defined function, use an `extern` block
|
LL - extern fn none_fn(x: bool) -> i32;
LL + extern { fn none_fn(x: bool) -> i32; }
|
LL | extern { fn none_fn(x: bool) -> i32; }
| + +
error: free function without a body
--> $DIR/not-in-block.rs:6:1
@ -28,9 +27,8 @@ LL + extern "C" fn c_fn(x: bool) -> i32 { <body> }
|
help: if you meant to declare an externally defined function, use an `extern` block
|
LL - extern "C" fn c_fn(x: bool) -> i32;
LL + extern "C" { fn c_fn(x: bool) -> i32; }
|
LL | extern "C" { fn c_fn(x: bool) -> i32; }
| + +
error: aborting due to 2 previous errors

View file

@ -95,9 +95,8 @@ LL | extern "rust-call" fn call(self, args: ()) -> () {}
found signature `extern "rust-call" fn(Foo, ()) -> ()`
help: change the self-receiver type to match the trait
|
LL - extern "rust-call" fn call(self, args: ()) -> () {}
LL + extern "rust-call" fn call(&self, args: ()) -> () {}
|
LL | extern "rust-call" fn call(&self, args: ()) -> () {}
| +
error[E0183]: manual implementations of `FnOnce` are experimental
--> $DIR/feature-gate-unboxed-closures-manual-impls.rs:18:6

View file

@ -51,9 +51,8 @@ LL | format_args!("{}", 0xffff_ffff); // treat unsuffixed literals as i32
= help: consider using the type `u32` instead
help: to use as a negative number (decimal `-1`), consider using the type `u32` for the literal and cast it to `i32`
|
LL - format_args!("{}", 0xffff_ffff); // treat unsuffixed literals as i32
LL + format_args!("{}", 0xffff_ffffu32 as i32); // treat unsuffixed literals as i32
|
LL | format_args!("{}", 0xffff_ffffu32 as i32); // treat unsuffixed literals as i32
| ++++++++++
error: aborting due to 5 previous errors

View file

@ -17,9 +17,8 @@ LL + use no_method_suggested_traits::qux::PrivPub;
|
help: there is a method `method2` with a similar name
|
LL - 1u32.method();
LL + 1u32.method2();
|
LL | 1u32.method2();
| +
error[E0599]: no method named `method` found for struct `Rc<&mut Box<&u32>>` in the current scope
--> $DIR/no-method-suggested-traits.rs:26:44
@ -40,9 +39,8 @@ LL + use no_method_suggested_traits::qux::PrivPub;
|
help: there is a method `method2` with a similar name
|
LL - std::rc::Rc::new(&mut Box::new(&1u32)).method();
LL + std::rc::Rc::new(&mut Box::new(&1u32)).method2();
|
LL | std::rc::Rc::new(&mut Box::new(&1u32)).method2();
| +
error[E0599]: no method named `method` found for type `char` in the current scope
--> $DIR/no-method-suggested-traits.rs:30:9
@ -60,9 +58,8 @@ LL + use foo::Bar;
|
help: there is a method `method2` with a similar name
|
LL - 'a'.method();
LL + 'a'.method2();
|
LL | 'a'.method2();
| +
error[E0599]: no method named `method` found for struct `Rc<&mut Box<&char>>` in the current scope
--> $DIR/no-method-suggested-traits.rs:32:43
@ -77,9 +74,8 @@ LL + use foo::Bar;
|
help: there is a method `method2` with a similar name
|
LL - std::rc::Rc::new(&mut Box::new(&'a')).method();
LL + std::rc::Rc::new(&mut Box::new(&'a')).method2();
|
LL | std::rc::Rc::new(&mut Box::new(&'a')).method2();
| +
error[E0599]: no method named `method` found for type `i32` in the current scope
--> $DIR/no-method-suggested-traits.rs:35:10
@ -99,9 +95,8 @@ LL + use no_method_suggested_traits::foo::PubPub;
|
help: there is a method `method3` with a similar name
|
LL - 1i32.method();
LL + 1i32.method3();
|
LL | 1i32.method3();
| +
error[E0599]: no method named `method` found for struct `Rc<&mut Box<&i32>>` in the current scope
--> $DIR/no-method-suggested-traits.rs:37:44
@ -116,9 +111,8 @@ LL + use no_method_suggested_traits::foo::PubPub;
|
help: there is a method `method3` with a similar name
|
LL - std::rc::Rc::new(&mut Box::new(&1i32)).method();
LL + std::rc::Rc::new(&mut Box::new(&1i32)).method3();
|
LL | std::rc::Rc::new(&mut Box::new(&1i32)).method3();
| +
error[E0599]: no method named `method` found for struct `Foo` in the current scope
--> $DIR/no-method-suggested-traits.rs:40:9

View file

@ -37,9 +37,8 @@ LL | | }
| |_____^
help: you might have meant to use the following enum variant
|
LL - B;
LL + B::B1;
|
LL | B::B1;
| ++++
error[E0425]: cannot find value `C` in this scope
--> $DIR/glob-resolve1.rs:29:5

View file

@ -32,9 +32,8 @@ LL | use foo::{self};
= 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
|
LL - use foo::{self};
LL + use foo::{self as other_foo};
|
LL | use foo::{self as other_foo};
| ++++++++++++
error[E0255]: the name `foo` is defined multiple times
--> $DIR/import-self.rs:12:5

View file

@ -6,9 +6,8 @@ LL | println!("Hello, {}!", crate::bar::do_the_thing);
|
help: a similar path exists
|
LL - println!("Hello, {}!", crate::bar::do_the_thing);
LL + println!("Hello, {}!", crate::foo::bar::do_the_thing);
|
LL | println!("Hello, {}!", crate::foo::bar::do_the_thing);
| +++++
help: consider importing this module
|
LL + use foo::bar;

View file

@ -6,9 +6,8 @@ LL | println!("Hello, {}!", crate::bar::do_the_thing);
|
help: a similar path exists
|
LL - println!("Hello, {}!", crate::bar::do_the_thing);
LL + println!("Hello, {}!", crate::foo::bar::do_the_thing);
|
LL | println!("Hello, {}!", crate::foo::bar::do_the_thing);
| +++++
help: consider importing this module
|
LL + use foo::bar;

View file

@ -11,9 +11,8 @@ LL | Foo::Bar => {}
|
help: use the tuple variant pattern syntax instead
|
LL - Foo::Bar => {}
LL + Foo::Bar(_) => {}
|
LL | Foo::Bar(_) => {}
| +++
help: a unit variant with a similar name exists
|
LL - Foo::Bar => {}

View file

@ -6,9 +6,8 @@ LL | 3.f()
|
help: you must specify a concrete type for this numeric value, like `i32`
|
LL - 3.f()
LL + 3_i32.f()
|
LL | 3_i32.f()
| ++++
error: aborting due to 1 previous error

View file

@ -6,9 +6,8 @@ LL | let a = (1.0).pow(1.0);
|
help: you must specify a concrete type for this numeric value, like `f32`
|
LL - let a = (1.0).pow(1.0);
LL + let a = (1.0_f32).pow(1.0);
|
LL | let a = (1.0_f32).pow(1.0);
| ++++
error: aborting due to 1 previous error

View file

@ -14,9 +14,8 @@ LL | S(Either::Right(_)) => {}
| ++ +
help: you might have meant to use field `0` whose type is `Either<usize, usize>`
|
LL - match S(Either::Left(5)) {
LL + match S(Either::Left(5)).0 {
|
LL | match S(Either::Left(5)).0 {
| ++
error: aborting due to 1 previous error

View file

@ -16,9 +16,8 @@ LL + use reexported_trait::Trait;
|
help: there is a method `trait_method_b` with a similar name
|
LL - reexported_trait::FooStruct.trait_method();
LL + reexported_trait::FooStruct.trait_method_b();
|
LL | reexported_trait::FooStruct.trait_method_b();
| ++
error[E0599]: no method named `trait_method_b` found for struct `FooStruct` in the current scope
--> $DIR/issue-56175.rs:7:33

View file

@ -10,9 +10,8 @@ LL | T::A(a) | T::B(a) => a,
found enum `T`
help: consider dereferencing the boxed value
|
LL - let y = match x {
LL + let y = match *x {
|
LL | let y = match *x {
| +
error[E0308]: mismatched types
--> $DIR/issue-57741.rs:20:19
@ -26,9 +25,8 @@ LL | T::A(a) | T::B(a) => a,
found enum `T`
help: consider dereferencing the boxed value
|
LL - let y = match x {
LL + let y = match *x {
|
LL | let y = match *x {
| +
error[E0308]: mismatched types
--> $DIR/issue-57741.rs:27:9
@ -42,9 +40,8 @@ LL | S::A { a } | S::B { b: a } => a,
found enum `S`
help: consider dereferencing the boxed value
|
LL - let y = match x {
LL + let y = match *x {
|
LL | let y = match *x {
| +
error[E0308]: mismatched types
--> $DIR/issue-57741.rs:27:22
@ -58,9 +55,8 @@ LL | S::A { a } | S::B { b: a } => a,
found enum `S`
help: consider dereferencing the boxed value
|
LL - let y = match x {
LL + let y = match *x {
|
LL | let y = match *x {
| +
error: aborting due to 4 previous errors

View file

@ -8,9 +8,8 @@ LL | let Bar::Present(z) = self else {
|
help: consider dereferencing to access the inner value using the Deref trait
|
LL - let Bar::Present(z) = self else {
LL + let Bar::Present(z) = &**self else {
|
LL | let Bar::Present(z) = &**self else {
| +++
error[E0308]: mismatched types
--> $DIR/let-else-deref-coercion.rs:68:13
@ -22,9 +21,8 @@ LL | let Bar(z) = x;
|
help: consider dereferencing to access the inner value using the Deref trait
|
LL - let Bar(z) = x;
LL + let Bar(z) = &**x;
|
LL | let Bar(z) = &**x;
| +++
error: aborting due to 2 previous errors

View file

@ -32,9 +32,8 @@ LL | "\●"
= help: for more information, visit <https://doc.rust-lang.org/reference/tokens.html#literals>
help: if you meant to write a literal backslash (perhaps escaping in a regular expression), consider a raw string literal
|
LL - "\●"
LL + r"\●"
|
LL | r"\●"
| +
error: aborting due to 4 previous errors

View file

@ -12,9 +12,8 @@ LL | x.use_mut();
= note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider consuming the `Vec<i32>` when turning it into an `Iterator`
|
LL - let mut x = vec![1].iter();
LL + let mut x = vec![1].into_iter();
|
LL | let mut x = vec![1].into_iter();
| +++++
help: consider using a `let` binding to create a longer lived value
|
LL ~ let binding = vec![1];

View file

@ -11,9 +11,8 @@ LL | #![deny(let_underscore_drop)]
| ^^^^^^^^^^^^^^^^^^^
help: consider binding to an unused variable to avoid immediately dropping the value
|
LL - let _ = foo();
LL + let _unused = foo();
|
LL | let _unused = foo();
| ++++++
help: consider immediately dropping the value
|
LL - let _ = foo();

View file

@ -28,9 +28,8 @@ LL | let _ = field;
|
help: consider binding to an unused variable to avoid immediately dropping the value
|
LL - let _ = field;
LL + let _unused = field;
|
LL | let _unused = field;
| ++++++
help: consider immediately dropping the value
|
LL - let _ = field;

View file

@ -11,9 +11,8 @@ LL | #![warn(let_underscore_drop)]
| ^^^^^^^^^^^^^^^^^^^
help: consider binding to an unused variable to avoid immediately dropping the value
|
LL - let _ = NontrivialDrop;
LL + let _unused = NontrivialDrop;
|
LL | let _unused = NontrivialDrop;
| ++++++
help: consider immediately dropping the value
|
LL - let _ = NontrivialDrop;

View file

@ -7,9 +7,8 @@ LL | let _ = data.lock().unwrap();
= note: `#[deny(let_underscore_lock)]` on by default
help: consider binding to an unused variable to avoid immediately dropping the value
|
LL - let _ = data.lock().unwrap();
LL + let _unused = data.lock().unwrap();
|
LL | let _unused = data.lock().unwrap();
| ++++++
help: consider immediately dropping the value
|
LL - let _ = data.lock().unwrap();
@ -24,9 +23,8 @@ LL | let _ = data.lock();
|
help: consider binding to an unused variable to avoid immediately dropping the value
|
LL - let _ = data.lock();
LL + let _unused = data.lock();
|
LL | let _unused = data.lock();
| ++++++
help: consider immediately dropping the value
|
LL - let _ = data.lock();
@ -42,9 +40,8 @@ LL | let (_, _) = (data.lock(), 1);
= help: consider immediately dropping the value using `drop(..)` after the `let` statement
help: consider binding to an unused variable to avoid immediately dropping the value
|
LL - let (_, _) = (data.lock(), 1);
LL + let (_unused, _) = (data.lock(), 1);
|
LL | let (_unused, _) = (data.lock(), 1);
| ++++++
error: non-binding let on a synchronization lock
--> $DIR/let_underscore_lock.rs:16:26
@ -55,9 +52,8 @@ LL | let (_a, Struct { a: _ }) = (0, Struct { a: data.lock() });
= help: consider immediately dropping the value using `drop(..)` after the `let` statement
help: consider binding to an unused variable to avoid immediately dropping the value
|
LL - let (_a, Struct { a: _ }) = (0, Struct { a: data.lock() });
LL + let (_a, Struct { a: _unused }) = (0, Struct { a: data.lock() });
|
LL | let (_a, Struct { a: _unused }) = (0, Struct { a: data.lock() });
| ++++++
error: non-binding let on a synchronization lock
--> $DIR/let_underscore_lock.rs:18:6

View file

@ -25,9 +25,8 @@ LL | let addr_32bit = &x as *const u8 as u32;
= help: if you can't comply with strict provenance and need to expose the pointer provenance you can use `.expose_provenance()` instead
help: use `.addr()` to obtain the address of a pointer
|
LL - let addr_32bit = &x as *const u8 as u32;
LL + let addr_32bit = (&x as *const u8).addr() as u32;
|
LL | let addr_32bit = (&x as *const u8).addr() as u32;
| + ++++++++
error: under strict provenance it is considered bad style to cast pointer `*const u8` to integer `usize`
--> $DIR/lint-strict-provenance-lossy-casts.rs:14:20

View file

@ -9,9 +9,8 @@ LL | let _y = &X;
= note: `#[warn(static_mut_refs)]` on by default
help: use `&raw const` instead to create a raw pointer
|
LL - let _y = &X;
LL + let _y = &raw const X;
|
LL | let _y = &raw const X;
| +++++++++
warning: creating a mutable reference to mutable static is discouraged
--> $DIR/static-mut-refs.rs:42:18
@ -46,9 +45,8 @@ LL | let (_b, _c) = (&X, &Y);
= note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives
help: use `&raw const` instead to create a raw pointer
|
LL - let (_b, _c) = (&X, &Y);
LL + let (_b, _c) = (&raw const X, &Y);
|
LL | let (_b, _c) = (&raw const X, &Y);
| +++++++++
warning: creating a shared reference to mutable static is discouraged
--> $DIR/static-mut-refs.rs:54:29
@ -60,9 +58,8 @@ LL | let (_b, _c) = (&X, &Y);
= note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives
help: use `&raw const` instead to create a raw pointer
|
LL - let (_b, _c) = (&X, &Y);
LL + let (_b, _c) = (&X, &raw const Y);
|
LL | let (_b, _c) = (&X, &raw const Y);
| +++++++++
warning: creating a shared reference to mutable static is discouraged
--> $DIR/static-mut-refs.rs:60:13
@ -74,9 +71,8 @@ LL | foo(&X);
= note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives
help: use `&raw const` instead to create a raw pointer
|
LL - foo(&X);
LL + foo(&raw const X);
|
LL | foo(&raw const X);
| +++++++++
warning: creating a shared reference to mutable static is discouraged
--> $DIR/static-mut-refs.rs:66:17
@ -106,9 +102,8 @@ LL | let _v = &A.value;
= note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives
help: use `&raw const` instead to create a raw pointer
|
LL - let _v = &A.value;
LL + let _v = &raw const A.value;
|
LL | let _v = &raw const A.value;
| +++++++++
warning: creating a shared reference to mutable static is discouraged
--> $DIR/static-mut-refs.rs:80:18
@ -120,9 +115,8 @@ LL | let _s = &A.s.value;
= note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives
help: use `&raw const` instead to create a raw pointer
|
LL - let _s = &A.s.value;
LL + let _s = &raw const A.s.value;
|
LL | let _s = &raw const A.s.value;
| +++++++++
warning: creating a shared reference to mutable static is discouraged
--> $DIR/static-mut-refs.rs:84:22

View file

@ -9,9 +9,8 @@ LL | let _y = &X;
= note: `#[deny(static_mut_refs)]` on by default
help: use `&raw const` instead to create a raw pointer
|
LL - let _y = &X;
LL + let _y = &raw const X;
|
LL | let _y = &raw const X;
| +++++++++
error: creating a mutable reference to mutable static is discouraged
--> $DIR/static-mut-refs.rs:42:18
@ -46,9 +45,8 @@ LL | let (_b, _c) = (&X, &Y);
= note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives
help: use `&raw const` instead to create a raw pointer
|
LL - let (_b, _c) = (&X, &Y);
LL + let (_b, _c) = (&raw const X, &Y);
|
LL | let (_b, _c) = (&raw const X, &Y);
| +++++++++
error: creating a shared reference to mutable static is discouraged
--> $DIR/static-mut-refs.rs:54:29
@ -60,9 +58,8 @@ LL | let (_b, _c) = (&X, &Y);
= note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives
help: use `&raw const` instead to create a raw pointer
|
LL - let (_b, _c) = (&X, &Y);
LL + let (_b, _c) = (&X, &raw const Y);
|
LL | let (_b, _c) = (&X, &raw const Y);
| +++++++++
error: creating a shared reference to mutable static is discouraged
--> $DIR/static-mut-refs.rs:60:13
@ -74,9 +71,8 @@ LL | foo(&X);
= note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives
help: use `&raw const` instead to create a raw pointer
|
LL - foo(&X);
LL + foo(&raw const X);
|
LL | foo(&raw const X);
| +++++++++
error: creating a shared reference to mutable static is discouraged
--> $DIR/static-mut-refs.rs:66:17
@ -106,9 +102,8 @@ LL | let _v = &A.value;
= note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives
help: use `&raw const` instead to create a raw pointer
|
LL - let _v = &A.value;
LL + let _v = &raw const A.value;
|
LL | let _v = &raw const A.value;
| +++++++++
error: creating a shared reference to mutable static is discouraged
--> $DIR/static-mut-refs.rs:80:18
@ -120,9 +115,8 @@ LL | let _s = &A.s.value;
= note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives
help: use `&raw const` instead to create a raw pointer
|
LL - let _s = &A.s.value;
LL + let _s = &raw const A.s.value;
|
LL | let _s = &raw const A.s.value;
| +++++++++
error: creating a shared reference to mutable static is discouraged
--> $DIR/static-mut-refs.rs:84:22

View file

@ -66,9 +66,8 @@ LL | let fail: i128 = 0x8000_0000_0000_0000_0000_0000_0000_0000;
= help: consider using the type `u128` instead
help: to use as a negative number (decimal `-170141183460469231731687303715884105728`), consider using the type `u128` for the literal and cast it to `i128`
|
LL - let fail: i128 = 0x8000_0000_0000_0000_0000_0000_0000_0000;
LL + let fail: i128 = 0x8000_0000_0000_0000_0000_0000_0000_0000u128 as i128;
|
LL | let fail: i128 = 0x8000_0000_0000_0000_0000_0000_0000_0000u128 as i128;
| ++++++++++++
warning: literal out of range for `i32`
--> $DIR/type-overflow.rs:27:16
@ -117,9 +116,8 @@ LL | let fail = 0x8FFF_FFFF_FFFF_FFFE;
= help: consider using the type `u64` instead
help: to use as a negative number (decimal `-2`), consider using the type `u32` for the literal and cast it to `i32`
|
LL - let fail = 0x8FFF_FFFF_FFFF_FFFE;
LL + let fail = 0x8FFF_FFFF_FFFF_FFFEu32 as i32;
|
LL | let fail = 0x8FFF_FFFF_FFFF_FFFEu32 as i32;
| ++++++++++
warning: literal out of range for `i8`
--> $DIR/type-overflow.rs:46:17

View file

@ -12,9 +12,8 @@ LL | #![deny(unused)]
= note: `#[deny(unused_variables)]` implied by `#[deny(unused)]`
help: try ignoring the field
|
LL - A { i, j } | B { i, j } => {
LL + A { i, j: _ } | B { i, j: _ } => {
|
LL | A { i, j: _ } | B { i, j: _ } => {
| +++ +++
error: unused variable: `j`
--> $DIR/issue-67691-unused-field-in-or-pattern.rs:30:16
@ -36,9 +35,8 @@ LL | Some(A { i, j } | B { i, j }) => {
|
help: try ignoring the field
|
LL - Some(A { i, j } | B { i, j }) => {
LL + Some(A { i, j: _ } | B { i, j: _ }) => {
|
LL | Some(A { i, j: _ } | B { i, j: _ }) => {
| +++ +++
error: unused variable: `j`
--> $DIR/issue-67691-unused-field-in-or-pattern.rs:52:21

View file

@ -627,9 +627,8 @@ LL | cmp!(a, b);
|
help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses
|
LL - cmp!(a, b);
LL + cmp!(std::ptr::addr_eq(a, b));
|
LL | cmp!(std::ptr::addr_eq(a, b));
| ++++++++++++++++++ +
warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected
--> $DIR/wide_pointer_comparisons.rs:159:39

View file

@ -13,9 +13,8 @@ LL | #![warn(edition_2024_expr_fragment_specifier)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: to keep the existing behavior, use the `expr_2021` fragment specifier
|
LL - ($e:expr) => {
LL + ($e:expr_2021) => {
|
LL | ($e:expr_2021) => {
| +++++
warning: the `expr` fragment specifier will accept more expressions in the 2024 edition
--> $DIR/expr_2021_cargo_fix_edition.rs:11:11
@ -27,9 +26,8 @@ LL | ($($i:expr)*) => { };
= note: for more information, see Migration Guide <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/macro-fragment-specifiers.html>
help: to keep the existing behavior, use the `expr_2021` fragment specifier
|
LL - ($($i:expr)*) => { };
LL + ($($i:expr_2021)*) => { };
|
LL | ($($i:expr_2021)*) => { };
| +++++
warning: 2 warnings emitted

Some files were not shown because too many files have changed in this diff Show more