Auto merge of #103048 - Dylan-DPC:rollup-47r62js, r=Dylan-DPC
Rollup of 8 pull requests Successful merges: - #102847 (impl AsFd and AsRawFd for io::{Stdin, Stdout, Stderr}, not the sys versions) - #102856 (Only test duplicate inherent impl items in a single place) - #102914 (Migrate css highlight without change) - #102938 (Move some tests to more reasonable directories) - #103015 (fix a typo) - #103018 (More dupe word typos) - #103025 (rustdoc: remove unused CSS `.search-container > *`) - #103031 (Suppress irrefutable let patterns lint for prefixes in match guards) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
9b0a099dfc
89 changed files with 389 additions and 352 deletions
|
@ -414,7 +414,7 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
|
|||
|
||||
let typeck_root_def_id = self.infcx.tcx.typeck_root_def_id(self.mir_def.did.to_def_id());
|
||||
|
||||
// If this is is a 'root' body (not a closure/generator/inline const), then
|
||||
// If this is a 'root' body (not a closure/generator/inline const), then
|
||||
// there are no extern regions, so the local regions start at the same
|
||||
// position as the (empty) sub-list of extern regions
|
||||
let first_local_index = if self.mir_def.did.to_def_id() == typeck_root_def_id {
|
||||
|
|
|
@ -65,7 +65,7 @@ pub(crate) fn get_file_name(crate_name: &str, crate_type: &str) -> String {
|
|||
}
|
||||
|
||||
/// Similar to `get_file_name`, but converts any dashes (`-`) in the `crate_name` to
|
||||
/// underscores (`_`). This is specially made for the the rustc and cargo wrappers
|
||||
/// underscores (`_`). This is specially made for the rustc and cargo wrappers
|
||||
/// which have a dash in the name, and that is not allowed in a crate name.
|
||||
pub(crate) fn get_wrapper_file_name(crate_name: &str, crate_type: &str) -> String {
|
||||
let crate_name = crate_name.replace('-', "_");
|
||||
|
|
|
@ -193,7 +193,7 @@ pub(super) fn from_casted_value<'tcx>(
|
|||
kind: StackSlotKind::ExplicitSlot,
|
||||
// FIXME Don't force the size to a multiple of 16 bytes once Cranelift gets a way to
|
||||
// specify stack slot alignment.
|
||||
// Stack slot size may be bigger for for example `[u8; 3]` which is packed into an `i32`.
|
||||
// Stack slot size may be bigger for example `[u8; 3]` which is packed into an `i32`.
|
||||
// It may also be smaller for example when the type is a wrapper around an integer with a
|
||||
// larger alignment than the integer.
|
||||
size: (std::cmp::max(abi_param_size, layout_size) + 15) / 16 * 16,
|
||||
|
|
|
@ -537,7 +537,7 @@ pub(crate) fn link(
|
|||
mut modules: Vec<ModuleCodegen<ModuleLlvm>>,
|
||||
) -> Result<ModuleCodegen<ModuleLlvm>, FatalError> {
|
||||
use super::lto::{Linker, ModuleBuffer};
|
||||
// Sort the modules by name to ensure to ensure deterministic behavior.
|
||||
// Sort the modules by name to ensure deterministic behavior.
|
||||
modules.sort_by(|a, b| a.name.cmp(&b.name));
|
||||
let (first, elements) =
|
||||
modules.split_first().expect("Bug! modules must contain at least one module.");
|
||||
|
|
|
@ -129,7 +129,7 @@ impl CoverageMapGenerator {
|
|||
// LLVM Coverage Mapping Format version 6 (zero-based encoded as 5)
|
||||
// requires setting the first filename to the compilation directory.
|
||||
// Since rustc generates coverage maps with relative paths, the
|
||||
// compilation directory can be combined with the the relative paths
|
||||
// compilation directory can be combined with the relative paths
|
||||
// to get absolute paths, if needed.
|
||||
let working_dir = tcx
|
||||
.sess
|
||||
|
|
|
@ -64,7 +64,7 @@ pub struct ConstEvalErr<'tcx> {
|
|||
impl<'tcx> ConstEvalErr<'tcx> {
|
||||
/// Turn an interpreter error into something to report to the user.
|
||||
/// As a side-effect, if RUSTC_CTFE_BACKTRACE is set, this prints the backtrace.
|
||||
/// Should be called only if the error is actually going to to be reported!
|
||||
/// Should be called only if the error is actually going to be reported!
|
||||
pub fn new<'mir, M: Machine<'mir, 'tcx>>(
|
||||
ecx: &InterpCx<'mir, 'tcx, M>,
|
||||
error: InterpErrorInfo<'tcx>,
|
||||
|
|
|
@ -794,7 +794,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
|||
todo.extend(static_roots);
|
||||
while let Some(id) = todo.pop() {
|
||||
if reachable.insert(id) {
|
||||
// This is a new allocation, add the allocation it points to to `todo`.
|
||||
// This is a new allocation, add the allocation it points to `todo`.
|
||||
if let Some((_, alloc)) = self.memory.alloc_map.get(id) {
|
||||
todo.extend(
|
||||
alloc.provenance().values().filter_map(|prov| prov.get_alloc_id()),
|
||||
|
|
|
@ -29,8 +29,8 @@ impl<N: Idx + Ord> VecGraph<N> {
|
|||
// Store the *target* of each edge into `edge_targets`.
|
||||
let edge_targets: Vec<N> = edge_pairs.iter().map(|&(_, target)| target).collect();
|
||||
|
||||
// Create the *edge starts* array. We are iterating over over
|
||||
// the (sorted) edge pairs. We maintain the invariant that the
|
||||
// Create the *edge starts* array. We are iterating over the
|
||||
// (sorted) edge pairs. We maintain the invariant that the
|
||||
// length of the `node_starts` array is enough to store the
|
||||
// current source node -- so when we see that the source node
|
||||
// for an edge is greater than the current length, we grow the
|
||||
|
|
|
@ -327,7 +327,7 @@ impl InvocationKind {
|
|||
fn placeholder_visibility(&self) -> Option<ast::Visibility> {
|
||||
// HACK: For unnamed fields placeholders should have the same visibility as the actual
|
||||
// fields because for tuple structs/variants resolve determines visibilities of their
|
||||
// constructor using these field visibilities before attributes on them are are expanded.
|
||||
// constructor using these field visibilities before attributes on them are expanded.
|
||||
// The assumption is that the attribute expansion cannot change field visibilities,
|
||||
// and it holds because only inert attributes are supported in this position.
|
||||
match self {
|
||||
|
|
|
@ -72,7 +72,7 @@ impl<'tcx> FnCtxt<'_, 'tcx> {
|
|||
//
|
||||
// - Unconstrained ints are replaced with `i32`.
|
||||
//
|
||||
// - Unconstrained floats are replaced with with `f64`.
|
||||
// - Unconstrained floats are replaced with `f64`.
|
||||
//
|
||||
// - Non-numerics may get replaced with `()` or `!`, depending on
|
||||
// how they were categorized by `calculate_diverging_fallback`
|
||||
|
|
|
@ -210,7 +210,7 @@ impl<'a, 'tcx> DropRangeVisitor<'a, 'tcx> {
|
|||
}
|
||||
|
||||
/// For an expression with an uninhabited return type (e.g. a function that returns !),
|
||||
/// this adds a self edge to to the CFG to model the fact that the function does not
|
||||
/// this adds a self edge to the CFG to model the fact that the function does not
|
||||
/// return.
|
||||
fn handle_uninhabited_return(&mut self, expr: &Expr<'tcx>) {
|
||||
let ty = self.typeck_results.expr_ty(expr);
|
||||
|
|
|
@ -352,7 +352,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
/// and that the path can be captured with required capture kind (depending on use in closure,
|
||||
/// move closure etc.)
|
||||
///
|
||||
/// Returns the set of of adjusted information along with the inferred closure kind and span
|
||||
/// Returns the set of adjusted information along with the inferred closure kind and span
|
||||
/// associated with the closure kind inference.
|
||||
///
|
||||
/// Note that we *always* infer a minimal kind, even if
|
||||
|
|
|
@ -58,6 +58,37 @@ impl<'tcx> InherentOverlapChecker<'tcx> {
|
|||
== item2.ident(self.tcx).normalize_to_macros_2_0()
|
||||
}
|
||||
|
||||
fn check_for_duplicate_items_in_impl(&self, impl_: DefId) {
|
||||
let impl_items = self.tcx.associated_items(impl_);
|
||||
|
||||
let mut seen_items = FxHashMap::default();
|
||||
for impl_item in impl_items.in_definition_order() {
|
||||
let span = self.tcx.def_span(impl_item.def_id);
|
||||
let ident = impl_item.ident(self.tcx);
|
||||
|
||||
let norm_ident = ident.normalize_to_macros_2_0();
|
||||
match seen_items.entry(norm_ident) {
|
||||
Entry::Occupied(entry) => {
|
||||
let former = entry.get();
|
||||
let mut err = struct_span_err!(
|
||||
self.tcx.sess,
|
||||
span,
|
||||
E0592,
|
||||
"duplicate definitions with name `{}`",
|
||||
ident,
|
||||
);
|
||||
err.span_label(span, format!("duplicate definitions for `{}`", ident));
|
||||
err.span_label(*former, format!("other definition for `{}`", ident));
|
||||
|
||||
err.emit();
|
||||
}
|
||||
Entry::Vacant(entry) => {
|
||||
entry.insert(span);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn check_for_common_items_in_impls(
|
||||
&self,
|
||||
impl1: DefId,
|
||||
|
@ -133,12 +164,6 @@ impl<'tcx> InherentOverlapChecker<'tcx> {
|
|||
|
||||
let impls = self.tcx.inherent_impls(id.def_id);
|
||||
|
||||
// If there is only one inherent impl block,
|
||||
// there is nothing to overlap check it with
|
||||
if impls.len() <= 1 {
|
||||
return;
|
||||
}
|
||||
|
||||
let overlap_mode = OverlapMode::get(self.tcx, id.def_id.to_def_id());
|
||||
|
||||
let impls_items = impls
|
||||
|
@ -152,6 +177,8 @@ impl<'tcx> InherentOverlapChecker<'tcx> {
|
|||
const ALLOCATING_ALGO_THRESHOLD: usize = 500;
|
||||
if impls.len() < ALLOCATING_ALGO_THRESHOLD {
|
||||
for (i, &(&impl1_def_id, impl_items1)) in impls_items.iter().enumerate() {
|
||||
self.check_for_duplicate_items_in_impl(impl1_def_id);
|
||||
|
||||
for &(&impl2_def_id, impl_items2) in &impls_items[(i + 1)..] {
|
||||
if self.impls_have_common_items(impl_items1, impl_items2) {
|
||||
self.check_for_overlapping_inherent_impls(
|
||||
|
@ -290,6 +317,8 @@ impl<'tcx> InherentOverlapChecker<'tcx> {
|
|||
impl_blocks.sort_unstable();
|
||||
for (i, &impl1_items_idx) in impl_blocks.iter().enumerate() {
|
||||
let &(&impl1_def_id, impl_items1) = &impls_items[impl1_items_idx];
|
||||
self.check_for_duplicate_items_in_impl(impl1_def_id);
|
||||
|
||||
for &impl2_items_idx in impl_blocks[(i + 1)..].iter() {
|
||||
let &(&impl2_def_id, impl_items2) = &impls_items[impl2_items_idx];
|
||||
if self.impls_have_common_items(impl_items1, impl_items2) {
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
use crate::constrained_generic_params as cgp;
|
||||
use min_specialization::check_min_specialization;
|
||||
|
||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_errors::struct_span_err;
|
||||
use rustc_hir::def::DefKind;
|
||||
use rustc_hir::def_id::LocalDefId;
|
||||
|
@ -19,8 +19,6 @@ use rustc_middle::ty::query::Providers;
|
|||
use rustc_middle::ty::{self, TyCtxt, TypeVisitable};
|
||||
use rustc_span::{Span, Symbol};
|
||||
|
||||
use std::collections::hash_map::Entry::{Occupied, Vacant};
|
||||
|
||||
mod min_specialization;
|
||||
|
||||
/// Checks that all the type/lifetime parameters on an impl also
|
||||
|
@ -59,7 +57,6 @@ fn check_mod_impl_wf(tcx: TyCtxt<'_>, module_def_id: LocalDefId) {
|
|||
for id in module.items() {
|
||||
if matches!(tcx.def_kind(id.def_id), DefKind::Impl) {
|
||||
enforce_impl_params_are_constrained(tcx, id.def_id.def_id);
|
||||
enforce_impl_items_are_distinct(tcx, id.def_id.def_id);
|
||||
if min_specialization {
|
||||
check_min_specialization(tcx, id.def_id.def_id);
|
||||
}
|
||||
|
@ -194,38 +191,3 @@ fn report_unused_parameter(tcx: TyCtxt<'_>, span: Span, kind: &str, name: Symbol
|
|||
}
|
||||
err.emit();
|
||||
}
|
||||
|
||||
/// Enforce that we do not have two items in an impl with the same name.
|
||||
fn enforce_impl_items_are_distinct(tcx: TyCtxt<'_>, impl_def_id: LocalDefId) {
|
||||
if tcx.impl_trait_ref(impl_def_id).is_some() {
|
||||
return;
|
||||
}
|
||||
let mut seen_type_items = FxHashMap::default();
|
||||
let mut seen_value_items = FxHashMap::default();
|
||||
for &impl_item_ref in tcx.associated_item_def_ids(impl_def_id) {
|
||||
let impl_item = tcx.associated_item(impl_item_ref);
|
||||
let seen_items = match impl_item.kind {
|
||||
ty::AssocKind::Type => &mut seen_type_items,
|
||||
_ => &mut seen_value_items,
|
||||
};
|
||||
let span = tcx.def_span(impl_item_ref);
|
||||
let ident = impl_item.ident(tcx);
|
||||
match seen_items.entry(ident.normalize_to_macros_2_0()) {
|
||||
Occupied(entry) => {
|
||||
let mut err = struct_span_err!(
|
||||
tcx.sess,
|
||||
span,
|
||||
E0201,
|
||||
"duplicate definitions with name `{}`:",
|
||||
ident
|
||||
);
|
||||
err.span_label(*entry.get(), format!("previous definition of `{}` here", ident));
|
||||
err.span_label(span, "duplicate definition");
|
||||
err.emit();
|
||||
}
|
||||
Vacant(entry) => {
|
||||
entry.insert(span);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1150,8 +1150,8 @@ impl<'tcx> InferCtxt<'tcx> {
|
|||
/// Return the universe that the region `r` was created in. For
|
||||
/// most regions (e.g., `'static`, named regions from the user,
|
||||
/// etc) this is the root universe U0. For inference variables or
|
||||
/// placeholders, however, it will return the universe which which
|
||||
/// they are associated.
|
||||
/// placeholders, however, it will return the universe which they
|
||||
/// are associated.
|
||||
pub fn universe_of_region(&self, r: ty::Region<'tcx>) -> ty::UniverseIndex {
|
||||
self.inner.borrow_mut().unwrap_region_constraints().universe(r)
|
||||
}
|
||||
|
|
|
@ -3310,7 +3310,7 @@ declare_lint! {
|
|||
/// explicitly.
|
||||
///
|
||||
/// To access a library from a binary target within the same crate,
|
||||
/// use `your_crate_name::` as the path path instead of `lib::`:
|
||||
/// use `your_crate_name::` as the path instead of `lib::`:
|
||||
///
|
||||
/// ```rust,compile_fail
|
||||
/// // bar/src/lib.rs
|
||||
|
|
|
@ -3937,7 +3937,7 @@ declare_lint! {
|
|||
///
|
||||
/// The compiler disables the automatic implementation if an explicit one
|
||||
/// exists for given type constructor. The exact rules governing this
|
||||
/// are currently unsound and quite subtle and and will be modified in the future.
|
||||
/// are currently unsound, quite subtle, and will be modified in the future.
|
||||
/// This change will cause the automatic implementation to be disabled in more
|
||||
/// cases, potentially breaking some code.
|
||||
pub SUSPICIOUS_AUTO_TRAIT_IMPLS,
|
||||
|
|
|
@ -43,7 +43,7 @@ pub trait PointerArithmetic: HasDataLayout {
|
|||
let val = val as i64;
|
||||
// Now wrap-around into the machine_isize range.
|
||||
if val > self.machine_isize_max() {
|
||||
// This can only happen the the ptr size is < 64, so we know max_usize_plus_1 fits into
|
||||
// This can only happen if the ptr size is < 64, so we know max_usize_plus_1 fits into
|
||||
// i64.
|
||||
debug_assert!(self.pointer_size().bits() < 64);
|
||||
let max_usize_plus_1 = 1u128 << self.pointer_size().bits();
|
||||
|
|
|
@ -13,8 +13,7 @@
|
|||
//!
|
||||
//! There are three groups of traits involved in each traversal.
|
||||
//! - `TypeFoldable`. This is implemented once for many types, including:
|
||||
//! - Types of interest, for which the the methods delegate to the
|
||||
//! folder.
|
||||
//! - Types of interest, for which the methods delegate to the folder.
|
||||
//! - All other types, including generic containers like `Vec` and `Option`.
|
||||
//! It defines a "skeleton" of how they should be folded.
|
||||
//! - `TypeSuperFoldable`. This is implemented only for each type of interest,
|
||||
|
|
|
@ -958,7 +958,7 @@ impl<'tcx> Ty<'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Checks if `ty` has has a significant drop.
|
||||
/// Checks if `ty` has a significant drop.
|
||||
///
|
||||
/// Note that this method can return false even if `ty` has a destructor
|
||||
/// attached; even if that is the case then the adt has been marked with
|
||||
|
|
|
@ -10,8 +10,7 @@
|
|||
//!
|
||||
//! There are three groups of traits involved in each traversal.
|
||||
//! - `TypeVisitable`. This is implemented once for many types, including:
|
||||
//! - Types of interest, for which the the methods delegate to the
|
||||
//! visitor.
|
||||
//! - Types of interest, for which the methods delegate to the visitor.
|
||||
//! - All other types, including generic containers like `Vec` and `Option`.
|
||||
//! It defines a "skeleton" of how they should be visited.
|
||||
//! - `TypeSuperVisitable`. This is implemented only for each type of interest,
|
||||
|
|
|
@ -370,8 +370,12 @@ impl<'p, 'tcx> MatchVisitor<'_, 'p, 'tcx> {
|
|||
|
||||
// Check if the let source is while, for there is no alternative place to put a prefix,
|
||||
// and we shouldn't lint.
|
||||
// For let guards inside a match, prefixes might use bindings of the match pattern,
|
||||
// so can't always be moved out.
|
||||
// FIXME: Add checking whether the bindings are actually used in the prefix,
|
||||
// and lint if they are not.
|
||||
let let_source = let_source_parent(self.tcx, top, None);
|
||||
if !matches!(let_source, LetSource::WhileLet) {
|
||||
if !matches!(let_source, LetSource::WhileLet | LetSource::IfLetGuard) {
|
||||
// Emit the lint
|
||||
let prefix = &chain_refutabilities[..until];
|
||||
lint_affix(prefix, "leading", "outside of the construct");
|
||||
|
@ -1151,10 +1155,14 @@ fn let_source_parent(tcx: TyCtxt<'_>, parent: HirId, pat_id: Option<HirId>) -> L
|
|||
|
||||
let parent_parent = hir.get_parent_node(parent);
|
||||
let parent_parent_node = hir.get(parent_parent);
|
||||
if let hir::Node::Stmt(hir::Stmt { kind: hir::StmtKind::Local(_), span, .. }) =
|
||||
parent_parent_node
|
||||
{
|
||||
return LetSource::LetElse(*span);
|
||||
match parent_parent_node {
|
||||
hir::Node::Stmt(hir::Stmt { kind: hir::StmtKind::Local(_), span, .. }) => {
|
||||
return LetSource::LetElse(*span);
|
||||
}
|
||||
hir::Node::Arm(hir::Arm { guard: Some(hir::Guard::If(_)), .. }) => {
|
||||
return LetSource::IfLetGuard;
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
let parent_parent_parent = hir.get_parent_node(parent_parent);
|
||||
|
|
|
@ -885,7 +885,7 @@ fn is_useful<'p, 'tcx>(
|
|||
// that has the potential to trigger the `non_exhaustive_omitted_patterns` lint.
|
||||
// To understand the workings checkout `Constructor::split` and `SplitWildcard::new/into_ctors`
|
||||
if is_non_exhaustive_and_wild
|
||||
// We check that the match has a wildcard pattern and that that wildcard is useful,
|
||||
// We check that the match has a wildcard pattern and that wildcard is useful,
|
||||
// meaning there are variants that are covered by the wildcard. Without the check
|
||||
// for `witness_preference` the lint would trigger on `if let NonExhaustiveEnum::A = foo {}`
|
||||
&& usefulness.is_useful() && matches!(witness_preference, RealArm)
|
||||
|
|
|
@ -2232,7 +2232,7 @@ impl<'a> Parser<'a> {
|
|||
///
|
||||
/// When encountering code like `foo::< bar + 3 >` or `foo::< bar - baz >` we suggest
|
||||
/// `foo::<{ bar + 3 }>` and `foo::<{ bar - baz }>`, respectively. We only provide a suggestion
|
||||
/// if we think that that the resulting expression would be well formed.
|
||||
/// if we think that the resulting expression would be well formed.
|
||||
pub fn recover_const_arg(
|
||||
&mut self,
|
||||
start: Span,
|
||||
|
|
|
@ -268,7 +268,7 @@ impl CheckAttrVisitor<'_> {
|
|||
}
|
||||
// FIXME(#65833): We permit associated consts to have an `#[inline]` attribute with
|
||||
// just a lint, because we previously erroneously allowed it and some crates used it
|
||||
// accidentally, to to be compatible with crates depending on them, we can't throw an
|
||||
// accidentally, to be compatible with crates depending on them, we can't throw an
|
||||
// error here.
|
||||
Target::AssocConst => {
|
||||
self.tcx.emit_spanned_lint(
|
||||
|
@ -376,7 +376,7 @@ impl CheckAttrVisitor<'_> {
|
|||
| Target::Method(MethodKind::Trait { body: true } | MethodKind::Inherent) => true,
|
||||
// FIXME(#80564): We permit struct fields, match arms and macro defs to have an
|
||||
// `#[allow_internal_unstable]` attribute with just a lint, because we previously
|
||||
// erroneously allowed it and some crates used it accidentally, to to be compatible
|
||||
// erroneously allowed it and some crates used it accidentally, to be compatible
|
||||
// with crates depending on them, we can't throw an error here.
|
||||
Target::Field | Target::Arm | Target::MacroDef => {
|
||||
self.inline_attr_str_error_with_macro_def(hir_id, attr, "naked");
|
||||
|
@ -456,7 +456,7 @@ impl CheckAttrVisitor<'_> {
|
|||
Target::Fn | Target::Method(..) | Target::ForeignFn | Target::Closure => true,
|
||||
// FIXME(#80564): We permit struct fields, match arms and macro defs to have an
|
||||
// `#[track_caller]` attribute with just a lint, because we previously
|
||||
// erroneously allowed it and some crates used it accidentally, to to be compatible
|
||||
// erroneously allowed it and some crates used it accidentally, to be compatible
|
||||
// with crates depending on them, we can't throw an error here.
|
||||
Target::Field | Target::Arm | Target::MacroDef => {
|
||||
for attr in attrs {
|
||||
|
@ -485,7 +485,7 @@ impl CheckAttrVisitor<'_> {
|
|||
Target::Struct | Target::Enum | Target::Variant => true,
|
||||
// FIXME(#80564): We permit struct fields, match arms and macro defs to have an
|
||||
// `#[non_exhaustive]` attribute with just a lint, because we previously
|
||||
// erroneously allowed it and some crates used it accidentally, to to be compatible
|
||||
// erroneously allowed it and some crates used it accidentally, to be compatible
|
||||
// with crates depending on them, we can't throw an error here.
|
||||
Target::Field | Target::Arm | Target::MacroDef => {
|
||||
self.inline_attr_str_error_with_macro_def(hir_id, attr, "non_exhaustive");
|
||||
|
@ -507,7 +507,7 @@ impl CheckAttrVisitor<'_> {
|
|||
Target::Trait => true,
|
||||
// FIXME(#80564): We permit struct fields, match arms and macro defs to have an
|
||||
// `#[marker]` attribute with just a lint, because we previously
|
||||
// erroneously allowed it and some crates used it accidentally, to to be compatible
|
||||
// erroneously allowed it and some crates used it accidentally, to be compatible
|
||||
// with crates depending on them, we can't throw an error here.
|
||||
Target::Field | Target::Arm | Target::MacroDef => {
|
||||
self.inline_attr_str_error_with_macro_def(hir_id, attr, "marker");
|
||||
|
@ -566,7 +566,7 @@ impl CheckAttrVisitor<'_> {
|
|||
}
|
||||
// FIXME(#80564): We permit struct fields, match arms and macro defs to have an
|
||||
// `#[target_feature]` attribute with just a lint, because we previously
|
||||
// erroneously allowed it and some crates used it accidentally, to to be compatible
|
||||
// erroneously allowed it and some crates used it accidentally, to be compatible
|
||||
// with crates depending on them, we can't throw an error here.
|
||||
Target::Field | Target::Arm | Target::MacroDef => {
|
||||
self.inline_attr_str_error_with_macro_def(hir_id, attr, "target_feature");
|
||||
|
@ -1205,7 +1205,7 @@ impl CheckAttrVisitor<'_> {
|
|||
Target::Fn | Target::Method(..) | Target::ForeignFn | Target::Closure => {}
|
||||
// FIXME(#80564): We permit struct fields, match arms and macro defs to have an
|
||||
// `#[cold]` attribute with just a lint, because we previously
|
||||
// erroneously allowed it and some crates used it accidentally, to to be compatible
|
||||
// erroneously allowed it and some crates used it accidentally, to be compatible
|
||||
// with crates depending on them, we can't throw an error here.
|
||||
Target::Field | Target::Arm | Target::MacroDef => {
|
||||
self.inline_attr_str_error_with_macro_def(hir_id, attr, "cold");
|
||||
|
@ -1247,7 +1247,7 @@ impl CheckAttrVisitor<'_> {
|
|||
Target::ForeignFn | Target::ForeignStatic => {}
|
||||
// FIXME(#80564): We permit struct fields, match arms and macro defs to have an
|
||||
// `#[link_name]` attribute with just a lint, because we previously
|
||||
// erroneously allowed it and some crates used it accidentally, to to be compatible
|
||||
// erroneously allowed it and some crates used it accidentally, to be compatible
|
||||
// with crates depending on them, we can't throw an error here.
|
||||
Target::Field | Target::Arm | Target::MacroDef => {
|
||||
self.inline_attr_str_error_with_macro_def(hir_id, attr, "link_name");
|
||||
|
@ -1281,7 +1281,7 @@ impl CheckAttrVisitor<'_> {
|
|||
Target::ExternCrate => true,
|
||||
// FIXME(#80564): We permit struct fields, match arms and macro defs to have an
|
||||
// `#[no_link]` attribute with just a lint, because we previously
|
||||
// erroneously allowed it and some crates used it accidentally, to to be compatible
|
||||
// erroneously allowed it and some crates used it accidentally, to be compatible
|
||||
// with crates depending on them, we can't throw an error here.
|
||||
Target::Field | Target::Arm | Target::MacroDef => {
|
||||
self.inline_attr_str_error_with_macro_def(hir_id, attr, "no_link");
|
||||
|
@ -1311,7 +1311,7 @@ impl CheckAttrVisitor<'_> {
|
|||
Target::Method(..) if self.is_impl_item(hir_id) => true,
|
||||
// FIXME(#80564): We permit struct fields, match arms and macro defs to have an
|
||||
// `#[export_name]` attribute with just a lint, because we previously
|
||||
// erroneously allowed it and some crates used it accidentally, to to be compatible
|
||||
// erroneously allowed it and some crates used it accidentally, to be compatible
|
||||
// with crates depending on them, we can't throw an error here.
|
||||
Target::Field | Target::Arm | Target::MacroDef => {
|
||||
self.inline_attr_str_error_with_macro_def(hir_id, attr, "export_name");
|
||||
|
@ -1503,7 +1503,7 @@ impl CheckAttrVisitor<'_> {
|
|||
Target::Static | Target::Fn | Target::Method(..) => {}
|
||||
// FIXME(#80564): We permit struct fields, match arms and macro defs to have an
|
||||
// `#[link_section]` attribute with just a lint, because we previously
|
||||
// erroneously allowed it and some crates used it accidentally, to to be compatible
|
||||
// erroneously allowed it and some crates used it accidentally, to be compatible
|
||||
// with crates depending on them, we can't throw an error here.
|
||||
Target::Field | Target::Arm | Target::MacroDef => {
|
||||
self.inline_attr_str_error_with_macro_def(hir_id, attr, "link_section");
|
||||
|
@ -1528,7 +1528,7 @@ impl CheckAttrVisitor<'_> {
|
|||
Target::Method(..) if self.is_impl_item(hir_id) => {}
|
||||
// FIXME(#80564): We permit struct fields, match arms and macro defs to have an
|
||||
// `#[no_mangle]` attribute with just a lint, because we previously
|
||||
// erroneously allowed it and some crates used it accidentally, to to be compatible
|
||||
// erroneously allowed it and some crates used it accidentally, to be compatible
|
||||
// with crates depending on them, we can't throw an error here.
|
||||
Target::Field | Target::Arm | Target::MacroDef => {
|
||||
self.inline_attr_str_error_with_macro_def(hir_id, attr, "no_mangle");
|
||||
|
@ -1782,7 +1782,7 @@ impl CheckAttrVisitor<'_> {
|
|||
Target::MacroDef => true,
|
||||
// FIXME(#80564): We permit struct fields and match arms to have an
|
||||
// `#[allow_internal_unstable]` attribute with just a lint, because we previously
|
||||
// erroneously allowed it and some crates used it accidentally, to to be compatible
|
||||
// erroneously allowed it and some crates used it accidentally, to be compatible
|
||||
// with crates depending on them, we can't throw an error here.
|
||||
Target::Field | Target::Arm => {
|
||||
self.inline_attr_str_error_without_macro_def(
|
||||
|
@ -1877,7 +1877,7 @@ impl CheckAttrVisitor<'_> {
|
|||
}
|
||||
// FIXME(#80564): We permit struct fields and match arms to have an
|
||||
// `#[allow_internal_unstable]` attribute with just a lint, because we previously
|
||||
// erroneously allowed it and some crates used it accidentally, to to be compatible
|
||||
// erroneously allowed it and some crates used it accidentally, to be compatible
|
||||
// with crates depending on them, we can't throw an error here.
|
||||
Target::Field | Target::Arm | Target::MacroDef => {
|
||||
self.inline_attr_str_error_with_macro_def(hir_id, attr, "allow_internal_unstable");
|
||||
|
|
|
@ -2060,7 +2060,7 @@ struct Finalize {
|
|||
/// Span of the whole path or some its characteristic fragment.
|
||||
/// E.g. span of `b` in `foo::{a, b, c}`, or full span for regular paths.
|
||||
path_span: Span,
|
||||
/// Span of the path start, suitable for prepending something to to it.
|
||||
/// Span of the path start, suitable for prepending something to it.
|
||||
/// E.g. span of `foo` in `foo::{a, b, c}`, or full span for regular paths.
|
||||
root_span: Span,
|
||||
/// Whether to report privacy errors or silently return "no resolution" for them,
|
||||
|
|
|
@ -186,7 +186,7 @@ top_level_options!(
|
|||
/// Remap source path prefixes in all output (messages, object files, debug, etc.).
|
||||
remap_path_prefix: Vec<(PathBuf, PathBuf)> [TRACKED_NO_CRATE_HASH],
|
||||
/// Base directory containing the `src/` for the Rust standard library, and
|
||||
/// potentially `rustc` as well, if we can can find it. Right now it's always
|
||||
/// potentially `rustc` as well, if we can find it. Right now it's always
|
||||
/// `$sysroot/lib/rustlib/src/rust` (i.e. the `rustup` `rust-src` component).
|
||||
///
|
||||
/// This directory is what the virtual `/rustc/$hash` is translated back to,
|
||||
|
|
|
@ -540,7 +540,7 @@ fn encode_ty<'tcx>(
|
|||
let mut s = String::new();
|
||||
let def_id = adt_def.0.did;
|
||||
if options.contains(EncodeTyOptions::GENERALIZE_REPR_C) && adt_def.repr().c() {
|
||||
// For for cross-language CFI support, the encoding must be compatible at the FFI
|
||||
// For cross-language CFI support, the encoding must be compatible at the FFI
|
||||
// boundary. For instance:
|
||||
//
|
||||
// struct type1 {};
|
||||
|
|
|
@ -47,7 +47,7 @@ pub enum PassMode {
|
|||
/// Pass the argument indirectly via a hidden pointer.
|
||||
/// The `extra_attrs` value, if any, is for the extra data (vtable or length)
|
||||
/// which indicates that it refers to an unsized rvalue.
|
||||
/// `on_stack` defines that the the value should be passed at a fixed
|
||||
/// `on_stack` defines that the value should be passed at a fixed
|
||||
/// stack offset in accordance to the ABI rather than passed using a
|
||||
/// pointer. This corresponds to the `byval` LLVM argument attribute.
|
||||
Indirect { attrs: ArgAttributes, extra_attrs: Option<ArgAttributes>, on_stack: bool },
|
||||
|
|
|
@ -193,7 +193,7 @@ fn overlap_within_probe<'cx, 'tcx>(
|
|||
}
|
||||
}
|
||||
|
||||
// We disable the leak when when creating the `snapshot` by using
|
||||
// We disable the leak when creating the `snapshot` by using
|
||||
// `infcx.probe_maybe_disable_leak_check`.
|
||||
if infcx.leak_check(true, snapshot).is_err() {
|
||||
debug!("overlap: leak check failed");
|
||||
|
|
|
@ -101,7 +101,7 @@ impl<'tcx> ConstUnifyCtxt<'tcx> {
|
|||
a_uv == b_uv
|
||||
}
|
||||
// FIXME(generic_const_exprs): We may want to either actually try
|
||||
// to evaluate `a_ct` and `b_ct` if they are are fully concrete or something like
|
||||
// to evaluate `a_ct` and `b_ct` if they are fully concrete or something like
|
||||
// this, for now we just return false here.
|
||||
_ => false,
|
||||
}
|
||||
|
|
|
@ -566,7 +566,7 @@ impl<'a, 'b, 'tcx> TypeFolder<'tcx> for AssocTypeNormalizer<'a, 'b, 'tcx> {
|
|||
.unwrap_or_else(|| ty.super_fold_with(self).into())
|
||||
};
|
||||
// For cases like #95134 we would like to catch overflows early
|
||||
// otherwise they slip away away and cause ICE.
|
||||
// otherwise they slip away and cause ICE.
|
||||
let recursion_limit = self.tcx().recursion_limit();
|
||||
if !recursion_limit.value_within_limit(self.depth)
|
||||
// HACK: Don't overflow when running cargo doc see #100991
|
||||
|
|
|
@ -264,7 +264,7 @@ fn adt_consider_insignificant_dtor<'tcx>(
|
|||
if is_marked_insig {
|
||||
// In some cases like `std::collections::HashMap` where the struct is a wrapper around
|
||||
// a type that is a Drop type, and the wrapped type (eg: `hashbrown::HashMap`) lies
|
||||
// outside stdlib, we might choose to still annotate the the wrapper (std HashMap) with
|
||||
// outside stdlib, we might choose to still annotate the wrapper (std HashMap) with
|
||||
// `rustc_insignificant_dtor`, even if the type itself doesn't have a `Drop` impl.
|
||||
Some(DtorType::Insignificant)
|
||||
} else if adt_def.destructor(tcx).is_some() {
|
||||
|
|
|
@ -1613,7 +1613,7 @@ impl<'a, T> CursorMut<'a, T> {
|
|||
None
|
||||
} else {
|
||||
// We can't point to the node that we pop. Copying the behavior of
|
||||
// `remove_current`, we move on the the next node in the sequence.
|
||||
// `remove_current`, we move on to the next node in the sequence.
|
||||
// If the list is of length 1 then we end pointing to the "ghost"
|
||||
// node at index 0, which is expected.
|
||||
if self.list.head == self.current {
|
||||
|
|
|
@ -692,7 +692,7 @@ pub trait Iterator {
|
|||
/// assert_eq!(it.next(), Some(NotClone(99))); // The separator.
|
||||
/// assert_eq!(it.next(), Some(NotClone(1))); // The next element from `v`.
|
||||
/// assert_eq!(it.next(), Some(NotClone(99))); // The separator.
|
||||
/// assert_eq!(it.next(), Some(NotClone(2))); // The last element from from `v`.
|
||||
/// assert_eq!(it.next(), Some(NotClone(2))); // The last element from `v`.
|
||||
/// assert_eq!(it.next(), None); // The iterator is finished.
|
||||
/// ```
|
||||
///
|
||||
|
|
|
@ -647,7 +647,7 @@ impl<T> MaybeUninit<T> {
|
|||
/// implements the [`Copy`] trait or not. When using multiple copies of the
|
||||
/// data (by calling `assume_init_read` multiple times, or first calling
|
||||
/// `assume_init_read` and then [`assume_init`]), it is your responsibility
|
||||
/// to ensure that that data may indeed be duplicated.
|
||||
/// to ensure that data may indeed be duplicated.
|
||||
///
|
||||
/// [inv]: #initialization-invariant
|
||||
/// [`assume_init`]: MaybeUninit::assume_init
|
||||
|
|
|
@ -76,7 +76,7 @@ pub fn compute_float<F: RawFloat>(q: i64, mut w: u64) -> BiasedFp {
|
|||
return BiasedFp { f: mantissa, e: power2 };
|
||||
}
|
||||
// Need to handle rounding ties. Normally, we need to round up,
|
||||
// but if we fall right in between and and we have an even basis, we
|
||||
// but if we fall right in between and we have an even basis, we
|
||||
// need to round down.
|
||||
//
|
||||
// This will only occur if:
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/// These functions compute the integer logarithm of their type, assuming
|
||||
/// that someone has already checked that the the value is strictly positive.
|
||||
/// that someone has already checked that the value is strictly positive.
|
||||
|
||||
// 0 < val <= u8::MAX
|
||||
#[inline]
|
||||
|
|
|
@ -694,7 +694,7 @@ impl<T: ?Sized> *const T {
|
|||
/// units of T: the distance in bytes is divided by `mem::size_of::<T>()`.
|
||||
///
|
||||
/// This computes the same value that [`offset_from`](#method.offset_from)
|
||||
/// would compute, but with the added precondition that that the offset is
|
||||
/// would compute, but with the added precondition that the offset is
|
||||
/// guaranteed to be non-negative. This method is equivalent to
|
||||
/// `usize::from(self.offset_from(origin)).unwrap_unchecked()`,
|
||||
/// but it provides slightly more information to the optimizer, which can
|
||||
|
|
|
@ -867,7 +867,7 @@ impl<T: ?Sized> *mut T {
|
|||
/// units of T: the distance in bytes is divided by `mem::size_of::<T>()`.
|
||||
///
|
||||
/// This computes the same value that [`offset_from`](#method.offset_from)
|
||||
/// would compute, but with the added precondition that that the offset is
|
||||
/// would compute, but with the added precondition that the offset is
|
||||
/// guaranteed to be non-negative. This method is equivalent to
|
||||
/// `usize::from(self.offset_from(origin)).unwrap_unchecked()`,
|
||||
/// but it provides slightly more information to the optimizer, which can
|
||||
|
|
|
@ -1642,8 +1642,8 @@ impl<T> AtomicPtr<T> {
|
|||
/// and the argument `val`, and stores a pointer with provenance of the
|
||||
/// current pointer and the resulting address.
|
||||
///
|
||||
/// This is equivalent equivalent to using [`map_addr`] to atomically
|
||||
/// perform `ptr = ptr.map_addr(|a| a | val)`. This can be used in tagged
|
||||
/// This is equivalent to using [`map_addr`] to atomically perform
|
||||
/// `ptr = ptr.map_addr(|a| a | val)`. This can be used in tagged
|
||||
/// pointer schemes to atomically set tag bits.
|
||||
///
|
||||
/// **Caveat**: This operation returns the previous value. To compute the
|
||||
|
@ -1693,8 +1693,8 @@ impl<T> AtomicPtr<T> {
|
|||
/// pointer, and the argument `val`, and stores a pointer with provenance of
|
||||
/// the current pointer and the resulting address.
|
||||
///
|
||||
/// This is equivalent equivalent to using [`map_addr`] to atomically
|
||||
/// perform `ptr = ptr.map_addr(|a| a & val)`. This can be used in tagged
|
||||
/// This is equivalent to using [`map_addr`] to atomically perform
|
||||
/// `ptr = ptr.map_addr(|a| a & val)`. This can be used in tagged
|
||||
/// pointer schemes to atomically unset tag bits.
|
||||
///
|
||||
/// **Caveat**: This operation returns the previous value. To compute the
|
||||
|
@ -1743,8 +1743,8 @@ impl<T> AtomicPtr<T> {
|
|||
/// pointer, and the argument `val`, and stores a pointer with provenance of
|
||||
/// the current pointer and the resulting address.
|
||||
///
|
||||
/// This is equivalent equivalent to using [`map_addr`] to atomically
|
||||
/// perform `ptr = ptr.map_addr(|a| a ^ val)`. This can be used in tagged
|
||||
/// This is equivalent to using [`map_addr`] to atomically perform
|
||||
/// `ptr = ptr.map_addr(|a| a ^ val)`. This can be used in tagged
|
||||
/// pointer schemes to atomically toggle tag bits.
|
||||
///
|
||||
/// **Caveat**: This operation returns the previous value. To compute the
|
||||
|
|
|
@ -172,7 +172,7 @@ fn test_can_not_overflow() {
|
|||
|
||||
// Calcutate the string length for the smallest overflowing number:
|
||||
let max_len_string = format_radix(num, base as u128);
|
||||
// Ensure that that string length is deemed to potentially overflow:
|
||||
// Ensure that string length is deemed to potentially overflow:
|
||||
assert!(can_overflow::<$t>(base, &max_len_string));
|
||||
}
|
||||
)*)
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
use super::raw::{AsRawFd, FromRawFd, IntoRawFd, RawFd};
|
||||
use crate::fmt;
|
||||
use crate::fs;
|
||||
use crate::io;
|
||||
use crate::marker::PhantomData;
|
||||
use crate::mem::forget;
|
||||
#[cfg(not(any(target_arch = "wasm32", target_env = "sgx")))]
|
||||
|
@ -385,3 +386,54 @@ impl<T: AsFd> AsFd for Box<T> {
|
|||
(**self).as_fd()
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "io_safety", since = "1.63.0")]
|
||||
impl AsFd for io::Stdin {
|
||||
#[inline]
|
||||
fn as_fd(&self) -> BorrowedFd<'_> {
|
||||
unsafe { BorrowedFd::borrow_raw(0) }
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "io_safety", since = "1.63.0")]
|
||||
impl<'a> AsFd for io::StdinLock<'a> {
|
||||
#[inline]
|
||||
fn as_fd(&self) -> BorrowedFd<'_> {
|
||||
// SAFETY: user code should not close stdin out from under the standard library
|
||||
unsafe { BorrowedFd::borrow_raw(0) }
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "io_safety", since = "1.63.0")]
|
||||
impl AsFd for io::Stdout {
|
||||
#[inline]
|
||||
fn as_fd(&self) -> BorrowedFd<'_> {
|
||||
unsafe { BorrowedFd::borrow_raw(1) }
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "io_safety", since = "1.63.0")]
|
||||
impl<'a> AsFd for io::StdoutLock<'a> {
|
||||
#[inline]
|
||||
fn as_fd(&self) -> BorrowedFd<'_> {
|
||||
// SAFETY: user code should not close stdout out from under the standard library
|
||||
unsafe { BorrowedFd::borrow_raw(1) }
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "io_safety", since = "1.63.0")]
|
||||
impl AsFd for io::Stderr {
|
||||
#[inline]
|
||||
fn as_fd(&self) -> BorrowedFd<'_> {
|
||||
unsafe { BorrowedFd::borrow_raw(2) }
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "io_safety", since = "1.63.0")]
|
||||
impl<'a> AsFd for io::StderrLock<'a> {
|
||||
#[inline]
|
||||
fn as_fd(&self) -> BorrowedFd<'_> {
|
||||
// SAFETY: user code should not close stderr out from under the standard library
|
||||
unsafe { BorrowedFd::borrow_raw(2) }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1629,7 +1629,7 @@ impl ExitStatusError {
|
|||
///
|
||||
/// This is exactly like [`code()`](Self::code), except that it returns a `NonZeroI32`.
|
||||
///
|
||||
/// Plain `code`, returning a plain integer, is provided because is is often more convenient.
|
||||
/// Plain `code`, returning a plain integer, is provided because it is often more convenient.
|
||||
/// The returned value from `code()` is indeed also nonzero; use `code_nonzero()` when you want
|
||||
/// a type-level guarantee of nonzeroness.
|
||||
///
|
||||
|
|
|
@ -287,7 +287,7 @@ impl ExitStatus {
|
|||
// SuS and POSIX) say a wait status is, but Fuchsia apparently uses a u64, so it won't
|
||||
// necessarily fit.
|
||||
//
|
||||
// It seems to me that that the right answer would be to provide std::os::fuchsia with its
|
||||
// It seems to me that the right answer would be to provide std::os::fuchsia with its
|
||||
// own ExitStatusExt, rather that trying to provide a not very convincing imitation of
|
||||
// Unix. Ie, std::os::unix::process:ExitStatusExt ought not to exist on Fuchsia. But
|
||||
// fixing this up that is beyond the scope of my efforts now.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use crate::io::{self, IoSlice, IoSliceMut};
|
||||
use crate::mem::ManuallyDrop;
|
||||
use crate::os::unix::io::{AsFd, BorrowedFd, FromRawFd};
|
||||
use crate::os::unix::io::FromRawFd;
|
||||
use crate::sys::fd::FileDesc;
|
||||
|
||||
pub struct Stdin(());
|
||||
|
@ -91,51 +91,3 @@ pub const STDIN_BUF_SIZE: usize = crate::sys_common::io::DEFAULT_BUF_SIZE;
|
|||
pub fn panic_output() -> Option<impl io::Write> {
|
||||
Some(Stderr::new())
|
||||
}
|
||||
|
||||
#[stable(feature = "io_safety", since = "1.63.0")]
|
||||
impl AsFd for io::Stdin {
|
||||
#[inline]
|
||||
fn as_fd(&self) -> BorrowedFd<'_> {
|
||||
unsafe { BorrowedFd::borrow_raw(libc::STDIN_FILENO) }
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "io_safety", since = "1.63.0")]
|
||||
impl<'a> AsFd for io::StdinLock<'a> {
|
||||
#[inline]
|
||||
fn as_fd(&self) -> BorrowedFd<'_> {
|
||||
unsafe { BorrowedFd::borrow_raw(libc::STDIN_FILENO) }
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "io_safety", since = "1.63.0")]
|
||||
impl AsFd for io::Stdout {
|
||||
#[inline]
|
||||
fn as_fd(&self) -> BorrowedFd<'_> {
|
||||
unsafe { BorrowedFd::borrow_raw(libc::STDOUT_FILENO) }
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "io_safety", since = "1.63.0")]
|
||||
impl<'a> AsFd for io::StdoutLock<'a> {
|
||||
#[inline]
|
||||
fn as_fd(&self) -> BorrowedFd<'_> {
|
||||
unsafe { BorrowedFd::borrow_raw(libc::STDOUT_FILENO) }
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "io_safety", since = "1.63.0")]
|
||||
impl AsFd for io::Stderr {
|
||||
#[inline]
|
||||
fn as_fd(&self) -> BorrowedFd<'_> {
|
||||
unsafe { BorrowedFd::borrow_raw(libc::STDERR_FILENO) }
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "io_safety", since = "1.63.0")]
|
||||
impl<'a> AsFd for io::StderrLock<'a> {
|
||||
#[inline]
|
||||
fn as_fd(&self) -> BorrowedFd<'_> {
|
||||
unsafe { BorrowedFd::borrow_raw(libc::STDERR_FILENO) }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ use super::fd::WasiFd;
|
|||
use crate::io::{self, IoSlice, IoSliceMut};
|
||||
use crate::mem::ManuallyDrop;
|
||||
use crate::os::raw;
|
||||
use crate::os::wasi::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd};
|
||||
use crate::os::wasi::io::{AsRawFd, FromRawFd};
|
||||
|
||||
pub struct Stdin;
|
||||
pub struct Stdout;
|
||||
|
@ -23,22 +23,6 @@ impl AsRawFd for Stdin {
|
|||
}
|
||||
}
|
||||
|
||||
impl AsFd for Stdin {
|
||||
#[inline]
|
||||
fn as_fd(&self) -> BorrowedFd<'_> {
|
||||
unsafe { BorrowedFd::borrow_raw(0) }
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "io_safety", since = "1.63.0")]
|
||||
impl<'a> AsFd for io::StdinLock<'a> {
|
||||
#[inline]
|
||||
fn as_fd(&self) -> BorrowedFd<'_> {
|
||||
// SAFETY: user code should not close stdin out from under the standard library
|
||||
unsafe { BorrowedFd::borrow_raw(0) }
|
||||
}
|
||||
}
|
||||
|
||||
impl io::Read for Stdin {
|
||||
fn read(&mut self, data: &mut [u8]) -> io::Result<usize> {
|
||||
self.read_vectored(&mut [IoSliceMut::new(data)])
|
||||
|
@ -67,22 +51,6 @@ impl AsRawFd for Stdout {
|
|||
}
|
||||
}
|
||||
|
||||
impl AsFd for Stdout {
|
||||
#[inline]
|
||||
fn as_fd(&self) -> BorrowedFd<'_> {
|
||||
unsafe { BorrowedFd::borrow_raw(1) }
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "io_safety", since = "1.63.0")]
|
||||
impl<'a> AsFd for io::StdoutLock<'a> {
|
||||
#[inline]
|
||||
fn as_fd(&self) -> BorrowedFd<'_> {
|
||||
// SAFETY: user code should not close stdout out from under the standard library
|
||||
unsafe { BorrowedFd::borrow_raw(1) }
|
||||
}
|
||||
}
|
||||
|
||||
impl io::Write for Stdout {
|
||||
fn write(&mut self, data: &[u8]) -> io::Result<usize> {
|
||||
self.write_vectored(&[IoSlice::new(data)])
|
||||
|
@ -114,22 +82,6 @@ impl AsRawFd for Stderr {
|
|||
}
|
||||
}
|
||||
|
||||
impl AsFd for Stderr {
|
||||
#[inline]
|
||||
fn as_fd(&self) -> BorrowedFd<'_> {
|
||||
unsafe { BorrowedFd::borrow_raw(2) }
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "io_safety", since = "1.63.0")]
|
||||
impl<'a> AsFd for io::StderrLock<'a> {
|
||||
#[inline]
|
||||
fn as_fd(&self) -> BorrowedFd<'_> {
|
||||
// SAFETY: user code should not close stderr out from under the standard library
|
||||
unsafe { BorrowedFd::borrow_raw(2) }
|
||||
}
|
||||
}
|
||||
|
||||
impl io::Write for Stderr {
|
||||
fn write(&mut self, data: &[u8]) -> io::Result<usize> {
|
||||
self.write_vectored(&[IoSlice::new(data)])
|
||||
|
|
|
@ -464,7 +464,7 @@ fn copy_sanitizers(
|
|||
builder.copy(&runtime.path, &dst);
|
||||
|
||||
if target == "x86_64-apple-darwin" || target == "aarch64-apple-darwin" {
|
||||
// Update the library’s install name to reflect that it has has been renamed.
|
||||
// Update the library’s install name to reflect that it has been renamed.
|
||||
apple_darwin_update_library_name(&dst, &format!("@rpath/{}", &runtime.name));
|
||||
// Upon renaming the install name, the code signature of the file will invalidate,
|
||||
// so we will sign it again.
|
||||
|
|
|
@ -1514,7 +1514,7 @@ pub(crate) fn clean_ty<'tcx>(ty: &hir::Ty<'tcx>, cx: &mut DocContext<'tcx>) -> T
|
|||
// as we currently do not supply the parent generics to anonymous constants
|
||||
// but do allow `ConstKind::Param`.
|
||||
//
|
||||
// `const_eval_poly` tries to to first substitute generic parameters which
|
||||
// `const_eval_poly` tries to first substitute generic parameters which
|
||||
// results in an ICE while manually constructing the constant and using `eval`
|
||||
// does nothing for `ConstKind::Param`.
|
||||
let ct = ty::Const::from_anon_const(cx.tcx, def_id);
|
||||
|
|
|
@ -612,7 +612,7 @@ fn generate_macro_def_id_path(
|
|||
};
|
||||
if path.len() < 2 {
|
||||
// The minimum we can have is the crate name followed by the macro name. If shorter, then
|
||||
// it means that that `relative` was empty, which is an error.
|
||||
// it means that `relative` was empty, which is an error.
|
||||
debug!("macro path cannot be empty!");
|
||||
return Err(HrefError::NotInExternalCache);
|
||||
}
|
||||
|
|
|
@ -808,9 +808,6 @@ table,
|
|||
height: 34px;
|
||||
margin-top: 4px;
|
||||
}
|
||||
.search-container > * {
|
||||
height: 100%;
|
||||
}
|
||||
.search-results-title {
|
||||
margin-top: 0;
|
||||
white-space: nowrap;
|
||||
|
@ -1089,8 +1086,55 @@ so that we can apply CSS-filters to change the arrow color in themes */
|
|||
color: var(--right-side-color);
|
||||
}
|
||||
|
||||
pre.rust {
|
||||
tab-size: 4;
|
||||
-moz-tab-size: 4;
|
||||
}
|
||||
|
||||
/* Code highlighting */
|
||||
pre.rust .kw {
|
||||
color: var(--code-highlight-kw-color);
|
||||
}
|
||||
pre.rust .kw-2 {
|
||||
color: var(--code-highlight-kw-2-color);
|
||||
}
|
||||
pre.rust .lifetime {
|
||||
color: var(--code-highlight-lifetime-color);
|
||||
}
|
||||
pre.rust .prelude-ty {
|
||||
color: var(--code-highlight-prelude-color);
|
||||
}
|
||||
pre.rust .prelude-val {
|
||||
color: var(--code-highlight-prelude-val-color);
|
||||
}
|
||||
pre.rust .string {
|
||||
color: var(--code-highlight-string-color);
|
||||
}
|
||||
pre.rust .number {
|
||||
color: var(--code-highlight-number-color);
|
||||
}
|
||||
pre.rust .bool-val {
|
||||
color: var(--code-highlight-literal-color);
|
||||
}
|
||||
pre.rust .self {
|
||||
color: var(--code-highlight-self-color);
|
||||
}
|
||||
pre.rust .attribute {
|
||||
color: var(--code-highlight-attribute-color);
|
||||
}
|
||||
pre.rust .macro,
|
||||
pre.rust .macro-nonterminal {
|
||||
color: var(--code-highlight-macro-color);
|
||||
}
|
||||
pre.rust .question-mark {
|
||||
font-weight: bold;
|
||||
color: var(--code-highlight-question-mark-color);
|
||||
}
|
||||
pre.rust .comment {
|
||||
color: var(--code-highlight-comment-color);
|
||||
}
|
||||
pre.rust .doccomment {
|
||||
color: var(--code-highlight-doc-comment-color);
|
||||
}
|
||||
|
||||
.example-wrap.compile_fail,
|
||||
|
@ -1296,11 +1340,6 @@ h3.variant {
|
|||
font-size: 1.25rem;
|
||||
}
|
||||
|
||||
pre.rust {
|
||||
tab-size: 4;
|
||||
-moz-tab-size: 4;
|
||||
}
|
||||
|
||||
.search-failed {
|
||||
text-align: center;
|
||||
margin-top: 20px;
|
||||
|
|
|
@ -41,6 +41,20 @@ Original by Dempfi (https://github.com/dempfi/ayu)
|
|||
--stab-background-color: #314559;
|
||||
--stab-code-color: #e6e1cf;
|
||||
--search-color: #fff;
|
||||
--code-highlight-kw-color: #ff7733;
|
||||
--code-highlight-kw-2-color: #ff7733;
|
||||
--code-highlight-lifetime-color: #ff7733;
|
||||
--code-highlight-prelude-color: #69f2df;
|
||||
--code-highlight-prelude-val-color: #ff7733;
|
||||
--code-highlight-number-color: #b8cc52;
|
||||
--code-highlight-string-color: #b8cc52;
|
||||
--code-highlight-literal-color: #ff7733;
|
||||
--code-highlight-attribute-color: #e6e1cf;
|
||||
--code-highlight-self-color: #36a3d9;
|
||||
--code-highlight-macro-color: #a37acc;
|
||||
--code-highlight-question-mark-color: #ff9011;
|
||||
--code-highlight-comment-color: #788797;
|
||||
--code-highlight-doc-comment-color: #a1ac88;
|
||||
}
|
||||
|
||||
.slider {
|
||||
|
@ -124,9 +138,6 @@ pre, .rustdoc.source .example-wrap {
|
|||
|
||||
.content .item-info::before { color: #ccc; }
|
||||
|
||||
pre.rust .comment { color: #788797; }
|
||||
pre.rust .doccomment { color: #a1ac88; }
|
||||
|
||||
.sidebar h2 a,
|
||||
.sidebar h3 a {
|
||||
color: white;
|
||||
|
@ -161,23 +172,6 @@ details.rustdoc-toggle > summary::before {
|
|||
|
||||
.src-line-numbers :target { background-color: transparent; }
|
||||
|
||||
/* Code highlighting */
|
||||
pre.rust .number, pre.rust .string { color: #b8cc52; }
|
||||
pre.rust .kw, pre.rust .kw-2, pre.rust .prelude-ty,
|
||||
pre.rust .bool-val, pre.rust .prelude-val,
|
||||
pre.rust .lifetime { color: #ff7733; }
|
||||
pre.rust .macro, pre.rust .macro-nonterminal { color: #a37acc; }
|
||||
pre.rust .question-mark {
|
||||
color: #ff9011;
|
||||
}
|
||||
pre.rust .self {
|
||||
color: #36a3d9;
|
||||
font-style: italic;
|
||||
}
|
||||
pre.rust .attribute {
|
||||
color: #e6e1cf;
|
||||
}
|
||||
|
||||
pre.example-line-numbers {
|
||||
color: #5c67736e;
|
||||
border: none;
|
||||
|
|
|
@ -36,6 +36,20 @@
|
|||
--stab-background-color: #314559;
|
||||
--stab-code-color: #e6e1cf;
|
||||
--search-color: #111;
|
||||
--code-highlight-kw-color: #ab8ac1;
|
||||
--code-highlight-kw-2-color: #769acb;
|
||||
--code-highlight-lifetime-color: #d97f26;
|
||||
--code-highlight-prelude-color: #769acb;
|
||||
--code-highlight-prelude-val-color: #ee6868;
|
||||
--code-highlight-number-color: #83a300;
|
||||
--code-highlight-string-color: #83a300;
|
||||
--code-highlight-literal-color: #ee6868;
|
||||
--code-highlight-attribute-color: #ee6868;
|
||||
--code-highlight-self-color: #ee6868;
|
||||
--code-highlight-macro-color: #3e999f;
|
||||
--code-highlight-question-mark-color: #ff9011;
|
||||
--code-highlight-comment-color: #8d8d8b;
|
||||
--code-highlight-doc-comment-color: #8ca375;
|
||||
}
|
||||
|
||||
.slider {
|
||||
|
@ -62,9 +76,6 @@ input:focus + .slider {
|
|||
|
||||
.content .item-info::before { color: #ccc; }
|
||||
|
||||
pre.rust .comment { color: #8d8d8b; }
|
||||
pre.rust .doccomment { color: #8ca375; }
|
||||
|
||||
body.source .example-wrap pre.rust a {
|
||||
background: #333;
|
||||
}
|
||||
|
@ -86,18 +97,6 @@ details.rustdoc-toggle > summary::before {
|
|||
|
||||
.src-line-numbers :target { background-color: transparent; }
|
||||
|
||||
/* Code highlighting */
|
||||
pre.rust .kw { color: #ab8ac1; }
|
||||
pre.rust .kw-2, pre.rust .prelude-ty { color: #769acb; }
|
||||
pre.rust .number, pre.rust .string { color: #83a300; }
|
||||
pre.rust .self, pre.rust .bool-val, pre.rust .prelude-val,
|
||||
pre.rust .attribute { color: #ee6868; }
|
||||
pre.rust .macro, pre.rust .macro-nonterminal { color: #3E999F; }
|
||||
pre.rust .lifetime { color: #d97f26; }
|
||||
pre.rust .question-mark {
|
||||
color: #ff9011;
|
||||
}
|
||||
|
||||
pre.example-line-numbers {
|
||||
border-color: #4a4949;
|
||||
}
|
||||
|
|
|
@ -36,6 +36,20 @@
|
|||
--stab-background-color: #fff5d6;
|
||||
--stab-code-color: #000;
|
||||
--search-color: #000;
|
||||
--code-highlight-kw-color: #8959a8;
|
||||
--code-highlight-kw-2-color: #4271ae;
|
||||
--code-highlight-lifetime-color: #b76514;
|
||||
--code-highlight-prelude-color: #4271ae;
|
||||
--code-highlight-prelude-val-color: #c82829;
|
||||
--code-highlight-number-color: #718c00;
|
||||
--code-highlight-string-color: #718c00;
|
||||
--code-highlight-literal-color: #c82829;
|
||||
--code-highlight-attribute-color: #c82829;
|
||||
--code-highlight-self-color: #c82829;
|
||||
--code-highlight-macro-color: #3e999f;
|
||||
--code-highlight-question-mark-color: #ff9011;
|
||||
--code-highlight-comment-color: #8e908c;
|
||||
--code-highlight-doc-comment-color: #4d4d4c;
|
||||
}
|
||||
|
||||
.slider {
|
||||
|
@ -78,20 +92,6 @@ body.source .example-wrap pre.rust a {
|
|||
|
||||
.src-line-numbers :target { background-color: transparent; }
|
||||
|
||||
/* Code highlighting */
|
||||
pre.rust .kw { color: #8959A8; }
|
||||
pre.rust .kw-2, pre.rust .prelude-ty { color: #4271AE; }
|
||||
pre.rust .number, pre.rust .string { color: #718C00; }
|
||||
pre.rust .self, pre.rust .bool-val, pre.rust .prelude-val,
|
||||
pre.rust .attribute { color: #C82829; }
|
||||
pre.rust .comment { color: #8E908C; }
|
||||
pre.rust .doccomment { color: #4D4D4C; }
|
||||
pre.rust .macro, pre.rust .macro-nonterminal { color: #3E999F; }
|
||||
pre.rust .lifetime { color: #B76514; }
|
||||
pre.rust .question-mark {
|
||||
color: #ff9011;
|
||||
}
|
||||
|
||||
pre.example-line-numbers {
|
||||
border-color: #c7c7c7;
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ pub struct Foo {
|
|||
|
||||
// Going from an aggregate struct to another type currently requires Copy to
|
||||
// enable the TrustedRandomAccess specialization. Without it optimizations do not yet
|
||||
// reliably recognize the loops as noop for for repr(C) or non-Copy structs.
|
||||
// reliably recognize the loops as noop for repr(C) or non-Copy structs.
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct Bar {
|
||||
a: u64,
|
||||
|
|
57
src/test/rustdoc-gui/highlight-colors.goml
Normal file
57
src/test/rustdoc-gui/highlight-colors.goml
Normal file
|
@ -0,0 +1,57 @@
|
|||
// This test checks the highlight colors in the source code pages.
|
||||
goto: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html"
|
||||
show-text: true
|
||||
|
||||
local-storage: {"rustdoc-theme": "ayu", "rustdoc-use-system-theme": "false"}
|
||||
reload:
|
||||
|
||||
assert-css: ("pre.rust .kw", {"color": "rgb(255, 119, 51)"}, ALL)
|
||||
assert-css: ("pre.rust .kw-2", {"color": "rgb(255, 119, 51)"}, ALL)
|
||||
assert-css: ("pre.rust .prelude-ty", {"color": "rgb(105, 242, 223)"}, ALL)
|
||||
assert-css: ("pre.rust .prelude-val", {"color": "rgb(255, 119, 51)"}, ALL)
|
||||
assert-css: ("pre.rust .lifetime", {"color": "rgb(255, 119, 51)"}, ALL)
|
||||
assert-css: ("pre.rust .number", {"color": "rgb(184, 204, 82)"}, ALL)
|
||||
assert-css: ("pre.rust .string", {"color": "rgb(184, 204, 82)"}, ALL)
|
||||
assert-css: ("pre.rust .bool-val", {"color": "rgb(255, 119, 51)"}, ALL)
|
||||
assert-css: ("pre.rust .self", {"color": "rgb(54, 163, 217)"}, ALL)
|
||||
assert-css: ("pre.rust .attribute", {"color": "rgb(230, 225, 207)"}, ALL)
|
||||
assert-css: ("pre.rust .macro", {"color": "rgb(163, 122, 204)"}, ALL)
|
||||
assert-css: ("pre.rust .question-mark", {"color": "rgb(255, 144, 17)"}, ALL)
|
||||
assert-css: ("pre.rust .comment", {"color": "rgb(120, 135, 151)"}, ALL)
|
||||
assert-css: ("pre.rust .doccomment", {"color": "rgb(161, 172, 136)"}, ALL)
|
||||
|
||||
local-storage: {"rustdoc-theme": "dark"}
|
||||
reload:
|
||||
|
||||
assert-css: ("pre.rust .kw", {"color": "rgb(171, 138, 193)"}, ALL)
|
||||
assert-css: ("pre.rust .kw-2", {"color": "rgb(118, 154, 203)"}, ALL)
|
||||
assert-css: ("pre.rust .prelude-ty", {"color": "rgb(118, 154, 203)"}, ALL)
|
||||
assert-css: ("pre.rust .prelude-val", {"color": "rgb(238, 104, 104)"}, ALL)
|
||||
assert-css: ("pre.rust .lifetime", {"color": "rgb(217, 127, 38)"}, ALL)
|
||||
assert-css: ("pre.rust .number", {"color": "rgb(131, 163, 0)"}, ALL)
|
||||
assert-css: ("pre.rust .string", {"color": "rgb(131, 163, 0)"}, ALL)
|
||||
assert-css: ("pre.rust .bool-val", {"color": "rgb(238, 104, 104)"}, ALL)
|
||||
assert-css: ("pre.rust .self", {"color": "rgb(238, 104, 104)"}, ALL)
|
||||
assert-css: ("pre.rust .attribute", {"color": "rgb(238, 104, 104)"}, ALL)
|
||||
assert-css: ("pre.rust .macro", {"color": "rgb(62, 153, 159)"}, ALL)
|
||||
assert-css: ("pre.rust .question-mark", {"color": "rgb(255, 144, 17)"}, ALL)
|
||||
assert-css: ("pre.rust .comment", {"color": "rgb(141, 141, 139)"}, ALL)
|
||||
assert-css: ("pre.rust .doccomment", {"color": "rgb(140, 163, 117)"}, ALL)
|
||||
|
||||
local-storage: {"rustdoc-theme": "light"}
|
||||
reload:
|
||||
|
||||
assert-css: ("pre.rust .kw", {"color": "rgb(137, 89, 168)"}, ALL)
|
||||
assert-css: ("pre.rust .kw-2", {"color": "rgb(66, 113, 174)"}, ALL)
|
||||
assert-css: ("pre.rust .prelude-ty", {"color": "rgb(66, 113, 174)"}, ALL)
|
||||
assert-css: ("pre.rust .prelude-val", {"color": "rgb(200, 40, 41)"}, ALL)
|
||||
assert-css: ("pre.rust .lifetime", {"color": "rgb(183, 101, 20)"}, ALL)
|
||||
assert-css: ("pre.rust .number", {"color": "rgb(113, 140, 0)"}, ALL)
|
||||
assert-css: ("pre.rust .string", {"color": "rgb(113, 140, 0)"}, ALL)
|
||||
assert-css: ("pre.rust .bool-val", {"color": "rgb(200, 40, 41)"}, ALL)
|
||||
assert-css: ("pre.rust .self", {"color": "rgb(200, 40, 41)"}, ALL)
|
||||
assert-css: ("pre.rust .attribute", {"color": "rgb(200, 40, 41)"}, ALL)
|
||||
assert-css: ("pre.rust .macro", {"color": "rgb(62, 153, 159)"}, ALL)
|
||||
assert-css: ("pre.rust .question-mark", {"color": "rgb(255, 144, 17)"}, ALL)
|
||||
assert-css: ("pre.rust .comment", {"color": "rgb(142, 144, 140)"}, ALL)
|
||||
assert-css: ("pre.rust .doccomment", {"color": "rgb(77, 77, 76)"}, ALL)
|
|
@ -363,9 +363,24 @@ pub trait TraitWithNoDocblocks {
|
|||
|
||||
pub struct TypeWithNoDocblocks;
|
||||
|
||||
impl TypeWithNoDocblocks {
|
||||
fn x() -> Option<Self> {
|
||||
Some(Self)
|
||||
}
|
||||
fn y() -> Option<u32> {
|
||||
// code comment
|
||||
let t = Self::x()?;
|
||||
Some(0)
|
||||
}
|
||||
}
|
||||
|
||||
impl TypeWithNoDocblocks {
|
||||
pub fn first_fn(&self) {}
|
||||
pub fn second_fn(&self) {}
|
||||
pub fn second_fn<'a>(&'a self) {
|
||||
let x = 12;
|
||||
let y = "a";
|
||||
let z = false;
|
||||
}
|
||||
}
|
||||
|
||||
pub unsafe fn unsafe_fn() {}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
error[E0201]: duplicate definitions with name `bar`:
|
||||
error[E0592]: duplicate definitions with name `bar`
|
||||
--> $DIR/associated-item-duplicate-names-2.rs:5:5
|
||||
|
|
||||
LL | const bar: bool = true;
|
||||
| --------------- previous definition of `bar` here
|
||||
| --------------- other definition for `bar`
|
||||
LL | fn bar() {}
|
||||
| ^^^^^^^^ duplicate definition
|
||||
| ^^^^^^^^ duplicate definitions for `bar`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0201`.
|
||||
For more information about this error, try `rustc --explain E0592`.
|
||||
|
|
|
@ -3,7 +3,7 @@ struct Foo;
|
|||
impl Foo {
|
||||
fn orange(&self) {}
|
||||
fn orange(&self) {}
|
||||
//~^ ERROR duplicate definition
|
||||
//~^ ERROR duplicate definitions with name `orange` [E0592]
|
||||
}
|
||||
|
||||
fn main() {}
|
11
src/test/ui/associated-item/impl-duplicate-methods.stderr
Normal file
11
src/test/ui/associated-item/impl-duplicate-methods.stderr
Normal file
|
@ -0,0 +1,11 @@
|
|||
error[E0592]: duplicate definitions with name `orange`
|
||||
--> $DIR/impl-duplicate-methods.rs:5:5
|
||||
|
|
||||
LL | fn orange(&self) {}
|
||||
| ---------------- other definition for `orange`
|
||||
LL | fn orange(&self) {}
|
||||
| ^^^^^^^^^^^^^^^^ duplicate definitions for `orange`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0592`.
|
|
@ -2,7 +2,7 @@ struct Foo(u8);
|
|||
|
||||
impl Foo {
|
||||
fn bar(&self) -> bool { self.0 > 5 }
|
||||
fn bar() {} //~ ERROR E0201
|
||||
fn bar() {} //~ ERROR E0592
|
||||
}
|
||||
|
||||
trait Baz {
|
||||
|
|
|
@ -21,14 +21,15 @@ LL | type Quux = u32;
|
|||
LL | type Quux = u32;
|
||||
| ^^^^^^^^^^^^^^^^ duplicate definition
|
||||
|
||||
error[E0201]: duplicate definitions with name `bar`:
|
||||
error[E0592]: duplicate definitions with name `bar`
|
||||
--> $DIR/E0201.rs:5:5
|
||||
|
|
||||
LL | fn bar(&self) -> bool { self.0 > 5 }
|
||||
| --------------------- previous definition of `bar` here
|
||||
| --------------------- other definition for `bar`
|
||||
LL | fn bar() {}
|
||||
| ^^^^^^^^ duplicate definition
|
||||
| ^^^^^^^^ duplicate definitions for `bar`
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0201`.
|
||||
Some errors have detailed explanations: E0201, E0592.
|
||||
For more information about an error, try `rustc --explain E0201`.
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
error[E0201]: duplicate definitions with name `orange`:
|
||||
--> $DIR/impl-duplicate-methods.rs:5:5
|
||||
|
|
||||
LL | fn orange(&self) {}
|
||||
| ---------------- previous definition of `orange` here
|
||||
LL | fn orange(&self) {}
|
||||
| ^^^^^^^^^^^^^^^^ duplicate definition
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0201`.
|
|
@ -1,12 +1,12 @@
|
|||
error[E0201]: duplicate definitions with name `bar`:
|
||||
error[E0592]: duplicate definitions with name `bar`
|
||||
--> $DIR/issue-4265.rs:10:5
|
||||
|
|
||||
LL | fn bar() {
|
||||
| -------- previous definition of `bar` here
|
||||
| -------- other definition for `bar`
|
||||
...
|
||||
LL | fn bar() {
|
||||
| ^^^^^^^^ duplicate definition
|
||||
| ^^^^^^^^ duplicate definitions for `bar`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0201`.
|
||||
For more information about this error, try `rustc --explain E0592`.
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
#[derive(Clone)]
|
||||
struct InGroup<F> {
|
||||
it: It,
|
||||
//~^ ERROR cannot find type `It` in this scope
|
||||
f: F,
|
||||
}
|
||||
fn dates_in_year() -> impl Clone {
|
||||
InGroup { f: |d| d }
|
||||
//~^ ERROR missing field `it` in initializer of `InGroup<_>`
|
||||
}
|
||||
|
||||
fn main() {}
|
|
@ -1,16 +0,0 @@
|
|||
error[E0412]: cannot find type `It` in this scope
|
||||
--> $DIR/issue-77993-1.rs:3:9
|
||||
|
|
||||
LL | it: It,
|
||||
| ^^ not found in this scope
|
||||
|
||||
error[E0063]: missing field `it` in initializer of `InGroup<_>`
|
||||
--> $DIR/issue-77993-1.rs:8:5
|
||||
|
|
||||
LL | InGroup { f: |d| d }
|
||||
| ^^^^^^^ missing `it`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0063, E0412.
|
||||
For more information about an error, try `rustc --explain E0063`.
|
|
@ -1,8 +1,6 @@
|
|||
//
|
||||
// popped up in in #94012, where an alternative desugaring was
|
||||
// popped up in #94012, where an alternative desugaring was
|
||||
// causing unreachable code errors
|
||||
|
||||
|
||||
#![deny(unused_variables)]
|
||||
#![deny(unreachable_code)]
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
error: unused variable: `x`
|
||||
--> $DIR/let-else-then-diverge.rs:11:13
|
||||
--> $DIR/let-else-then-diverge.rs:9:13
|
||||
|
|
||||
LL | let x = 5;
|
||||
| ^ help: if this is intentional, prefix it with an underscore: `_x`
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/let-else-then-diverge.rs:6:9
|
||||
--> $DIR/let-else-then-diverge.rs:4:9
|
||||
|
|
||||
LL | #![deny(unused_variables)]
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
error[E0201]: duplicate definitions with name `bar`:
|
||||
error[E0592]: duplicate definitions with name `bar`
|
||||
--> $DIR/method-macro-backtrace.rs:22:5
|
||||
|
|
||||
LL | fn bar(&self) { }
|
||||
| ------------- previous definition of `bar` here
|
||||
| ------------- other definition for `bar`
|
||||
LL | fn bar(&self) { }
|
||||
| ^^^^^^^^^^^^^ duplicate definition
|
||||
| ^^^^^^^^^^^^^ duplicate definitions for `bar`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0201`.
|
||||
For more information about this error, try `rustc --explain E0592`.
|
||||
|
|
|
@ -5,7 +5,7 @@ extern crate call_deprecated;
|
|||
|
||||
// These first two `#[allow(deprecated)]` attributes
|
||||
// do nothing, since the AST nodes for `First` and `Second`
|
||||
// haven't been been assigned a `NodeId`.
|
||||
// haven't been assigned a `NodeId`.
|
||||
// See #63221 for a discussion about how we should
|
||||
// handle the interaction of 'inert' attributes and
|
||||
// proc-macro attributes.
|
||||
|
|
|
@ -75,26 +75,26 @@ LL | if let first = &opt && let None = Some(1) {}
|
|||
= note: this pattern will always match
|
||||
= help: consider moving it outside of the construct
|
||||
|
||||
error: irrefutable `let` patterns
|
||||
error: irrefutable `if let` guard patterns
|
||||
--> $DIR/irrefutable-lets.rs:44:28
|
||||
|
|
||||
LL | Some(ref first) if let second = first && let _third = second && let v = 4 + 4 => {},
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: these patterns will always match, so the `let` is useless
|
||||
= help: consider removing `let`
|
||||
= note: these patterns will always match, so the guard is useless
|
||||
= help: consider removing the guard and adding a `let` inside the match arm
|
||||
|
||||
error: leading irrefutable pattern in let chain
|
||||
--> $DIR/irrefutable-lets.rs:50:28
|
||||
error: trailing irrefutable patterns in let chain
|
||||
--> $DIR/irrefutable-lets.rs:59:16
|
||||
|
|
||||
LL | Some(ref first) if let Range { start: local_start, end: _ } = first
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | && let v = local_end && let w = v => {},
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: this pattern will always match
|
||||
= help: consider moving it outside of the construct
|
||||
= note: these patterns will always match
|
||||
= help: consider moving them into the body
|
||||
|
||||
error: irrefutable `while let` patterns
|
||||
--> $DIR/irrefutable-lets.rs:59:11
|
||||
--> $DIR/irrefutable-lets.rs:68:11
|
||||
|
|
||||
LL | while let first = &opt && let (a, b) = (1, 2) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -103,7 +103,7 @@ LL | while let first = &opt && let (a, b) = (1, 2) {}
|
|||
= help: consider instead using a `loop { ... }` with a `let` inside it
|
||||
|
||||
error: trailing irrefutable patterns in let chain
|
||||
--> $DIR/irrefutable-lets.rs:62:40
|
||||
--> $DIR/irrefutable-lets.rs:71:40
|
||||
|
|
||||
LL | while let Some(ref first) = opt && let second = first && let _third = second {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
|
@ -42,18 +42,27 @@ fn main() {
|
|||
|
||||
match opt {
|
||||
Some(ref first) if let second = first && let _third = second && let v = 4 + 4 => {},
|
||||
//[disallowed]~^ ERROR irrefutable `let` patterns
|
||||
//[disallowed]~^ ERROR irrefutable `if let` guard patterns
|
||||
_ => {}
|
||||
}
|
||||
|
||||
// No error about leading irrefutable patterns: the expr on the rhs might
|
||||
// use the bindings created by the match.
|
||||
match opt {
|
||||
Some(ref first) if let Range { start: local_start, end: _ } = first
|
||||
//[disallowed]~^ ERROR leading irrefutable pattern in let chain
|
||||
&& let None = local_start => {},
|
||||
_ => {}
|
||||
}
|
||||
|
||||
// No error, despite the prefix being irrefutable
|
||||
match opt {
|
||||
Some(ref first) if let Range { start: Some(_), end: local_end } = first
|
||||
&& let v = local_end && let w = v => {},
|
||||
//[disallowed]~^ ERROR trailing irrefutable patterns in let chain
|
||||
_ => {}
|
||||
}
|
||||
|
||||
// No error, despite the prefix being irrefutable: moving out could change the behaviour,
|
||||
// due to possible side effects of the operation.
|
||||
while let first = &opt && let Some(ref second) = first && let None = second.start {}
|
||||
|
||||
while let first = &opt && let (a, b) = (1, 2) {}
|
||||
|
|
|
@ -7,8 +7,8 @@ use std::path::Path;
|
|||
|
||||
const ENTRY_LIMIT: usize = 1000;
|
||||
// FIXME: The following limits should be reduced eventually.
|
||||
const ROOT_ENTRY_LIMIT: usize = 950;
|
||||
const ISSUES_ENTRY_LIMIT: usize = 2141;
|
||||
const ROOT_ENTRY_LIMIT: usize = 948;
|
||||
const ISSUES_ENTRY_LIMIT: usize = 2126;
|
||||
|
||||
fn check_entries(path: &Path, bad: &mut bool) {
|
||||
let dirs = walkdir::WalkDir::new(&path.join("test/ui"))
|
||||
|
|
Loading…
Add table
Reference in a new issue