Auto merge of #128529 - matthiaskrgr:rollup-gzq2slo, r=matthiaskrgr

Rollup of 6 pull requests

Successful merges:

 - #126818 (Better handle suggestions for the already present code and fix some suggestions)
 - #128436 (Update sysinfo version to 0.31.2)
 - #128453 (raw_eq: using it on bytes with provenance is not UB (outside const-eval))
 - #128491 ([`macro_metavar_expr_concat`] Dogfooding)
 - #128494 (MIR required_consts, mentioned_items: ensure we do not forget to fill these lists)
 - #128521 (rustdoc: Remove dead opaque_tys rendering logic)

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2024-08-02 04:53:45 +00:00
commit 2cec7a85ed
39 changed files with 358 additions and 225 deletions

View File

@ -771,7 +771,7 @@ dependencies = [
"tracing-subscriber", "tracing-subscriber",
"unified-diff", "unified-diff",
"walkdir", "walkdir",
"windows", "windows 0.52.0",
] ]
[[package]] [[package]]
@ -1713,7 +1713,7 @@ dependencies = [
"iana-time-zone-haiku", "iana-time-zone-haiku",
"js-sys", "js-sys",
"wasm-bindgen", "wasm-bindgen",
"windows-core", "windows-core 0.52.0",
] ]
[[package]] [[package]]
@ -2436,15 +2436,6 @@ dependencies = [
"windows-sys 0.52.0", "windows-sys 0.52.0",
] ]
[[package]]
name = "ntapi"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8a3895c6391c39d7fe7ebc444a87eb2991b2a0bc718fdabd071eec617fc68e4"
dependencies = [
"winapi",
]
[[package]] [[package]]
name = "nu-ansi-term" name = "nu-ansi-term"
version = "0.46.0" version = "0.46.0"
@ -3717,7 +3708,7 @@ dependencies = [
"thorin-dwp", "thorin-dwp",
"tracing", "tracing",
"wasm-encoder 0.210.0", "wasm-encoder 0.210.0",
"windows", "windows 0.52.0",
] ]
[[package]] [[package]]
@ -3774,7 +3765,7 @@ dependencies = [
"tempfile", "tempfile",
"thin-vec", "thin-vec",
"tracing", "tracing",
"windows", "windows 0.52.0",
] ]
[[package]] [[package]]
@ -3835,7 +3826,7 @@ dependencies = [
"shlex", "shlex",
"time", "time",
"tracing", "tracing",
"windows", "windows 0.52.0",
] ]
[[package]] [[package]]
@ -3886,7 +3877,7 @@ dependencies = [
"termcolor", "termcolor",
"termize", "termize",
"tracing", "tracing",
"windows", "windows 0.52.0",
] ]
[[package]] [[package]]
@ -4607,7 +4598,7 @@ dependencies = [
"smallvec", "smallvec",
"termize", "termize",
"tracing", "tracing",
"windows", "windows 0.52.0",
] ]
[[package]] [[package]]
@ -5365,16 +5356,13 @@ dependencies = [
[[package]] [[package]]
name = "sysinfo" name = "sysinfo"
version = "0.30.12" version = "0.31.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "732ffa00f53e6b2af46208fba5718d9662a421049204e156328b66791ffa15ae" checksum = "d4115055da5f572fff541dd0c4e61b0262977f453cc9fe04be83aba25a89bdab"
dependencies = [ dependencies = [
"cfg-if",
"core-foundation-sys", "core-foundation-sys",
"libc", "libc",
"ntapi", "windows 0.57.0",
"once_cell",
"windows",
] ]
[[package]] [[package]]
@ -6299,7 +6287,17 @@ version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be" checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be"
dependencies = [ dependencies = [
"windows-core", "windows-core 0.52.0",
"windows-targets 0.52.5",
]
[[package]]
name = "windows"
version = "0.57.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "12342cb4d8e3b046f3d80effd474a7a02447231330ef77d71daa6fbc40681143"
dependencies = [
"windows-core 0.57.0",
"windows-targets 0.52.5", "windows-targets 0.52.5",
] ]
@ -6326,12 +6324,55 @@ dependencies = [
"windows-targets 0.52.5", "windows-targets 0.52.5",
] ]
[[package]]
name = "windows-core"
version = "0.57.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2ed2439a290666cd67ecce2b0ffaad89c2a56b976b736e6ece670297897832d"
dependencies = [
"windows-implement",
"windows-interface",
"windows-result",
"windows-targets 0.52.5",
]
[[package]]
name = "windows-implement"
version = "0.57.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9107ddc059d5b6fbfbffdfa7a7fe3e22a226def0b2608f72e9d552763d3e1ad7"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.67",
]
[[package]]
name = "windows-interface"
version = "0.57.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "29bee4b38ea3cde66011baa44dba677c432a78593e202392d1e9070cf2a7fca7"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.67",
]
[[package]] [[package]]
name = "windows-metadata" name = "windows-metadata"
version = "0.58.0" version = "0.58.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2e837f3c3012cfe9e7086302a93f441a7999439be1ad4c530d55d2f6d2921809" checksum = "2e837f3c3012cfe9e7086302a93f441a7999439be1ad4c530d55d2f6d2921809"
[[package]]
name = "windows-result"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5e383302e8ec8515204254685643de10811af0ed97ea37210dc26fb0032647f8"
dependencies = [
"windows-targets 0.52.5",
]
[[package]] [[package]]
name = "windows-sys" name = "windows-sys"
version = "0.48.0" version = "0.48.0"

View File

@ -316,9 +316,6 @@ const_eval_range_upper = less or equal to {$hi}
const_eval_range_wrapping = less or equal to {$hi}, or greater or equal to {$lo} const_eval_range_wrapping = less or equal to {$hi}, or greater or equal to {$lo}
const_eval_raw_bytes = the raw bytes of the constant (size: {$size}, align: {$align}) {"{"}{$bytes}{"}"} const_eval_raw_bytes = the raw bytes of the constant (size: {$size}, align: {$align}) {"{"}{$bytes}{"}"}
const_eval_raw_eq_with_provenance =
`raw_eq` on bytes with provenance
const_eval_raw_ptr_comparison = const_eval_raw_ptr_comparison =
pointers cannot be reliably compared during const eval pointers cannot be reliably compared during const eval
.note = see issue #53020 <https://github.com/rust-lang/rust/issues/53020> for more information .note = see issue #53020 <https://github.com/rust-lang/rust/issues/53020> for more information

View File

@ -877,7 +877,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
body: &'tcx mir::Body<'tcx>, body: &'tcx mir::Body<'tcx>,
) -> InterpResult<'tcx> { ) -> InterpResult<'tcx> {
// Make sure all the constants required by this frame evaluate successfully (post-monomorphization check). // Make sure all the constants required by this frame evaluate successfully (post-monomorphization check).
for &const_ in &body.required_consts { for &const_ in body.required_consts() {
let c = let c =
self.instantiate_from_current_frame_and_normalize_erasing_regions(const_.const_)?; self.instantiate_from_current_frame_and_normalize_erasing_regions(const_.const_)?;
c.eval(*self.tcx, self.param_env, const_.span).map_err(|err| { c.eval(*self.tcx, self.param_env, const_.span).map_err(|err| {

View File

@ -690,9 +690,6 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
// zero-sized access // zero-sized access
return Ok(&[]); return Ok(&[]);
}; };
if alloc_ref.has_provenance() {
throw_ub_custom!(fluent::const_eval_raw_eq_with_provenance);
}
alloc_ref.get_bytes_strip_provenance() alloc_ref.get_bytes_strip_provenance()
}; };

View File

@ -1767,7 +1767,10 @@ impl HumanEmitter {
debug!(?suggestions); debug!(?suggestions);
if suggestions.is_empty() { if suggestions.is_empty() {
// Suggestions coming from macros can have malformed spans. This is a heavy handed // Here we check if there are suggestions that have actual code changes. We sometimes
// suggest the same code that is already there, instead of changing how we produce the
// suggestions and filtering there, we just don't emit the suggestion.
// Suggestions coming from macros can also have malformed spans. This is a heavy handed
// approach to avoid ICEs by ignoring the suggestion outright. // approach to avoid ICEs by ignoring the suggestion outright.
return Ok(()); return Ok(());
} }
@ -2046,7 +2049,9 @@ impl HumanEmitter {
assert!(underline_start >= 0 && underline_end >= 0); assert!(underline_start >= 0 && underline_end >= 0);
let padding: usize = max_line_num_len + 3; let padding: usize = max_line_num_len + 3;
for p in underline_start..underline_end { for p in underline_start..underline_end {
if let DisplaySuggestion::Underline = show_code_change { if let DisplaySuggestion::Underline = show_code_change
&& is_different(sm, &part.snippet, part.span)
{
// If this is a replacement, underline with `~`, if this is an addition // If this is a replacement, underline with `~`, if this is an addition
// underline with `+`. // underline with `+`.
buffer.putc( buffer.putc(
@ -2824,6 +2829,18 @@ impl Style {
} }
} }
/// Whether the original and suggested code are the same.
pub fn is_different(sm: &SourceMap, suggested: &str, sp: Span) -> bool {
let found = match sm.span_to_snippet(sp) {
Ok(snippet) => snippet,
Err(e) => {
warn!(error = ?e, "Invalid span {:?}", sp);
return true;
}
};
found != suggested
}
/// Whether the original and suggested code are visually similar enough to warrant extra wording. /// Whether the original and suggested code are visually similar enough to warrant extra wording.
pub fn is_case_difference(sm: &SourceMap, suggested: &str, sp: Span) -> bool { pub fn is_case_difference(sm: &SourceMap, suggested: &str, sp: Span) -> bool {
// FIXME: this should probably be extended to also account for `FO0` → `FOO` and unicode. // FIXME: this should probably be extended to also account for `FO0` → `FOO` and unicode.

View File

@ -50,7 +50,7 @@ pub use diagnostic_impls::{
IndicateAnonymousLifetime, SingleLabelManySpans, IndicateAnonymousLifetime, SingleLabelManySpans,
}; };
pub use emitter::ColorConfig; pub use emitter::ColorConfig;
use emitter::{is_case_difference, DynEmitter, Emitter}; use emitter::{is_case_difference, is_different, DynEmitter, Emitter};
use registry::Registry; use registry::Registry;
use rustc_data_structures::fx::{FxHashSet, FxIndexMap, FxIndexSet}; use rustc_data_structures::fx::{FxHashSet, FxIndexMap, FxIndexSet};
use rustc_data_structures::stable_hasher::{Hash128, StableHasher}; use rustc_data_structures::stable_hasher::{Hash128, StableHasher};
@ -357,10 +357,16 @@ impl CodeSuggestion {
_ => 1, _ => 1,
}) })
.sum(); .sum();
line_highlight.push(SubstitutionHighlight { if !is_different(sm, &part.snippet, part.span) {
start: (cur_lo.col.0 as isize + acc) as usize, // Account for cases where we are suggesting the same code that's already
end: (cur_lo.col.0 as isize + acc + len) as usize, // there. This shouldn't happen often, but in some cases for multipart
}); // suggestions it's much easier to handle it here than in the origin.
} else {
line_highlight.push(SubstitutionHighlight {
start: (cur_lo.col.0 as isize + acc) as usize,
end: (cur_lo.col.0 as isize + acc + len) as usize,
});
}
buf.push_str(&part.snippet); buf.push_str(&part.snippet);
let cur_hi = sm.lookup_char_pos(part.span.hi()); let cur_hi = sm.lookup_char_pos(part.span.hi());
// Account for the difference between the width of the current code and the // Account for the difference between the width of the current code and the
@ -392,7 +398,11 @@ impl CodeSuggestion {
while buf.ends_with('\n') { while buf.ends_with('\n') {
buf.pop(); buf.pop();
} }
Some((buf, substitution.parts, highlights, only_capitalization)) if highlights.iter().all(|parts| parts.is_empty()) {
None
} else {
Some((buf, substitution.parts, highlights, only_capitalization))
}
}) })
.collect() .collect()
} }

View File

@ -383,15 +383,17 @@ pub struct Body<'tcx> {
/// Constants that are required to evaluate successfully for this MIR to be well-formed. /// Constants that are required to evaluate successfully for this MIR to be well-formed.
/// We hold in this field all the constants we are not able to evaluate yet. /// We hold in this field all the constants we are not able to evaluate yet.
/// `None` indicates that the list has not been computed yet.
/// ///
/// This is soundness-critical, we make a guarantee that all consts syntactically mentioned in a /// This is soundness-critical, we make a guarantee that all consts syntactically mentioned in a
/// function have successfully evaluated if the function ever gets executed at runtime. /// function have successfully evaluated if the function ever gets executed at runtime.
pub required_consts: Vec<ConstOperand<'tcx>>, pub required_consts: Option<Vec<ConstOperand<'tcx>>>,
/// Further items that were mentioned in this function and hence *may* become monomorphized, /// Further items that were mentioned in this function and hence *may* become monomorphized,
/// depending on optimizations. We use this to avoid optimization-dependent compile errors: the /// depending on optimizations. We use this to avoid optimization-dependent compile errors: the
/// collector recursively traverses all "mentioned" items and evaluates all their /// collector recursively traverses all "mentioned" items and evaluates all their
/// `required_consts`. /// `required_consts`.
/// `None` indicates that the list has not been computed yet.
/// ///
/// This is *not* soundness-critical and the contents of this list are *not* a stable guarantee. /// This is *not* soundness-critical and the contents of this list are *not* a stable guarantee.
/// All that's relevant is that this set is optimization-level-independent, and that it includes /// All that's relevant is that this set is optimization-level-independent, and that it includes
@ -399,7 +401,7 @@ pub struct Body<'tcx> {
/// set after drop elaboration, so some drop calls that can never be reached are not considered /// set after drop elaboration, so some drop calls that can never be reached are not considered
/// "mentioned".) See the documentation of `CollectionMode` in /// "mentioned".) See the documentation of `CollectionMode` in
/// `compiler/rustc_monomorphize/src/collector.rs` for more context. /// `compiler/rustc_monomorphize/src/collector.rs` for more context.
pub mentioned_items: Vec<Spanned<MentionedItem<'tcx>>>, pub mentioned_items: Option<Vec<Spanned<MentionedItem<'tcx>>>>,
/// Does this body use generic parameters. This is used for the `ConstEvaluatable` check. /// Does this body use generic parameters. This is used for the `ConstEvaluatable` check.
/// ///
@ -477,8 +479,8 @@ impl<'tcx> Body<'tcx> {
spread_arg: None, spread_arg: None,
var_debug_info, var_debug_info,
span, span,
required_consts: Vec::new(), required_consts: None,
mentioned_items: Vec::new(), mentioned_items: None,
is_polymorphic: false, is_polymorphic: false,
injection_phase: None, injection_phase: None,
tainted_by_errors, tainted_by_errors,
@ -507,8 +509,8 @@ impl<'tcx> Body<'tcx> {
arg_count: 0, arg_count: 0,
spread_arg: None, spread_arg: None,
span: DUMMY_SP, span: DUMMY_SP,
required_consts: Vec::new(), required_consts: None,
mentioned_items: Vec::new(), mentioned_items: None,
var_debug_info: Vec::new(), var_debug_info: Vec::new(),
is_polymorphic: false, is_polymorphic: false,
injection_phase: None, injection_phase: None,
@ -785,6 +787,40 @@ impl<'tcx> Body<'tcx> {
// No inlined `SourceScope`s, or all of them were `#[track_caller]`. // No inlined `SourceScope`s, or all of them were `#[track_caller]`.
caller_location.unwrap_or_else(|| from_span(source_info.span)) caller_location.unwrap_or_else(|| from_span(source_info.span))
} }
#[track_caller]
pub fn set_required_consts(&mut self, required_consts: Vec<ConstOperand<'tcx>>) {
assert!(
self.required_consts.is_none(),
"required_consts for {:?} have already been set",
self.source.def_id()
);
self.required_consts = Some(required_consts);
}
#[track_caller]
pub fn required_consts(&self) -> &[ConstOperand<'tcx>] {
match &self.required_consts {
Some(l) => l,
None => panic!("required_consts for {:?} have not yet been set", self.source.def_id()),
}
}
#[track_caller]
pub fn set_mentioned_items(&mut self, mentioned_items: Vec<Spanned<MentionedItem<'tcx>>>) {
assert!(
self.mentioned_items.is_none(),
"mentioned_items for {:?} have already been set",
self.source.def_id()
);
self.mentioned_items = Some(mentioned_items);
}
#[track_caller]
pub fn mentioned_items(&self) -> &[Spanned<MentionedItem<'tcx>>] {
match &self.mentioned_items {
Some(l) => l,
None => panic!("mentioned_items for {:?} have not yet been set", self.source.def_id()),
}
}
} }
impl<'tcx> Index<BasicBlock> for Body<'tcx> { impl<'tcx> Index<BasicBlock> for Body<'tcx> {

View File

@ -1066,9 +1066,11 @@ macro_rules! super_body {
$self.visit_span($(& $mutability)? $body.span); $self.visit_span($(& $mutability)? $body.span);
for const_ in &$($mutability)? $body.required_consts { if let Some(required_consts) = &$($mutability)? $body.required_consts {
let location = Location::START; for const_ in required_consts {
$self.visit_const_operand(const_, location); let location = Location::START;
$self.visit_const_operand(const_, location);
}
} }
} }
} }

View File

@ -54,8 +54,8 @@ pub(super) fn build_custom_mir<'tcx>(
spread_arg: None, spread_arg: None,
var_debug_info: Vec::new(), var_debug_info: Vec::new(),
span, span,
required_consts: Vec::new(), required_consts: None,
mentioned_items: Vec::new(), mentioned_items: None,
is_polymorphic: false, is_polymorphic: false,
tainted_by_errors: None, tainted_by_errors: None,
injection_phase: None, injection_phase: None,

View File

@ -744,8 +744,8 @@ impl<'tcx> Inliner<'tcx> {
// Copy required constants from the callee_body into the caller_body. Although we are only // Copy required constants from the callee_body into the caller_body. Although we are only
// pushing unevaluated consts to `required_consts`, here they may have been evaluated // pushing unevaluated consts to `required_consts`, here they may have been evaluated
// because we are calling `instantiate_and_normalize_erasing_regions` -- so we filter again. // because we are calling `instantiate_and_normalize_erasing_regions` -- so we filter again.
caller_body.required_consts.extend( caller_body.required_consts.as_mut().unwrap().extend(
callee_body.required_consts.into_iter().filter(|ct| ct.const_.is_required_const()), callee_body.required_consts().into_iter().filter(|ct| ct.const_.is_required_const()),
); );
// Now that we incorporated the callee's `required_consts`, we can remove the callee from // Now that we incorporated the callee's `required_consts`, we can remove the callee from
// `mentioned_items` -- but we have to take their `mentioned_items` in return. This does // `mentioned_items` -- but we have to take their `mentioned_items` in return. This does
@ -755,12 +755,11 @@ impl<'tcx> Inliner<'tcx> {
// We need to reconstruct the `required_item` for the callee so that we can find and // We need to reconstruct the `required_item` for the callee so that we can find and
// remove it. // remove it.
let callee_item = MentionedItem::Fn(func.ty(caller_body, self.tcx)); let callee_item = MentionedItem::Fn(func.ty(caller_body, self.tcx));
if let Some(idx) = let caller_mentioned_items = caller_body.mentioned_items.as_mut().unwrap();
caller_body.mentioned_items.iter().position(|item| item.node == callee_item) if let Some(idx) = caller_mentioned_items.iter().position(|item| item.node == callee_item) {
{
// We found the callee, so remove it and add its items instead. // We found the callee, so remove it and add its items instead.
caller_body.mentioned_items.remove(idx); caller_mentioned_items.remove(idx);
caller_body.mentioned_items.extend(callee_body.mentioned_items); caller_mentioned_items.extend(callee_body.mentioned_items());
} else { } else {
// If we can't find the callee, there's no point in adding its items. Probably it // If we can't find the callee, there's no point in adding its items. Probably it
// already got removed by being inlined elsewhere in the same function, so we already // already got removed by being inlined elsewhere in the same function, so we already

View File

@ -28,11 +28,10 @@ use rustc_hir::def::DefKind;
use rustc_hir::def_id::LocalDefId; use rustc_hir::def_id::LocalDefId;
use rustc_hir::intravisit::{self, Visitor}; use rustc_hir::intravisit::{self, Visitor};
use rustc_index::IndexVec; use rustc_index::IndexVec;
use rustc_middle::mir::visit::Visitor as _;
use rustc_middle::mir::{ use rustc_middle::mir::{
traversal, AnalysisPhase, Body, CallSource, ClearCrossCrate, ConstOperand, ConstQualifs, AnalysisPhase, Body, CallSource, ClearCrossCrate, ConstOperand, ConstQualifs, LocalDecl,
LocalDecl, MirPass, MirPhase, Operand, Place, ProjectionElem, Promoted, RuntimePhase, Rvalue, MirPass, MirPhase, Operand, Place, ProjectionElem, Promoted, RuntimePhase, Rvalue, SourceInfo,
SourceInfo, Statement, StatementKind, TerminatorKind, START_BLOCK, Statement, StatementKind, TerminatorKind, START_BLOCK,
}; };
use rustc_middle::ty::{self, TyCtxt, TypeVisitableExt}; use rustc_middle::ty::{self, TyCtxt, TypeVisitableExt};
use rustc_middle::util::Providers; use rustc_middle::util::Providers;
@ -339,12 +338,15 @@ fn mir_promoted(
// Collect `required_consts` *before* promotion, so if there are any consts being promoted // Collect `required_consts` *before* promotion, so if there are any consts being promoted
// we still add them to the list in the outer MIR body. // we still add them to the list in the outer MIR body.
let mut required_consts = Vec::new(); RequiredConstsVisitor::compute_required_consts(&mut body);
let mut required_consts_visitor = RequiredConstsVisitor::new(&mut required_consts); // If this has an associated by-move async closure body, that doesn't get run through these
for (bb, bb_data) in traversal::reverse_postorder(&body) { // passes itself, it gets "tagged along" by the pass manager. `RequiredConstsVisitor` is not
required_consts_visitor.visit_basic_block_data(bb, bb_data); // a regular pass so we have to also apply it manually to the other body.
if let Some(coroutine) = body.coroutine.as_mut() {
if let Some(by_move_body) = coroutine.by_move_body.as_mut() {
RequiredConstsVisitor::compute_required_consts(by_move_body);
}
} }
body.required_consts = required_consts;
// What we need to run borrowck etc. // What we need to run borrowck etc.
let promote_pass = promote_consts::PromoteTemps::default(); let promote_pass = promote_consts::PromoteTemps::default();
@ -561,9 +563,6 @@ fn run_optimization_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
tcx, tcx,
body, body,
&[ &[
// Before doing anything, remember which items are being mentioned so that the set of items
// visited does not depend on the optimization level.
&mentioned_items::MentionedItems,
// Add some UB checks before any UB gets optimized away. // Add some UB checks before any UB gets optimized away.
&check_alignment::CheckAlignment, &check_alignment::CheckAlignment,
// Before inlining: trim down MIR with passes to reduce inlining work. // Before inlining: trim down MIR with passes to reduce inlining work.
@ -657,6 +656,19 @@ fn inner_optimized_mir(tcx: TyCtxt<'_>, did: LocalDefId) -> Body<'_> {
return body; return body;
} }
// Before doing anything, remember which items are being mentioned so that the set of items
// visited does not depend on the optimization level.
// We do not use `run_passes` for this as that might skip the pass if `injection_phase` is set.
mentioned_items::MentionedItems.run_pass(tcx, &mut body);
// If this has an associated by-move async closure body, that doesn't get run through these
// passes itself, it gets "tagged along" by the pass manager. Since we're not using the pass
// manager we have to do this by hand.
if let Some(coroutine) = body.coroutine.as_mut() {
if let Some(by_move_body) = coroutine.by_move_body.as_mut() {
mentioned_items::MentionedItems.run_pass(tcx, by_move_body);
}
}
// If `mir_drops_elaborated_and_const_checked` found that the current body has unsatisfiable // If `mir_drops_elaborated_and_const_checked` found that the current body has unsatisfiable
// predicates, it will shrink the MIR to a single `unreachable` terminator. // predicates, it will shrink the MIR to a single `unreachable` terminator.
// More generally, if MIR is a lone `unreachable`, there is nothing to optimize. // More generally, if MIR is a lone `unreachable`, there is nothing to optimize.

View File

@ -23,10 +23,9 @@ impl<'tcx> MirPass<'tcx> for MentionedItems {
} }
fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut mir::Body<'tcx>) { fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut mir::Body<'tcx>) {
debug_assert!(body.mentioned_items.is_empty());
let mut mentioned_items = Vec::new(); let mut mentioned_items = Vec::new();
MentionedItemsVisitor { tcx, body, mentioned_items: &mut mentioned_items }.visit_body(body); MentionedItemsVisitor { tcx, body, mentioned_items: &mut mentioned_items }.visit_body(body);
body.mentioned_items = mentioned_items; body.set_mentioned_items(mentioned_items);
} }
} }

View File

@ -702,6 +702,9 @@ struct Promoter<'a, 'tcx> {
temps: &'a mut IndexVec<Local, TempState>, temps: &'a mut IndexVec<Local, TempState>,
extra_statements: &'a mut Vec<(Location, Statement<'tcx>)>, extra_statements: &'a mut Vec<(Location, Statement<'tcx>)>,
/// Used to assemble the required_consts list while building the promoted.
required_consts: Vec<ConstOperand<'tcx>>,
/// If true, all nested temps are also kept in the /// If true, all nested temps are also kept in the
/// source MIR, not moved to the promoted MIR. /// source MIR, not moved to the promoted MIR.
keep_original: bool, keep_original: bool,
@ -924,11 +927,14 @@ impl<'a, 'tcx> Promoter<'a, 'tcx> {
let span = self.promoted.span; let span = self.promoted.span;
self.assign(RETURN_PLACE, rvalue, span); self.assign(RETURN_PLACE, rvalue, span);
// Now that we did promotion, we know whether we'll want to add this to `required_consts`. // Now that we did promotion, we know whether we'll want to add this to `required_consts` of
// the surrounding MIR body.
if self.add_to_required { if self.add_to_required {
self.source.required_consts.push(promoted_op); self.source.required_consts.as_mut().unwrap().push(promoted_op);
} }
self.promoted.set_required_consts(self.required_consts);
self.promoted self.promoted
} }
} }
@ -947,7 +953,7 @@ impl<'a, 'tcx> MutVisitor<'tcx> for Promoter<'a, 'tcx> {
fn visit_const_operand(&mut self, constant: &mut ConstOperand<'tcx>, _location: Location) { fn visit_const_operand(&mut self, constant: &mut ConstOperand<'tcx>, _location: Location) {
if constant.const_.is_required_const() { if constant.const_.is_required_const() {
self.promoted.required_consts.push(*constant); self.required_consts.push(*constant);
} }
// Skipping `super_constant` as the visitor is otherwise only looking for locals. // Skipping `super_constant` as the visitor is otherwise only looking for locals.
@ -1011,9 +1017,9 @@ fn promote_candidates<'tcx>(
extra_statements: &mut extra_statements, extra_statements: &mut extra_statements,
keep_original: false, keep_original: false,
add_to_required: false, add_to_required: false,
required_consts: Vec::new(),
}; };
// `required_consts` of the promoted itself gets filled while building the MIR body.
let mut promoted = promoter.promote_candidate(candidate, promotions.len()); let mut promoted = promoter.promote_candidate(candidate, promotions.len());
promoted.source.promoted = Some(promotions.next_index()); promoted.source.promoted = Some(promotions.next_index());
promotions.push(promoted); promotions.push(promoted);

View File

@ -1,14 +1,23 @@
use rustc_middle::mir::visit::Visitor; use rustc_middle::mir::visit::Visitor;
use rustc_middle::mir::{ConstOperand, Location}; use rustc_middle::mir::{traversal, Body, ConstOperand, Location};
pub struct RequiredConstsVisitor<'a, 'tcx> { pub struct RequiredConstsVisitor<'a, 'tcx> {
required_consts: &'a mut Vec<ConstOperand<'tcx>>, required_consts: &'a mut Vec<ConstOperand<'tcx>>,
} }
impl<'a, 'tcx> RequiredConstsVisitor<'a, 'tcx> { impl<'a, 'tcx> RequiredConstsVisitor<'a, 'tcx> {
pub fn new(required_consts: &'a mut Vec<ConstOperand<'tcx>>) -> Self { fn new(required_consts: &'a mut Vec<ConstOperand<'tcx>>) -> Self {
RequiredConstsVisitor { required_consts } RequiredConstsVisitor { required_consts }
} }
pub fn compute_required_consts(body: &mut Body<'tcx>) {
let mut required_consts = Vec::new();
let mut required_consts_visitor = RequiredConstsVisitor::new(&mut required_consts);
for (bb, bb_data) in traversal::reverse_postorder(&body) {
required_consts_visitor.visit_basic_block_data(bb, bb_data);
}
body.set_required_consts(required_consts);
}
} }
impl<'tcx> Visitor<'tcx> for RequiredConstsVisitor<'_, 'tcx> { impl<'tcx> Visitor<'tcx> for RequiredConstsVisitor<'_, 'tcx> {

View File

@ -305,7 +305,7 @@ fn new_body<'tcx>(
arg_count: usize, arg_count: usize,
span: Span, span: Span,
) -> Body<'tcx> { ) -> Body<'tcx> {
Body::new( let mut body = Body::new(
source, source,
basic_blocks, basic_blocks,
IndexVec::from_elem_n( IndexVec::from_elem_n(
@ -326,7 +326,10 @@ fn new_body<'tcx>(
None, None,
// FIXME(compiler-errors): is this correct? // FIXME(compiler-errors): is this correct?
None, None,
) );
// Shims do not directly mention any consts.
body.set_required_consts(Vec::new());
body
} }
pub struct DropShimElaborator<'a, 'tcx> { pub struct DropShimElaborator<'a, 'tcx> {
@ -969,13 +972,16 @@ pub fn build_adt_ctor(tcx: TyCtxt<'_>, ctor_id: DefId) -> Body<'_> {
}; };
let source = MirSource::item(ctor_id); let source = MirSource::item(ctor_id);
let body = new_body( let mut body = new_body(
source, source,
IndexVec::from_elem_n(start_block, 1), IndexVec::from_elem_n(start_block, 1),
local_decls, local_decls,
sig.inputs().len(), sig.inputs().len(),
span, span,
); );
// A constructor doesn't mention any other items (and we don't run the usual optimization passes
// so this would otherwise not get filled).
body.set_mentioned_items(Vec::new());
crate::pass_manager::dump_mir_for_phase_change(tcx, &body); crate::pass_manager::dump_mir_for_phase_change(tcx, &body);

View File

@ -1229,7 +1229,7 @@ fn collect_items_of_instance<'tcx>(
// Always visit all `required_consts`, so that we evaluate them and abort compilation if any of // Always visit all `required_consts`, so that we evaluate them and abort compilation if any of
// them errors. // them errors.
for const_op in &body.required_consts { for const_op in body.required_consts() {
if let Some(val) = collector.eval_constant(const_op) { if let Some(val) = collector.eval_constant(const_op) {
collect_const_value(tcx, val, mentioned_items); collect_const_value(tcx, val, mentioned_items);
} }
@ -1237,7 +1237,7 @@ fn collect_items_of_instance<'tcx>(
// Always gather mentioned items. We try to avoid processing items that we have already added to // Always gather mentioned items. We try to avoid processing items that we have already added to
// `used_items` above. // `used_items` above.
for item in &body.mentioned_items { for item in body.mentioned_items() {
if !collector.used_mentioned_items.contains(&item.node) { if !collector.used_mentioned_items.contains(&item.node) {
let item_mono = collector.monomorphize(item.node); let item_mono = collector.monomorphize(item.node);
visit_mentioned_item(tcx, &item_mono, item.span, mentioned_items); visit_mentioned_item(tcx, &item_mono, item.span, mentioned_items);

View File

@ -2436,11 +2436,13 @@ extern "rust-intrinsic" {
/// ///
/// # Safety /// # Safety
/// ///
/// It's UB to call this if any of the *bytes* in `*a` or `*b` are uninitialized or carry a /// It's UB to call this if any of the *bytes* in `*a` or `*b` are uninitialized.
/// pointer value.
/// Note that this is a stricter criterion than just the *values* being /// Note that this is a stricter criterion than just the *values* being
/// fully-initialized: if `T` has padding, it's UB to call this intrinsic. /// fully-initialized: if `T` has padding, it's UB to call this intrinsic.
/// ///
/// At compile-time, it is furthermore UB to call this if any of the bytes
/// in `*a` or `*b` have provenance.
///
/// (The implementation is allowed to branch on the results of comparisons, /// (The implementation is allowed to branch on the results of comparisons,
/// which is UB if any of their inputs are `undef`.) /// which is UB if any of their inputs are `undef`.)
#[rustc_const_unstable(feature = "const_intrinsic_raw_eq", issue = "none")] #[rustc_const_unstable(feature = "const_intrinsic_raw_eq", issue = "none")]

View File

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

View File

@ -168,14 +168,7 @@ pub(crate) macro syscall {
if let Some(fun) = $name.get() { if let Some(fun) = $name.get() {
fun($($arg_name),*) fun($($arg_name),*)
} else { } else {
// This looks like a hack, but concat_idents only accepts idents libc::syscall(libc::${concat(SYS_, $name)}, $($arg_name),*) as $ret
// (not paths).
use libc::*;
syscall(
concat_idents!(SYS_, $name),
$($arg_name),*
) as $ret
} }
} }
) )
@ -185,14 +178,7 @@ pub(crate) macro syscall {
pub(crate) macro raw_syscall { pub(crate) macro raw_syscall {
(fn $name:ident($($arg_name:ident: $t:ty),*) -> $ret:ty) => ( (fn $name:ident($($arg_name:ident: $t:ty),*) -> $ret:ty) => (
unsafe fn $name($($arg_name:$t),*) -> $ret { unsafe fn $name($($arg_name:$t),*) -> $ret {
// This looks like a hack, but concat_idents only accepts idents libc::syscall(libc::${concat(SYS_, $name)}, $($arg_name),*) as $ret
// (not paths).
use libc::*;
syscall(
concat_idents!(SYS_, $name),
$($arg_name),*
) as $ret
} }
) )
} }

View File

@ -65,7 +65,7 @@ dependencies = [
"termcolor", "termcolor",
"toml", "toml",
"walkdir", "walkdir",
"windows", "windows 0.52.0",
"xz2", "xz2",
] ]
@ -378,12 +378,6 @@ dependencies = [
"memchr", "memchr",
] ]
[[package]]
name = "once_cell"
version = "1.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
[[package]] [[package]]
name = "opener" name = "opener"
version = "0.5.2" version = "0.5.2"
@ -549,16 +543,15 @@ dependencies = [
[[package]] [[package]]
name = "sysinfo" name = "sysinfo"
version = "0.30.5" version = "0.31.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fb4f3438c8f6389c864e61221cbc97e9bca98b4daf39a5beb7bea660f528bb2" checksum = "d4115055da5f572fff541dd0c4e61b0262977f453cc9fe04be83aba25a89bdab"
dependencies = [ dependencies = [
"cfg-if",
"core-foundation-sys", "core-foundation-sys",
"libc", "libc",
"memchr",
"ntapi", "ntapi",
"once_cell", "windows 0.57.0",
"windows",
] ]
[[package]] [[package]]
@ -655,7 +648,17 @@ version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be" checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be"
dependencies = [ dependencies = [
"windows-core", "windows-core 0.52.0",
"windows-targets",
]
[[package]]
name = "windows"
version = "0.57.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "12342cb4d8e3b046f3d80effd474a7a02447231330ef77d71daa6fbc40681143"
dependencies = [
"windows-core 0.57.0",
"windows-targets", "windows-targets",
] ]
@ -668,6 +671,49 @@ dependencies = [
"windows-targets", "windows-targets",
] ]
[[package]]
name = "windows-core"
version = "0.57.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2ed2439a290666cd67ecce2b0ffaad89c2a56b976b736e6ece670297897832d"
dependencies = [
"windows-implement",
"windows-interface",
"windows-result",
"windows-targets",
]
[[package]]
name = "windows-implement"
version = "0.57.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9107ddc059d5b6fbfbffdfa7a7fe3e22a226def0b2608f72e9d552763d3e1ad7"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "windows-interface"
version = "0.57.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "29bee4b38ea3cde66011baa44dba677c432a78593e202392d1e9070cf2a7fca7"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "windows-result"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5e383302e8ec8515204254685643de10811af0ed97ea37210dc26fb0032647f8"
dependencies = [
"windows-targets",
]
[[package]] [[package]]
name = "windows-sys" name = "windows-sys"
version = "0.52.0" version = "0.52.0"
@ -679,13 +725,14 @@ dependencies = [
[[package]] [[package]]
name = "windows-targets" name = "windows-targets"
version = "0.52.0" version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
dependencies = [ dependencies = [
"windows_aarch64_gnullvm", "windows_aarch64_gnullvm",
"windows_aarch64_msvc", "windows_aarch64_msvc",
"windows_i686_gnu", "windows_i686_gnu",
"windows_i686_gnullvm",
"windows_i686_msvc", "windows_i686_msvc",
"windows_x86_64_gnu", "windows_x86_64_gnu",
"windows_x86_64_gnullvm", "windows_x86_64_gnullvm",
@ -694,45 +741,51 @@ dependencies = [
[[package]] [[package]]
name = "windows_aarch64_gnullvm" name = "windows_aarch64_gnullvm"
version = "0.52.0" version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
[[package]] [[package]]
name = "windows_aarch64_msvc" name = "windows_aarch64_msvc"
version = "0.52.0" version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
[[package]] [[package]]
name = "windows_i686_gnu" name = "windows_i686_gnu"
version = "0.52.0" version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
[[package]]
name = "windows_i686_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
[[package]] [[package]]
name = "windows_i686_msvc" name = "windows_i686_msvc"
version = "0.52.0" version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
[[package]] [[package]]
name = "windows_x86_64_gnu" name = "windows_x86_64_gnu"
version = "0.52.0" version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
[[package]] [[package]]
name = "windows_x86_64_gnullvm" name = "windows_x86_64_gnullvm"
version = "0.52.0" version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
[[package]] [[package]]
name = "windows_x86_64_msvc" name = "windows_x86_64_msvc"
version = "0.52.0" version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
[[package]] [[package]]
name = "xattr" name = "xattr"

View File

@ -63,7 +63,7 @@ walkdir = "2.4"
xz2 = "0.1" xz2 = "0.1"
# Dependencies needed by the build-metrics feature # Dependencies needed by the build-metrics feature
sysinfo = { version = "0.30", default-features = false, optional = true } sysinfo = { version = "0.31.2", default-features = false, optional = true, features = ["system"] }
[target.'cfg(windows)'.dependencies.junction] [target.'cfg(windows)'.dependencies.junction]
version = "1.0.0" version = "1.0.0"

View File

@ -13,7 +13,7 @@ use build_helper::metrics::{
JsonInvocation, JsonInvocationSystemStats, JsonNode, JsonRoot, JsonStepSystemStats, Test, JsonInvocation, JsonInvocationSystemStats, JsonNode, JsonRoot, JsonStepSystemStats, Test,
TestOutcome, TestSuite, TestSuiteMetadata, TestOutcome, TestSuite, TestSuiteMetadata,
}; };
use sysinfo::System; use sysinfo::{CpuRefreshKind, RefreshKind, System};
use crate::core::builder::{Builder, Step}; use crate::core::builder::{Builder, Step};
use crate::utils::helpers::t; use crate::utils::helpers::t;
@ -55,7 +55,9 @@ impl BuildMetrics {
finished_steps: Vec::new(), finished_steps: Vec::new(),
running_steps: Vec::new(), running_steps: Vec::new(),
system_info: System::new(), system_info: System::new_with_specifics(
RefreshKind::new().with_cpu(CpuRefreshKind::everything()),
),
timer_start: None, timer_start: None,
invocation_timer_start: Instant::now(), invocation_timer_start: Instant::now(),
invocation_start: SystemTime::now(), invocation_start: SystemTime::now(),
@ -77,7 +79,7 @@ impl BuildMetrics {
self.collect_stats(&mut *state); self.collect_stats(&mut *state);
} }
state.system_info.refresh_cpu(); state.system_info.refresh_cpu_usage();
state.timer_start = Some(Instant::now()); state.timer_start = Some(Instant::now());
state.running_steps.push(StepMetrics { state.running_steps.push(StepMetrics {
@ -110,7 +112,7 @@ impl BuildMetrics {
state.running_steps.last_mut().unwrap().children.push(step); state.running_steps.last_mut().unwrap().children.push(step);
// Start collecting again for the parent step. // Start collecting again for the parent step.
state.system_info.refresh_cpu(); state.system_info.refresh_cpu_usage();
state.timer_start = Some(Instant::now()); state.timer_start = Some(Instant::now());
} }
} }
@ -148,7 +150,7 @@ impl BuildMetrics {
let elapsed = state.timer_start.unwrap().elapsed(); let elapsed = state.timer_start.unwrap().elapsed();
step.duration_excluding_children_sec += elapsed; step.duration_excluding_children_sec += elapsed;
state.system_info.refresh_cpu(); state.system_info.refresh_cpu_usage();
let cpu = state.system_info.cpus().iter().map(|p| p.cpu_usage()).sum::<f32>(); let cpu = state.system_info.cpus().iter().map(|p| p.cpu_usage()).sum::<f32>();
step.cpu_usage_time_sec += cpu as f64 / 100.0 * elapsed.as_secs_f64(); step.cpu_usage_time_sec += cpu as f64 / 100.0 * elapsed.as_secs_f64();
} }
@ -159,8 +161,9 @@ impl BuildMetrics {
let dest = build.out.join("metrics.json"); let dest = build.out.join("metrics.json");
let mut system = System::new(); let mut system =
system.refresh_cpu(); System::new_with_specifics(RefreshKind::new().with_cpu(CpuRefreshKind::everything()));
system.refresh_cpu_usage();
system.refresh_memory(); system.refresh_memory();
let system_stats = JsonInvocationSystemStats { let system_stats = JsonInvocationSystemStats {

View File

@ -332,7 +332,6 @@ struct AllTypes {
macros: FxHashSet<ItemEntry>, macros: FxHashSet<ItemEntry>,
functions: FxHashSet<ItemEntry>, functions: FxHashSet<ItemEntry>,
type_aliases: FxHashSet<ItemEntry>, type_aliases: FxHashSet<ItemEntry>,
opaque_tys: FxHashSet<ItemEntry>,
statics: FxHashSet<ItemEntry>, statics: FxHashSet<ItemEntry>,
constants: FxHashSet<ItemEntry>, constants: FxHashSet<ItemEntry>,
attribute_macros: FxHashSet<ItemEntry>, attribute_macros: FxHashSet<ItemEntry>,
@ -352,7 +351,6 @@ impl AllTypes {
macros: new_set(100), macros: new_set(100),
functions: new_set(100), functions: new_set(100),
type_aliases: new_set(100), type_aliases: new_set(100),
opaque_tys: new_set(100),
statics: new_set(100), statics: new_set(100),
constants: new_set(100), constants: new_set(100),
attribute_macros: new_set(100), attribute_macros: new_set(100),
@ -415,9 +413,6 @@ impl AllTypes {
if !self.type_aliases.is_empty() { if !self.type_aliases.is_empty() {
sections.insert(ItemSection::TypeAliases); sections.insert(ItemSection::TypeAliases);
} }
if !self.opaque_tys.is_empty() {
sections.insert(ItemSection::OpaqueTypes);
}
if !self.statics.is_empty() { if !self.statics.is_empty() {
sections.insert(ItemSection::Statics); sections.insert(ItemSection::Statics);
} }
@ -471,7 +466,6 @@ impl AllTypes {
print_entries(f, &self.functions, ItemSection::Functions); print_entries(f, &self.functions, ItemSection::Functions);
print_entries(f, &self.type_aliases, ItemSection::TypeAliases); print_entries(f, &self.type_aliases, ItemSection::TypeAliases);
print_entries(f, &self.trait_aliases, ItemSection::TraitAliases); print_entries(f, &self.trait_aliases, ItemSection::TraitAliases);
print_entries(f, &self.opaque_tys, ItemSection::OpaqueTypes);
print_entries(f, &self.statics, ItemSection::Statics); print_entries(f, &self.statics, ItemSection::Statics);
print_entries(f, &self.constants, ItemSection::Constants); print_entries(f, &self.constants, ItemSection::Constants);
} }
@ -2174,7 +2168,6 @@ pub(crate) enum ItemSection {
AssociatedConstants, AssociatedConstants,
ForeignTypes, ForeignTypes,
Keywords, Keywords,
OpaqueTypes,
AttributeMacros, AttributeMacros,
DeriveMacros, DeriveMacros,
TraitAliases, TraitAliases,
@ -2207,7 +2200,6 @@ impl ItemSection {
AssociatedConstants, AssociatedConstants,
ForeignTypes, ForeignTypes,
Keywords, Keywords,
OpaqueTypes,
AttributeMacros, AttributeMacros,
DeriveMacros, DeriveMacros,
TraitAliases, TraitAliases,
@ -2237,7 +2229,6 @@ impl ItemSection {
Self::AssociatedConstants => "associated-consts", Self::AssociatedConstants => "associated-consts",
Self::ForeignTypes => "foreign-types", Self::ForeignTypes => "foreign-types",
Self::Keywords => "keywords", Self::Keywords => "keywords",
Self::OpaqueTypes => "opaque-types",
Self::AttributeMacros => "attributes", Self::AttributeMacros => "attributes",
Self::DeriveMacros => "derives", Self::DeriveMacros => "derives",
Self::TraitAliases => "trait-aliases", Self::TraitAliases => "trait-aliases",
@ -2267,7 +2258,6 @@ impl ItemSection {
Self::AssociatedConstants => "Associated Constants", Self::AssociatedConstants => "Associated Constants",
Self::ForeignTypes => "Foreign Types", Self::ForeignTypes => "Foreign Types",
Self::Keywords => "Keywords", Self::Keywords => "Keywords",
Self::OpaqueTypes => "Opaque Types",
Self::AttributeMacros => "Attribute Macros", Self::AttributeMacros => "Attribute Macros",
Self::DeriveMacros => "Derive Macros", Self::DeriveMacros => "Derive Macros",
Self::TraitAliases => "Trait Aliases", Self::TraitAliases => "Trait Aliases",

View File

@ -568,7 +568,6 @@ function preLoadCss(cssUrl) {
//block("associatedconstant", "associated-consts", "Associated Constants"); //block("associatedconstant", "associated-consts", "Associated Constants");
block("foreigntype", "foreign-types", "Foreign Types"); block("foreigntype", "foreign-types", "Foreign Types");
block("keyword", "keywords", "Keywords"); block("keyword", "keywords", "Keywords");
block("opaque", "opaque-types", "Opaque Types");
block("attr", "attributes", "Attribute Macros"); block("attr", "attributes", "Attribute Macros");
block("derive", "derives", "Derive Macros"); block("derive", "derives", "Derive Macros");
block("traitalias", "trait-aliases", "Trait Aliases"); block("traitalias", "trait-aliases", "Trait Aliases");

View File

@ -145,7 +145,9 @@ impl<'tcx> LateLintPass<'tcx> for UnnecessaryWraps {
( (
"this function's return value is unnecessary".to_string(), "this function's return value is unnecessary".to_string(),
"remove the return type...".to_string(), "remove the return type...".to_string(),
snippet(cx, fn_decl.output.span(), "..").to_string(), // FIXME: we should instead get the span including the `->` and suggest an
// empty string for this case.
"()".to_string(),
"...and then remove returned values", "...and then remove returned values",
) )
} else { } else {

View File

@ -63,7 +63,7 @@ LL | let _val = None::<()>.expect("this always happens");
help: remove the `None` and `expect()` help: remove the `None` and `expect()`
| |
LL | let _val = panic!("this always happens"); LL | let _val = panic!("this always happens");
| ~~~~~~~ ~ | ~~~~~~~
error: used `unwrap_or_default()` on `None` value error: used `unwrap_or_default()` on `None` value
--> tests/ui/unnecessary_literal_unwrap.rs:22:24 --> tests/ui/unnecessary_literal_unwrap.rs:22:24
@ -134,7 +134,7 @@ LL | None::<()>.expect("this always happens");
help: remove the `None` and `expect()` help: remove the `None` and `expect()`
| |
LL | panic!("this always happens"); LL | panic!("this always happens");
| ~~~~~~~ ~ | ~~~~~~~
error: used `unwrap_or_default()` on `None` value error: used `unwrap_or_default()` on `None` value
--> tests/ui/unnecessary_literal_unwrap.rs:30:5 --> tests/ui/unnecessary_literal_unwrap.rs:30:5

View File

@ -118,8 +118,8 @@ LL | | }
| |
help: remove the return type... help: remove the return type...
| |
LL | fn issue_6640_1(a: bool, b: bool) -> Option<()> { LL | fn issue_6640_1(a: bool, b: bool) -> () {
| ~~~~~~~~~~ | ~~
help: ...and then remove returned values help: ...and then remove returned values
| |
LL ~ return ; LL ~ return ;
@ -145,8 +145,8 @@ LL | | }
| |
help: remove the return type... help: remove the return type...
| |
LL | fn issue_6640_2(a: bool, b: bool) -> Result<(), i32> { LL | fn issue_6640_2(a: bool, b: bool) -> () {
| ~~~~~~~~~~~~~~~ | ~~
help: ...and then remove returned values help: ...and then remove returned values
| |
LL ~ return ; LL ~ return ;

View File

@ -1,10 +0,0 @@
#![feature(intrinsics)]
extern "rust-intrinsic" {
fn raw_eq<T>(a: &T, b: &T) -> bool;
}
fn main() {
let x = &0;
unsafe { raw_eq(&x, &x) }; //~ERROR: `raw_eq` on bytes with provenance
}

View File

@ -1,15 +0,0 @@
error: Undefined Behavior: `raw_eq` on bytes with provenance
--> $DIR/raw_eq_on_ptr.rs:LL:CC
|
LL | unsafe { raw_eq(&x, &x) };
| ^^^^^^^^^^^^^^ `raw_eq` on bytes with provenance
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
= note: BACKTRACE:
= note: inside `main` at $DIR/raw_eq_on_ptr.rs:LL:CC
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
error: aborting due to 1 previous error

View File

@ -10,7 +10,7 @@ log = "0.4"
anyhow = { version = "1", features = ["backtrace"] } anyhow = { version = "1", features = ["backtrace"] }
humantime = "2" humantime = "2"
humansize = "2" humansize = "2"
sysinfo = { version = "0.30", default-features = false } sysinfo = { version = "0.31.2", default-features = false, features = ["disk"] }
fs_extra = "1" fs_extra = "1"
camino = "1" camino = "1"
tar = "0.4" tar = "0.4"

View File

@ -4,10 +4,6 @@ error[E0282]: type annotations needed
LL | Combination::<0>.and::<_>().and::<_>(); LL | Combination::<0>.and::<_>().and::<_>();
| ^^^ cannot infer type of the type parameter `M` declared on the method `and` | ^^^ cannot infer type of the type parameter `M` declared on the method `and`
| |
help: consider specifying the generic argument
|
LL | Combination::<0>.and::<_>().and::<_>();
| ~~~~~
error: aborting due to 1 previous error error: aborting due to 1 previous error

View File

@ -24,10 +24,6 @@ note: ...and refers to the struct `ParseOptions` which is defined here
| |
LL | pub struct ParseOptions {} LL | pub struct ParseOptions {}
| ^^^^^^^^^^^^^^^^^^^^^^^ you could import this directly | ^^^^^^^^^^^^^^^^^^^^^^^ you could import this directly
help: import `ParseOptions` through the re-export
|
LL | pub use parser::ParseOptions;
| ~~~~~~~~~~~~~~~~~~~~
error: aborting due to 1 previous error error: aborting due to 1 previous error

View File

@ -10,7 +10,7 @@ const RAW_EQ_PADDING: bool = unsafe {
const RAW_EQ_PTR: bool = unsafe { const RAW_EQ_PTR: bool = unsafe {
std::intrinsics::raw_eq(&(&0), &(&1)) std::intrinsics::raw_eq(&(&0), &(&1))
//~^ ERROR evaluation of constant value failed //~^ ERROR evaluation of constant value failed
//~| `raw_eq` on bytes with provenance //~| unable to turn pointer into integer
}; };
pub fn main() { pub fn main() {

View File

@ -8,7 +8,10 @@ error[E0080]: evaluation of constant value failed
--> $DIR/intrinsic-raw_eq-const-bad.rs:11:5 --> $DIR/intrinsic-raw_eq-const-bad.rs:11:5
| |
LL | std::intrinsics::raw_eq(&(&0), &(&1)) LL | std::intrinsics::raw_eq(&(&0), &(&1))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `raw_eq` on bytes with provenance | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into integer
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View File

@ -74,7 +74,7 @@ LL | let _ = PartialEq::eq(&a, &b);
help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses
| |
LL | let _ = std::ptr::addr_eq(a, b); LL | let _ = std::ptr::addr_eq(a, b);
| ~~~~~~~~~~~~~~~~~~ ~ ~ | ~~~~~~~~~~~~~~~~~~ ~
warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected
--> $DIR/wide_pointer_comparisons.rs:35:13 --> $DIR/wide_pointer_comparisons.rs:35:13
@ -85,7 +85,7 @@ LL | let _ = PartialEq::ne(&a, &b);
help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses
| |
LL | let _ = !std::ptr::addr_eq(a, b); LL | let _ = !std::ptr::addr_eq(a, b);
| ~~~~~~~~~~~~~~~~~~~ ~ ~ | ~~~~~~~~~~~~~~~~~~~ ~
warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected
--> $DIR/wide_pointer_comparisons.rs:37:13 --> $DIR/wide_pointer_comparisons.rs:37:13
@ -96,7 +96,7 @@ LL | let _ = a.eq(&b);
help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses
| |
LL | let _ = std::ptr::addr_eq(a, b); LL | let _ = std::ptr::addr_eq(a, b);
| ++++++++++++++++++ ~ ~ | ++++++++++++++++++ ~
warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected
--> $DIR/wide_pointer_comparisons.rs:39:13 --> $DIR/wide_pointer_comparisons.rs:39:13
@ -107,7 +107,7 @@ LL | let _ = a.ne(&b);
help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses
| |
LL | let _ = !std::ptr::addr_eq(a, b); LL | let _ = !std::ptr::addr_eq(a, b);
| +++++++++++++++++++ ~ ~ | +++++++++++++++++++ ~
warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected
--> $DIR/wide_pointer_comparisons.rs:41:13 --> $DIR/wide_pointer_comparisons.rs:41:13
@ -283,7 +283,7 @@ LL | let _ = PartialEq::eq(a, b);
help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses
| |
LL | let _ = std::ptr::addr_eq(*a, *b); LL | let _ = std::ptr::addr_eq(*a, *b);
| ~~~~~~~~~~~~~~~~~~~ ~~~ ~ | ~~~~~~~~~~~~~~~~~~~ ~~~
warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected
--> $DIR/wide_pointer_comparisons.rs:85:17 --> $DIR/wide_pointer_comparisons.rs:85:17
@ -294,7 +294,7 @@ LL | let _ = PartialEq::ne(a, b);
help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses
| |
LL | let _ = !std::ptr::addr_eq(*a, *b); LL | let _ = !std::ptr::addr_eq(*a, *b);
| ~~~~~~~~~~~~~~~~~~~~ ~~~ ~ | ~~~~~~~~~~~~~~~~~~~~ ~~~
warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected
--> $DIR/wide_pointer_comparisons.rs:87:17 --> $DIR/wide_pointer_comparisons.rs:87:17
@ -305,7 +305,7 @@ LL | let _ = PartialEq::eq(&a, &b);
help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses
| |
LL | let _ = std::ptr::addr_eq(*a, *b); LL | let _ = std::ptr::addr_eq(*a, *b);
| ~~~~~~~~~~~~~~~~~~~ ~~~ ~ | ~~~~~~~~~~~~~~~~~~~ ~~~
warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected
--> $DIR/wide_pointer_comparisons.rs:89:17 --> $DIR/wide_pointer_comparisons.rs:89:17
@ -316,7 +316,7 @@ LL | let _ = PartialEq::ne(&a, &b);
help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses
| |
LL | let _ = !std::ptr::addr_eq(*a, *b); LL | let _ = !std::ptr::addr_eq(*a, *b);
| ~~~~~~~~~~~~~~~~~~~~ ~~~ ~ | ~~~~~~~~~~~~~~~~~~~~ ~~~
warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected
--> $DIR/wide_pointer_comparisons.rs:91:17 --> $DIR/wide_pointer_comparisons.rs:91:17
@ -327,7 +327,7 @@ LL | let _ = a.eq(b);
help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses
| |
LL | let _ = std::ptr::addr_eq(*a, *b); LL | let _ = std::ptr::addr_eq(*a, *b);
| +++++++++++++++++++ ~~~ ~ | +++++++++++++++++++ ~~~
warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected
--> $DIR/wide_pointer_comparisons.rs:93:17 --> $DIR/wide_pointer_comparisons.rs:93:17
@ -338,7 +338,7 @@ LL | let _ = a.ne(b);
help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses
| |
LL | let _ = !std::ptr::addr_eq(*a, *b); LL | let _ = !std::ptr::addr_eq(*a, *b);
| ++++++++++++++++++++ ~~~ ~ | ++++++++++++++++++++ ~~~
warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected
--> $DIR/wide_pointer_comparisons.rs:95:17 --> $DIR/wide_pointer_comparisons.rs:95:17
@ -519,11 +519,11 @@ LL | let _ = PartialEq::eq(&a, &b);
help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses
| |
LL | let _ = std::ptr::addr_eq(a, b); LL | let _ = std::ptr::addr_eq(a, b);
| ~~~~~~~~~~~~~~~~~~ ~ ~ | ~~~~~~~~~~~~~~~~~~ ~
help: use explicit `std::ptr::eq` method to compare metadata and addresses help: use explicit `std::ptr::eq` method to compare metadata and addresses
| |
LL | let _ = std::ptr::eq(a, b); LL | let _ = std::ptr::eq(a, b);
| ~~~~~~~~~~~~~ ~ ~ | ~~~~~~~~~~~~~ ~
warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected
--> $DIR/wide_pointer_comparisons.rs:133:17 --> $DIR/wide_pointer_comparisons.rs:133:17
@ -534,11 +534,11 @@ LL | let _ = PartialEq::ne(&a, &b);
help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses
| |
LL | let _ = !std::ptr::addr_eq(a, b); LL | let _ = !std::ptr::addr_eq(a, b);
| ~~~~~~~~~~~~~~~~~~~ ~ ~ | ~~~~~~~~~~~~~~~~~~~ ~
help: use explicit `std::ptr::eq` method to compare metadata and addresses help: use explicit `std::ptr::eq` method to compare metadata and addresses
| |
LL | let _ = !std::ptr::eq(a, b); LL | let _ = !std::ptr::eq(a, b);
| ~~~~~~~~~~~~~~ ~ ~ | ~~~~~~~~~~~~~~ ~
warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected
--> $DIR/wide_pointer_comparisons.rs:135:17 --> $DIR/wide_pointer_comparisons.rs:135:17
@ -549,11 +549,11 @@ LL | let _ = a.eq(&b);
help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses
| |
LL | let _ = std::ptr::addr_eq(a, b); LL | let _ = std::ptr::addr_eq(a, b);
| ++++++++++++++++++ ~ ~ | ++++++++++++++++++ ~
help: use explicit `std::ptr::eq` method to compare metadata and addresses help: use explicit `std::ptr::eq` method to compare metadata and addresses
| |
LL | let _ = std::ptr::eq(a, b); LL | let _ = std::ptr::eq(a, b);
| +++++++++++++ ~ ~ | +++++++++++++ ~
warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected
--> $DIR/wide_pointer_comparisons.rs:137:17 --> $DIR/wide_pointer_comparisons.rs:137:17
@ -564,11 +564,11 @@ LL | let _ = a.ne(&b);
help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses
| |
LL | let _ = !std::ptr::addr_eq(a, b); LL | let _ = !std::ptr::addr_eq(a, b);
| +++++++++++++++++++ ~ ~ | +++++++++++++++++++ ~
help: use explicit `std::ptr::eq` method to compare metadata and addresses help: use explicit `std::ptr::eq` method to compare metadata and addresses
| |
LL | let _ = !std::ptr::eq(a, b); LL | let _ = !std::ptr::eq(a, b);
| ++++++++++++++ ~ ~ | ++++++++++++++ ~
warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected
--> $DIR/wide_pointer_comparisons.rs:142:9 --> $DIR/wide_pointer_comparisons.rs:142:9
@ -594,7 +594,7 @@ LL | cmp!(a, b);
help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses
| |
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 warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected
--> $DIR/wide_pointer_comparisons.rs:159:39 --> $DIR/wide_pointer_comparisons.rs:159:39

View File

@ -14,7 +14,7 @@ LL | let Bar(x, y, Foo(z)) = make_bar();
help: consider making the fields publicly accessible help: consider making the fields publicly accessible
| |
LL | pub(crate) struct Bar(pub u8, pub u8, pub Foo); LL | pub(crate) struct Bar(pub u8, pub u8, pub Foo);
| ~~~ ~~~ +++ | ~~~ +++
error[E0532]: cannot match against a tuple struct which contains private fields error[E0532]: cannot match against a tuple struct which contains private fields
--> $DIR/issue-75907.rs:15:19 --> $DIR/issue-75907.rs:15:19

View File

@ -53,7 +53,7 @@ LL | pub struct C(pub isize, isize);
help: consider making the fields publicly accessible help: consider making the fields publicly accessible
| |
LL | pub struct C(pub isize, pub isize); LL | pub struct C(pub isize, pub isize);
| ~~~ +++ | +++
error[E0603]: tuple struct constructor `A` is private error[E0603]: tuple struct constructor `A` is private
--> $DIR/privacy5.rs:56:12 --> $DIR/privacy5.rs:56:12
@ -262,7 +262,7 @@ LL | pub struct C(pub isize, isize);
help: consider making the fields publicly accessible help: consider making the fields publicly accessible
| |
LL | pub struct C(pub isize, pub isize); LL | pub struct C(pub isize, pub isize);
| ~~~ +++ | +++
error[E0603]: tuple struct constructor `C` is private error[E0603]: tuple struct constructor `C` is private
--> $DIR/privacy5.rs:69:12 --> $DIR/privacy5.rs:69:12
@ -281,7 +281,7 @@ LL | pub struct C(pub isize, isize);
help: consider making the fields publicly accessible help: consider making the fields publicly accessible
| |
LL | pub struct C(pub isize, pub isize); LL | pub struct C(pub isize, pub isize);
| ~~~ +++ | +++
error[E0603]: tuple struct constructor `C` is private error[E0603]: tuple struct constructor `C` is private
--> $DIR/privacy5.rs:70:12 --> $DIR/privacy5.rs:70:12
@ -300,7 +300,7 @@ LL | pub struct C(pub isize, isize);
help: consider making the fields publicly accessible help: consider making the fields publicly accessible
| |
LL | pub struct C(pub isize, pub isize); LL | pub struct C(pub isize, pub isize);
| ~~~ +++ | +++
error[E0603]: tuple struct constructor `C` is private error[E0603]: tuple struct constructor `C` is private
--> $DIR/privacy5.rs:71:12 --> $DIR/privacy5.rs:71:12
@ -319,7 +319,7 @@ LL | pub struct C(pub isize, isize);
help: consider making the fields publicly accessible help: consider making the fields publicly accessible
| |
LL | pub struct C(pub isize, pub isize); LL | pub struct C(pub isize, pub isize);
| ~~~ +++ | +++
error[E0603]: tuple struct constructor `C` is private error[E0603]: tuple struct constructor `C` is private
--> $DIR/privacy5.rs:72:18 --> $DIR/privacy5.rs:72:18
@ -338,7 +338,7 @@ LL | pub struct C(pub isize, isize);
help: consider making the fields publicly accessible help: consider making the fields publicly accessible
| |
LL | pub struct C(pub isize, pub isize); LL | pub struct C(pub isize, pub isize);
| ~~~ +++ | +++
error[E0603]: tuple struct constructor `C` is private error[E0603]: tuple struct constructor `C` is private
--> $DIR/privacy5.rs:73:18 --> $DIR/privacy5.rs:73:18
@ -357,7 +357,7 @@ LL | pub struct C(pub isize, isize);
help: consider making the fields publicly accessible help: consider making the fields publicly accessible
| |
LL | pub struct C(pub isize, pub isize); LL | pub struct C(pub isize, pub isize);
| ~~~ +++ | +++
error[E0603]: tuple struct constructor `C` is private error[E0603]: tuple struct constructor `C` is private
--> $DIR/privacy5.rs:74:18 --> $DIR/privacy5.rs:74:18
@ -376,7 +376,7 @@ LL | pub struct C(pub isize, isize);
help: consider making the fields publicly accessible help: consider making the fields publicly accessible
| |
LL | pub struct C(pub isize, pub isize); LL | pub struct C(pub isize, pub isize);
| ~~~ +++ | +++
error[E0603]: tuple struct constructor `C` is private error[E0603]: tuple struct constructor `C` is private
--> $DIR/privacy5.rs:75:18 --> $DIR/privacy5.rs:75:18
@ -395,7 +395,7 @@ LL | pub struct C(pub isize, isize);
help: consider making the fields publicly accessible help: consider making the fields publicly accessible
| |
LL | pub struct C(pub isize, pub isize); LL | pub struct C(pub isize, pub isize);
| ~~~ +++ | +++
error[E0603]: tuple struct constructor `A` is private error[E0603]: tuple struct constructor `A` is private
--> $DIR/privacy5.rs:83:17 --> $DIR/privacy5.rs:83:17
@ -452,7 +452,7 @@ LL | pub struct C(pub isize, isize);
help: consider making the fields publicly accessible help: consider making the fields publicly accessible
| |
LL | pub struct C(pub isize, pub isize); LL | pub struct C(pub isize, pub isize);
| ~~~ +++ | +++
error[E0603]: tuple struct constructor `A` is private error[E0603]: tuple struct constructor `A` is private
--> $DIR/privacy5.rs:90:20 --> $DIR/privacy5.rs:90:20

View File

@ -17,10 +17,6 @@ error[E0282]: type annotations needed
LL | .sum::<_>() LL | .sum::<_>()
| ^^^ cannot infer type of the type parameter `S` declared on the method `sum` | ^^^ cannot infer type of the type parameter `S` declared on the method `sum`
| |
help: consider specifying the generic argument
|
LL | .sum::<_>()
| ~~~~~
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View File

@ -40,7 +40,7 @@ LL | let _ = vec![1, 2, 3].into_iter().collect::Vec<_>>();
help: surround the type parameters with angle brackets help: surround the type parameters with angle brackets
| |
LL | let _ = vec![1, 2, 3].into_iter().collect::<Vec<_>>(); LL | let _ = vec![1, 2, 3].into_iter().collect::<Vec<_>>();
| + ~ | +
error: aborting due to 4 previous errors error: aborting due to 4 previous errors