1
Fork 0

Auto merge of #100740 - Dylan-DPC:rollup-0td6yq4, r=Dylan-DPC

Rollup of 9 pull requests

Successful merges:

 - #99576 (Do not allow `Drop` impl on foreign fundamental types)
 - #100081 (never consider unsafe blocks unused if they would be required with deny(unsafe_op_in_unsafe_fn))
 - #100208 (make NOP dyn casts not require anything about the vtable)
 - #100494 (Cleanup rustdoc themes)
 - #100522 (Only check the `DefId` for the recursion check in MIR inliner.)
 - #100592 (Manually implement Debug for ImportKind.)
 - #100598 (Don't fix builtin index when Where clause is found)
 - #100721 (Add diagnostics lints to `rustc_type_ir` module)
 - #100731 (rustdoc: count deref and non-deref as same set of used methods)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2022-08-19 18:45:41 +00:00
commit e1b28cd2f1
48 changed files with 851 additions and 992 deletions

View file

@ -29,6 +29,7 @@ pub(crate) fn unsized_info<'tcx>(
let old_info =
old_info.expect("unsized_info: missing old info for trait upcasting coercion");
if data_a.principal_def_id() == data_b.principal_def_id() {
// A NOP cast that doesn't actually change anything, should be allowed even with invalid vtables.
return old_info;
}

View file

@ -151,6 +151,7 @@ pub fn unsized_info<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
let old_info =
old_info.expect("unsized_info: missing old info for trait upcasting coercion");
if data_a.principal_def_id() == data_b.principal_def_id() {
// A NOP cast that doesn't actually change anything, should be allowed even with invalid vtables.
return old_info;
}

View file

@ -298,7 +298,12 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
self.write_immediate(val, dest)
}
(&ty::Dynamic(ref data_a, ..), &ty::Dynamic(ref data_b, ..)) => {
let (old_data, old_vptr) = self.read_immediate(src)?.to_scalar_pair()?;
let val = self.read_immediate(src)?;
if data_a.principal() == data_b.principal() {
// A NOP cast that doesn't actually change anything, should be allowed even with mismatching vtables.
return self.write_immediate(*val, dest);
}
let (old_data, old_vptr) = val.to_scalar_pair()?;
let old_vptr = old_vptr.to_pointer(self)?;
let (ty, old_trait) = self.get_ptr_vtable(old_vptr)?;
if old_trait != data_a.principal() {

View file

@ -24,8 +24,8 @@ typeck_lifetimes_or_bounds_mismatch_on_trait =
.generics_label = lifetimes in impl do not match this {$item_kind} in trait
typeck_drop_impl_on_wrong_item =
the `Drop` trait may only be implemented for structs, enums, and unions
.label = must be a struct, enum, or union
the `Drop` trait may only be implemented for local structs, enums, and unions
.label = must be a struct, enum, or union in the current crate
typeck_field_already_declared =
field `{$field_name}` is already declared

View file

@ -566,7 +566,7 @@ impl Drop for DiagnosticBuilderInner<'_> {
),
));
handler.emit_diagnostic(&mut self.diagnostic);
panic!();
panic!("error was constructed but not emitted");
}
}
// `.emit()` was previously called, or maybe we're during `.cancel()`.

View file

@ -2,7 +2,7 @@
use crate::mir::{Body, ConstantKind, Promoted};
use crate::ty::{self, OpaqueHiddenType, Ty, TyCtxt};
use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::fx::FxHashSet;
use rustc_data_structures::vec_map::VecMap;
use rustc_errors::ErrorGuaranteed;
use rustc_hir as hir;
@ -115,21 +115,6 @@ pub enum UnusedUnsafe {
/// `unsafe` block nested under another (used) `unsafe` block
/// > ``… because it's nested under this `unsafe` block``
InUnsafeBlock(hir::HirId),
/// `unsafe` block nested under `unsafe fn`
/// > ``… because it's nested under this `unsafe fn` ``
///
/// the second HirId here indicates the first usage of the `unsafe` block,
/// which allows retrieval of the LintLevelSource for why that operation would
/// have been permitted without the block
InUnsafeFn(hir::HirId, hir::HirId),
}
#[derive(Copy, Clone, PartialEq, TyEncodable, TyDecodable, HashStable, Debug)]
pub enum UsedUnsafeBlockData {
SomeDisallowedInUnsafeFn,
// the HirId here indicates the first usage of the `unsafe` block
// (i.e. the one that's first encountered in the MIR traversal of the unsafety check)
AllAllowedInUnsafeFn(hir::HirId),
}
#[derive(TyEncodable, TyDecodable, HashStable, Debug)]
@ -138,10 +123,7 @@ pub struct UnsafetyCheckResult {
pub violations: Vec<UnsafetyViolation>,
/// Used `unsafe` blocks in this function. This is used for the "unused_unsafe" lint.
///
/// The keys are the used `unsafe` blocks, the UnusedUnsafeKind indicates whether
/// or not any of the usages happen at a place that doesn't allow `unsafe_op_in_unsafe_fn`.
pub used_unsafe_blocks: FxHashMap<hir::HirId, UsedUnsafeBlockData>,
pub used_unsafe_blocks: FxHashSet<hir::HirId>,
/// This is `Some` iff the item is not a closure.
pub unused_unsafes: Option<Vec<(hir::HirId, UnusedUnsafe)>>,

View file

@ -75,10 +75,11 @@ impl<'tcx> UnsafetyVisitor<'_, 'tcx> {
match self.safety_context {
SafetyContext::BuiltinUnsafeBlock => {}
SafetyContext::UnsafeBlock { ref mut used, .. } => {
if !self.body_unsafety.is_unsafe() || !unsafe_op_in_unsafe_fn_allowed {
// Mark this block as useful
*used = true;
}
// Mark this block as useful (even inside `unsafe fn`, where it is technically
// redundant -- but we want to eventually enable `unsafe_op_in_unsafe_fn` by
// default which will require those blocks:
// https://github.com/rust-lang/rust/issues/71668#issuecomment-1203075594).
*used = true;
}
SafetyContext::UnsafeFn if unsafe_op_in_unsafe_fn_allowed => {}
SafetyContext::UnsafeFn => {

View file

@ -1,17 +1,16 @@
use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::fx::FxHashSet;
use rustc_errors::struct_span_err;
use rustc_hir as hir;
use rustc_hir::def_id::{DefId, LocalDefId};
use rustc_hir::hir_id::HirId;
use rustc_hir::intravisit;
use rustc_middle::mir::visit::{MutatingUseContext, PlaceContext, Visitor};
use rustc_middle::mir::*;
use rustc_middle::ty::query::Providers;
use rustc_middle::ty::{self, TyCtxt};
use rustc_middle::{lint, mir::*};
use rustc_session::lint::builtin::{UNSAFE_OP_IN_UNSAFE_FN, UNUSED_UNSAFE};
use rustc_session::lint::Level;
use std::collections::hash_map;
use std::ops::Bound;
pub struct UnsafetyChecker<'a, 'tcx> {
@ -23,10 +22,7 @@ pub struct UnsafetyChecker<'a, 'tcx> {
param_env: ty::ParamEnv<'tcx>,
/// Used `unsafe` blocks in this function. This is used for the "unused_unsafe" lint.
///
/// The keys are the used `unsafe` blocks, the UnusedUnsafeKind indicates whether
/// or not any of the usages happen at a place that doesn't allow `unsafe_op_in_unsafe_fn`.
used_unsafe_blocks: FxHashMap<HirId, UsedUnsafeBlockData>,
used_unsafe_blocks: FxHashSet<HirId>,
}
impl<'a, 'tcx> UnsafetyChecker<'a, 'tcx> {
@ -130,10 +126,7 @@ impl<'tcx> Visitor<'tcx> for UnsafetyChecker<'_, 'tcx> {
&AggregateKind::Closure(def_id, _) | &AggregateKind::Generator(def_id, _, _) => {
let UnsafetyCheckResult { violations, used_unsafe_blocks, .. } =
self.tcx.unsafety_check_result(def_id);
self.register_violations(
violations,
used_unsafe_blocks.iter().map(|(&h, &d)| (h, d)),
);
self.register_violations(violations, used_unsafe_blocks.iter().copied());
}
},
_ => {}
@ -257,22 +250,8 @@ impl<'tcx> UnsafetyChecker<'_, 'tcx> {
fn register_violations<'a>(
&mut self,
violations: impl IntoIterator<Item = &'a UnsafetyViolation>,
new_used_unsafe_blocks: impl IntoIterator<Item = (HirId, UsedUnsafeBlockData)>,
new_used_unsafe_blocks: impl IntoIterator<Item = HirId>,
) {
use UsedUnsafeBlockData::{AllAllowedInUnsafeFn, SomeDisallowedInUnsafeFn};
let update_entry = |this: &mut Self, hir_id, new_usage| {
match this.used_unsafe_blocks.entry(hir_id) {
hash_map::Entry::Occupied(mut entry) => {
if new_usage == SomeDisallowedInUnsafeFn {
*entry.get_mut() = SomeDisallowedInUnsafeFn;
}
}
hash_map::Entry::Vacant(entry) => {
entry.insert(new_usage);
}
};
};
let safety = self.body.source_scopes[self.source_info.scope]
.local_data
.as_ref()
@ -299,22 +278,14 @@ impl<'tcx> UnsafetyChecker<'_, 'tcx> {
}
}),
Safety::BuiltinUnsafe => {}
Safety::ExplicitUnsafe(hir_id) => violations.into_iter().for_each(|violation| {
update_entry(
self,
hir_id,
match self.tcx.lint_level_at_node(UNSAFE_OP_IN_UNSAFE_FN, violation.lint_root).0
{
Level::Allow => AllAllowedInUnsafeFn(violation.lint_root),
_ => SomeDisallowedInUnsafeFn,
},
)
Safety::ExplicitUnsafe(hir_id) => violations.into_iter().for_each(|_violation| {
self.used_unsafe_blocks.insert(hir_id);
}),
};
new_used_unsafe_blocks
.into_iter()
.for_each(|(hir_id, usage_data)| update_entry(self, hir_id, usage_data));
new_used_unsafe_blocks.into_iter().for_each(|hir_id| {
self.used_unsafe_blocks.insert(hir_id);
});
}
fn check_mut_borrowing_layout_constrained_field(
&mut self,
@ -411,34 +382,28 @@ enum Context {
struct UnusedUnsafeVisitor<'a, 'tcx> {
tcx: TyCtxt<'tcx>,
used_unsafe_blocks: &'a FxHashMap<HirId, UsedUnsafeBlockData>,
used_unsafe_blocks: &'a FxHashSet<HirId>,
context: Context,
unused_unsafes: &'a mut Vec<(HirId, UnusedUnsafe)>,
}
impl<'tcx> intravisit::Visitor<'tcx> for UnusedUnsafeVisitor<'_, 'tcx> {
fn visit_block(&mut self, block: &'tcx hir::Block<'tcx>) {
use UsedUnsafeBlockData::{AllAllowedInUnsafeFn, SomeDisallowedInUnsafeFn};
if let hir::BlockCheckMode::UnsafeBlock(hir::UnsafeSource::UserProvided) = block.rules {
let used = match self.tcx.lint_level_at_node(UNUSED_UNSAFE, block.hir_id) {
(Level::Allow, _) => Some(SomeDisallowedInUnsafeFn),
_ => self.used_unsafe_blocks.get(&block.hir_id).copied(),
(Level::Allow, _) => true,
_ => self.used_unsafe_blocks.contains(&block.hir_id),
};
let unused_unsafe = match (self.context, used) {
(_, None) => UnusedUnsafe::Unused,
(Context::Safe, Some(_))
| (Context::UnsafeFn(_), Some(SomeDisallowedInUnsafeFn)) => {
(_, false) => UnusedUnsafe::Unused,
(Context::Safe, true) | (Context::UnsafeFn(_), true) => {
let previous_context = self.context;
self.context = Context::UnsafeBlock(block.hir_id);
intravisit::walk_block(self, block);
self.context = previous_context;
return;
}
(Context::UnsafeFn(hir_id), Some(AllAllowedInUnsafeFn(lint_root))) => {
UnusedUnsafe::InUnsafeFn(hir_id, lint_root)
}
(Context::UnsafeBlock(hir_id), Some(_)) => UnusedUnsafe::InUnsafeBlock(hir_id),
(Context::UnsafeBlock(hir_id), true) => UnusedUnsafe::InUnsafeBlock(hir_id),
};
self.unused_unsafes.push((block.hir_id, unused_unsafe));
}
@ -462,7 +427,7 @@ impl<'tcx> intravisit::Visitor<'tcx> for UnusedUnsafeVisitor<'_, 'tcx> {
fn check_unused_unsafe(
tcx: TyCtxt<'_>,
def_id: LocalDefId,
used_unsafe_blocks: &FxHashMap<HirId, UsedUnsafeBlockData>,
used_unsafe_blocks: &FxHashSet<HirId>,
) -> Vec<(HirId, UnusedUnsafe)> {
let body_id = tcx.hir().maybe_body_owned_by(def_id);
@ -535,25 +500,6 @@ fn report_unused_unsafe(tcx: TyCtxt<'_>, kind: UnusedUnsafe, id: HirId) {
"because it's nested under this `unsafe` block",
);
}
UnusedUnsafe::InUnsafeFn(id, usage_lint_root) => {
db.span_label(
tcx.sess.source_map().guess_head_span(tcx.hir().span(id)),
"because it's nested under this `unsafe` fn",
)
.note(
"this `unsafe` block does contain unsafe operations, \
but those are already allowed in an `unsafe fn`",
);
let (level, source) =
tcx.lint_level_at_node(UNSAFE_OP_IN_UNSAFE_FN, usage_lint_root);
assert_eq!(level, Level::Allow);
lint::explain_lint_level_source(
UNSAFE_OP_IN_UNSAFE_FN,
Level::Allow,
source,
&mut db,
);
}
}
db.emit();

View file

@ -10,6 +10,7 @@ use rustc_middle::mir::*;
use rustc_middle::ty::subst::Subst;
use rustc_middle::ty::{self, ConstKind, Instance, InstanceDef, ParamEnv, Ty, TyCtxt};
use rustc_session::config::OptLevel;
use rustc_span::def_id::DefId;
use rustc_span::{hygiene::ExpnKind, ExpnData, LocalExpnId, Span};
use rustc_target::spec::abi::Abi;
@ -103,8 +104,12 @@ struct Inliner<'tcx> {
param_env: ParamEnv<'tcx>,
/// Caller codegen attributes.
codegen_fn_attrs: &'tcx CodegenFnAttrs,
/// Stack of inlined Instances.
history: Vec<ty::Instance<'tcx>>,
/// Stack of inlined instances.
/// We only check the `DefId` and not the substs because we want to
/// avoid inlining cases of polymorphic recursion.
/// The number of `DefId`s is finite, so checking history is enough
/// to ensure that we do not loop endlessly while inlining.
history: Vec<DefId>,
/// Indicates that the caller body has been modified.
changed: bool,
}
@ -132,7 +137,7 @@ impl<'tcx> Inliner<'tcx> {
Ok(new_blocks) => {
debug!("inlined {}", callsite.callee);
self.changed = true;
self.history.push(callsite.callee);
self.history.push(callsite.callee.def_id());
self.process_blocks(caller_body, new_blocks);
self.history.pop();
}
@ -308,7 +313,7 @@ impl<'tcx> Inliner<'tcx> {
return None;
}
if self.history.contains(&callee) {
if self.history.contains(&callee.def_id()) {
return None;
}

View file

@ -31,7 +31,7 @@ use std::{mem, ptr};
type Res = def::Res<NodeId>;
/// Contains data for specific kinds of imports.
#[derive(Clone, Debug)]
#[derive(Clone)]
pub enum ImportKind<'a> {
Single {
/// `source` in `use prefix::source as target`.
@ -62,6 +62,44 @@ pub enum ImportKind<'a> {
MacroUse,
}
/// Manually implement `Debug` for `ImportKind` because the `source/target_bindings`
/// contain `Cell`s which can introduce infinite loops while printing.
impl<'a> std::fmt::Debug for ImportKind<'a> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
use ImportKind::*;
match self {
Single {
ref source,
ref target,
ref type_ns_only,
ref nested,
ref additional_ids,
// Ignore the following to avoid an infinite loop while printing.
source_bindings: _,
target_bindings: _,
} => f
.debug_struct("Single")
.field("source", source)
.field("target", target)
.field("type_ns_only", type_ns_only)
.field("nested", nested)
.field("additional_ids", additional_ids)
.finish_non_exhaustive(),
Glob { ref is_prelude, ref max_vis } => f
.debug_struct("Glob")
.field("is_prelude", is_prelude)
.field("max_vis", max_vis)
.finish(),
ExternCrate { ref source, ref target } => f
.debug_struct("ExternCrate")
.field("source", source)
.field("target", target)
.finish(),
MacroUse => f.debug_struct("MacroUse").finish(),
}
}
}
/// One import.
#[derive(Debug, Clone)]
pub(crate) struct Import<'a> {

View file

@ -1,6 +1,8 @@
#![feature(fmt_helpers_for_derive)]
#![feature(min_specialization)]
#![feature(rustc_attrs)]
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
#[macro_use]
extern crate bitflags;

View file

@ -3,7 +3,6 @@
// substitutions.
use crate::check::FnCtxt;
use hir::def_id::LocalDefId;
use rustc_data_structures::fx::FxHashMap;
use rustc_errors::ErrorGuaranteed;
@ -16,6 +15,7 @@ use rustc_middle::mir::FakeReadCause;
use rustc_middle::ty::adjustment::{Adjust, Adjustment, PointerCast};
use rustc_middle::ty::fold::{TypeFoldable, TypeFolder, TypeSuperFoldable};
use rustc_middle::ty::visit::{TypeSuperVisitable, TypeVisitable};
use rustc_middle::ty::TypeckResults;
use rustc_middle::ty::{self, ClosureSizeProfileData, Ty, TyCtxt};
use rustc_span::symbol::sym;
use rustc_span::Span;
@ -192,6 +192,27 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> {
}
}
// (ouz-a 1005988): Normally `[T] : std::ops::Index<usize>` should be normalized
// into [T] but currently `Where` clause stops the normalization process for it,
// here we compare types of expr and base in a code without `Where` clause they would be equal
// if they are not we don't modify the expr, hence we bypass the ICE
fn is_builtin_index(
&mut self,
typeck_results: &TypeckResults<'tcx>,
e: &hir::Expr<'_>,
base_ty: Ty<'tcx>,
index_ty: Ty<'tcx>,
) -> bool {
if let Some(elem_ty) = base_ty.builtin_index() {
let Some(exp_ty) = typeck_results.expr_ty_opt(e) else {return false;};
let resolved_exp_ty = self.resolve(exp_ty, &e.span);
elem_ty == resolved_exp_ty && index_ty == self.fcx.tcx.types.usize
} else {
false
}
}
// Similar to operators, indexing is always assumed to be overloaded
// Here, correct cases where an indexing expression can be simplified
// to use builtin indexing because the index type is known to be
@ -222,8 +243,9 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> {
)
});
let index_ty = self.fcx.resolve_vars_if_possible(index_ty);
let resolved_base_ty = self.resolve(*base_ty, &base.span);
if base_ty.builtin_index().is_some() && index_ty == self.fcx.tcx.types.usize {
if self.is_builtin_index(&typeck_results, e, resolved_base_ty, index_ty) {
// Remove the method call record
typeck_results.type_dependent_defs_mut().remove(e.hir_id);
typeck_results.node_substs_mut().remove(e.hir_id);

View file

@ -47,9 +47,11 @@ impl<'tcx> Checker<'tcx> {
}
fn visit_implementation_of_drop(tcx: TyCtxt<'_>, impl_did: LocalDefId) {
// Destructors only work on nominal types.
if let ty::Adt(..) | ty::Error(_) = tcx.type_of(impl_did).kind() {
return;
// Destructors only work on local ADT types.
match tcx.type_of(impl_did).kind() {
ty::Adt(def, _) if def.did().is_local() => return,
ty::Error(_) => return,
_ => {}
}
let sp = match tcx.hir().expect_item(impl_did).kind {

View file

@ -1985,7 +1985,7 @@ fn sidebar_assoc_items(cx: &Context<'_>, out: &mut Buffer, it: &clean::Item) {
{
let mut derefs = FxHashSet::default();
derefs.insert(did);
sidebar_deref_methods(cx, out, impl_, v, &mut derefs);
sidebar_deref_methods(cx, out, impl_, v, &mut derefs, &mut used_links);
}
let format_impls = |impls: Vec<&Impl>, id_map: &mut IdMap| {
@ -2057,6 +2057,7 @@ fn sidebar_deref_methods(
impl_: &Impl,
v: &[Impl],
derefs: &mut FxHashSet<DefId>,
used_links: &mut FxHashSet<String>,
) {
let c = cx.cache();
@ -2089,13 +2090,10 @@ fn sidebar_deref_methods(
.and_then(|did| c.impls.get(&did));
if let Some(impls) = inner_impl {
debug!("found inner_impl: {:?}", impls);
let mut used_links = FxHashSet::default();
let mut ret = impls
.iter()
.filter(|i| i.inner_impl().trait_.is_none())
.flat_map(|i| {
get_methods(i.inner_impl(), true, &mut used_links, deref_mut, cx.tcx())
})
.flat_map(|i| get_methods(i.inner_impl(), true, used_links, deref_mut, cx.tcx()))
.collect::<Vec<_>>();
if !ret.is_empty() {
let id = if let Some(target_def_id) = real_target.def_id(c) {
@ -2124,7 +2122,14 @@ fn sidebar_deref_methods(
.map(|t| Some(t.def_id()) == cx.tcx().lang_items().deref_trait())
.unwrap_or(false)
}) {
sidebar_deref_methods(cx, out, target_deref_impl, target_impls, derefs);
sidebar_deref_methods(
cx,
out,
target_deref_impl,
target_impls,
derefs,
used_links,
);
}
}
}

View file

@ -693,8 +693,13 @@ h2.location a {
flex-grow: 1;
margin: 0px;
padding: 0px;
/* We use overflow-wrap: break-word for Safari, which doesn't recognize
`anywhere`: https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-wrap */
overflow-wrap: break-word;
/* Then override it with `anywhere`, which is required to make non-Safari browsers break
more aggressively when we want them to. */
overflow-wrap: anywhere;
background-color: var(--main-background-color);
}
.in-band > code, .in-band > .code-header {
@ -731,13 +736,13 @@ pre, .rustdoc.source .example-wrap {
.docblock table td {
padding: .5em;
border: 1px dashed;
border: 1px dashed var(--border-color);
}
.docblock table th {
padding: .5em;
text-align: left;
border: 1px solid;
border: 1px solid var(--border-color);
}
.fields + table {
@ -835,20 +840,6 @@ nav.sub {
.source nav.sub {
margin-left: 32px;
}
nav.main {
padding: 20px 0;
text-align: center;
}
nav.main .current {
border-top: 1px solid;
border-bottom: 1px solid;
}
nav.main .separator {
border: 1px solid;
display: inline-block;
height: 23px;
margin: 0 20px;
}
nav.sum { text-align: right; }
nav.sub form { display: inline; }
@ -974,7 +965,7 @@ table,
max-width: 100%;
/* contents can overflow because of max-width limit, then show ellipsis */
text-overflow: ellipsis;
border: 1px solid;
border: 1px solid var(--border-color);
border-radius: 4px;
outline: none;
cursor: pointer;
@ -1027,11 +1018,12 @@ so that we can apply CSS-filters to change the arrow color in themes */
-moz-box-sizing: border-box !important;
box-sizing: border-box !important;
outline: none;
border: 1px solid;
border: 1px solid var(--border-color);
border-radius: 2px;
padding: 8px;
font-size: 1rem;
width: 100%;
background-color: var(--button-background-color);
}
.search-results {
@ -1087,7 +1079,7 @@ so that we can apply CSS-filters to change the arrow color in themes */
display: block;
margin-top: 7px;
border-radius: 3px;
border: 1px solid;
border: 1px solid var(--border-color);
font-size: 1rem;
}
@ -1096,7 +1088,7 @@ so that we can apply CSS-filters to change the arrow color in themes */
content: '';
position: absolute;
right: 11px;
border: solid;
border: solid var(--border-color);
border-width: 1px 1px 0 0;
display: inline-block;
padding: 4px;
@ -1132,13 +1124,13 @@ so that we can apply CSS-filters to change the arrow color in themes */
text-align: center;
display: block;
margin: 10px 0;
border-bottom: 1px solid;
border-bottom: 1px solid var(--border-color);
padding-bottom: 4px;
margin-bottom: 6px;
}
#help-button span.bottom {
clear: both;
border-top: 1px solid;
border-top: 1px solid var(--border-color);
}
.side-by-side {
text-align: initial;
@ -1331,6 +1323,7 @@ h3.variant {
border-radius: 6px;
margin-left: 5px;
font-size: 1rem;
border: 1px solid var(--border-color);
}
.tooltip.ignore::after {
@ -1496,7 +1489,7 @@ pre.rust {
#source-sidebar > .title {
font-size: 1.5rem;
text-align: center;
border-bottom: 1px solid;
border-bottom: 1px solid var(--border-color);
margin-bottom: 6px;
}
#sidebar-toggle > button {
@ -1524,11 +1517,12 @@ pre.rust {
#copy-path {
height: 34px;
background-color: var(--main-background-color);
}
#settings-menu > a, #help-button > button, #copy-path {
padding: 5px;
width: 33px;
border: 1px solid;
border: 1px solid var(--border-color);
border-radius: 2px;
cursor: pointer;
}
@ -1539,6 +1533,7 @@ pre.rust {
padding: 5px;
height: 100%;
display: block;
background-color: var(--button-background-color);
}
@keyframes rotating {
@ -1588,37 +1583,13 @@ input:checked + .slider {
border: 0;
}
#theme-choices {
display: none;
position: absolute;
left: 0;
top: 28px;
border: 1px solid;
border-radius: 3px;
z-index: 1;
cursor: pointer;
}
#theme-choices > button {
border: none;
width: 100%;
padding: 4px 8px;
text-align: center;
background: rgba(0,0,0,0);
overflow-wrap: normal;
}
#theme-choices > button:not(:first-child) {
border-top: 1px solid;
}
kbd {
display: inline-block;
padding: 3px 5px;
font: 15px monospace;
line-height: 10px;
vertical-align: middle;
border: solid 1px;
border: solid 1px var(--border-color);
border-radius: 3px;
cursor: default;
}

View file

@ -14,6 +14,8 @@ Original by Dempfi (https://github.com/dempfi/ayu)
--scrollbar-thumb-background-color: #5c6773;
--scrollbar-color: #5c6773 #24292f;
--headings-border-bottom-color: #5c6773;
--border-color: #5c6773;
--button-background-color: #141920;
}
.slider {
@ -36,10 +38,6 @@ h4 {
border: none;
}
.in-band {
background-color: #0f1419;
}
.docblock code {
color: #ffb454;
}
@ -84,10 +82,6 @@ pre, .rustdoc.source .example-wrap {
border-right: 1px solid #ffb44c;
}
.docblock table td, .docblock table th {
border-color: #5c6773;
}
.search-results a:hover {
background-color: #777;
}
@ -151,13 +145,6 @@ pre, .rustdoc.source .example-wrap {
pre.rust .comment { color: #788797; }
pre.rust .doccomment { color: #a1ac88; }
nav.main .current {
border-top-color: #5c6773;
border-bottom-color: #5c6773;
}
nav.main .separator {
border: 1px solid #5c6773;
}
a {
color: #39AFD7;
}
@ -182,17 +169,6 @@ details.rustdoc-toggle > summary::before {
filter: invert(100%);
}
.search-input {
background-color: #141920;
border-color: #424c57;
}
#crate-search {
/* Without the `!important`, the border-color is ignored for `<select>`...
It cannot be in the group above because `.search-input` has a different border color on
hover. */
border-color: #5c6773 !important;
}
#crate-search-div::after {
/* match border-color; uses https://codepen.io/sosuke/pen/Pjoqqp */
filter: invert(41%) sepia(12%) saturate(487%) hue-rotate(171deg) brightness(94%) contrast(94%);
@ -205,7 +181,7 @@ details.rustdoc-toggle > summary::before {
}
.search-input {
color: #ffffff;
color: #fff;
}
.module-item .stab,
@ -333,7 +309,6 @@ pre.ignore:hover, .information:hover + pre.ignore {
.tooltip::after {
background-color: #314559;
color: #c5c5c5;
border: 1px solid #5c6773;
}
.tooltip::before {
@ -342,11 +317,6 @@ pre.ignore:hover, .information:hover + pre.ignore {
.notable-traits-tooltiptext {
background-color: #314559;
border-color: #5c6773;
}
.notable-traits-tooltiptext .notable {
border-bottom-color: #5c6773;
}
#titles > button.selected {
@ -449,23 +419,13 @@ a.result-keyword:focus {}
.sidebar a.current.tymethod {}
.sidebar a.current.keyword {}
@media (max-width: 700px) {
.sidebar-elems {
border-right-color: #5c6773;
}
}
kbd {
color: #c5c5c5;
background-color: #314559;
border-color: #5c6773;
border-bottom-color: #5c6773;
box-shadow: inset 0 -1px 0 #5c6773;
}
#settings-menu > a, #help-button > button {
border-color: #5c6773;
background-color: #0f1419;
color: #fff;
}
@ -473,11 +433,6 @@ kbd {
filter: invert(100);
}
.popover, .popover::before,
#help-button span.top, #help-button span.bottom {
border-color: #5c6773;
}
#copy-path {
color: #fff;
}
@ -493,19 +448,6 @@ kbd {
border-color: #e0e0e0;
}
#theme-choices {
border-color: #5c6773;
background-color: #0f1419;
}
#theme-choices > button:not(:first-child) {
border-top-color: #5c6773;
}
#theme-choices > button:hover, #theme-choices > button:focus {
background-color: rgba(110, 110, 110, 0.33);
}
.search-results .result-name span.alias {
color: #c5c5c5;
}
@ -515,7 +457,6 @@ kbd {
#source-sidebar > .title {
color: #fff;
border-bottom-color: #5c6773;
}
#source-sidebar div.files > a:hover, details.dir-entry summary:hover,
#source-sidebar div.files > a:focus, details.dir-entry summary:focus {

View file

@ -9,6 +9,8 @@
--scrollbar-thumb-background-color: rgba(32, 34, 37, .6);
--scrollbar-color: rgba(32,34,37,.6) #5a5a5a;
--headings-border-bottom-color: #d2d2d2;
--border-color: #e0e0e0;
--button-background-color: #f0f0f0;
}
.slider {
@ -21,10 +23,6 @@ input:focus + .slider {
box-shadow: 0 0 0 2px #0a84ff, 0 0 0 6px rgba(10, 132, 255, 0.3);
}
.in-band {
background-color: #353535;
}
.rust-logo {
filter: drop-shadow(1px 0 0px #fff)
drop-shadow(0 1px 0 #fff)
@ -42,10 +40,6 @@ input:focus + .slider {
background-color: #0a042f !important;
}
.docblock table td, .docblock table th {
border-color: #ddd;
}
.search-results a:hover {
background-color: #777;
}
@ -127,14 +121,6 @@ a.result-keyword:focus { background-color: #884719; }
pre.rust .comment { color: #8d8d8b; }
pre.rust .doccomment { color: #8ca375; }
nav.main .current {
border-top-color: #eee;
border-bottom-color: #eee;
}
nav.main .separator {
border-color: #eee;
}
a {
color: #D2991D;
}
@ -154,16 +140,9 @@ details.rustdoc-toggle > summary::before {
.search-input {
color: #111;
background-color: #f0f0f0;
border-color: #f0f0f0;
}
#crate-search {
/* Without the `!important`, the border-color is ignored for `<select>`...
It cannot be in the group above because `.search-input` has a different border color on
hover. */
border-color: #d2d2d2 !important;
}
#crate-search-div::after {
/* match border-color; uses https://codepen.io/sosuke/pen/Pjoqqp */
filter: invert(94%) sepia(0%) saturate(721%) hue-rotate(255deg) brightness(90%) contrast(90%);
@ -175,10 +154,6 @@ details.rustdoc-toggle > summary::before {
filter: invert(69%) sepia(60%) saturate(6613%) hue-rotate(184deg) brightness(100%) contrast(91%);
}
.search-input {
border-color: #e0e0e0;
}
.search-input:focus {
border-color: #008dfd;
}
@ -296,11 +271,6 @@ pre.ignore:hover, .information:hover + pre.ignore {
.notable-traits-tooltiptext {
background-color: #111;
border-color: #777;
}
.notable-traits-tooltiptext .notable {
border-bottom-color: #d2d2d2;
}
#titles > button:not(.selected) {
@ -317,23 +287,13 @@ pre.ignore:hover, .information:hover + pre.ignore {
color: #888;
}
@media (max-width: 700px) {
.sidebar-elems {
border-right-color: #000;
}
}
kbd {
color: #000;
background-color: #fafbfc;
border-color: #d1d5da;
border-bottom-color: #c6cbd1;
box-shadow: inset 0 -1px 0 #c6cbd1;
}
#settings-menu > a, #help-button > button {
border-color: #e0e0e0;
background: #f0f0f0;
color: #000;
}
@ -342,11 +302,6 @@ kbd {
border-color: #ffb900;
}
.popover, .popover::before,
#help-button span.top, #help-button span.bottom {
border-color: #d2d2d2;
}
#copy-path {
color: #999;
}
@ -357,19 +312,6 @@ kbd {
filter: invert(65%);
}
#theme-choices {
border-color: #e0e0e0;
background-color: #353535;
}
#theme-choices > button:not(:first-child) {
border-top-color: #e0e0e0;
}
#theme-choices > button:hover, #theme-choices > button:focus {
background-color: #4e4e4e;
}
.search-results .result-name span.alias {
color: #fff;
}
@ -377,9 +319,6 @@ kbd {
color: #ccc;
}
#source-sidebar > .title {
border-bottom-color: #ccc;
}
#source-sidebar div.files > a:hover, details.dir-entry summary:hover,
#source-sidebar div.files > a:focus, details.dir-entry summary:focus {
background-color: #444;

View file

@ -9,6 +9,8 @@
--scrollbar-thumb-background-color: rgba(36, 37, 39, 0.6);
--scrollbar-color: rgba(36, 37, 39, 0.6) #d9d9d9;
--headings-border-bottom-color: #ddd;
--border-color: #e0e0e0;
--button-background-color: #fff;
}
.slider {
@ -21,10 +23,6 @@ input:focus + .slider {
box-shadow: 0 0 0 2px #0a84ff, 0 0 0 6px rgba(10, 132, 255, 0.3);
}
.in-band {
background-color: white;
}
.rust-logo {
/* This rule exists to force other themes to explicitly style the logo.
* Rustdoc has a custom linter for this purpose.
@ -41,10 +39,6 @@ input:focus + .slider {
background-color: #FDFFD3 !important;
}
.docblock table td, .docblock table th {
border-color: #ddd;
}
.search-results a:hover {
background-color: #ddd;
}
@ -123,14 +117,6 @@ a.result-keyword:focus { background-color: #afc6e4; }
.sidebar a.current.tymethod { color: #a67736; }
.sidebar a.current.keyword { color: #356da4; }
nav.main .current {
border-top-color: #000;
border-bottom-color: #000;
}
nav.main .separator {
border: 1px solid #000;
}
a {
color: #3873AD;
}
@ -144,16 +130,6 @@ details.rustdoc-toggle > summary::before {
color: #999;
}
.search-input {
background-color: white;
border-color: #e0e0e0;
}
#crate-search {
/* Without the `!important`, the border-color is ignored for `<select>`...
It cannot be in the group above because `.search-input` has a different border color on
hover. */
border-color: #e0e0e0 !important;
}
#crate-search-div::after {
/* match border-color; uses https://codepen.io/sosuke/pen/Pjoqqp */
filter: invert(100%) sepia(0%) saturate(4223%) hue-rotate(289deg) brightness(114%) contrast(76%);
@ -279,11 +255,6 @@ pre.ignore:hover, .information:hover + pre.ignore {
.notable-traits-tooltiptext {
background-color: #eee;
border-color: #999;
}
.notable-traits-tooltiptext .notable {
border-bottom-color: #DDDDDD;
}
#titles > button:not(.selected) {
@ -300,35 +271,17 @@ pre.ignore:hover, .information:hover + pre.ignore {
color: #888;
}
@media (max-width: 700px) {
.sidebar-elems {
border-right-color: #000;
}
}
kbd {
color: #000;
background-color: #fafbfc;
border-color: #d1d5da;
border-bottom-color: #c6cbd1;
box-shadow: inset 0 -1px 0 #c6cbd1;
}
#settings-menu > a, #help-button > button {
border-color: #e0e0e0;
background-color: #fff;
}
#settings-menu > a:hover, #settings-menu > a:focus,
#help-button > button:hover, #help-button > button:focus {
border-color: #717171;
}
.popover, .popover::before,
#help-button span.top, #help-button span.bottom {
border-color: #e0e0e0;
}
#copy-path {
color: #999;
}
@ -339,19 +292,6 @@ kbd {
filter: invert(35%);
}
#theme-choices {
border-color: #ccc;
background-color: #fff;
}
#theme-choices > button:not(:first-child) {
border-top-color: #e0e0e0;
}
#theme-choices > button:hover, #theme-choices > button:focus {
background-color: #eee;
}
.search-results .result-name span.alias {
color: #000;
}
@ -359,9 +299,6 @@ kbd {
color: #999;
}
#source-sidebar > .title {
border-bottom-color: #ccc;
}
#source-sidebar div.files > a:hover, details.dir-entry summary:hover,
#source-sidebar div.files > a:focus, details.dir-entry summary:focus {
background-color: #E0E0E0;

View file

@ -0,0 +1,25 @@
// Make sure that the MIR inliner does not loop indefinitely on polymorphic recursion.
// compile-flags: --crate-type lib
// Randomize `def_path_hash` by defining them under a module with different names
macro_rules! emit {
($($m:ident)*) => {$(
pub mod $m {
pub trait Tr { type Next: Tr; }
pub fn hoge<const N: usize, T: Tr>() {
inner::<N, T>();
}
#[inline(always)]
fn inner<const N: usize, T: Tr>()
{
inner::<N, T::Next>();
inner::<N, T::Next>();
}
}
)*};
}
// Increase the chance of triggering the bug
emit!(m00 m01 m02 m03 m04 m05 m06 m07 m08 m09 m10 m11 m12 m13 m14 m15 m16 m17 m18 m19);

View file

@ -0,0 +1,31 @@
// compile-flags: -Z mir-opt-level=0
// EMIT_MIR issue_91633.hey.mir_map.0.mir
fn hey<T> (it: &[T])
where
[T] : std::ops::Index<usize>,
{
let _ = &it[0];
}
// EMIT_MIR issue_91633.bar.mir_map.0.mir
fn bar<T> (it: Box<[T]>)
where
[T] : std::ops::Index<usize>,
{
let _ = it[0];
}
// EMIT_MIR issue_91633.fun.mir_map.0.mir
fn fun<T> (it: &[T]) -> &T
{
let f = &it[0];
f
}
// EMIT_MIR issue_91633.foo.mir_map.0.mir
fn foo<T: Clone> (it: Box<[T]>) -> T
{
let f = it[0].clone();
f
}
fn main(){}

View file

@ -0,0 +1,39 @@
// MIR for `bar` 0 mir_map
fn bar(_1: Box<[T]>) -> () {
debug it => _1; // in scope 0 at $DIR/issue-91633.rs:+0:12: +0:14
let mut _0: (); // return place in scope 0 at $DIR/issue-91633.rs:+1:2: +1:2
let mut _2: &<[T] as std::ops::Index<usize>>::Output; // in scope 0 at $DIR/issue-91633.rs:+4:14: +4:19
let mut _3: &[T]; // in scope 0 at $DIR/issue-91633.rs:+4:14: +4:16
scope 1 {
}
bb0: {
StorageLive(_2); // scope 0 at $DIR/issue-91633.rs:+4:14: +4:19
StorageLive(_3); // scope 0 at $DIR/issue-91633.rs:+4:14: +4:16
_3 = &(*_1); // scope 0 at $DIR/issue-91633.rs:+4:14: +4:16
_2 = <[T] as Index<usize>>::index(move _3, const 0_usize) -> [return: bb1, unwind: bb3]; // scope 0 at $DIR/issue-91633.rs:+4:14: +4:19
// mir::Constant
// + span: $DIR/issue-91633.rs:15:14: 15:19
// + literal: Const { ty: for<'r> fn(&'r [T], usize) -> &'r <[T] as Index<usize>>::Output {<[T] as Index<usize>>::index}, val: Value(<ZST>) }
}
bb1: {
StorageDead(_3); // scope 0 at $DIR/issue-91633.rs:+4:18: +4:19
StorageDead(_2); // scope 0 at $DIR/issue-91633.rs:+4:19: +4:20
_0 = const (); // scope 0 at $DIR/issue-91633.rs:+3:2: +5:3
drop(_1) -> [return: bb2, unwind: bb4]; // scope 0 at $DIR/issue-91633.rs:+5:2: +5:3
}
bb2: {
return; // scope 0 at $DIR/issue-91633.rs:+5:3: +5:3
}
bb3 (cleanup): {
drop(_1) -> bb4; // scope 0 at $DIR/issue-91633.rs:+5:2: +5:3
}
bb4 (cleanup): {
resume; // scope 0 at $DIR/issue-91633.rs:+0:1: +5:3
}
}

View file

@ -0,0 +1,57 @@
// MIR for `foo` 0 mir_map
fn foo(_1: Box<[T]>) -> T {
debug it => _1; // in scope 0 at $DIR/issue-91633.rs:+0:19: +0:21
let mut _0: T; // return place in scope 0 at $DIR/issue-91633.rs:+0:36: +0:37
let _2: T; // in scope 0 at $DIR/issue-91633.rs:+2:10: +2:11
let mut _3: &T; // in scope 0 at $DIR/issue-91633.rs:+2:14: +2:27
let _4: usize; // in scope 0 at $DIR/issue-91633.rs:+2:17: +2:18
let mut _5: usize; // in scope 0 at $DIR/issue-91633.rs:+2:14: +2:19
let mut _6: bool; // in scope 0 at $DIR/issue-91633.rs:+2:14: +2:19
scope 1 {
debug f => _2; // in scope 1 at $DIR/issue-91633.rs:+2:10: +2:11
}
bb0: {
StorageLive(_2); // scope 0 at $DIR/issue-91633.rs:+2:10: +2:11
StorageLive(_3); // scope 0 at $DIR/issue-91633.rs:+2:14: +2:27
StorageLive(_4); // scope 0 at $DIR/issue-91633.rs:+2:17: +2:18
_4 = const 0_usize; // scope 0 at $DIR/issue-91633.rs:+2:17: +2:18
_5 = Len((*_1)); // scope 0 at $DIR/issue-91633.rs:+2:14: +2:19
_6 = Lt(_4, _5); // scope 0 at $DIR/issue-91633.rs:+2:14: +2:19
assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> [success: bb1, unwind: bb5]; // scope 0 at $DIR/issue-91633.rs:+2:14: +2:19
}
bb1: {
_3 = &(*_1)[_4]; // scope 0 at $DIR/issue-91633.rs:+2:14: +2:27
_2 = <T as Clone>::clone(move _3) -> [return: bb2, unwind: bb5]; // scope 0 at $DIR/issue-91633.rs:+2:14: +2:27
// mir::Constant
// + span: $DIR/issue-91633.rs:28:20: 28:25
// + literal: Const { ty: for<'r> fn(&'r T) -> T {<T as Clone>::clone}, val: Value(<ZST>) }
}
bb2: {
StorageDead(_3); // scope 0 at $DIR/issue-91633.rs:+2:26: +2:27
FakeRead(ForLet(None), _2); // scope 0 at $DIR/issue-91633.rs:+2:10: +2:11
StorageDead(_4); // scope 0 at $DIR/issue-91633.rs:+2:27: +2:28
_0 = move _2; // scope 1 at $DIR/issue-91633.rs:+3:6: +3:7
drop(_2) -> [return: bb3, unwind: bb5]; // scope 0 at $DIR/issue-91633.rs:+4:2: +4:3
}
bb3: {
StorageDead(_2); // scope 0 at $DIR/issue-91633.rs:+4:2: +4:3
drop(_1) -> [return: bb4, unwind: bb6]; // scope 0 at $DIR/issue-91633.rs:+4:2: +4:3
}
bb4: {
return; // scope 0 at $DIR/issue-91633.rs:+4:3: +4:3
}
bb5 (cleanup): {
drop(_1) -> bb6; // scope 0 at $DIR/issue-91633.rs:+4:2: +4:3
}
bb6 (cleanup): {
resume; // scope 0 at $DIR/issue-91633.rs:+0:1: +4:3
}
}

View file

@ -0,0 +1,35 @@
// MIR for `fun` 0 mir_map
fn fun(_1: &[T]) -> &T {
debug it => _1; // in scope 0 at $DIR/issue-91633.rs:+0:12: +0:14
let mut _0: &T; // return place in scope 0 at $DIR/issue-91633.rs:+0:25: +0:27
let _2: &T; // in scope 0 at $DIR/issue-91633.rs:+2:10: +2:11
let _3: usize; // in scope 0 at $DIR/issue-91633.rs:+2:18: +2:19
let mut _4: usize; // in scope 0 at $DIR/issue-91633.rs:+2:15: +2:20
let mut _5: bool; // in scope 0 at $DIR/issue-91633.rs:+2:15: +2:20
scope 1 {
debug f => _2; // in scope 1 at $DIR/issue-91633.rs:+2:10: +2:11
}
bb0: {
StorageLive(_2); // scope 0 at $DIR/issue-91633.rs:+2:10: +2:11
StorageLive(_3); // scope 0 at $DIR/issue-91633.rs:+2:18: +2:19
_3 = const 0_usize; // scope 0 at $DIR/issue-91633.rs:+2:18: +2:19
_4 = Len((*_1)); // scope 0 at $DIR/issue-91633.rs:+2:15: +2:20
_5 = Lt(_3, _4); // scope 0 at $DIR/issue-91633.rs:+2:15: +2:20
assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind: bb2]; // scope 0 at $DIR/issue-91633.rs:+2:15: +2:20
}
bb1: {
_2 = &(*_1)[_3]; // scope 0 at $DIR/issue-91633.rs:+2:14: +2:20
FakeRead(ForLet(None), _2); // scope 0 at $DIR/issue-91633.rs:+2:10: +2:11
_0 = &(*_2); // scope 1 at $DIR/issue-91633.rs:+3:6: +3:7
StorageDead(_3); // scope 0 at $DIR/issue-91633.rs:+4:2: +4:3
StorageDead(_2); // scope 0 at $DIR/issue-91633.rs:+4:2: +4:3
return; // scope 0 at $DIR/issue-91633.rs:+4:3: +4:3
}
bb2 (cleanup): {
resume; // scope 0 at $DIR/issue-91633.rs:+0:1: +4:3
}
}

View file

@ -0,0 +1,35 @@
// MIR for `hey` 0 mir_map
fn hey(_1: &[T]) -> () {
debug it => _1; // in scope 0 at $DIR/issue-91633.rs:+0:12: +0:14
let mut _0: (); // return place in scope 0 at $DIR/issue-91633.rs:+1:2: +1:2
let mut _2: &<[T] as std::ops::Index<usize>>::Output; // in scope 0 at $DIR/issue-91633.rs:+4:14: +4:20
let _3: &<[T] as std::ops::Index<usize>>::Output; // in scope 0 at $DIR/issue-91633.rs:+4:15: +4:20
let mut _4: &[T]; // in scope 0 at $DIR/issue-91633.rs:+4:15: +4:17
scope 1 {
}
bb0: {
StorageLive(_2); // scope 0 at $DIR/issue-91633.rs:+4:14: +4:20
StorageLive(_3); // scope 0 at $DIR/issue-91633.rs:+4:15: +4:20
StorageLive(_4); // scope 0 at $DIR/issue-91633.rs:+4:15: +4:17
_4 = &(*_1); // scope 0 at $DIR/issue-91633.rs:+4:15: +4:17
_3 = <[T] as Index<usize>>::index(move _4, const 0_usize) -> [return: bb1, unwind: bb2]; // scope 0 at $DIR/issue-91633.rs:+4:15: +4:20
// mir::Constant
// + span: $DIR/issue-91633.rs:7:15: 7:20
// + literal: Const { ty: for<'r> fn(&'r [T], usize) -> &'r <[T] as Index<usize>>::Output {<[T] as Index<usize>>::index}, val: Value(<ZST>) }
}
bb1: {
StorageDead(_4); // scope 0 at $DIR/issue-91633.rs:+4:19: +4:20
_2 = &(*_3); // scope 0 at $DIR/issue-91633.rs:+4:14: +4:20
StorageDead(_2); // scope 0 at $DIR/issue-91633.rs:+4:20: +4:21
_0 = const (); // scope 0 at $DIR/issue-91633.rs:+3:2: +5:3
StorageDead(_3); // scope 0 at $DIR/issue-91633.rs:+5:2: +5:3
return; // scope 0 at $DIR/issue-91633.rs:+5:3: +5:3
}
bb2 (cleanup): {
resume; // scope 0 at $DIR/issue-91633.rs:+0:1: +5:3
}
}

View file

@ -56,7 +56,7 @@ reload:
click: "#help-button"
assert-css: (
"#help-button .popover",
{"display": "block", "border-color": "rgb(210, 210, 210)"},
{"display": "block", "border-color": "rgb(224, 224, 224)"},
)
compare-elements-css: ("#help-button .popover", "#help-button .top", ["border-color"])
compare-elements-css: ("#help-button .popover", "#help-button .bottom", ["border-color"])

View file

@ -69,7 +69,7 @@ click: "#settings-menu"
wait-for: "#settings"
click: "#theme-dark"
wait-for-css: ("#crate-search", {
"border": "1px solid rgb(210, 210, 210)",
"border": "1px solid rgb(224, 224, 224)",
"color": "rgb(221, 221, 221)",
"background-color": "rgb(53, 53, 53)",
})

View file

@ -0,0 +1,243 @@
// This test ensures that the elements in ".search-form" have the expected display.
goto: file://|DOC_PATH|/test_docs/index.html
show-text: true
// Ayu theme
local-storage: {
"rustdoc-theme": "ayu",
"rustdoc-use-system-theme": "false",
}
reload:
assert-css: (
".search-input",
{
"border-color": "rgb(92, 103, 115)",
"background-color": "rgb(20, 25, 32)",
"color": "rgb(255, 255, 255)",
},
)
focus: ".search-input"
// Nothing should change.
assert-css: (
".search-input",
{
"border-color": "rgb(92, 103, 115)",
"background-color": "rgb(20, 25, 32)",
"color": "rgb(255, 255, 255)",
},
)
assert-css: (
"#help-button",
{"border-color": "rgb(197, 197, 197)"},
)
assert-css: (
"#help-button > button",
{
"color": "rgb(255, 255, 255)",
"border-color": "rgb(92, 103, 115)",
"background-color": "rgb(20, 25, 32)",
},
)
move-cursor-to: "#help-button"
assert-css: (
"#help-button:hover",
{"border-color": "rgb(197, 197, 197)"},
)
// Only "border-color" should change.
assert-css: (
"#help-button:hover > button",
{
"color": "rgb(255, 255, 255)",
"border-color": "rgb(224, 224, 224)",
"background-color": "rgb(20, 25, 32)",
},
)
assert-css: (
"#settings-menu",
{"border-color": "rgb(197, 197, 197)"},
)
assert-css: (
"#settings-menu > a",
{
"color": "rgb(255, 255, 255)",
"border-color": "rgb(92, 103, 115)",
"background-color": "rgb(20, 25, 32)",
},
)
move-cursor-to: "#settings-menu"
assert-css: (
"#settings-menu:hover",
{"border-color": "rgb(197, 197, 197)"},
)
// Only "border-color" should change.
assert-css: (
"#settings-menu:hover > a",
{
"color": "rgb(255, 255, 255)",
"border-color": "rgb(224, 224, 224)",
"background-color": "rgb(20, 25, 32)",
},
)
// Dark theme
local-storage: {
"rustdoc-theme": "dark",
"rustdoc-use-system-theme": "false",
}
reload:
assert-css: (
".search-input",
{
"border-color": "rgb(240, 240, 240)",
"background-color": "rgb(240, 240, 240)",
"color": "rgb(17, 17, 17)",
},
)
focus: ".search-input"
// Only "border-color" should change.
assert-css: (
".search-input",
{
"border-color": "rgb(0, 141, 253)",
"background-color": "rgb(240, 240, 240)",
"color": "rgb(17, 17, 17)",
},
)
assert-css: (
"#help-button",
{"border-color": "rgb(221, 221, 221)"},
)
assert-css: (
"#help-button > button",
{
"color": "rgb(0, 0, 0)",
"border-color": "rgb(224, 224, 224)",
"background-color": "rgb(240, 240, 240)",
},
)
move-cursor-to: "#help-button"
assert-css: (
"#help-button:hover",
{"border-color": "rgb(221, 221, 221)"},
)
// Only "border-color" should change.
assert-css: (
"#help-button:hover > button",
{
"color": "rgb(0, 0, 0)",
"border-color": "rgb(255, 185, 0)",
"background-color": "rgb(240, 240, 240)",
},
)
assert-css: (
"#settings-menu",
{"border-color": "rgb(221, 221, 221)"},
)
assert-css: (
"#settings-menu > a",
{
"color": "rgb(0, 0, 0)",
"border-color": "rgb(224, 224, 224)",
"background-color": "rgb(240, 240, 240)",
},
)
move-cursor-to: "#settings-menu"
assert-css: (
"#settings-menu:hover",
{"border-color": "rgb(221, 221, 221)"},
)
// Only "border-color" should change.
assert-css: (
"#settings-menu:hover > a",
{
"color": "rgb(0, 0, 0)",
"border-color": "rgb(255, 185, 0)",
"background-color": "rgb(240, 240, 240)",
},
)
// Light theme
local-storage: {
"rustdoc-theme": "light",
"rustdoc-use-system-theme": "false",
}
reload:
assert-css: (
".search-input",
{
"border-color": "rgb(224, 224, 224)",
"background-color": "rgb(255, 255, 255)",
"color": "rgb(0, 0, 0)",
},
)
focus: ".search-input"
// Nothing should change.
assert-css: (
".search-input",
{
"border-color": "rgb(102, 175, 233)",
"background-color": "rgb(255, 255, 255)",
"color": "rgb(0, 0, 0)",
},
)
assert-css: (
"#help-button",
{"border-color": "rgb(0, 0, 0)"},
)
assert-css: (
"#help-button > button",
{
"color": "rgb(0, 0, 0)",
"border-color": "rgb(224, 224, 224)",
"background-color": "rgb(255, 255, 255)",
},
)
move-cursor-to: "#help-button"
assert-css: (
"#help-button:hover",
{"border-color": "rgb(0, 0, 0)"},
)
// Only "border-color" should change.
assert-css: (
"#help-button:hover > button",
{
"color": "rgb(0, 0, 0)",
"border-color": "rgb(113, 113, 113)",
"background-color": "rgb(255, 255, 255)",
},
)
assert-css: (
"#settings-menu",
{"border-color": "rgb(0, 0, 0)"},
)
assert-css: (
"#settings-menu > a",
{
"color": "rgb(56, 115, 173)",
"border-color": "rgb(224, 224, 224)",
"background-color": "rgb(255, 255, 255)",
},
)
move-cursor-to: "#settings-menu"
assert-css: (
"#settings-menu:hover",
{"border-color": "rgb(0, 0, 0)"},
)
// Only "border-color" should change.
assert-css: (
"#settings-menu:hover > a",
{
"color": "rgb(56, 115, 173)",
"border-color": "rgb(113, 113, 113)",
"background-color": "rgb(255, 255, 255)",
},
)

View file

@ -3,9 +3,8 @@ goto: file://|DOC_PATH|/test_docs/index.html
local-storage: {"rustdoc-use-system-theme": "false", "rustdoc-theme": "dark"}
reload:
assert-css: (".search-input", {"border-color": "rgb(224, 224, 224)"})
assert-css: (".search-input", {"border-color": "rgb(240, 240, 240)"})
click: ".search-input"
focus: ".search-input"
assert-css: (".search-input", {"border-color": "rgb(0, 141, 253)"})
local-storage: {"rustdoc-theme": "light"}
@ -18,6 +17,6 @@ assert-css: (".search-input", {"border-color": "rgb(102, 175, 233)"})
local-storage: {"rustdoc-theme": "ayu"}
reload:
assert-css: (".search-input", {"border-color": "rgb(66, 76, 87)"})
assert-css: (".search-input", {"border-color": "rgb(92, 103, 115)"})
click: ".search-input"
assert-css: (".search-input", {"border-color": "rgb(66, 76, 87)"})
assert-css: (".search-input", {"border-color": "rgb(92, 103, 115)"})

View file

@ -0,0 +1,30 @@
#![crate_name="foo"]
pub struct Vec;
pub struct Slice;
impl std::ops::Deref for Vec {
type Target = Slice;
fn deref(&self) -> &Slice {
&Slice
}
}
// @has foo/struct.Vec.html '//*[@class="sidebar-elems"]//section//li/a[@href="#method.is_empty"]' \
// "is_empty"
impl Vec {
pub fn is_empty(&self) -> bool {
true
}
}
// @has foo/struct.Vec.html '//*[@class="sidebar-elems"]//section//li/a[@href="#method.is_empty-1"]' \
// "is_empty"
// @has foo/struct.Slice.html '//*[@class="sidebar-elems"]//section//li/a[@href="#method.is_empty"]' \
// "is_empty"
impl Slice {
pub fn is_empty(&self) -> bool {
true
}
}

View file

@ -278,26 +278,36 @@ LL | const TRAIT_OBJ_CONTENT_INVALID: &dyn Trait = unsafe { mem::transmute::<_,
╾allocN─╼ ╾allocN─╼ │ ╾──╼╾──╼
}
error[E0080]: evaluation of constant value failed
--> $DIR/ub-wide-ptr.rs:147:62
error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-wide-ptr.rs:147:1
|
LL | const RAW_TRAIT_OBJ_VTABLE_NULL: *const dyn Trait = unsafe { mem::transmute((&92u8, 0usize)) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds pointer use: null pointer is a dangling pointer (it has no provenance)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered null pointer, but expected a vtable pointer
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 8, align: 4) {
╾allocN─╼ 00 00 00 00 │ ╾──╼....
}
error[E0080]: evaluation of constant value failed
--> $DIR/ub-wide-ptr.rs:150:65
error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-wide-ptr.rs:149:1
|
LL | const RAW_TRAIT_OBJ_VTABLE_INVALID: *const dyn Trait = unsafe { mem::transmute((&92u8, &3u64)) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using allocN as vtable pointer but it does not point to a vtable
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered allocN, but expected a vtable pointer
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 8, align: 4) {
╾allocN─╼ ╾allocN─╼ │ ╾──╼╾──╼
}
error[E0080]: could not evaluate static initializer
--> $DIR/ub-wide-ptr.rs:157:5
--> $DIR/ub-wide-ptr.rs:155:5
|
LL | mem::transmute::<_, &dyn Trait>((&92u8, 0usize))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds pointer use: null pointer is a dangling pointer (it has no provenance)
error[E0080]: could not evaluate static initializer
--> $DIR/ub-wide-ptr.rs:161:5
--> $DIR/ub-wide-ptr.rs:159:5
|
LL | mem::transmute::<_, &dyn Trait>((&92u8, &3u64))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using allocN as vtable pointer but it does not point to a vtable

View file

@ -278,26 +278,36 @@ LL | const TRAIT_OBJ_CONTENT_INVALID: &dyn Trait = unsafe { mem::transmute::<_,
╾──────allocN───────╼ ╾──────allocN───────╼ │ ╾──────╼╾──────╼
}
error[E0080]: evaluation of constant value failed
--> $DIR/ub-wide-ptr.rs:147:62
error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-wide-ptr.rs:147:1
|
LL | const RAW_TRAIT_OBJ_VTABLE_NULL: *const dyn Trait = unsafe { mem::transmute((&92u8, 0usize)) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds pointer use: null pointer is a dangling pointer (it has no provenance)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered null pointer, but expected a vtable pointer
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 16, align: 8) {
╾──────allocN───────╼ 00 00 00 00 00 00 00 00 │ ╾──────╼........
}
error[E0080]: evaluation of constant value failed
--> $DIR/ub-wide-ptr.rs:150:65
error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-wide-ptr.rs:149:1
|
LL | const RAW_TRAIT_OBJ_VTABLE_INVALID: *const dyn Trait = unsafe { mem::transmute((&92u8, &3u64)) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using allocN as vtable pointer but it does not point to a vtable
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered allocN, but expected a vtable pointer
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 16, align: 8) {
╾──────allocN───────╼ ╾──────allocN───────╼ │ ╾──────╼╾──────╼
}
error[E0080]: could not evaluate static initializer
--> $DIR/ub-wide-ptr.rs:157:5
--> $DIR/ub-wide-ptr.rs:155:5
|
LL | mem::transmute::<_, &dyn Trait>((&92u8, 0usize))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds pointer use: null pointer is a dangling pointer (it has no provenance)
error[E0080]: could not evaluate static initializer
--> $DIR/ub-wide-ptr.rs:161:5
--> $DIR/ub-wide-ptr.rs:159:5
|
LL | mem::transmute::<_, &dyn Trait>((&92u8, &3u64))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using allocN as vtable pointer but it does not point to a vtable

View file

@ -145,11 +145,9 @@ const TRAIT_OBJ_CONTENT_INVALID: &dyn Trait = unsafe { mem::transmute::<_, &bool
// # raw trait object
const RAW_TRAIT_OBJ_VTABLE_NULL: *const dyn Trait = unsafe { mem::transmute((&92u8, 0usize)) };
//~^ ERROR evaluation of constant value failed
//~| null pointer
//~^ ERROR it is undefined behavior to use this value
const RAW_TRAIT_OBJ_VTABLE_INVALID: *const dyn Trait = unsafe { mem::transmute((&92u8, &3u64)) };
//~^ ERROR evaluation of constant value failed
//~| does not point to a vtable
//~^ ERROR it is undefined behavior to use this value
const RAW_TRAIT_OBJ_CONTENT_INVALID: *const dyn Trait = unsafe { mem::transmute::<_, &bool>(&3u8) } as *const dyn Trait; // ok because raw
// Const eval fails for these, so they need to be statics to error.

View file

@ -0,0 +1,23 @@
use std::ops::Deref;
use std::pin::Pin;
struct Whatever<T>(T);
impl<T> Deref for Whatever<T> {
type Target = T;
fn deref(&self) -> &T {
&self.0
}
}
struct A;
impl Drop for Pin<Whatever<A>> {
//~^ ERROR the `Drop` trait may only be implemented for local structs, enums, and unions
fn drop(&mut self) {}
}
fn main() {
let x = Pin::new(Whatever(1.0f32));
}

View file

@ -0,0 +1,9 @@
error[E0120]: the `Drop` trait may only be implemented for local structs, enums, and unions
--> $DIR/drop-foreign-fundamental.rs:16:15
|
LL | impl Drop for Pin<Whatever<A>> {
| ^^^^^^^^^^^^^^^^ must be a struct, enum, or union in the current crate
error: aborting due to previous error
For more information about this error, try `rustc --explain E0120`.

View file

@ -1,5 +1,5 @@
impl<'a> Drop for &'a mut isize {
//~^ ERROR the `Drop` trait may only be implemented for structs, enums, and unions
//~^ ERROR the `Drop` trait may only be implemented for local structs, enums, and unions
//~^^ ERROR E0117
fn drop(&mut self) {
println!("kaboom");
@ -8,8 +8,7 @@ impl<'a> Drop for &'a mut isize {
impl Drop for Nonexistent {
//~^ ERROR cannot find type `Nonexistent`
fn drop(&mut self) { }
fn drop(&mut self) {}
}
fn main() {
}
fn main() {}

View file

@ -15,11 +15,11 @@ LL | impl<'a> Drop for &'a mut isize {
|
= note: define and implement a trait or new type instead
error[E0120]: the `Drop` trait may only be implemented for structs, enums, and unions
error[E0120]: the `Drop` trait may only be implemented for local structs, enums, and unions
--> $DIR/drop-on-non-struct.rs:1:19
|
LL | impl<'a> Drop for &'a mut isize {
| ^^^^^^^^^^^^^ must be a struct, enum, or union
| ^^^^^^^^^^^^^ must be a struct, enum, or union in the current crate
error: aborting due to 3 previous errors

View file

@ -1,4 +1,4 @@
impl Drop for u32 {} //~ ERROR E0117
//~| ERROR the `Drop` trait may only be implemented for structs, enums, and unions
//~| ERROR the `Drop` trait may only be implemented for local structs, enums, and unions
fn main() {}

View file

@ -9,11 +9,11 @@ LL | impl Drop for u32 {}
|
= note: define and implement a trait or new type instead
error[E0120]: the `Drop` trait may only be implemented for structs, enums, and unions
error[E0120]: the `Drop` trait may only be implemented for local structs, enums, and unions
--> $DIR/E0117.rs:1:15
|
LL | impl Drop for u32 {}
| ^^^ must be a struct, enum, or union
| ^^^ must be a struct, enum, or union in the current crate
error: aborting due to 2 previous errors

View file

@ -1,8 +1,8 @@
error[E0120]: the `Drop` trait may only be implemented for structs, enums, and unions
error[E0120]: the `Drop` trait may only be implemented for local structs, enums, and unions
--> $DIR/E0120.rs:3:15
|
LL | impl Drop for dyn MyTrait {
| ^^^^^^^^^^^ must be a struct, enum, or union
| ^^^^^^^^^^^ must be a struct, enum, or union in the current crate
error: aborting due to previous error

View file

@ -7,11 +7,11 @@ LL | impl<T> Drop for T where T: A {
= note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local
= note: only traits defined in the current crate can be implemented for a type parameter
error[E0120]: the `Drop` trait may only be implemented for structs, enums, and unions
error[E0120]: the `Drop` trait may only be implemented for local structs, enums, and unions
--> $DIR/issue-41974.rs:7:18
|
LL | impl<T> Drop for T where T: A {
| ^ must be a struct, enum, or union
| ^ must be a struct, enum, or union in the current crate
error: aborting due to 2 previous errors

View file

@ -22,7 +22,7 @@ fn bad1() { unsafe {} } //~ ERROR: unnecessary `unsafe` block
fn bad2() { unsafe { bad1() } } //~ ERROR: unnecessary `unsafe` block
unsafe fn bad3() { unsafe {} } //~ ERROR: unnecessary `unsafe` block
fn bad4() { unsafe { callback(||{}) } } //~ ERROR: unnecessary `unsafe` block
unsafe fn bad5() { unsafe { unsf() } } //~ ERROR: unnecessary `unsafe` block
unsafe fn bad5() { unsafe { unsf() } }
fn bad6() {
unsafe { // don't put the warning here
unsafe { //~ ERROR: unnecessary `unsafe` block
@ -31,7 +31,7 @@ fn bad6() {
}
}
unsafe fn bad7() {
unsafe { //~ ERROR: unnecessary `unsafe` block
unsafe {
unsafe { //~ ERROR: unnecessary `unsafe` block
unsf()
}

View file

@ -30,14 +30,6 @@ error: unnecessary `unsafe` block
LL | fn bad4() { unsafe { callback(||{}) } }
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe-thir.rs:25:20
|
LL | unsafe fn bad5() { unsafe { unsf() } }
| ---------------- ^^^^^^ unnecessary `unsafe` block
| |
| because it's nested under this `unsafe` fn
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe-thir.rs:28:9
|
@ -54,13 +46,5 @@ LL | unsafe {
LL | unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe-thir.rs:34:5
|
LL | unsafe fn bad7() {
| ---------------- because it's nested under this `unsafe` fn
LL | unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: aborting due to 8 previous errors
error: aborting due to 6 previous errors

View file

@ -28,17 +28,6 @@ error: unnecessary `unsafe` block
LL | fn bad4() { unsafe { callback(||{}) } }
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:30:20
|
LL | unsafe fn bad5() { unsafe { unsf() } }
| ---------------- ^^^^^^ unnecessary `unsafe` block
| |
| because it's nested under this `unsafe` fn
|
= note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn`
= note: `#[allow(unsafe_op_in_unsafe_fn)]` on by default
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:32:5
|
@ -51,17 +40,6 @@ error: unnecessary `unsafe` block
LL | unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:40:9
|
LL | unsafe fn bad7() {
| ---------------- because it's nested under this `unsafe` fn
LL | unsafe {
LL | unsafe {
| ^^^^^^ unnecessary `unsafe` block
|
= note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn`
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:74:9
|
@ -272,91 +250,32 @@ error: unnecessary `unsafe` block
LL | unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:197:13
|
LL | unsafe fn granularity_2() {
| ------------------------- because it's nested under this `unsafe` fn
LL | unsafe {
LL | unsafe { unsf() }
| ^^^^^^ unnecessary `unsafe` block
|
= note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn`
note: the lint level is defined here
--> $DIR/lint-unused-unsafe.rs:194:13
|
LL | #[allow(unsafe_op_in_unsafe_fn)]
| ^^^^^^^^^^^^^^^^^^^^^^
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:198:13
|
LL | unsafe fn granularity_2() {
| ------------------------- because it's nested under this `unsafe` fn
...
LL | unsafe { unsf() }
| ^^^^^^ unnecessary `unsafe` block
|
= note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn`
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:199:13
|
LL | unsafe fn granularity_2() {
| ------------------------- because it's nested under this `unsafe` fn
...
LL | unsafe { unsf() }
| ^^^^^^ unnecessary `unsafe` block
|
= note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn`
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:205:9
|
LL | unsafe fn top_level_used_2() {
| ---------------------------- because it's nested under this `unsafe` fn
LL | unsafe {
| ^^^^^^ unnecessary `unsafe` block
|
= note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn`
note: the lint level is defined here
--> $DIR/lint-unused-unsafe.rs:203:13
|
LL | #[allow(unsafe_op_in_unsafe_fn)]
| ^^^^^^^^^^^^^^^^^^^^^^
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:207:13
|
LL | unsafe fn top_level_used_2() {
| ---------------------------- because it's nested under this `unsafe` fn
...
LL | unsafe {
| ------ because it's nested under this `unsafe` block
LL | unsf();
LL | unsafe { unsf() }
| ^^^^^^ unnecessary `unsafe` block
|
= note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn`
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:208:13
|
LL | unsafe fn top_level_used_2() {
| ---------------------------- because it's nested under this `unsafe` fn
LL | unsafe {
| ------ because it's nested under this `unsafe` block
...
LL | unsafe { unsf() }
| ^^^^^^ unnecessary `unsafe` block
|
= note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn`
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:209:13
|
LL | unsafe fn top_level_used_2() {
| ---------------------------- because it's nested under this `unsafe` fn
LL | unsafe {
| ------ because it's nested under this `unsafe` block
...
LL | unsafe { unsf() }
| ^^^^^^ unnecessary `unsafe` block
|
= note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn`
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:220:17
@ -398,19 +317,12 @@ LL | unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:254:9
--> $DIR/lint-unused-unsafe.rs:255:13
|
LL | unsafe fn granular_disallow_op_in_unsafe_fn_3() {
| ----------------------------------------------- because it's nested under this `unsafe` fn
LL | unsafe {
| ^^^^^^ unnecessary `unsafe` block
|
= note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn`
note: the lint level is defined here
--> $DIR/lint-unused-unsafe.rs:252:13
|
LL | #[allow(unsafe_op_in_unsafe_fn)]
| ^^^^^^^^^^^^^^^^^^^^^^
| ------ because it's nested under this `unsafe` block
LL | unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:268:13
@ -630,91 +542,32 @@ error: unnecessary `unsafe` block
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:409:24
|
LL | unsafe fn granularity_2() {
| ------------------------- because it's nested under this `unsafe` fn
LL | let _ = || unsafe {
LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
|
= note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn`
note: the lint level is defined here
--> $DIR/lint-unused-unsafe.rs:406:13
|
LL | #[allow(unsafe_op_in_unsafe_fn)]
| ^^^^^^^^^^^^^^^^^^^^^^
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:410:24
|
LL | unsafe fn granularity_2() {
| ------------------------- because it's nested under this `unsafe` fn
...
LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
|
= note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn`
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:411:24
|
LL | unsafe fn granularity_2() {
| ------------------------- because it's nested under this `unsafe` fn
...
LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
|
= note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn`
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:417:20
|
LL | unsafe fn top_level_used_2() {
| ---------------------------- because it's nested under this `unsafe` fn
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
|
= note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn`
note: the lint level is defined here
--> $DIR/lint-unused-unsafe.rs:415:13
|
LL | #[allow(unsafe_op_in_unsafe_fn)]
| ^^^^^^^^^^^^^^^^^^^^^^
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:419:24
|
LL | unsafe fn top_level_used_2() {
| ---------------------------- because it's nested under this `unsafe` fn
...
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
LL | unsf();
LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
|
= note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn`
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:420:24
|
LL | unsafe fn top_level_used_2() {
| ---------------------------- because it's nested under this `unsafe` fn
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
...
LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
|
= note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn`
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:421:24
|
LL | unsafe fn top_level_used_2() {
| ---------------------------- because it's nested under this `unsafe` fn
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
...
LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
|
= note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn`
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:432:28
@ -756,19 +609,12 @@ LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:466:20
--> $DIR/lint-unused-unsafe.rs:467:24
|
LL | unsafe fn granular_disallow_op_in_unsafe_fn_3() {
| ----------------------------------------------- because it's nested under this `unsafe` fn
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
|
= note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn`
note: the lint level is defined here
--> $DIR/lint-unused-unsafe.rs:464:13
|
LL | #[allow(unsafe_op_in_unsafe_fn)]
| ^^^^^^^^^^^^^^^^^^^^^^
| ------ because it's nested under this `unsafe` block
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:480:24
@ -988,91 +834,32 @@ error: unnecessary `unsafe` block
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:622:24
|
LL | unsafe fn granularity_2() {
| ------------------------- because it's nested under this `unsafe` fn
LL | let _ = || unsafe {
LL | let _ = || unsafe { let _ = || unsf(); };
| ^^^^^^ unnecessary `unsafe` block
|
= note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn`
note: the lint level is defined here
--> $DIR/lint-unused-unsafe.rs:619:13
|
LL | #[allow(unsafe_op_in_unsafe_fn)]
| ^^^^^^^^^^^^^^^^^^^^^^
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:623:24
|
LL | unsafe fn granularity_2() {
| ------------------------- because it's nested under this `unsafe` fn
...
LL | let _ = || unsafe { let _ = || unsf(); };
| ^^^^^^ unnecessary `unsafe` block
|
= note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn`
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:624:24
|
LL | unsafe fn granularity_2() {
| ------------------------- because it's nested under this `unsafe` fn
...
LL | let _ = || unsafe { let _ = || unsf(); };
| ^^^^^^ unnecessary `unsafe` block
|
= note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn`
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:630:20
|
LL | unsafe fn top_level_used_2() {
| ---------------------------- because it's nested under this `unsafe` fn
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
|
= note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn`
note: the lint level is defined here
--> $DIR/lint-unused-unsafe.rs:628:13
|
LL | #[allow(unsafe_op_in_unsafe_fn)]
| ^^^^^^^^^^^^^^^^^^^^^^
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:632:24
|
LL | unsafe fn top_level_used_2() {
| ---------------------------- because it's nested under this `unsafe` fn
...
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
LL | let _ = || unsf();
LL | let _ = || unsafe { let _ = || unsf(); };
| ^^^^^^ unnecessary `unsafe` block
|
= note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn`
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:633:24
|
LL | unsafe fn top_level_used_2() {
| ---------------------------- because it's nested under this `unsafe` fn
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
...
LL | let _ = || unsafe { let _ = || unsf(); };
| ^^^^^^ unnecessary `unsafe` block
|
= note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn`
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:634:24
|
LL | unsafe fn top_level_used_2() {
| ---------------------------- because it's nested under this `unsafe` fn
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
...
LL | let _ = || unsafe { let _ = || unsf(); };
| ^^^^^^ unnecessary `unsafe` block
|
= note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn`
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:645:28
@ -1114,19 +901,12 @@ LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:679:20
--> $DIR/lint-unused-unsafe.rs:680:24
|
LL | unsafe fn granular_disallow_op_in_unsafe_fn_3() {
| ----------------------------------------------- because it's nested under this `unsafe` fn
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
|
= note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn`
note: the lint level is defined here
--> $DIR/lint-unused-unsafe.rs:677:13
|
LL | #[allow(unsafe_op_in_unsafe_fn)]
| ^^^^^^^^^^^^^^^^^^^^^^
| ------ because it's nested under this `unsafe` block
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:693:24
@ -1256,91 +1036,32 @@ error: unnecessary `unsafe` block
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:784:28
|
LL | unsafe fn granularity_2() {
| ------------------------- because it's nested under this `unsafe` fn
LL | let _ = || unsafe {
LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
|
= note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn`
note: the lint level is defined here
--> $DIR/lint-unused-unsafe.rs:781:17
|
LL | #[allow(unsafe_op_in_unsafe_fn)]
| ^^^^^^^^^^^^^^^^^^^^^^
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:785:28
|
LL | unsafe fn granularity_2() {
| ------------------------- because it's nested under this `unsafe` fn
...
LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
|
= note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn`
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:786:28
|
LL | unsafe fn granularity_2() {
| ------------------------- because it's nested under this `unsafe` fn
...
LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
|
= note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn`
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:792:24
|
LL | unsafe fn top_level_used_2() {
| ---------------------------- because it's nested under this `unsafe` fn
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
|
= note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn`
note: the lint level is defined here
--> $DIR/lint-unused-unsafe.rs:790:17
|
LL | #[allow(unsafe_op_in_unsafe_fn)]
| ^^^^^^^^^^^^^^^^^^^^^^
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:794:28
|
LL | unsafe fn top_level_used_2() {
| ---------------------------- because it's nested under this `unsafe` fn
...
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
LL | unsf();
LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
|
= note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn`
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:795:28
|
LL | unsafe fn top_level_used_2() {
| ---------------------------- because it's nested under this `unsafe` fn
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
...
LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
|
= note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn`
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:796:28
|
LL | unsafe fn top_level_used_2() {
| ---------------------------- because it's nested under this `unsafe` fn
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
...
LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
|
= note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn`
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:807:32
@ -1382,19 +1103,12 @@ LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:841:24
--> $DIR/lint-unused-unsafe.rs:842:28
|
LL | unsafe fn granular_disallow_op_in_unsafe_fn_3() {
| ----------------------------------------------- because it's nested under this `unsafe` fn
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
|
= note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn`
note: the lint level is defined here
--> $DIR/lint-unused-unsafe.rs:839:17
|
LL | #[allow(unsafe_op_in_unsafe_fn)]
| ^^^^^^^^^^^^^^^^^^^^^^
| ------ because it's nested under this `unsafe` block
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:855:28
@ -1524,91 +1238,32 @@ error: unnecessary `unsafe` block
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:942:28
|
LL | unsafe fn granularity_2() {
| ------------------------- because it's nested under this `unsafe` fn
LL | let _ = || unsafe {
LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
|
= note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn`
note: the lint level is defined here
--> $DIR/lint-unused-unsafe.rs:939:17
|
LL | #[allow(unsafe_op_in_unsafe_fn)]
| ^^^^^^^^^^^^^^^^^^^^^^
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:943:28
|
LL | unsafe fn granularity_2() {
| ------------------------- because it's nested under this `unsafe` fn
...
LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
|
= note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn`
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:944:28
|
LL | unsafe fn granularity_2() {
| ------------------------- because it's nested under this `unsafe` fn
...
LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
|
= note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn`
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:950:24
|
LL | unsafe fn top_level_used_2() {
| ---------------------------- because it's nested under this `unsafe` fn
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
|
= note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn`
note: the lint level is defined here
--> $DIR/lint-unused-unsafe.rs:948:17
|
LL | #[allow(unsafe_op_in_unsafe_fn)]
| ^^^^^^^^^^^^^^^^^^^^^^
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:952:28
|
LL | unsafe fn top_level_used_2() {
| ---------------------------- because it's nested under this `unsafe` fn
...
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
LL | unsf();
LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
|
= note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn`
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:953:28
|
LL | unsafe fn top_level_used_2() {
| ---------------------------- because it's nested under this `unsafe` fn
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
...
LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
|
= note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn`
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:954:28
|
LL | unsafe fn top_level_used_2() {
| ---------------------------- because it's nested under this `unsafe` fn
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
...
LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
|
= note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn`
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:965:32
@ -1650,19 +1305,12 @@ LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:999:24
--> $DIR/lint-unused-unsafe.rs:1000:28
|
LL | unsafe fn granular_disallow_op_in_unsafe_fn_3() {
| ----------------------------------------------- because it's nested under this `unsafe` fn
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
|
= note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn`
note: the lint level is defined here
--> $DIR/lint-unused-unsafe.rs:997:17
|
LL | #[allow(unsafe_op_in_unsafe_fn)]
| ^^^^^^^^^^^^^^^^^^^^^^
| ------ because it's nested under this `unsafe` block
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:1013:28
@ -1672,21 +1320,6 @@ LL | let _ = || unsafe {
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:1044:9
|
LL | unsafe fn multiple_unsafe_op_in_unsafe_fn_allows() {
| -------------------------------------------------- because it's nested under this `unsafe` fn
LL | unsafe {
| ^^^^^^ unnecessary `unsafe` block
|
= note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn`
note: the lint level is defined here
--> $DIR/lint-unused-unsafe.rs:1045:21
|
LL | #[allow(unsafe_op_in_unsafe_fn)]
| ^^^^^^^^^^^^^^^^^^^^^^
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:1059:29
|
@ -1726,87 +1359,32 @@ error: unnecessary `unsafe` block
LL | let _ = async { unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:1074:33
|
LL | async unsafe fn async_blocks() {
| ------------------------------ because it's nested under this `unsafe` fn
...
LL | let _ = async { unsafe { let _ = async { unsf() }; }};
| ^^^^^^ unnecessary `unsafe` block
|
= note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn`
note: the lint level is defined here
--> $DIR/lint-unused-unsafe.rs:1071:17
|
LL | #[allow(unsafe_op_in_unsafe_fn)]
| ^^^^^^^^^^^^^^^^^^^^^^
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:1075:33
|
LL | async unsafe fn async_blocks() {
| ------------------------------ because it's nested under this `unsafe` fn
...
LL | let _ = async { unsafe { let _ = async { unsf() }; }};
| ^^^^^^ unnecessary `unsafe` block
|
= note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn`
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:1076:33
|
LL | async unsafe fn async_blocks() {
| ------------------------------ because it's nested under this `unsafe` fn
...
LL | let _ = async { unsafe { let _ = async { unsf() }; }};
| ^^^^^^ unnecessary `unsafe` block
|
= note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn`
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:1078:29
|
LL | async unsafe fn async_blocks() {
| ------------------------------ because it's nested under this `unsafe` fn
...
LL | let _ = async { unsafe {
| ^^^^^^ unnecessary `unsafe` block
|
= note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn`
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:1080:33
|
LL | async unsafe fn async_blocks() {
| ------------------------------ because it's nested under this `unsafe` fn
...
LL | let _ = async { unsafe {
| ------ because it's nested under this `unsafe` block
LL | let _ = async { unsf() };
LL | let _ = async { unsafe { let _ = async { unsf() }; }};
| ^^^^^^ unnecessary `unsafe` block
|
= note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn`
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:1081:33
|
LL | async unsafe fn async_blocks() {
| ------------------------------ because it's nested under this `unsafe` fn
LL | let _ = async { unsafe {
| ------ because it's nested under this `unsafe` block
...
LL | let _ = async { unsafe { let _ = async { unsf() }; }};
| ^^^^^^ unnecessary `unsafe` block
|
= note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn`
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:1082:33
|
LL | async unsafe fn async_blocks() {
| ------------------------------ because it's nested under this `unsafe` fn
LL | let _ = async { unsafe {
| ------ because it's nested under this `unsafe` block
...
LL | let _ = async { unsafe { let _ = async { unsf() }; }};
| ^^^^^^ unnecessary `unsafe` block
|
= note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn`
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:1092:22
@ -1820,5 +1398,5 @@ error: unnecessary `unsafe` block
LL | let _x: [(); unsafe { unsafe { size() } }] = [];
| ^^^^^^ unnecessary `unsafe` block
error: aborting due to 201 previous errors
error: aborting due to 174 previous errors

View file

@ -27,7 +27,7 @@ fn bad1() { unsafe {} } //~ ERROR: unnecessary `unsafe` block
fn bad2() { unsafe { bad1() } } //~ ERROR: unnecessary `unsafe` block
unsafe fn bad3() { unsafe {} } //~ ERROR: unnecessary `unsafe` block
fn bad4() { unsafe { callback(||{}) } } //~ ERROR: unnecessary `unsafe` block
unsafe fn bad5() { unsafe { unsf() } } //~ ERROR: unnecessary `unsafe` block
unsafe fn bad5() { unsafe { unsf() } }
fn bad6() {
unsafe { //~ ERROR: unnecessary `unsafe` block
unsafe { // don't put the warning here
@ -37,7 +37,7 @@ fn bad6() {
}
unsafe fn bad7() {
unsafe { //~ ERROR: unnecessary `unsafe` block
unsafe { //~ ERROR: unnecessary `unsafe` block
unsafe {
unsf()
}
}
@ -194,15 +194,15 @@ mod additional_tests {
#[allow(unsafe_op_in_unsafe_fn)]
unsafe fn granularity_2() {
unsafe { //~ ERROR: unnecessary `unsafe` block
unsafe { unsf() } //~ ERROR: unnecessary `unsafe` block
unsafe { unsf() } //~ ERROR: unnecessary `unsafe` block
unsafe { unsf() } //~ ERROR: unnecessary `unsafe` block
unsafe { unsf() }
unsafe { unsf() }
unsafe { unsf() }
}
}
#[allow(unsafe_op_in_unsafe_fn)]
unsafe fn top_level_used_2() {
unsafe { //~ ERROR: unnecessary `unsafe` block
unsafe {
unsf();
unsafe { unsf() } //~ ERROR: unnecessary `unsafe` block
unsafe { unsf() } //~ ERROR: unnecessary `unsafe` block
@ -251,8 +251,8 @@ mod additional_tests {
#[allow(unsafe_op_in_unsafe_fn)]
unsafe fn granular_disallow_op_in_unsafe_fn_3() {
unsafe { //~ ERROR: unnecessary `unsafe` block
unsafe {
unsafe {
unsafe { //~ ERROR: unnecessary `unsafe` block
#[deny(unsafe_op_in_unsafe_fn)]
{
unsf();
@ -406,15 +406,15 @@ mod additional_tests_closures {
#[allow(unsafe_op_in_unsafe_fn)]
unsafe fn granularity_2() {
let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block
let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block
let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block
let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block
let _ = || unsafe { unsf() };
let _ = || unsafe { unsf() };
let _ = || unsafe { unsf() };
};
}
#[allow(unsafe_op_in_unsafe_fn)]
unsafe fn top_level_used_2() {
let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block
let _ = || unsafe {
unsf();
let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block
let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block
@ -463,8 +463,8 @@ mod additional_tests_closures {
#[allow(unsafe_op_in_unsafe_fn)]
unsafe fn granular_disallow_op_in_unsafe_fn_3() {
let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block
let _ = || unsafe {
let _ = || unsafe {
let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block
#[deny(unsafe_op_in_unsafe_fn)]
{
unsf();
@ -619,15 +619,15 @@ mod additional_tests_even_more_closures {
#[allow(unsafe_op_in_unsafe_fn)]
unsafe fn granularity_2() {
let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block
let _ = || unsafe { let _ = || unsf(); }; //~ ERROR: unnecessary `unsafe` block
let _ = || unsafe { let _ = || unsf(); }; //~ ERROR: unnecessary `unsafe` block
let _ = || unsafe { let _ = || unsf(); }; //~ ERROR: unnecessary `unsafe` block
let _ = || unsafe { let _ = || unsf(); };
let _ = || unsafe { let _ = || unsf(); };
let _ = || unsafe { let _ = || unsf(); };
};
}
#[allow(unsafe_op_in_unsafe_fn)]
unsafe fn top_level_used_2() {
let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block
let _ = || unsafe {
let _ = || unsf();
let _ = || unsafe { let _ = || unsf(); }; //~ ERROR: unnecessary `unsafe` block
let _ = || unsafe { let _ = || unsf(); }; //~ ERROR: unnecessary `unsafe` block
@ -676,8 +676,8 @@ mod additional_tests_even_more_closures {
#[allow(unsafe_op_in_unsafe_fn)]
unsafe fn granular_disallow_op_in_unsafe_fn_3() {
let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block
let _ = || unsafe {
let _ = || unsafe {
let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block
#[deny(unsafe_op_in_unsafe_fn)]
{
let _ = || unsf();
@ -781,15 +781,15 @@ mod item_likes {
#[allow(unsafe_op_in_unsafe_fn)]
unsafe fn granularity_2() {
let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block
let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block
let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block
let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block
let _ = || unsafe { unsf() };
let _ = || unsafe { unsf() };
let _ = || unsafe { unsf() };
};
}
#[allow(unsafe_op_in_unsafe_fn)]
unsafe fn top_level_used_2() {
let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block
let _ = || unsafe {
unsf();
let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block
let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block
@ -838,8 +838,8 @@ mod item_likes {
#[allow(unsafe_op_in_unsafe_fn)]
unsafe fn granular_disallow_op_in_unsafe_fn_3() {
let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block
let _ = || unsafe {
let _ = || unsafe {
let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block
#[deny(unsafe_op_in_unsafe_fn)]
{
unsf();
@ -939,15 +939,15 @@ mod item_likes {
#[allow(unsafe_op_in_unsafe_fn)]
unsafe fn granularity_2() {
let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block
let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block
let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block
let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block
let _ = || unsafe { unsf() };
let _ = || unsafe { unsf() };
let _ = || unsafe { unsf() };
};
}
#[allow(unsafe_op_in_unsafe_fn)]
unsafe fn top_level_used_2() {
let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block
let _ = || unsafe {
unsf();
let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block
let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block
@ -996,8 +996,8 @@ mod item_likes {
#[allow(unsafe_op_in_unsafe_fn)]
unsafe fn granular_disallow_op_in_unsafe_fn_3() {
let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block
let _ = || unsafe {
let _ = || unsafe {
let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block
#[deny(unsafe_op_in_unsafe_fn)]
{
unsf();
@ -1041,7 +1041,7 @@ mod additional_tests_extra {
#[warn(unsafe_op_in_unsafe_fn)]
unsafe fn multiple_unsafe_op_in_unsafe_fn_allows() {
unsafe { //~ ERROR: unnecessary `unsafe` block
unsafe {
#[allow(unsafe_op_in_unsafe_fn)]
{
unsf();
@ -1071,11 +1071,11 @@ mod additional_tests_extra {
#[allow(unsafe_op_in_unsafe_fn)]
{
let _ = async { unsafe { //~ ERROR: unnecessary `unsafe` block
let _ = async { unsafe { let _ = async { unsf() }; }}; //~ ERROR: unnecessary `unsafe` block
let _ = async { unsafe { let _ = async { unsf() }; }}; //~ ERROR: unnecessary `unsafe` block
let _ = async { unsafe { let _ = async { unsf() }; }}; //~ ERROR: unnecessary `unsafe` block
let _ = async { unsafe { let _ = async { unsf() }; }};
let _ = async { unsafe { let _ = async { unsf() }; }};
let _ = async { unsafe { let _ = async { unsf() }; }};
}};
let _ = async { unsafe { //~ ERROR: unnecessary `unsafe` block
let _ = async { unsafe {
let _ = async { unsf() };
let _ = async { unsafe { let _ = async { unsf() }; }}; //~ ERROR: unnecessary `unsafe` block
let _ = async { unsafe { let _ = async { unsf() }; }}; //~ ERROR: unnecessary `unsafe` block

View file

@ -0,0 +1,8 @@
// check-pass
fn f<T> (it: &[T])
where
[T] : std::ops::Index<usize>,
{
let _ = &it[0];
}
fn main(){}

View file

@ -81,40 +81,8 @@ error: unnecessary `unsafe` block
LL | unsafe { unsafe { unsf() } }
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:60:5
|
LL | unsafe fn allow_level() {
| ----------------------- because it's nested under this `unsafe` fn
...
LL | unsafe { unsf() }
| ^^^^^^ unnecessary `unsafe` block
|
= note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn`
note: the lint level is defined here
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:53:9
|
LL | #[allow(unsafe_op_in_unsafe_fn)]
| ^^^^^^^^^^^^^^^^^^^^^^
error: unnecessary `unsafe` block
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:72:9
|
LL | unsafe fn nested_allow_level() {
| ------------------------------ because it's nested under this `unsafe` fn
...
LL | unsafe { unsf() }
| ^^^^^^ unnecessary `unsafe` block
|
= note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn`
note: the lint level is defined here
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:65:13
|
LL | #[allow(unsafe_op_in_unsafe_fn)]
| ^^^^^^^^^^^^^^^^^^^^^^
error[E0133]: call to unsafe function is unsafe and requires unsafe block
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:78:5
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:76:5
|
LL | unsf();
| ^^^^^^ call to unsafe function
@ -122,13 +90,13 @@ LL | unsf();
= note: consult the function's documentation for information on how to avoid undefined behavior
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:83:9
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:81:9
|
LL | unsf();
| ^^^^^^ call to unsafe function
|
= note: consult the function's documentation for information on how to avoid undefined behavior
error: aborting due to 13 previous errors
error: aborting due to 11 previous errors
For more information about this error, try `rustc --explain E0133`.

View file

@ -58,7 +58,6 @@ unsafe fn allow_level() {
VOID = ();
unsafe { unsf() }
//~^ ERROR unnecessary `unsafe` block
}
unsafe fn nested_allow_level() {
@ -70,7 +69,6 @@ unsafe fn nested_allow_level() {
VOID = ();
unsafe { unsf() }
//~^ ERROR unnecessary `unsafe` block
}
}

View file

@ -83,26 +83,8 @@ LL | unsafe { unsafe { unsf() } }
| |
| because it's nested under this `unsafe` block
error: unnecessary `unsafe` block
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:60:5
|
LL | unsafe fn allow_level() {
| ----------------------- because it's nested under this `unsafe` fn
...
LL | unsafe { unsf() }
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:72:9
|
LL | unsafe fn nested_allow_level() {
| ------------------------------ because it's nested under this `unsafe` fn
...
LL | unsafe { unsf() }
| ^^^^^^ unnecessary `unsafe` block
error[E0133]: call to unsafe function `unsf` is unsafe and requires unsafe block
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:78:5
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:76:5
|
LL | unsf();
| ^^^^^^ call to unsafe function
@ -110,13 +92,13 @@ LL | unsf();
= note: consult the function's documentation for information on how to avoid undefined behavior
error[E0133]: call to unsafe function `unsf` is unsafe and requires unsafe function or block
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:83:9
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:81:9
|
LL | unsf();
| ^^^^^^ call to unsafe function
|
= note: consult the function's documentation for information on how to avoid undefined behavior
error: aborting due to 13 previous errors
error: aborting due to 11 previous errors
For more information about this error, try `rustc --explain E0133`.