Auto merge of #142033 - matthiaskrgr:rollup-99lvg0j, r=matthiaskrgr
Rollup of 11 pull requests Successful merges: - rust-lang/rust#141890 (Add link to correct documentation in htmldocck.py) - rust-lang/rust#141932 (Fix for async drop inside async gen fn) - rust-lang/rust#141960 (Use non-2015 edition paths in tests that do not test for their resolution) - rust-lang/rust#141968 (Run wfcheck in one big loop instead of per module) - rust-lang/rust#141969 (Triagebot: Remove `assign.users_on_vacation`) - rust-lang/rust#141985 (Ensure query keys are printed with reduced queries) - rust-lang/rust#141999 (Visit the ident in `PreciseCapturingNonLifetimeArg`.) - rust-lang/rust#142005 (Change `tag_field` to `FieldIdx` in `Variants::Multiple`) - rust-lang/rust#142017 (Fix incorrect use of "recommend" over "recommended") - rust-lang/rust#142024 (Don't refer to 'this tail expression' in expansion.) - rust-lang/rust#142025 (Don't refer to 'local binding' in extern macro.) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
81a964c23e
97 changed files with 478 additions and 534 deletions
|
|
@ -758,7 +758,7 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
|
|||
niche_variants,
|
||||
niche_start,
|
||||
},
|
||||
tag_field: 0,
|
||||
tag_field: FieldIdx::new(0),
|
||||
variants: IndexVec::new(),
|
||||
},
|
||||
fields: FieldsShape::Arbitrary {
|
||||
|
|
@ -1072,7 +1072,7 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
|
|||
variants: Variants::Multiple {
|
||||
tag,
|
||||
tag_encoding: TagEncoding::Direct,
|
||||
tag_field: 0,
|
||||
tag_field: FieldIdx::new(0),
|
||||
variants: IndexVec::new(),
|
||||
},
|
||||
fields: FieldsShape::Arbitrary {
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ pub(super) fn layout<
|
|||
// Build a prefix layout, including "promoting" all ineligible
|
||||
// locals as part of the prefix. We compute the layout of all of
|
||||
// these fields at once to get optimal packing.
|
||||
let tag_index = prefix_layouts.len();
|
||||
let tag_index = prefix_layouts.next_index();
|
||||
|
||||
// `variant_fields` already accounts for the reserved variants, so no need to add them.
|
||||
let max_discr = (variant_fields.len() - 1) as u128;
|
||||
|
|
@ -187,7 +187,7 @@ pub(super) fn layout<
|
|||
|
||||
// "a" (`0..b_start`) and "b" (`b_start..`) correspond to
|
||||
// "outer" and "promoted" fields respectively.
|
||||
let b_start = FieldIdx::new(tag_index + 1);
|
||||
let b_start = tag_index.plus(1);
|
||||
let offsets_b = IndexVec::from_raw(offsets.raw.split_off(b_start.index()));
|
||||
let offsets_a = offsets;
|
||||
|
||||
|
|
|
|||
|
|
@ -1573,7 +1573,7 @@ pub enum Variants<FieldIdx: Idx, VariantIdx: Idx> {
|
|||
Multiple {
|
||||
tag: Scalar,
|
||||
tag_encoding: TagEncoding<VariantIdx>,
|
||||
tag_field: usize,
|
||||
tag_field: FieldIdx,
|
||||
variants: IndexVec<VariantIdx, LayoutData<FieldIdx, VariantIdx>>,
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3314,7 +3314,13 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
|
|||
"function parameter".to_string(),
|
||||
"function parameter borrowed here".to_string(),
|
||||
),
|
||||
LocalKind::Temp if self.body.local_decls[local].is_user_variable() => {
|
||||
LocalKind::Temp
|
||||
if self.body.local_decls[local].is_user_variable()
|
||||
&& !self.body.local_decls[local]
|
||||
.source_info
|
||||
.span
|
||||
.in_external_macro(self.infcx.tcx.sess.source_map()) =>
|
||||
{
|
||||
("local binding".to_string(), "local binding introduced here".to_string())
|
||||
}
|
||||
LocalKind::ReturnPointer | LocalKind::Temp => {
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ pub(crate) fn codegen_set_discriminant<'tcx>(
|
|||
tag_encoding: TagEncoding::Direct,
|
||||
variants: _,
|
||||
} => {
|
||||
let ptr = place.place_field(fx, FieldIdx::new(tag_field));
|
||||
let ptr = place.place_field(fx, tag_field);
|
||||
let to = layout.ty.discriminant_for_variant(fx.tcx, variant_index).unwrap().val;
|
||||
let to = match ptr.layout().ty.kind() {
|
||||
ty::Uint(UintTy::U128) | ty::Int(IntTy::I128) => {
|
||||
|
|
@ -53,7 +53,7 @@ pub(crate) fn codegen_set_discriminant<'tcx>(
|
|||
variants: _,
|
||||
} => {
|
||||
if variant_index != untagged_variant {
|
||||
let niche = place.place_field(fx, FieldIdx::new(tag_field));
|
||||
let niche = place.place_field(fx, tag_field);
|
||||
let niche_type = fx.clif_type(niche.layout().ty).unwrap();
|
||||
let niche_value = variant_index.as_u32() - niche_variants.start().as_u32();
|
||||
let niche_value = (niche_value as u128).wrapping_add(niche_start);
|
||||
|
|
@ -118,7 +118,7 @@ pub(crate) fn codegen_get_discriminant<'tcx>(
|
|||
let cast_to = fx.clif_type(dest_layout.ty).unwrap();
|
||||
|
||||
// Read the tag/niche-encoded discriminant from memory.
|
||||
let tag = value.value_field(fx, FieldIdx::new(tag_field));
|
||||
let tag = value.value_field(fx, tag_field);
|
||||
let tag = tag.load_scalar(fx);
|
||||
|
||||
// Decode the discriminant (specifically if it's niche-encoded).
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use std::borrow::Cow;
|
||||
|
||||
use libc::c_uint;
|
||||
use rustc_abi::{Align, Endian, Size, TagEncoding, VariantIdx, Variants};
|
||||
use rustc_abi::{Align, Endian, FieldIdx, Size, TagEncoding, VariantIdx, Variants};
|
||||
use rustc_codegen_ssa::debuginfo::type_names::compute_debuginfo_type_name;
|
||||
use rustc_codegen_ssa::debuginfo::{tag_base_type, wants_c_like_enum_debuginfo};
|
||||
use rustc_codegen_ssa::traits::{ConstCodegenMethods, MiscCodegenMethods};
|
||||
|
|
@ -401,7 +401,7 @@ fn build_union_fields_for_enum<'ll, 'tcx>(
|
|||
enum_type_and_layout: TyAndLayout<'tcx>,
|
||||
enum_type_di_node: &'ll DIType,
|
||||
variant_indices: impl Iterator<Item = VariantIdx> + Clone,
|
||||
tag_field: usize,
|
||||
tag_field: FieldIdx,
|
||||
untagged_variant_index: Option<VariantIdx>,
|
||||
) -> SmallVec<&'ll DIType> {
|
||||
let tag_base_type = tag_base_type(cx.tcx, enum_type_and_layout);
|
||||
|
|
@ -805,7 +805,7 @@ fn build_union_fields_for_direct_tag_enum_or_coroutine<'ll, 'tcx>(
|
|||
variant_field_infos: &[VariantFieldInfo<'ll>],
|
||||
discr_type_di_node: &'ll DIType,
|
||||
tag_base_type: Ty<'tcx>,
|
||||
tag_field: usize,
|
||||
tag_field: FieldIdx,
|
||||
untagged_variant_index: Option<VariantIdx>,
|
||||
di_flags: DIFlags,
|
||||
) -> SmallVec<&'ll DIType> {
|
||||
|
|
@ -858,7 +858,7 @@ fn build_union_fields_for_direct_tag_enum_or_coroutine<'ll, 'tcx>(
|
|||
}));
|
||||
|
||||
assert_eq!(
|
||||
cx.size_and_align_of(enum_type_and_layout.field(cx, tag_field).ty),
|
||||
cx.size_and_align_of(enum_type_and_layout.field(cx, tag_field.as_usize()).ty),
|
||||
cx.size_and_align_of(self::tag_base_type(cx.tcx, enum_type_and_layout))
|
||||
);
|
||||
|
||||
|
|
@ -875,7 +875,7 @@ fn build_union_fields_for_direct_tag_enum_or_coroutine<'ll, 'tcx>(
|
|||
Endian::Big => (8, 0),
|
||||
};
|
||||
|
||||
let tag_field_offset = enum_type_and_layout.fields.offset(tag_field).bytes();
|
||||
let tag_field_offset = enum_type_and_layout.fields.offset(tag_field.as_usize()).bytes();
|
||||
let lo_offset = Size::from_bytes(tag_field_offset + lo_offset);
|
||||
let hi_offset = Size::from_bytes(tag_field_offset + hi_offset);
|
||||
|
||||
|
|
@ -905,8 +905,8 @@ fn build_union_fields_for_direct_tag_enum_or_coroutine<'ll, 'tcx>(
|
|||
cx,
|
||||
enum_type_di_node,
|
||||
TAG_FIELD_NAME,
|
||||
enum_type_and_layout.field(cx, tag_field),
|
||||
enum_type_and_layout.fields.offset(tag_field),
|
||||
enum_type_and_layout.field(cx, tag_field.as_usize()),
|
||||
enum_type_and_layout.fields.offset(tag_field.as_usize()),
|
||||
di_flags,
|
||||
tag_base_type_di_node,
|
||||
None,
|
||||
|
|
|
|||
|
|
@ -373,7 +373,7 @@ fn build_discr_member_di_node<'ll, 'tcx>(
|
|||
file,
|
||||
UNKNOWN_LINE_NUMBER,
|
||||
layout,
|
||||
enum_or_coroutine_type_and_layout.fields.offset(tag_field),
|
||||
enum_or_coroutine_type_and_layout.fields.offset(tag_field.as_usize()),
|
||||
DIFlags::FlagArtificial,
|
||||
ty,
|
||||
))
|
||||
|
|
|
|||
|
|
@ -462,10 +462,10 @@ impl<'a, 'tcx, V: CodegenObject> OperandRef<'tcx, V> {
|
|||
let tag_op = match self.val {
|
||||
OperandValue::ZeroSized => bug!(),
|
||||
OperandValue::Immediate(_) | OperandValue::Pair(_, _) => {
|
||||
self.extract_field(fx, bx, tag_field)
|
||||
self.extract_field(fx, bx, tag_field.as_usize())
|
||||
}
|
||||
OperandValue::Ref(place) => {
|
||||
let tag = place.with_type(self.layout).project_field(bx, tag_field);
|
||||
let tag = place.with_type(self.layout).project_field(bx, tag_field.as_usize());
|
||||
bx.load_operand(tag)
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -250,7 +250,7 @@ impl<'a, 'tcx, V: CodegenObject> PlaceRef<'tcx, V> {
|
|||
Variants::Single { index } => assert_eq!(index, variant_index),
|
||||
|
||||
Variants::Multiple { tag_encoding: TagEncoding::Direct, tag_field, .. } => {
|
||||
let ptr = self.project_field(bx, tag_field);
|
||||
let ptr = self.project_field(bx, tag_field.as_usize());
|
||||
let to =
|
||||
self.layout.ty.discriminant_for_variant(bx.tcx(), variant_index).unwrap().val;
|
||||
bx.store_to_place(
|
||||
|
|
@ -265,7 +265,7 @@ impl<'a, 'tcx, V: CodegenObject> PlaceRef<'tcx, V> {
|
|||
..
|
||||
} => {
|
||||
if variant_index != untagged_variant {
|
||||
let niche = self.project_field(bx, tag_field);
|
||||
let niche = self.project_field(bx, tag_field.as_usize());
|
||||
let niche_llty = bx.cx().immediate_backend_type(niche.layout);
|
||||
let BackendRepr::Scalar(scalar) = niche.layout.backend_repr else {
|
||||
bug!("expected a scalar placeref for the niche");
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
//! Functions for reading and writing discriminants of multi-variant layouts (enums and coroutines).
|
||||
|
||||
use rustc_abi::{self as abi, TagEncoding, VariantIdx, Variants};
|
||||
use rustc_abi::{self as abi, FieldIdx, TagEncoding, VariantIdx, Variants};
|
||||
use rustc_middle::ty::layout::{LayoutOf, PrimitiveExt, TyAndLayout};
|
||||
use rustc_middle::ty::{self, CoroutineArgsExt, ScalarInt, Ty};
|
||||
use rustc_middle::{mir, span_bug};
|
||||
|
|
@ -26,7 +26,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
|
|||
// No need to validate that the discriminant here because the
|
||||
// `TyAndLayout::for_variant()` call earlier already checks the
|
||||
// variant is valid.
|
||||
let tag_dest = self.project_field(dest, tag_field)?;
|
||||
let tag_dest = self.project_field(dest, tag_field.as_usize())?;
|
||||
self.write_scalar(tag, &tag_dest)
|
||||
}
|
||||
None => {
|
||||
|
|
@ -96,7 +96,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
|
|||
let tag_layout = self.layout_of(tag_scalar_layout.primitive().to_int_ty(*self.tcx))?;
|
||||
|
||||
// Read tag and sanity-check `tag_layout`.
|
||||
let tag_val = self.read_immediate(&self.project_field(op, tag_field)?)?;
|
||||
let tag_val = self.read_immediate(&self.project_field(op, tag_field.as_usize())?)?;
|
||||
assert_eq!(tag_layout.size, tag_val.layout.size);
|
||||
assert_eq!(tag_layout.backend_repr.is_signed(), tag_val.layout.backend_repr.is_signed());
|
||||
trace!("tag value: {}", tag_val);
|
||||
|
|
@ -231,7 +231,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
|
|||
&self,
|
||||
layout: TyAndLayout<'tcx>,
|
||||
variant_index: VariantIdx,
|
||||
) -> InterpResult<'tcx, Option<(ScalarInt, usize)>> {
|
||||
) -> InterpResult<'tcx, Option<(ScalarInt, FieldIdx)>> {
|
||||
// Layout computation excludes uninhabited variants from consideration.
|
||||
// Therefore, there's no way to represent those variants in the given layout.
|
||||
// Essentially, uninhabited variants do not have a tag that corresponds to their
|
||||
|
|
|
|||
|
|
@ -294,7 +294,7 @@ impl<'rt, 'tcx, M: Machine<'tcx>> ValidityVisitor<'rt, 'tcx, M> {
|
|||
// First, check if we are projecting to a variant.
|
||||
match layout.variants {
|
||||
Variants::Multiple { tag_field, .. } => {
|
||||
if tag_field == field {
|
||||
if tag_field.as_usize() == field {
|
||||
return match layout.ty.kind() {
|
||||
ty::Adt(def, ..) if def.is_enum() => PathElem::EnumTag,
|
||||
ty::Coroutine(..) => PathElem::CoroutineTag,
|
||||
|
|
|
|||
|
|
@ -1332,8 +1332,9 @@ pub fn walk_precise_capturing_arg<'v, V: Visitor<'v>>(
|
|||
match *arg {
|
||||
PreciseCapturingArg::Lifetime(lt) => visitor.visit_lifetime(lt),
|
||||
PreciseCapturingArg::Param(param) => {
|
||||
let PreciseCapturingNonLifetimeArg { hir_id, ident: _, res: _ } = param;
|
||||
visitor.visit_id(hir_id)
|
||||
let PreciseCapturingNonLifetimeArg { hir_id, ident, res: _ } = param;
|
||||
try_visit!(visitor.visit_id(hir_id));
|
||||
visitor.visit_ident(ident)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ use rustc_data_structures::fx::{FxHashSet, FxIndexMap, FxIndexSet};
|
|||
use rustc_errors::codes::*;
|
||||
use rustc_errors::{Applicability, ErrorGuaranteed, pluralize, struct_span_code_err};
|
||||
use rustc_hir::def::{DefKind, Res};
|
||||
use rustc_hir::def_id::{DefId, LocalDefId, LocalModDefId};
|
||||
use rustc_hir::def_id::{DefId, LocalDefId};
|
||||
use rustc_hir::lang_items::LangItem;
|
||||
use rustc_hir::{AmbigArg, ItemKind};
|
||||
use rustc_infer::infer::outlives::env::OutlivesEnvironment;
|
||||
|
|
@ -2402,8 +2402,8 @@ impl<'tcx> WfCheckingCtxt<'_, 'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
fn check_mod_type_wf(tcx: TyCtxt<'_>, module: LocalModDefId) -> Result<(), ErrorGuaranteed> {
|
||||
let items = tcx.hir_module_items(module);
|
||||
fn check_type_wf(tcx: TyCtxt<'_>, (): ()) -> Result<(), ErrorGuaranteed> {
|
||||
let items = tcx.hir_crate_items(());
|
||||
let res = items
|
||||
.par_items(|item| tcx.ensure_ok().check_well_formed(item.owner_id.def_id))
|
||||
.and(items.par_impl_items(|item| tcx.ensure_ok().check_well_formed(item.owner_id.def_id)))
|
||||
|
|
@ -2412,9 +2412,8 @@ fn check_mod_type_wf(tcx: TyCtxt<'_>, module: LocalModDefId) -> Result<(), Error
|
|||
items.par_foreign_items(|item| tcx.ensure_ok().check_well_formed(item.owner_id.def_id)),
|
||||
)
|
||||
.and(items.par_opaques(|item| tcx.ensure_ok().check_well_formed(item)));
|
||||
if module == LocalModDefId::CRATE_DEF_ID {
|
||||
super::entry::check_for_entry_fn(tcx);
|
||||
}
|
||||
super::entry::check_for_entry_fn(tcx);
|
||||
|
||||
res
|
||||
}
|
||||
|
||||
|
|
@ -2552,5 +2551,5 @@ struct RedundantLifetimeArgsLint<'tcx> {
|
|||
}
|
||||
|
||||
pub fn provide(providers: &mut Providers) {
|
||||
*providers = Providers { check_mod_type_wf, check_well_formed, ..*providers };
|
||||
*providers = Providers { check_type_wf, check_well_formed, ..*providers };
|
||||
}
|
||||
|
|
|
|||
|
|
@ -182,9 +182,7 @@ pub fn check_crate(tcx: TyCtxt<'_>) {
|
|||
// what we are intending to discard, to help future type-based refactoring.
|
||||
type R = Result<(), ErrorGuaranteed>;
|
||||
|
||||
tcx.par_hir_for_each_module(|module| {
|
||||
let _: R = tcx.ensure_ok().check_mod_type_wf(module);
|
||||
});
|
||||
let _: R = tcx.ensure_ok().check_type_wf(());
|
||||
|
||||
for &trait_def_id in tcx.all_local_trait_impls(()).keys() {
|
||||
let _: R = tcx.ensure_ok().coherent_trait(trait_def_id);
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ use rustc_data_structures::profiling::SelfProfilerRef;
|
|||
use rustc_query_system::ich::StableHashingContext;
|
||||
use rustc_session::Session;
|
||||
|
||||
use crate::ty::print::with_reduced_queries;
|
||||
use crate::ty::{self, TyCtxt};
|
||||
|
||||
#[macro_use]
|
||||
|
|
@ -84,4 +85,8 @@ impl<'tcx> DepContext for TyCtxt<'tcx> {
|
|||
fn dep_kind_info(&self, dk: DepKind) -> &DepKindStruct<'tcx> {
|
||||
&self.query_kinds[dk.as_usize()]
|
||||
}
|
||||
|
||||
fn with_reduced_queries<T>(self, f: impl FnOnce() -> T) -> T {
|
||||
with_reduced_queries!(f())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1148,8 +1148,8 @@ rustc_queries! {
|
|||
desc { |tcx| "checking deathness of variables in {}", describe_as_module(key, tcx) }
|
||||
}
|
||||
|
||||
query check_mod_type_wf(key: LocalModDefId) -> Result<(), ErrorGuaranteed> {
|
||||
desc { |tcx| "checking that types are well-formed in {}", describe_as_module(key, tcx) }
|
||||
query check_type_wf(key: ()) -> Result<(), ErrorGuaranteed> {
|
||||
desc { "checking that types are well-formed" }
|
||||
return_result_from_ensure_ok
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -934,7 +934,7 @@ where
|
|||
.unwrap(),
|
||||
),
|
||||
Variants::Multiple { tag, tag_field, .. } => {
|
||||
if i == tag_field {
|
||||
if FieldIdx::from_usize(i) == tag_field {
|
||||
return TyMaybeWithLayout::TyAndLayout(tag_layout(tag));
|
||||
}
|
||||
TyMaybeWithLayout::Ty(args.as_coroutine().prefix_tys()[i])
|
||||
|
|
@ -1060,8 +1060,10 @@ where
|
|||
tag_field,
|
||||
variants,
|
||||
..
|
||||
} if variants.len() == 2 && this.fields.offset(*tag_field) == offset => {
|
||||
let tagged_variant = if untagged_variant.as_u32() == 0 {
|
||||
} if variants.len() == 2
|
||||
&& this.fields.offset(tag_field.as_usize()) == offset =>
|
||||
{
|
||||
let tagged_variant = if *untagged_variant == VariantIdx::ZERO {
|
||||
VariantIdx::from_u32(1)
|
||||
} else {
|
||||
VariantIdx::from_u32(0)
|
||||
|
|
|
|||
|
|
@ -1886,7 +1886,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
|
|||
) -> Result<(), PrintError> {
|
||||
define_scoped_cx!(self);
|
||||
|
||||
if self.should_print_verbose() {
|
||||
if with_reduced_queries() || self.should_print_verbose() {
|
||||
p!(write("ValTree({:?}: ", cv.valtree), print(cv.ty), ")");
|
||||
return Ok(());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -382,12 +382,34 @@ pub(super) fn expand_async_drops<'tcx>(
|
|||
dropline_call_bb = Some(drop_call_bb);
|
||||
}
|
||||
|
||||
// value needed only for return-yields or gen-coroutines, so just const here
|
||||
let value = Operand::Constant(Box::new(ConstOperand {
|
||||
span: body.span,
|
||||
user_ty: None,
|
||||
const_: Const::from_bool(tcx, false),
|
||||
}));
|
||||
let value =
|
||||
if matches!(coroutine_kind, CoroutineKind::Desugared(CoroutineDesugaring::AsyncGen, _))
|
||||
{
|
||||
// For AsyncGen we need `yield Poll<OptRet>::Pending`
|
||||
let full_yield_ty = body.yield_ty().unwrap();
|
||||
let ty::Adt(_poll_adt, args) = *full_yield_ty.kind() else { bug!() };
|
||||
let ty::Adt(_option_adt, args) = *args.type_at(0).kind() else { bug!() };
|
||||
let yield_ty = args.type_at(0);
|
||||
Operand::Constant(Box::new(ConstOperand {
|
||||
span: source_info.span,
|
||||
const_: Const::Unevaluated(
|
||||
UnevaluatedConst::new(
|
||||
tcx.require_lang_item(LangItem::AsyncGenPending, None),
|
||||
tcx.mk_args(&[yield_ty.into()]),
|
||||
),
|
||||
full_yield_ty,
|
||||
),
|
||||
user_ty: None,
|
||||
}))
|
||||
} else {
|
||||
// value needed only for return-yields or gen-coroutines, so just const here
|
||||
Operand::Constant(Box::new(ConstOperand {
|
||||
span: body.span,
|
||||
user_ty: None,
|
||||
const_: Const::from_bool(tcx, false),
|
||||
}))
|
||||
};
|
||||
|
||||
use rustc_middle::mir::AssertKind::ResumedAfterDrop;
|
||||
let panic_bb = insert_panic_block(tcx, body, ResumedAfterDrop(coroutine_kind));
|
||||
|
||||
|
|
|
|||
|
|
@ -178,9 +178,7 @@ pub trait DepNodeParams<Tcx: DepContext>: fmt::Debug + Sized {
|
|||
panic!("Not implemented. Accidentally called on anonymous node?")
|
||||
}
|
||||
|
||||
fn to_debug_str(&self, _: Tcx) -> String {
|
||||
format!("{self:?}")
|
||||
}
|
||||
fn to_debug_str(&self, tcx: Tcx) -> String;
|
||||
|
||||
/// This method tries to recover the query key from the given `DepNode`,
|
||||
/// something which is needed when forcing `DepNode`s during red-green
|
||||
|
|
@ -210,8 +208,11 @@ where
|
|||
}
|
||||
|
||||
#[inline(always)]
|
||||
default fn to_debug_str(&self, _: Tcx) -> String {
|
||||
format!("{:?}", *self)
|
||||
default fn to_debug_str(&self, tcx: Tcx) -> String {
|
||||
// Make sure to print dep node params with reduced queries since printing
|
||||
// may themselves call queries, which may lead to (possibly untracked!)
|
||||
// query cycles.
|
||||
tcx.with_reduced_queries(|| format!("{self:?}"))
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
|
|
|
|||
|
|
@ -88,6 +88,8 @@ pub trait DepContext: Copy {
|
|||
f(self, dep_node)
|
||||
}
|
||||
}
|
||||
|
||||
fn with_reduced_queries<T>(self, _: impl FnOnce() -> T) -> T;
|
||||
}
|
||||
|
||||
pub trait Deps: DynSync {
|
||||
|
|
|
|||
|
|
@ -180,7 +180,7 @@ impl<'tcx> Stable<'tcx> for rustc_abi::Variants<rustc_abi::FieldIdx, rustc_abi::
|
|||
VariantsShape::Multiple {
|
||||
tag: tag.stable(tables),
|
||||
tag_encoding: tag_encoding.stable(tables),
|
||||
tag_field: *tag_field,
|
||||
tag_field: tag_field.stable(tables),
|
||||
variants: variants.iter().as_slice().stable(tables),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3841,7 +3841,9 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
|||
.expr_ty_adjusted_opt(inner_expr)
|
||||
.unwrap_or(Ty::new_misc_error(tcx));
|
||||
let span = inner_expr.span;
|
||||
if Some(span) != err.span.primary_span() {
|
||||
if Some(span) != err.span.primary_span()
|
||||
&& !span.in_external_macro(tcx.sess.source_map())
|
||||
{
|
||||
err.span_label(
|
||||
span,
|
||||
if ty.references_error() {
|
||||
|
|
|
|||
|
|
@ -451,7 +451,7 @@ pub(crate) mod rustc {
|
|||
|
||||
// For enums (but not coroutines), the tag field is
|
||||
// currently always the first field of the layout.
|
||||
assert_eq!(*tag_field, 0);
|
||||
assert_eq!(*tag_field, FieldIdx::ZERO);
|
||||
|
||||
let variants = def.discriminants(cx.tcx()).try_fold(
|
||||
Self::uninhabited(),
|
||||
|
|
|
|||
|
|
@ -932,7 +932,7 @@ fn variant_info_for_coroutine<'tcx>(
|
|||
// However, if the discriminant is placed past the end of the variant, then we need
|
||||
// to factor in the size of the discriminant manually. This really should be refactored
|
||||
// better, but this "works" for now.
|
||||
if layout.fields.offset(tag_field) >= variant_size {
|
||||
if layout.fields.offset(tag_field.as_usize()) >= variant_size {
|
||||
variant_size += match tag_encoding {
|
||||
TagEncoding::Direct => tag.size(cx),
|
||||
_ => Size::ZERO,
|
||||
|
|
|
|||
|
|
@ -192,7 +192,7 @@ to save information after compiling a crate to be reused when recompiling the
|
|||
crate, improving re-compile times. This takes a path to a directory where
|
||||
incremental files will be stored.
|
||||
|
||||
Using incremental compilation inhibits certain optimizations (for example by increasing the amount of codegen units) and is therefore not recommend for release builds.
|
||||
Using incremental compilation inhibits certain optimizations (for example by increasing the amount of codegen units) and is therefore not recommended for release builds.
|
||||
|
||||
## inline-threshold
|
||||
|
||||
|
|
|
|||
|
|
@ -2,120 +2,8 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
r"""
|
||||
htmldocck.py is a custom checker script for Rustdoc HTML outputs.
|
||||
|
||||
# How and why?
|
||||
|
||||
The principle is simple: This script receives a path to generated HTML
|
||||
documentation and a "template" script, which has a series of check
|
||||
commands like `@has` or `@matches`. Each command is used to check if
|
||||
some pattern is present or not present in the particular file or in
|
||||
a particular node of the HTML tree. In many cases, the template script
|
||||
happens to be the source code given to rustdoc.
|
||||
|
||||
While it indeed is possible to test in smaller portions, it has been
|
||||
hard to construct tests in this fashion and major rendering errors were
|
||||
discovered much later. This script is designed to make black-box and
|
||||
regression testing of Rustdoc easy. This does not preclude the needs for
|
||||
unit testing, but can be used to complement related tests by quickly
|
||||
showing the expected renderings.
|
||||
|
||||
In order to avoid one-off dependencies for this task, this script uses
|
||||
a reasonably working HTML parser and the existing XPath implementation
|
||||
from Python's standard library. Hopefully, we won't render
|
||||
non-well-formed HTML.
|
||||
|
||||
# Commands
|
||||
|
||||
Commands start with an `@` followed by a command name (letters and
|
||||
hyphens), and zero or more arguments separated by one or more whitespace
|
||||
characters and optionally delimited with single or double quotes. The `@`
|
||||
mark cannot be preceded by a non-whitespace character. Other lines
|
||||
(including every text up to the first `@`) are ignored, but it is
|
||||
recommended to avoid the use of `@` in the template file.
|
||||
|
||||
There are a number of supported commands:
|
||||
|
||||
* `@has PATH` checks for the existence of the given file.
|
||||
|
||||
`PATH` is relative to the output directory. It can be given as `-`
|
||||
which repeats the most recently used `PATH`.
|
||||
|
||||
* `@hasraw PATH PATTERN` and `@matchesraw PATH PATTERN` checks
|
||||
for the occurrence of the given pattern `PATTERN` in the specified file.
|
||||
Only one occurrence of the pattern is enough.
|
||||
|
||||
For `@hasraw`, `PATTERN` is a whitespace-normalized (every consecutive
|
||||
whitespace being replaced by one single space character) string.
|
||||
The entire file is also whitespace-normalized including newlines.
|
||||
|
||||
For `@matchesraw`, `PATTERN` is a Python-supported regular expression.
|
||||
The file remains intact but the regexp is matched without the `MULTILINE`
|
||||
and `IGNORECASE` options. You can still use a prefix `(?m)` or `(?i)`
|
||||
to override them, and `\A` and `\Z` for definitely matching
|
||||
the beginning and end of the file.
|
||||
|
||||
(The same distinction goes to other variants of these commands.)
|
||||
|
||||
* `@has PATH XPATH PATTERN` and `@matches PATH XPATH PATTERN` checks for
|
||||
the presence of the given XPath `XPATH` in the specified HTML file,
|
||||
and also the occurrence of the given pattern `PATTERN` in the matching
|
||||
node or attribute. Only one occurrence of the pattern in the match
|
||||
is enough.
|
||||
|
||||
`PATH` should be a valid and well-formed HTML file. It does *not*
|
||||
accept arbitrary HTML5; it should have matching open and close tags
|
||||
and correct entity references at least.
|
||||
|
||||
`XPATH` is an XPath expression to match. The XPath is fairly limited:
|
||||
`tag`, `*`, `.`, `//`, `..`, `[@attr]`, `[@attr='value']`, `[tag]`,
|
||||
`[POS]` (element located in given `POS`), `[last()-POS]`, `text()`
|
||||
and `@attr` (both as the last segment) are supported. Some examples:
|
||||
|
||||
- `//pre` or `.//pre` matches any element with a name `pre`.
|
||||
- `//a[@href]` matches any element with an `href` attribute.
|
||||
- `//*[@class="impl"]//code` matches any element with a name `code`,
|
||||
which is an ancestor of some element which `class` attr is `impl`.
|
||||
- `//h1[@class="fqn"]/span[1]/a[last()]/@class` matches a value of
|
||||
`class` attribute in the last `a` element (can be followed by more
|
||||
elements that are not `a`) inside the first `span` in the `h1` with
|
||||
a class of `fqn`. Note that there cannot be any additional elements
|
||||
between them due to the use of `/` instead of `//`.
|
||||
|
||||
Do not try to use non-absolute paths, it won't work due to the flawed
|
||||
ElementTree implementation. The script rejects them.
|
||||
|
||||
For the text matches (i.e. paths not ending with `@attr`), any
|
||||
subelements are flattened into one string; this is handy for ignoring
|
||||
highlights for example. If you want to simply check for the presence of
|
||||
a given node or attribute, use an empty string (`""`) as a `PATTERN`.
|
||||
|
||||
* `@count PATH XPATH COUNT` checks for the occurrence of the given XPath
|
||||
in the specified file. The number of occurrences must match the given
|
||||
count.
|
||||
|
||||
* `@count PATH XPATH TEXT COUNT` checks for the occurrence of the given XPath
|
||||
with the given text in the specified file. The number of occurrences must
|
||||
match the given count.
|
||||
|
||||
* `@snapshot NAME PATH XPATH` creates a snapshot test named NAME.
|
||||
A snapshot test captures a subtree of the DOM, at the location
|
||||
determined by the XPath, and compares it to a pre-recorded value
|
||||
in a file. The file's name is the test's name with the `.rs` extension
|
||||
replaced with `.NAME.html`, where NAME is the snapshot's name.
|
||||
|
||||
htmldocck supports the `--bless` option to accept the current subtree
|
||||
as expected, saving it to the file determined by the snapshot's name.
|
||||
compiletest's `--bless` flag is forwarded to htmldocck.
|
||||
|
||||
* `@has-dir PATH` checks for the existence of the given directory.
|
||||
|
||||
* `@files FOLDER_PATH [ENTRIES]`, checks that `FOLDER_PATH` contains exactly
|
||||
`[ENTRIES]`.
|
||||
|
||||
All conditions can be negated with `!`. `@!has foo/type.NoSuch.html`
|
||||
checks if the given file does not exist, for example.
|
||||
|
||||
For documentation and usage instructions, please see
|
||||
https://rustc-dev-guide.rust-lang.org/rustdoc-internals/rustdoc-test-suite.html
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
|
|
|
|||
|
|
@ -345,9 +345,7 @@ pub(crate) fn run_global_ctxt(
|
|||
// (see `override_queries` in the `config`)
|
||||
|
||||
// NOTE: These are copy/pasted from typeck/lib.rs and should be kept in sync with those changes.
|
||||
let _ = tcx.sess.time("wf_checking", || {
|
||||
tcx.try_par_hir_for_each_module(|module| tcx.ensure_ok().check_mod_type_wf(module))
|
||||
});
|
||||
let _ = tcx.sess.time("wf_checking", || tcx.ensure_ok().check_type_wf(()));
|
||||
|
||||
tcx.dcx().abort_if_errors();
|
||||
|
||||
|
|
|
|||
25
tests/incremental/print-dep-node-cycle.rs
Normal file
25
tests/incremental/print-dep-node-cycle.rs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
//@ compile-flags: -Z query-dep-graph
|
||||
//@ revisions: rpass1
|
||||
|
||||
// Exercises a debug-assertions-only query cycle that when printing a valtree const in
|
||||
// a dep node's debug representation, we end up invoking a query that also has a valtree
|
||||
// const in its dep node's debug representation, which leads to a cycle (and ICE, since
|
||||
// deps are not tracked when printing dep nodes' debug representations).
|
||||
|
||||
#![feature(adt_const_params)]
|
||||
|
||||
use std::marker::ConstParamTy;
|
||||
|
||||
#[derive(Debug, ConstParamTy, PartialEq, Eq)]
|
||||
enum Foo {
|
||||
A1,
|
||||
}
|
||||
|
||||
#[inline(never)]
|
||||
fn hello<const F: Foo>() {
|
||||
println!("{:#?}", F);
|
||||
}
|
||||
|
||||
fn main() {
|
||||
hello::<{ Foo::A1 }>();
|
||||
}
|
||||
|
|
@ -1,7 +1,8 @@
|
|||
//@ known-bug: #140530
|
||||
// ex-ice: #140530
|
||||
//@ edition: 2024
|
||||
|
||||
//@ build-pass
|
||||
#![feature(async_drop, gen_blocks)]
|
||||
#![allow(incomplete_features)]
|
||||
async gen fn a() {
|
||||
_ = async {}
|
||||
}
|
||||
|
|
@ -12,14 +12,6 @@ note: required by a bound in `compare_ty::Trait::Ty`
|
|||
LL | type Ty: IntoIterator<Item = ()>;
|
||||
| ^^^^^^^^^ required by this bound in `Trait::Ty`
|
||||
|
||||
error: unconstrained opaque type
|
||||
--> $DIR/in-assoc-type-unconstrained.rs:8:26
|
||||
|
|
||||
LL | type Ty = Option<impl Sized>;
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: `Ty` must be used in combination with a concrete type within the same impl
|
||||
|
||||
error[E0053]: method `method` has an incompatible type for trait
|
||||
--> $DIR/in-assoc-type-unconstrained.rs:22:24
|
||||
|
|
||||
|
|
@ -42,6 +34,14 @@ LL - fn method() -> () {}
|
|||
LL + fn method() -> <() as compare_method::Trait>::Ty {}
|
||||
|
|
||||
|
||||
error: unconstrained opaque type
|
||||
--> $DIR/in-assoc-type-unconstrained.rs:8:26
|
||||
|
|
||||
LL | type Ty = Option<impl Sized>;
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: `Ty` must be used in combination with a concrete type within the same impl
|
||||
|
||||
error: unconstrained opaque type
|
||||
--> $DIR/in-assoc-type-unconstrained.rs:20:19
|
||||
|
|
||||
|
|
|
|||
|
|
@ -15,19 +15,6 @@ LL - fn eq(&self, _other: &(Foo, i32)) -> bool {
|
|||
LL + fn eq(&self, _other: &(a::Bar, i32)) -> bool {
|
||||
|
|
||||
|
||||
error: item does not constrain `a::Foo::{opaque#0}`
|
||||
--> $DIR/recursive-type-alias-impl-trait-declaration-too-subtle.rs:10:12
|
||||
|
|
||||
LL | fn eq(&self, _other: &(Foo, i32)) -> bool {
|
||||
| ^^
|
||||
|
|
||||
= note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]`
|
||||
note: this opaque type is supposed to be constrained
|
||||
--> $DIR/recursive-type-alias-impl-trait-declaration-too-subtle.rs:4:16
|
||||
|
|
||||
LL | type Foo = impl PartialEq<(Foo, i32)>;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0053]: method `eq` has an incompatible type for trait
|
||||
--> $DIR/recursive-type-alias-impl-trait-declaration-too-subtle.rs:25:30
|
||||
|
|
||||
|
|
@ -50,6 +37,19 @@ LL - fn eq(&self, _other: &(Bar, i32)) -> bool {
|
|||
LL + fn eq(&self, _other: &(b::Foo, i32)) -> bool {
|
||||
|
|
||||
|
||||
error: item does not constrain `a::Foo::{opaque#0}`
|
||||
--> $DIR/recursive-type-alias-impl-trait-declaration-too-subtle.rs:10:12
|
||||
|
|
||||
LL | fn eq(&self, _other: &(Foo, i32)) -> bool {
|
||||
| ^^
|
||||
|
|
||||
= note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]`
|
||||
note: this opaque type is supposed to be constrained
|
||||
--> $DIR/recursive-type-alias-impl-trait-declaration-too-subtle.rs:4:16
|
||||
|
|
||||
LL | type Foo = impl PartialEq<(Foo, i32)>;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: unconstrained opaque type
|
||||
--> $DIR/recursive-type-alias-impl-trait-declaration-too-subtle.rs:19:16
|
||||
|
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ mod reuse {
|
|||
|
||||
pub fn check<u16>() {
|
||||
assert_eq!(size_of::<u8>(), 8);
|
||||
assert_eq!(size_of::<::u64>(), 0);
|
||||
assert_eq!(size_of::<crate::u64>(), 0);
|
||||
assert_eq!(size_of::<i16>(), 3 * size_of::<*const ()>());
|
||||
assert_eq!(size_of::<u16>(), 0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ impl Test for u32 {
|
|||
|
||||
pub mod export {
|
||||
#[no_mangle]
|
||||
pub extern "C" fn issue_28983(t: <u32 as ::Test>::T) -> i32 { t*3 }
|
||||
pub extern "C" fn issue_28983(t: <u32 as crate::Test>::T) -> i32 { t*3 }
|
||||
}
|
||||
|
||||
// to test both exporting and importing functions, import
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ struct S;
|
|||
|
||||
mod m {
|
||||
fn f() {
|
||||
impl ::S {
|
||||
impl crate::S {
|
||||
pub fn s(&self) {}
|
||||
}
|
||||
}
|
||||
|
|
@ -24,7 +24,7 @@ pub struct S1;
|
|||
fn f() {
|
||||
pub struct Z;
|
||||
|
||||
impl ::Tr for ::S1 {
|
||||
impl crate::Tr for crate::S1 {
|
||||
type A = Z; // Private-in-public error unless `struct Z` is pub
|
||||
}
|
||||
}
|
||||
|
|
@ -43,7 +43,7 @@ mod m1 {
|
|||
pub field: u8
|
||||
}
|
||||
|
||||
impl ::Tr1 for ::S2 {
|
||||
impl crate::Tr1 for crate::S2 {
|
||||
type A = Z;
|
||||
fn pull(&self) -> Self::A { Z{field: 10} }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ mod bar {
|
|||
|
||||
pub use baz::*;
|
||||
mod baz {
|
||||
pub use main as f;
|
||||
pub use crate::main as f;
|
||||
}
|
||||
|
||||
pub fn main() {}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ impl Iterator for Foo {
|
|||
type Item = Box<dyn Trait>;
|
||||
fn next(&mut self) -> Option<Box<dyn Trait>> {
|
||||
extern crate issue_41053;
|
||||
impl ::Trait for issue_41053::Test {
|
||||
impl crate::Trait for issue_41053::Test {
|
||||
fn foo(&self) {}
|
||||
}
|
||||
Some(Box::new(issue_41053::Test))
|
||||
|
|
|
|||
|
|
@ -18,18 +18,18 @@ pub enum IResult<I,O> {
|
|||
Incomplete(u32, u64)
|
||||
}
|
||||
|
||||
pub fn multispace<T: Copy>(input: T) -> ::IResult<i8, i8> {
|
||||
::IResult::Done(0, 0)
|
||||
pub fn multispace<T: Copy>(input: T) -> crate::IResult<i8, i8> {
|
||||
crate::IResult::Done(0, 0)
|
||||
}
|
||||
|
||||
mod nom_sql {
|
||||
fn where_clause(i: &[u8]) -> ::IResult<&[u8], Option<String>> {
|
||||
let X = match ::multispace(i) {
|
||||
::IResult::Done(..) => ::IResult::Done(i, None::<String>),
|
||||
_ => ::IResult::Error(::Err::NodePosition(0)),
|
||||
fn where_clause(i: &[u8]) -> crate::IResult<&[u8], Option<String>> {
|
||||
let X = match crate::multispace(i) {
|
||||
crate::IResult::Done(..) => crate::IResult::Done(i, None::<String>),
|
||||
_ => crate::IResult::Error(crate::Err::NodePosition(0)),
|
||||
};
|
||||
match X {
|
||||
::IResult::Done(_, _) => ::IResult::Done(i, None),
|
||||
crate::IResult::Done(_, _) => crate::IResult::Done(i, None),
|
||||
_ => X
|
||||
}
|
||||
}
|
||||
|
|
@ -39,16 +39,16 @@ mod nom_sql {
|
|||
match {
|
||||
where_clause(i)
|
||||
} {
|
||||
::IResult::Done(_, o) => ::IResult::Done(i, Some(o)),
|
||||
::IResult::Error(_) => ::IResult::Done(i, None),
|
||||
_ => ::IResult::Incomplete(0, 0),
|
||||
crate::IResult::Done(_, o) => crate::IResult::Done(i, Some(o)),
|
||||
crate::IResult::Error(_) => crate::IResult::Done(i, None),
|
||||
_ => crate::IResult::Incomplete(0, 0),
|
||||
}
|
||||
} {
|
||||
::IResult::Done(z, _) => ::IResult::Done(z, None::<String>),
|
||||
crate::IResult::Done(z, _) => crate::IResult::Done(z, None::<String>),
|
||||
_ => return ()
|
||||
};
|
||||
match Y {
|
||||
::IResult::Done(x, _) => {
|
||||
crate::IResult::Done(x, _) => {
|
||||
let bytes = b"; ";
|
||||
let len = x.len();
|
||||
bytes[len];
|
||||
|
|
|
|||
|
|
@ -13,20 +13,20 @@ mod macro_ns {
|
|||
}
|
||||
|
||||
mod merge2 {
|
||||
pub use type_ns::A;
|
||||
pub use value_ns::A;
|
||||
pub use crate::type_ns::A;
|
||||
pub use crate::value_ns::A;
|
||||
}
|
||||
mod merge3 {
|
||||
pub use type_ns::A;
|
||||
pub use value_ns::A;
|
||||
pub use macro_ns::A;
|
||||
pub use crate::type_ns::A;
|
||||
pub use crate::value_ns::A;
|
||||
pub use crate::macro_ns::A;
|
||||
}
|
||||
|
||||
mod use2 {
|
||||
pub use merge2::A;
|
||||
pub use crate::merge2::A;
|
||||
}
|
||||
mod use3 {
|
||||
pub use merge3::A;
|
||||
pub use crate::merge3::A;
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ mod b {
|
|||
}
|
||||
|
||||
impl Builder {
|
||||
pub fn with_a(&mut self, _a: fn() -> dyn (::a::A)) {}
|
||||
pub fn with_a(&mut self, _a: fn() -> dyn (crate::a::A)) {}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,22 +1,22 @@
|
|||
struct T;
|
||||
|
||||
mod t1 {
|
||||
type Foo = ::T;
|
||||
type Foo = crate::T;
|
||||
mod Foo {} //~ ERROR the name `Foo` is defined multiple times
|
||||
}
|
||||
|
||||
mod t2 {
|
||||
type Foo = ::T;
|
||||
type Foo = crate::T;
|
||||
struct Foo; //~ ERROR the name `Foo` is defined multiple times
|
||||
}
|
||||
|
||||
mod t3 {
|
||||
type Foo = ::T;
|
||||
type Foo = crate::T;
|
||||
enum Foo {} //~ ERROR the name `Foo` is defined multiple times
|
||||
}
|
||||
|
||||
mod t4 {
|
||||
type Foo = ::T;
|
||||
type Foo = crate::T;
|
||||
fn Foo() {} // ok
|
||||
}
|
||||
|
||||
|
|
@ -26,7 +26,7 @@ mod t5 {
|
|||
}
|
||||
|
||||
mod t6 {
|
||||
type Foo = ::T;
|
||||
type Foo = crate::T;
|
||||
impl Foo {} // ok
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
error[E0428]: the name `Foo` is defined multiple times
|
||||
--> $DIR/issue-6936.rs:5:5
|
||||
|
|
||||
LL | type Foo = ::T;
|
||||
| --------------- previous definition of the type `Foo` here
|
||||
LL | type Foo = crate::T;
|
||||
| -------------------- previous definition of the type `Foo` here
|
||||
LL | mod Foo {}
|
||||
| ^^^^^^^ `Foo` redefined here
|
||||
|
|
||||
|
|
@ -11,8 +11,8 @@ LL | mod Foo {}
|
|||
error[E0428]: the name `Foo` is defined multiple times
|
||||
--> $DIR/issue-6936.rs:10:5
|
||||
|
|
||||
LL | type Foo = ::T;
|
||||
| --------------- previous definition of the type `Foo` here
|
||||
LL | type Foo = crate::T;
|
||||
| -------------------- previous definition of the type `Foo` here
|
||||
LL | struct Foo;
|
||||
| ^^^^^^^^^^^ `Foo` redefined here
|
||||
|
|
||||
|
|
@ -21,8 +21,8 @@ LL | struct Foo;
|
|||
error[E0428]: the name `Foo` is defined multiple times
|
||||
--> $DIR/issue-6936.rs:15:5
|
||||
|
|
||||
LL | type Foo = ::T;
|
||||
| --------------- previous definition of the type `Foo` here
|
||||
LL | type Foo = crate::T;
|
||||
| -------------------- previous definition of the type `Foo` here
|
||||
LL | enum Foo {}
|
||||
| ^^^^^^^^ `Foo` redefined here
|
||||
|
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ mod test1 {
|
|||
mod bar { pub fn p() -> isize { 2 } }
|
||||
|
||||
pub mod baz {
|
||||
use test1::bar::p;
|
||||
use crate::test1::bar::p;
|
||||
|
||||
pub fn my_main() { assert_eq!(p(), 2); }
|
||||
}
|
||||
|
|
@ -20,7 +20,7 @@ mod test2 {
|
|||
mod bar { pub fn p() -> isize { 2 } }
|
||||
|
||||
pub mod baz {
|
||||
use test2::bar::p;
|
||||
use crate::test2::bar::p;
|
||||
|
||||
pub fn my_main() { assert_eq!(p(), 2); }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,16 +9,16 @@
|
|||
mod a { pub static x: isize = 3; pub static y: isize = 4; }
|
||||
|
||||
mod b {
|
||||
use a::x; //~ ERROR: unused import
|
||||
use crate::a::x; //~ ERROR: unused import
|
||||
#[allow(unused_imports)]
|
||||
use a::y; // no error here
|
||||
use crate::a::y; // no error here
|
||||
}
|
||||
|
||||
#[allow(unused_imports)]
|
||||
mod c {
|
||||
use a::x;
|
||||
use crate::a::x;
|
||||
#[deny(unused_imports)]
|
||||
use a::y; //~ ERROR: unused import
|
||||
use crate::a::y; //~ ERROR: unused import
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
error: unused import: `a::x`
|
||||
error: unused import: `crate::a::x`
|
||||
--> $DIR/lint-directives-on-use-items-issue-10534.rs:12:9
|
||||
|
|
||||
LL | use a::x;
|
||||
| ^^^^
|
||||
LL | use crate::a::x;
|
||||
| ^^^^^^^^^^^
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/lint-directives-on-use-items-issue-10534.rs:1:9
|
||||
|
|
@ -10,11 +10,11 @@ note: the lint level is defined here
|
|||
LL | #![deny(unused_imports)]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error: unused import: `a::y`
|
||||
error: unused import: `crate::a::y`
|
||||
--> $DIR/lint-directives-on-use-items-issue-10534.rs:21:9
|
||||
|
|
||||
LL | use a::y;
|
||||
| ^^^^
|
||||
LL | use crate::a::y;
|
||||
| ^^^^^^^^^^^
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/lint-directives-on-use-items-issue-10534.rs:20:12
|
||||
|
|
|
|||
|
|
@ -184,10 +184,10 @@ mod internal_impl {
|
|||
}
|
||||
/// dox
|
||||
pub mod public_interface {
|
||||
pub use internal_impl::documented as foo;
|
||||
pub use internal_impl::undocumented1 as bar;
|
||||
pub use internal_impl::{documented, undocumented2};
|
||||
pub use internal_impl::globbed::*;
|
||||
pub use crate::internal_impl::documented as foo;
|
||||
pub use crate::internal_impl::undocumented1 as bar;
|
||||
pub use crate::internal_impl::{documented, undocumented2};
|
||||
pub use crate::internal_impl::globbed::*;
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
#![deny(unused_import_braces)]
|
||||
|
||||
use test::{A}; //~ ERROR braces around A is unnecessary
|
||||
use crate::test::{A}; //~ ERROR braces around A is unnecessary
|
||||
|
||||
mod test {
|
||||
use test::{self}; // OK
|
||||
use test::{self as rename}; // OK
|
||||
use crate::test::{self}; // OK
|
||||
use crate::test::{self as rename}; // OK
|
||||
pub struct A;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
error: braces around A is unnecessary
|
||||
--> $DIR/lint-unnecessary-import-braces.rs:3:1
|
||||
|
|
||||
LL | use test::{A};
|
||||
| ^^^^^^^^^^^^^^
|
||||
LL | use crate::test::{A};
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/lint-unnecessary-import-braces.rs:1:9
|
||||
|
|
|
|||
|
|
@ -48,8 +48,8 @@ pub mod bar {
|
|||
pub struct Square;
|
||||
|
||||
pub mod c {
|
||||
use foo::Point;
|
||||
use foo::Square; //~ ERROR unused import: `foo::Square`
|
||||
use crate::foo::Point;
|
||||
use crate::foo::Square; //~ ERROR unused import: `crate::foo::Square`
|
||||
pub fn cc(_p: Point) -> super::Square {
|
||||
fn f() -> super::Square {
|
||||
super::Square
|
||||
|
|
@ -74,7 +74,7 @@ fn g() {
|
|||
// cf. issue #35135.
|
||||
#[allow(unused_variables)]
|
||||
fn h() {
|
||||
use test2::foo; //~ ERROR unused import: `test2::foo`
|
||||
use crate::test2::foo; //~ ERROR unused import: `crate::test2::foo`
|
||||
let foo = 0;
|
||||
}
|
||||
|
||||
|
|
@ -83,6 +83,6 @@ fn main() {
|
|||
let mut a = 3;
|
||||
let mut b = 4;
|
||||
swap(&mut a, &mut b);
|
||||
test::C.b();
|
||||
crate::test::C.b();
|
||||
foo();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,11 +28,11 @@ error: unused import: `bar`
|
|||
LL | use test2::{foo, bar};
|
||||
| ^^^
|
||||
|
||||
error: unused import: `foo::Square`
|
||||
error: unused import: `crate::foo::Square`
|
||||
--> $DIR/lint-unused-imports.rs:52:13
|
||||
|
|
||||
LL | use foo::Square;
|
||||
| ^^^^^^^^^^^
|
||||
LL | use crate::foo::Square;
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: unused import: `self::g`
|
||||
--> $DIR/lint-unused-imports.rs:68:9
|
||||
|
|
@ -40,11 +40,11 @@ error: unused import: `self::g`
|
|||
LL | use self::g;
|
||||
| ^^^^^^^
|
||||
|
||||
error: unused import: `test2::foo`
|
||||
error: unused import: `crate::test2::foo`
|
||||
--> $DIR/lint-unused-imports.rs:77:9
|
||||
|
|
||||
LL | use test2::foo;
|
||||
| ^^^^^^^^^^
|
||||
LL | use crate::test2::foo;
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: unused import: `test::B2`
|
||||
--> $DIR/lint-unused-imports.rs:20:5
|
||||
|
|
|
|||
|
|
@ -68,15 +68,15 @@ mod with_crate {
|
|||
|
||||
mod garden {
|
||||
mod with_pub_restricted_path {
|
||||
vis_passthru! { pub(in garden) const A: i32 = 0; }
|
||||
vis_passthru! { pub(in garden) enum B {} }
|
||||
vis_passthru! { pub(in garden) extern "C" fn c() {} }
|
||||
vis_passthru! { pub(in garden) mod d {} }
|
||||
vis_passthru! { pub(in garden) static E: i32 = 0; }
|
||||
vis_passthru! { pub(in garden) struct F; }
|
||||
vis_passthru! { pub(in garden) trait G {} }
|
||||
vis_passthru! { pub(in garden) type H = i32; }
|
||||
vis_passthru! { pub(in garden) use A as I; }
|
||||
vis_passthru! { pub(in crate::garden) const A: i32 = 0; }
|
||||
vis_passthru! { pub(in crate::garden) enum B {} }
|
||||
vis_passthru! { pub(in crate::garden) extern "C" fn c() {} }
|
||||
vis_passthru! { pub(in crate::garden) mod d {} }
|
||||
vis_passthru! { pub(in crate::garden) static E: i32 = 0; }
|
||||
vis_passthru! { pub(in crate::garden) struct F; }
|
||||
vis_passthru! { pub(in crate::garden) trait G {} }
|
||||
vis_passthru! { pub(in crate::garden) type H = i32; }
|
||||
vis_passthru! { pub(in crate::garden) use A as I; }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,26 +11,26 @@ mod foo { pub use two_macros::macro_one as bar; }
|
|||
|
||||
trait T {
|
||||
foo::bar!();
|
||||
::foo::bar!();
|
||||
crate::foo::bar!();
|
||||
}
|
||||
|
||||
struct S {
|
||||
x: foo::bar!(i32),
|
||||
y: ::foo::bar!(i32),
|
||||
y: crate::foo::bar!(i32),
|
||||
}
|
||||
|
||||
impl S {
|
||||
foo::bar!();
|
||||
::foo::bar!();
|
||||
crate::foo::bar!();
|
||||
}
|
||||
|
||||
fn main() {
|
||||
foo::bar!();
|
||||
::foo::bar!();
|
||||
crate::foo::bar!();
|
||||
|
||||
let _ = foo::bar!(0);
|
||||
let _ = ::foo::bar!(0);
|
||||
let _ = crate::foo::bar!(0);
|
||||
|
||||
let foo::bar!(_) = 0;
|
||||
let ::foo::bar!(_) = 0;
|
||||
let crate::foo::bar!(_) = 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ extern crate ret_from_ext;
|
|||
|
||||
fn foo() -> impl Sized {
|
||||
drop(|| ret_from_ext::foo!());
|
||||
//~^ ERROR cannot return reference to local binding
|
||||
//~^ ERROR cannot return reference to temporary value
|
||||
|
||||
ret_from_ext::foo!()
|
||||
//~^ ERROR temporary value dropped while borrowed
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
error[E0515]: cannot return reference to local binding
|
||||
error[E0515]: cannot return reference to temporary value
|
||||
--> $DIR/return_from_external_macro.rs:7:13
|
||||
|
|
||||
LL | drop(|| ret_from_ext::foo!());
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
| |
|
||||
| returns a reference to data owned by the current function
|
||||
| local binding introduced here
|
||||
| temporary value created here
|
||||
|
|
||||
= note: this error originates in the macro `ret_from_ext::foo` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
|
|
|
|||
|
|
@ -9,15 +9,15 @@ impl Foo for u32 {
|
|||
}
|
||||
|
||||
pub mod bar {
|
||||
pub use Foo;
|
||||
pub use crate::Foo;
|
||||
pub fn bar<T: Foo>(x: T) -> T {
|
||||
x.zero()
|
||||
}
|
||||
}
|
||||
|
||||
mod baz {
|
||||
use bar;
|
||||
use Foo;
|
||||
use crate::bar;
|
||||
use crate::Foo;
|
||||
pub fn baz<T: Foo + Copy>(x: T) -> T {
|
||||
if 0 == 1 {
|
||||
bar::bar(x.zero())
|
||||
|
|
|
|||
|
|
@ -9,15 +9,15 @@ impl Foo for u32 {
|
|||
}
|
||||
|
||||
pub mod bar {
|
||||
pub use Foo;
|
||||
pub use crate::Foo;
|
||||
pub fn bar<T: Foo>(x: T) -> T {
|
||||
x.zero()
|
||||
}
|
||||
}
|
||||
|
||||
mod baz {
|
||||
use bar;
|
||||
use Foo;
|
||||
use crate::bar;
|
||||
use crate::Foo;
|
||||
pub fn baz<T: Foo>(x: T) -> T {
|
||||
if 0 == 1 {
|
||||
bar::bar(x.zero())
|
||||
|
|
|
|||
|
|
@ -12,11 +12,11 @@ mod m2 {
|
|||
}
|
||||
|
||||
mod m {
|
||||
pub use m2::Foo::*;
|
||||
pub use crate::m2::Foo::*;
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
use m2::Foo::*;
|
||||
use crate::m2::Foo::*;
|
||||
|
||||
foo(); //~ ERROR cannot find function `foo` in this scope
|
||||
m::foo(); //~ ERROR cannot find function `foo` in module `m`
|
||||
|
|
|
|||
|
|
@ -2,10 +2,8 @@ error[E0277]: the trait bound `(): T` is not satisfied
|
|||
--> $DIR/feature-gate-never_type_fallback.rs:10:9
|
||||
|
|
||||
LL | foo(panic!())
|
||||
| --- ^^^^^^^^
|
||||
| | |
|
||||
| | the trait `T` is not implemented for `()`
|
||||
| | this tail expression is of type `()`
|
||||
| --- ^^^^^^^^ the trait `T` is not implemented for `()`
|
||||
| |
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
help: this trait has no implementations, consider adding one
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ pub enum E {
|
|||
}
|
||||
|
||||
pub mod b {
|
||||
pub fn key(e: ::E) -> &'static str {
|
||||
pub fn key(e: crate::E) -> &'static str {
|
||||
match e {
|
||||
A => "A",
|
||||
//~^ ERROR pattern binding `A` is named the same as one of the variants of the type `E`
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ use std::default::Default;
|
|||
#[derive(Default)]
|
||||
pub struct Foo<T>(T, T);
|
||||
|
||||
impl<T: ::std::fmt::Display> Foo<T> {
|
||||
impl<T: std::fmt::Display> Foo<T> {
|
||||
fn foo(&self) {
|
||||
match *self {
|
||||
Foo::<T>(ref x, ref y) => println!("Goodbye, World! {} {}", x, y)
|
||||
|
|
@ -36,7 +36,7 @@ fn main() {
|
|||
let w = Wrapper { value: Foo(10u8, 11u8) };
|
||||
match w {
|
||||
Wrapper::<Foo<u8>> { value: Foo(10, 11) } => {},
|
||||
::Wrapper::<<Foo<_> as Tr>::U> { value: Foo::<u8>(11, 16) } => { panic!() },
|
||||
crate::Wrapper::<<Foo<_> as Tr>::U> { value: Foo::<u8>(11, 16) } => { panic!() },
|
||||
_ => { panic!() }
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,32 +13,32 @@ enum Other {
|
|||
|
||||
fn main() {
|
||||
match Foo::Baz {
|
||||
::Foo::Bar(3) => panic!(),
|
||||
::Foo::Bar(_) if false => panic!(),
|
||||
::Foo::Bar(..) if false => panic!(),
|
||||
::Foo::Bar(_n) => panic!(),
|
||||
::Foo::Baz => {}
|
||||
crate::Foo::Bar(3) => panic!(),
|
||||
crate::Foo::Bar(_) if false => panic!(),
|
||||
crate::Foo::Bar(..) if false => panic!(),
|
||||
crate::Foo::Bar(_n) => panic!(),
|
||||
crate::Foo::Baz => {}
|
||||
}
|
||||
match Foo::Bar(3) {
|
||||
::Foo::Bar(3) => {}
|
||||
::Foo::Bar(_) if false => panic!(),
|
||||
::Foo::Bar(..) if false => panic!(),
|
||||
::Foo::Bar(_n) => panic!(),
|
||||
::Foo::Baz => panic!(),
|
||||
crate::Foo::Bar(3) => {}
|
||||
crate::Foo::Bar(_) if false => panic!(),
|
||||
crate::Foo::Bar(..) if false => panic!(),
|
||||
crate::Foo::Bar(_n) => panic!(),
|
||||
crate::Foo::Baz => panic!(),
|
||||
}
|
||||
match Foo::Bar(4) {
|
||||
::Foo::Bar(3) => panic!(),
|
||||
::Foo::Bar(_) if false => panic!(),
|
||||
::Foo::Bar(..) if false => panic!(),
|
||||
::Foo::Bar(n) => assert_eq!(n, 4),
|
||||
::Foo::Baz => panic!(),
|
||||
crate::Foo::Bar(3) => panic!(),
|
||||
crate::Foo::Bar(_) if false => panic!(),
|
||||
crate::Foo::Bar(..) if false => panic!(),
|
||||
crate::Foo::Bar(n) => assert_eq!(n, 4),
|
||||
crate::Foo::Baz => panic!(),
|
||||
}
|
||||
|
||||
match Other::Other1(Foo::Baz) {
|
||||
::Other::Other1(::Foo::Baz) => {}
|
||||
::Other::Other1(::Foo::Bar(_)) => {}
|
||||
::Other::Other2(::Foo::Baz, ::Foo::Bar(_)) => {}
|
||||
::Other::Other2(::Foo::Bar(..), ::Foo::Baz) => {}
|
||||
::Other::Other2(..) => {}
|
||||
crate::Other::Other1(crate::Foo::Baz) => {}
|
||||
crate::Other::Other1(crate::Foo::Bar(_)) => {}
|
||||
crate::Other::Other2(crate::Foo::Baz, crate::Foo::Bar(_)) => {}
|
||||
crate::Other::Other2(crate::Foo::Bar(..), crate::Foo::Baz) => {}
|
||||
crate::Other::Other2(..) => {}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,6 @@ enum Other {
|
|||
|
||||
fn main() {
|
||||
match Other::Other1(Foo::Baz) {
|
||||
::Other::Other2(::Foo::Bar(..)) => {}
|
||||
crate::Other::Other2(crate::Foo::Bar(..)) => {}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ mod visibility {
|
|||
mod c {
|
||||
use super::*;
|
||||
pub struct AlsoSecretlyUninhabited {
|
||||
_priv: ::Struct1,
|
||||
_priv: crate::Struct1,
|
||||
}
|
||||
assert_empty!(SometimesEmptyStruct);
|
||||
assert_non_empty!(SometimesEmptyEnum);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
pub mod a {
|
||||
pub use a::b::c;
|
||||
pub use crate::a::b::c;
|
||||
|
||||
pub mod b {
|
||||
pub mod c {
|
||||
|
|
|
|||
|
|
@ -5,10 +5,10 @@ struct S1 {
|
|||
bar: i32,
|
||||
}
|
||||
mod m1 {
|
||||
pub use ::f1; //~ ERROR `f1` is only public within the crate, and cannot be re-exported outside
|
||||
pub use ::S1; //~ ERROR `S1` is only public within the crate, and cannot be re-exported outside
|
||||
pub use ::E1; //~ ERROR `E1` is only public within the crate, and cannot be re-exported outside
|
||||
pub use ::E1::V; //~ ERROR `V` is only public within the crate, and cannot be re-exported outside
|
||||
pub use crate::f1; //~ ERROR `f1` is only public within the crate, and cannot be re-exported outside
|
||||
pub use crate::S1; //~ ERROR `S1` is only public within the crate, and cannot be re-exported outside
|
||||
pub use crate::E1; //~ ERROR `E1` is only public within the crate, and cannot be re-exported outside
|
||||
pub use crate::E1::V; //~ ERROR `V` is only public within the crate, and cannot be re-exported outside
|
||||
}
|
||||
|
||||
pub(crate) fn f2() {}
|
||||
|
|
@ -20,10 +20,10 @@ pub(crate) struct S2 {
|
|||
bar: i32,
|
||||
}
|
||||
mod m2 {
|
||||
pub use ::f2; //~ ERROR `f2` is only public within the crate, and cannot be re-exported outside
|
||||
pub use ::S2; //~ ERROR `S2` is only public within the crate, and cannot be re-exported outside
|
||||
pub use ::E2; //~ ERROR `E2` is only public within the crate, and cannot be re-exported outside
|
||||
pub use ::E2::V; //~ ERROR `V` is only public within the crate, and cannot be re-exported outside
|
||||
pub use crate::f2; //~ ERROR `f2` is only public within the crate, and cannot be re-exported outside
|
||||
pub use crate::S2; //~ ERROR `S2` is only public within the crate, and cannot be re-exported outside
|
||||
pub use crate::E2; //~ ERROR `E2` is only public within the crate, and cannot be re-exported outside
|
||||
pub use crate::E2::V; //~ ERROR `V` is only public within the crate, and cannot be re-exported outside
|
||||
}
|
||||
|
||||
mod m3 {
|
||||
|
|
@ -42,7 +42,7 @@ pub use m3::E3; //~ ERROR `E3` is only public within the crate, and cannot be re
|
|||
pub use m3::E3::V; //~ ERROR `V` is only public within the crate, and cannot be re-exported outside
|
||||
|
||||
pub(self) fn f4() {}
|
||||
pub use ::f4 as f5; //~ ERROR `f4` is only public within the crate, and cannot be re-exported outside
|
||||
pub use crate::f4 as f5; //~ ERROR `f4` is only public within the crate, and cannot be re-exported outside
|
||||
|
||||
pub mod m10 {
|
||||
pub mod m {
|
||||
|
|
|
|||
|
|
@ -1,82 +1,82 @@
|
|||
error[E0364]: `f1` is only public within the crate, and cannot be re-exported outside
|
||||
--> $DIR/crate-private-reexport.rs:8:13
|
||||
|
|
||||
LL | pub use ::f1;
|
||||
| ^^^^
|
||||
LL | pub use crate::f1;
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
note: consider marking `f1` as `pub` in the imported module
|
||||
--> $DIR/crate-private-reexport.rs:8:13
|
||||
|
|
||||
LL | pub use ::f1;
|
||||
| ^^^^
|
||||
LL | pub use crate::f1;
|
||||
| ^^^^^^^^^
|
||||
|
||||
error[E0365]: `S1` is only public within the crate, and cannot be re-exported outside
|
||||
--> $DIR/crate-private-reexport.rs:9:13
|
||||
|
|
||||
LL | pub use ::S1;
|
||||
| ^^^^ re-export of crate public `S1`
|
||||
LL | pub use crate::S1;
|
||||
| ^^^^^^^^^ re-export of crate public `S1`
|
||||
|
|
||||
= note: consider declaring type or module `S1` with `pub`
|
||||
|
||||
error[E0365]: `E1` is only public within the crate, and cannot be re-exported outside
|
||||
--> $DIR/crate-private-reexport.rs:10:13
|
||||
|
|
||||
LL | pub use ::E1;
|
||||
| ^^^^ re-export of crate public `E1`
|
||||
LL | pub use crate::E1;
|
||||
| ^^^^^^^^^ re-export of crate public `E1`
|
||||
|
|
||||
= note: consider declaring type or module `E1` with `pub`
|
||||
|
||||
error[E0364]: `V` is only public within the crate, and cannot be re-exported outside
|
||||
--> $DIR/crate-private-reexport.rs:11:13
|
||||
|
|
||||
LL | pub use ::E1::V;
|
||||
| ^^^^^^^
|
||||
LL | pub use crate::E1::V;
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
note: consider marking `V` as `pub` in the imported module
|
||||
--> $DIR/crate-private-reexport.rs:11:13
|
||||
|
|
||||
LL | pub use ::E1::V;
|
||||
| ^^^^^^^
|
||||
LL | pub use crate::E1::V;
|
||||
| ^^^^^^^^^^^^
|
||||
|
||||
error[E0364]: `f2` is only public within the crate, and cannot be re-exported outside
|
||||
--> $DIR/crate-private-reexport.rs:23:13
|
||||
|
|
||||
LL | pub use ::f2;
|
||||
| ^^^^
|
||||
LL | pub use crate::f2;
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
note: consider marking `f2` as `pub` in the imported module
|
||||
--> $DIR/crate-private-reexport.rs:23:13
|
||||
|
|
||||
LL | pub use ::f2;
|
||||
| ^^^^
|
||||
LL | pub use crate::f2;
|
||||
| ^^^^^^^^^
|
||||
|
||||
error[E0365]: `S2` is only public within the crate, and cannot be re-exported outside
|
||||
--> $DIR/crate-private-reexport.rs:24:13
|
||||
|
|
||||
LL | pub use ::S2;
|
||||
| ^^^^ re-export of crate public `S2`
|
||||
LL | pub use crate::S2;
|
||||
| ^^^^^^^^^ re-export of crate public `S2`
|
||||
|
|
||||
= note: consider declaring type or module `S2` with `pub`
|
||||
|
||||
error[E0365]: `E2` is only public within the crate, and cannot be re-exported outside
|
||||
--> $DIR/crate-private-reexport.rs:25:13
|
||||
|
|
||||
LL | pub use ::E2;
|
||||
| ^^^^ re-export of crate public `E2`
|
||||
LL | pub use crate::E2;
|
||||
| ^^^^^^^^^ re-export of crate public `E2`
|
||||
|
|
||||
= note: consider declaring type or module `E2` with `pub`
|
||||
|
||||
error[E0364]: `V` is only public within the crate, and cannot be re-exported outside
|
||||
--> $DIR/crate-private-reexport.rs:26:13
|
||||
|
|
||||
LL | pub use ::E2::V;
|
||||
| ^^^^^^^
|
||||
LL | pub use crate::E2::V;
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
note: consider marking `V` as `pub` in the imported module
|
||||
--> $DIR/crate-private-reexport.rs:26:13
|
||||
|
|
||||
LL | pub use ::E2::V;
|
||||
| ^^^^^^^
|
||||
LL | pub use crate::E2::V;
|
||||
| ^^^^^^^^^^^^
|
||||
|
||||
error[E0364]: `f3` is only public within the crate, and cannot be re-exported outside
|
||||
--> $DIR/crate-private-reexport.rs:39:9
|
||||
|
|
@ -121,14 +121,14 @@ LL | pub use m3::E3::V;
|
|||
error[E0364]: `f4` is only public within the crate, and cannot be re-exported outside
|
||||
--> $DIR/crate-private-reexport.rs:45:9
|
||||
|
|
||||
LL | pub use ::f4 as f5;
|
||||
| ^^^^^^^^^^
|
||||
LL | pub use crate::f4 as f5;
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: consider marking `f4` as `pub` in the imported module
|
||||
--> $DIR/crate-private-reexport.rs:45:9
|
||||
|
|
||||
LL | pub use ::f4 as f5;
|
||||
| ^^^^^^^^^^
|
||||
LL | pub use crate::f4 as f5;
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0364]: `f6` is private, and cannot be re-exported
|
||||
--> $DIR/crate-private-reexport.rs:53:13
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ struct SemiPriv;
|
|||
|
||||
mod m1 {
|
||||
struct Priv;
|
||||
impl ::SemiPriv {
|
||||
impl crate::SemiPriv {
|
||||
pub fn f(_: Priv) {} //~ WARN type `m1::Priv` is more private than the item `m1::<impl SemiPriv>::f`
|
||||
}
|
||||
|
||||
|
|
@ -13,12 +13,12 @@ mod m1 {
|
|||
|
||||
mod m2 {
|
||||
struct Priv;
|
||||
impl ::std::ops::Deref for ::SemiPriv {
|
||||
impl std::ops::Deref for crate::SemiPriv {
|
||||
type Target = Priv; //~ ERROR private type `m2::Priv` in public interface
|
||||
fn deref(&self) -> &Self::Target { unimplemented!() }
|
||||
}
|
||||
|
||||
impl ::std::ops::Deref for Priv {
|
||||
impl std::ops::Deref for Priv {
|
||||
type Target = Priv; // ok
|
||||
fn deref(&self) -> &Self::Target { unimplemented!() }
|
||||
}
|
||||
|
|
@ -30,7 +30,7 @@ trait SemiPrivTrait {
|
|||
|
||||
mod m3 {
|
||||
struct Priv;
|
||||
impl ::SemiPrivTrait for () {
|
||||
impl crate::SemiPrivTrait for () {
|
||||
type Assoc = Priv; //~ ERROR private type `m3::Priv` in public interface
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ error[E0446]: private type `m2::Priv` in public interface
|
|||
|
|
||||
LL | struct Priv;
|
||||
| ----------- `m2::Priv` declared as private
|
||||
LL | impl ::std::ops::Deref for ::SemiPriv {
|
||||
LL | impl std::ops::Deref for crate::SemiPriv {
|
||||
LL | type Target = Priv;
|
||||
| ^^^^^^^^^^^ can't leak private type
|
||||
|
||||
|
|
@ -25,7 +25,7 @@ error[E0446]: private type `m3::Priv` in public interface
|
|||
|
|
||||
LL | struct Priv;
|
||||
| ----------- `m3::Priv` declared as private
|
||||
LL | impl ::SemiPrivTrait for () {
|
||||
LL | impl crate::SemiPrivTrait for () {
|
||||
LL | type Assoc = Priv;
|
||||
| ^^^^^^^^^^ can't leak private type
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ mod rank {
|
|||
Full,
|
||||
}
|
||||
|
||||
pub(in rank) enum PettyOfficer {
|
||||
pub(in crate::rank) enum PettyOfficer {
|
||||
SecondClass,
|
||||
FirstClass,
|
||||
Chief,
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ mod m {
|
|||
pub struct S(u8);
|
||||
|
||||
mod n {
|
||||
use S;
|
||||
use crate::S;
|
||||
fn f() {
|
||||
S(10);
|
||||
//~^ ERROR expected function, tuple struct or tuple variant, found struct `S`
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ mod foo {
|
|||
pub use self::bar::S;
|
||||
mod bar {
|
||||
pub struct S;
|
||||
pub use baz;
|
||||
pub use crate::baz;
|
||||
}
|
||||
|
||||
trait T {
|
||||
|
|
@ -21,9 +21,9 @@ pub mod baz {
|
|||
fn f() {}
|
||||
|
||||
fn g() {
|
||||
::foo::bar::baz::f(); //~ERROR module `bar` is private
|
||||
::foo::bar::S::f(); //~ERROR module `bar` is private
|
||||
<() as ::foo::T>::Assoc::f(); //~ERROR trait `T` is private
|
||||
crate::foo::bar::baz::f(); //~ERROR module `bar` is private
|
||||
crate::foo::bar::S::f(); //~ERROR module `bar` is private
|
||||
<() as crate::foo::T>::Assoc::f(); //~ERROR trait `T` is private
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
error[E0603]: module `bar` is private
|
||||
--> $DIR/privacy-in-paths.rs:24:16
|
||||
--> $DIR/privacy-in-paths.rs:24:21
|
||||
|
|
||||
LL | ::foo::bar::baz::f();
|
||||
| ^^^ - function `f` is not publicly re-exported
|
||||
| |
|
||||
| private module
|
||||
LL | crate::foo::bar::baz::f();
|
||||
| ^^^ - function `f` is not publicly re-exported
|
||||
| |
|
||||
| private module
|
||||
|
|
||||
note: the module `bar` is defined here
|
||||
--> $DIR/privacy-in-paths.rs:3:5
|
||||
|
|
@ -13,10 +13,10 @@ LL | mod bar {
|
|||
| ^^^^^^^
|
||||
|
||||
error[E0603]: module `bar` is private
|
||||
--> $DIR/privacy-in-paths.rs:25:16
|
||||
--> $DIR/privacy-in-paths.rs:25:21
|
||||
|
|
||||
LL | ::foo::bar::S::f();
|
||||
| ^^^ private module
|
||||
LL | crate::foo::bar::S::f();
|
||||
| ^^^ private module
|
||||
|
|
||||
note: the module `bar` is defined here
|
||||
--> $DIR/privacy-in-paths.rs:3:5
|
||||
|
|
@ -25,17 +25,17 @@ LL | mod bar {
|
|||
| ^^^^^^^
|
||||
help: consider importing this struct through its public re-export instead
|
||||
|
|
||||
LL - ::foo::bar::S::f();
|
||||
LL - crate::foo::bar::S::f();
|
||||
LL + foo::S::f();
|
||||
|
|
||||
|
||||
error[E0603]: trait `T` is private
|
||||
--> $DIR/privacy-in-paths.rs:26:23
|
||||
--> $DIR/privacy-in-paths.rs:26:28
|
||||
|
|
||||
LL | <() as ::foo::T>::Assoc::f();
|
||||
| ^ ----- associated type `Assoc` is not publicly re-exported
|
||||
| |
|
||||
| private trait
|
||||
LL | <() as crate::foo::T>::Assoc::f();
|
||||
| ^ ----- associated type `Assoc` is not publicly re-exported
|
||||
| |
|
||||
| private trait
|
||||
|
|
||||
note: the trait `T` is defined here
|
||||
--> $DIR/privacy-in-paths.rs:8:5
|
||||
|
|
|
|||
|
|
@ -9,5 +9,5 @@ mod foo {
|
|||
}
|
||||
|
||||
fn main() {
|
||||
<i32 as ::foo::Bar>::baz(); //~ERROR trait `Bar` is private
|
||||
<i32 as crate::foo::Bar>::baz(); //~ERROR trait `Bar` is private
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
error[E0603]: trait `Bar` is private
|
||||
--> $DIR/privacy-ufcs.rs:12:20
|
||||
--> $DIR/privacy-ufcs.rs:12:25
|
||||
|
|
||||
LL | <i32 as ::foo::Bar>::baz();
|
||||
| ^^^ --- associated function `baz` is not publicly re-exported
|
||||
| |
|
||||
| private trait
|
||||
LL | <i32 as crate::foo::Bar>::baz();
|
||||
| ^^^ --- associated function `baz` is not publicly re-exported
|
||||
| |
|
||||
| private trait
|
||||
|
|
||||
note: the trait `Bar` is defined here
|
||||
--> $DIR/privacy-ufcs.rs:4:5
|
||||
|
|
|
|||
|
|
@ -98,34 +98,34 @@ fn lol() {
|
|||
|
||||
mod foo {
|
||||
fn test() {
|
||||
::bar::A::foo();
|
||||
::bar::A::bar(); //~ ERROR: associated function `bar` is private
|
||||
::bar::A.foo2();
|
||||
::bar::baz::A::foo(); //~ ERROR: module `baz` is private
|
||||
::bar::baz::A::bar(); //~ ERROR: module `baz` is private
|
||||
crate::bar::A::foo();
|
||||
crate::bar::A::bar(); //~ ERROR: associated function `bar` is private
|
||||
crate::bar::A.foo2();
|
||||
crate::bar::baz::A::foo(); //~ ERROR: module `baz` is private
|
||||
crate::bar::baz::A::bar(); //~ ERROR: module `baz` is private
|
||||
//~^ ERROR: associated function `bar` is private
|
||||
::bar::baz::A.foo2(); //~ ERROR: module `baz` is private
|
||||
::bar::baz::A.bar2(); //~ ERROR: module `baz` is private
|
||||
crate::bar::baz::A.foo2(); //~ ERROR: module `baz` is private
|
||||
crate::bar::baz::A.bar2(); //~ ERROR: module `baz` is private
|
||||
//~^ ERROR: method `bar2` is private
|
||||
|
||||
let _: isize =
|
||||
::bar::B::foo(); //~ ERROR: trait `B` is private
|
||||
::lol();
|
||||
crate::bar::B::foo(); //~ ERROR: trait `B` is private
|
||||
crate::lol();
|
||||
|
||||
::bar::Enum::Pub;
|
||||
crate::bar::Enum::Pub;
|
||||
|
||||
unsafe {
|
||||
::bar::epriv(); //~ ERROR: function `epriv` is private
|
||||
::bar::epub();
|
||||
crate::bar::epriv(); //~ ERROR: function `epriv` is private
|
||||
crate::bar::epub();
|
||||
}
|
||||
|
||||
::bar::foo();
|
||||
::bar::bar();
|
||||
crate::bar::foo();
|
||||
crate::bar::bar();
|
||||
|
||||
::bar::gpub();
|
||||
crate::bar::gpub();
|
||||
|
||||
::bar::baz::foo(); //~ ERROR: module `baz` is private
|
||||
::bar::baz::bar(); //~ ERROR: module `baz` is private
|
||||
crate::bar::baz::foo(); //~ ERROR: module `baz` is private
|
||||
crate::bar::baz::bar(); //~ ERROR: module `baz` is private
|
||||
}
|
||||
|
||||
fn test2() {
|
||||
|
|
@ -154,7 +154,7 @@ mod foo {
|
|||
bar::bar();
|
||||
}
|
||||
|
||||
impl ::bar::B for f32 { fn foo() -> f32 { 1.0 } }
|
||||
impl crate::bar::B for f32 { fn foo() -> f32 { 1.0 } }
|
||||
//~^ ERROR: trait `B` is private
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -48,12 +48,12 @@ LL | mod i {
|
|||
| ^^^^^
|
||||
|
||||
error[E0603]: module `baz` is private
|
||||
--> $DIR/privacy1.rs:104:16
|
||||
--> $DIR/privacy1.rs:104:21
|
||||
|
|
||||
LL | ::bar::baz::A::foo();
|
||||
| ^^^ - struct `A` is not publicly re-exported
|
||||
| |
|
||||
| private module
|
||||
LL | crate::bar::baz::A::foo();
|
||||
| ^^^ - struct `A` is not publicly re-exported
|
||||
| |
|
||||
| private module
|
||||
|
|
||||
note: the module `baz` is defined here
|
||||
--> $DIR/privacy1.rs:50:5
|
||||
|
|
@ -62,12 +62,12 @@ LL | mod baz {
|
|||
| ^^^^^^^
|
||||
|
||||
error[E0603]: module `baz` is private
|
||||
--> $DIR/privacy1.rs:105:16
|
||||
--> $DIR/privacy1.rs:105:21
|
||||
|
|
||||
LL | ::bar::baz::A::bar();
|
||||
| ^^^ - struct `A` is not publicly re-exported
|
||||
| |
|
||||
| private module
|
||||
LL | crate::bar::baz::A::bar();
|
||||
| ^^^ - struct `A` is not publicly re-exported
|
||||
| |
|
||||
| private module
|
||||
|
|
||||
note: the module `baz` is defined here
|
||||
--> $DIR/privacy1.rs:50:5
|
||||
|
|
@ -76,12 +76,12 @@ LL | mod baz {
|
|||
| ^^^^^^^
|
||||
|
||||
error[E0603]: module `baz` is private
|
||||
--> $DIR/privacy1.rs:107:16
|
||||
--> $DIR/privacy1.rs:107:21
|
||||
|
|
||||
LL | ::bar::baz::A.foo2();
|
||||
| ^^^ - unit struct `A` is not publicly re-exported
|
||||
| |
|
||||
| private module
|
||||
LL | crate::bar::baz::A.foo2();
|
||||
| ^^^ - unit struct `A` is not publicly re-exported
|
||||
| |
|
||||
| private module
|
||||
|
|
||||
note: the module `baz` is defined here
|
||||
--> $DIR/privacy1.rs:50:5
|
||||
|
|
@ -90,12 +90,12 @@ LL | mod baz {
|
|||
| ^^^^^^^
|
||||
|
||||
error[E0603]: module `baz` is private
|
||||
--> $DIR/privacy1.rs:108:16
|
||||
--> $DIR/privacy1.rs:108:21
|
||||
|
|
||||
LL | ::bar::baz::A.bar2();
|
||||
| ^^^ - unit struct `A` is not publicly re-exported
|
||||
| |
|
||||
| private module
|
||||
LL | crate::bar::baz::A.bar2();
|
||||
| ^^^ - unit struct `A` is not publicly re-exported
|
||||
| |
|
||||
| private module
|
||||
|
|
||||
note: the module `baz` is defined here
|
||||
--> $DIR/privacy1.rs:50:5
|
||||
|
|
@ -104,12 +104,12 @@ LL | mod baz {
|
|||
| ^^^^^^^
|
||||
|
||||
error[E0603]: trait `B` is private
|
||||
--> $DIR/privacy1.rs:112:16
|
||||
--> $DIR/privacy1.rs:112:21
|
||||
|
|
||||
LL | ::bar::B::foo();
|
||||
| ^ --- associated function `foo` is not publicly re-exported
|
||||
| |
|
||||
| private trait
|
||||
LL | crate::bar::B::foo();
|
||||
| ^ --- associated function `foo` is not publicly re-exported
|
||||
| |
|
||||
| private trait
|
||||
|
|
||||
note: the trait `B` is defined here
|
||||
--> $DIR/privacy1.rs:40:5
|
||||
|
|
@ -118,10 +118,10 @@ LL | trait B {
|
|||
| ^^^^^^^
|
||||
|
||||
error[E0603]: function `epriv` is private
|
||||
--> $DIR/privacy1.rs:118:20
|
||||
--> $DIR/privacy1.rs:118:25
|
||||
|
|
||||
LL | ::bar::epriv();
|
||||
| ^^^^^ private function
|
||||
LL | crate::bar::epriv();
|
||||
| ^^^^^ private function
|
||||
|
|
||||
note: the function `epriv` is defined here
|
||||
--> $DIR/privacy1.rs:65:9
|
||||
|
|
@ -130,10 +130,10 @@ LL | fn epriv();
|
|||
| ^^^^^^^^^^^
|
||||
|
||||
error[E0603]: module `baz` is private
|
||||
--> $DIR/privacy1.rs:127:16
|
||||
--> $DIR/privacy1.rs:127:21
|
||||
|
|
||||
LL | ::bar::baz::foo();
|
||||
| ^^^ private module
|
||||
LL | crate::bar::baz::foo();
|
||||
| ^^^ private module
|
||||
|
|
||||
note: the module `baz` is defined here
|
||||
--> $DIR/privacy1.rs:50:5
|
||||
|
|
@ -142,15 +142,15 @@ LL | mod baz {
|
|||
| ^^^^^^^
|
||||
help: consider importing this function through its public re-export instead
|
||||
|
|
||||
LL - ::bar::baz::foo();
|
||||
LL - crate::bar::baz::foo();
|
||||
LL + bar::foo();
|
||||
|
|
||||
|
||||
error[E0603]: module `baz` is private
|
||||
--> $DIR/privacy1.rs:128:16
|
||||
--> $DIR/privacy1.rs:128:21
|
||||
|
|
||||
LL | ::bar::baz::bar();
|
||||
| ^^^ private module
|
||||
LL | crate::bar::baz::bar();
|
||||
| ^^^ private module
|
||||
|
|
||||
note: the module `baz` is defined here
|
||||
--> $DIR/privacy1.rs:50:5
|
||||
|
|
@ -159,15 +159,15 @@ LL | mod baz {
|
|||
| ^^^^^^^
|
||||
help: consider importing this function through its public re-export instead
|
||||
|
|
||||
LL - ::bar::baz::bar();
|
||||
LL - crate::bar::baz::bar();
|
||||
LL + bar::bar();
|
||||
|
|
||||
|
||||
error[E0603]: trait `B` is private
|
||||
--> $DIR/privacy1.rs:157:17
|
||||
--> $DIR/privacy1.rs:157:22
|
||||
|
|
||||
LL | impl ::bar::B for f32 { fn foo() -> f32 { 1.0 } }
|
||||
| ^ private trait
|
||||
LL | impl crate::bar::B for f32 { fn foo() -> f32 { 1.0 } }
|
||||
| ^ private trait
|
||||
|
|
||||
note: the trait `B` is defined here
|
||||
--> $DIR/privacy1.rs:40:5
|
||||
|
|
@ -194,31 +194,31 @@ LL | bar::A::bar();
|
|||
| ^^^ private associated function
|
||||
|
||||
error[E0624]: associated function `bar` is private
|
||||
--> $DIR/privacy1.rs:102:19
|
||||
--> $DIR/privacy1.rs:102:24
|
||||
|
|
||||
LL | fn bar() {}
|
||||
| -------- private associated function defined here
|
||||
...
|
||||
LL | ::bar::A::bar();
|
||||
| ^^^ private associated function
|
||||
LL | crate::bar::A::bar();
|
||||
| ^^^ private associated function
|
||||
|
||||
error[E0624]: associated function `bar` is private
|
||||
--> $DIR/privacy1.rs:105:24
|
||||
--> $DIR/privacy1.rs:105:29
|
||||
|
|
||||
LL | fn bar() {}
|
||||
| -------- private associated function defined here
|
||||
...
|
||||
LL | ::bar::baz::A::bar();
|
||||
| ^^^ private associated function
|
||||
LL | crate::bar::baz::A::bar();
|
||||
| ^^^ private associated function
|
||||
|
||||
error[E0624]: method `bar2` is private
|
||||
--> $DIR/privacy1.rs:108:23
|
||||
--> $DIR/privacy1.rs:108:28
|
||||
|
|
||||
LL | fn bar2(&self) {}
|
||||
| -------------- private method defined here
|
||||
...
|
||||
LL | ::bar::baz::A.bar2();
|
||||
| ^^^^ private method
|
||||
LL | crate::bar::baz::A.bar2();
|
||||
| ^^^^ private method
|
||||
|
||||
error: aborting due to 18 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ mod bar {
|
|||
pub use self::glob::*;
|
||||
|
||||
pub mod glob {
|
||||
use foo;
|
||||
use crate::foo;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ LL | use bar::glob::foo;
|
|||
note: the function import `foo` is defined here...
|
||||
--> $DIR/privacy2.rs:13:13
|
||||
|
|
||||
LL | use foo;
|
||||
| ^^^
|
||||
LL | use crate::foo;
|
||||
| ^^^^^^^^^^
|
||||
note: ...and refers to the function `foo` which is defined here
|
||||
--> $DIR/privacy2.rs:17:1
|
||||
|
|
||||
|
|
|
|||
|
|
@ -4,6 +4,12 @@ error[E0432]: unresolved import `bar::gpriv`
|
|||
LL | use bar::gpriv;
|
||||
| ^^^^^^^^^^ no `gpriv` in `bar`
|
||||
|
||||
error: requires `sized` lang_item
|
||||
--> $DIR/privacy3.rs:13:20
|
||||
|
|
||||
LL | fn gpriv() {}
|
||||
| ^^
|
||||
|
||||
error: requires `sized` lang_item
|
||||
--> $DIR/privacy3.rs:18:14
|
||||
|
|
||||
|
|
@ -28,12 +34,6 @@ error: requires `sized` lang_item
|
|||
LL | fn main() {}
|
||||
| ^^
|
||||
|
||||
error: requires `sized` lang_item
|
||||
--> $DIR/privacy3.rs:13:20
|
||||
|
|
||||
LL | fn gpriv() {}
|
||||
| ^^
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0432`.
|
||||
|
|
|
|||
|
|
@ -12,9 +12,9 @@ trait Ref {
|
|||
mod m {
|
||||
struct Priv;
|
||||
|
||||
impl ::Arr0 for [Priv; 0] { fn arr0_secret(&self) {} }
|
||||
impl ::TyParam for Option<Priv> { fn ty_param_secret(&self) {} }
|
||||
impl<'a> ::Ref for &'a Priv { fn ref_secret(self) {} }
|
||||
impl crate::Arr0 for [Priv; 0] { fn arr0_secret(&self) {} }
|
||||
impl crate::TyParam for Option<Priv> { fn ty_param_secret(&self) {} }
|
||||
impl<'a> crate::Ref for &'a Priv { fn ref_secret(self) {} }
|
||||
}
|
||||
|
||||
fn anyref<'a, T>() -> &'a T { panic!() }
|
||||
|
|
|
|||
|
|
@ -2,14 +2,14 @@
|
|||
#![allow(warnings)]
|
||||
|
||||
mod foo {
|
||||
pub use foo::bar::S;
|
||||
pub use crate::foo::bar::S;
|
||||
mod bar {
|
||||
#[derive(Default)]
|
||||
pub struct S {
|
||||
pub(in foo) x: i32,
|
||||
pub(in crate::foo) x: i32,
|
||||
}
|
||||
impl S {
|
||||
pub(in foo) fn f(&self) -> i32 { 0 }
|
||||
pub(in crate::foo) fn f(&self) -> i32 { 0 }
|
||||
}
|
||||
|
||||
pub struct S2 {
|
||||
|
|
@ -19,7 +19,7 @@ mod foo {
|
|||
pub(crate) fn f(&self) -> bool { false }
|
||||
}
|
||||
|
||||
impl ::std::ops::Deref for S {
|
||||
impl std::ops::Deref for S {
|
||||
type Target = S2;
|
||||
fn deref(&self) -> &S2 { unimplemented!() }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
mod foo {
|
||||
struct Priv;
|
||||
mod bar {
|
||||
use foo::Priv;
|
||||
use crate::foo::Priv;
|
||||
pub(super) fn f(_: Priv) {}
|
||||
pub(crate) fn g(_: Priv) {}
|
||||
pub(crate) fn h(_: Priv) {}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
mod foo {
|
||||
pub mod bar {
|
||||
pub struct S {
|
||||
pub(in foo) x: i32,
|
||||
pub(in crate::foo) x: i32,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -14,6 +14,6 @@ mod foo {
|
|||
}
|
||||
|
||||
fn main() {
|
||||
use foo::bar::S;
|
||||
use crate::foo::bar::S;
|
||||
S { x: 0 }; //~ ERROR private
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ macro_rules! local { () => {
|
|||
|
||||
mod qself {
|
||||
#[derive(Double)]
|
||||
struct QSelf(<::Foo as $crate::Trait>::Assoc);
|
||||
struct QSelf(<crate::Foo as $crate::Trait>::Assoc);
|
||||
}
|
||||
|
||||
mod qself_recurse {
|
||||
|
|
@ -43,7 +43,7 @@ macro_rules! local { () => {
|
|||
#[derive(Double)]
|
||||
#[repr(u32)]
|
||||
enum QSelfInConst {
|
||||
Variant = <::Foo as $crate::Trait>::CONST,
|
||||
Variant = <crate::Foo as $crate::Trait>::CONST,
|
||||
}
|
||||
}
|
||||
} }
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ use self::two::*;
|
|||
mod empty_helper {}
|
||||
|
||||
mod one {
|
||||
use empty_helper;
|
||||
use crate::empty_helper;
|
||||
|
||||
#[derive(Empty)]
|
||||
#[empty_helper]
|
||||
|
|
@ -18,7 +18,7 @@ mod one {
|
|||
}
|
||||
|
||||
mod two {
|
||||
use empty_helper;
|
||||
use crate::empty_helper;
|
||||
|
||||
#[derive(Empty)]
|
||||
#[empty_helper]
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ extern crate issue_50493;
|
|||
|
||||
#[derive(Derive)]
|
||||
struct Restricted {
|
||||
pub(in restricted) field: usize, //~ ERROR visibilities can only be restricted to ancestor modules
|
||||
pub(in crate::restricted) field: usize, //~ ERROR visibilities can only be restricted to ancestor modules
|
||||
}
|
||||
|
||||
mod restricted {}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
error[E0742]: visibilities can only be restricted to ancestor modules
|
||||
--> $DIR/issue-50493.rs:8:12
|
||||
|
|
||||
LL | pub(in restricted) field: usize,
|
||||
| ^^^^^^^^^^
|
||||
LL | pub(in crate::restricted) field: usize,
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
extern crate test_macros;
|
||||
|
||||
mod m1 {
|
||||
use m2::Empty;
|
||||
use crate::m2::Empty;
|
||||
|
||||
#[derive(Empty)]
|
||||
struct A {}
|
||||
|
|
|
|||
|
|
@ -7,14 +7,14 @@ mod foo1 {
|
|||
}
|
||||
|
||||
mod foo2 {
|
||||
use foo1::core; //~ ERROR crate import `core` is private
|
||||
use crate::foo1::core; //~ ERROR crate import `core` is private
|
||||
pub mod bar {
|
||||
extern crate core;
|
||||
}
|
||||
}
|
||||
|
||||
mod baz {
|
||||
pub use foo2::bar::core; //~ ERROR crate import `core` is private
|
||||
pub use crate::foo2::bar::core; //~ ERROR crate import `core` is private
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
error[E0603]: crate import `core` is private
|
||||
--> $DIR/pub-reexport-priv-extern-crate.rs:10:15
|
||||
--> $DIR/pub-reexport-priv-extern-crate.rs:10:22
|
||||
|
|
||||
LL | use foo1::core;
|
||||
| ^^^^ private crate import
|
||||
LL | use crate::foo1::core;
|
||||
| ^^^^ private crate import
|
||||
|
|
||||
note: the crate import `core` is defined here
|
||||
--> $DIR/pub-reexport-priv-extern-crate.rs:6:5
|
||||
|
|
@ -11,10 +11,10 @@ LL | extern crate core;
|
|||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0603]: crate import `core` is private
|
||||
--> $DIR/pub-reexport-priv-extern-crate.rs:17:24
|
||||
--> $DIR/pub-reexport-priv-extern-crate.rs:17:31
|
||||
|
|
||||
LL | pub use foo2::bar::core;
|
||||
| ^^^^ private crate import
|
||||
LL | pub use crate::foo2::bar::core;
|
||||
| ^^^^ private crate import
|
||||
|
|
||||
note: the crate import `core` is defined here
|
||||
--> $DIR/pub-reexport-priv-extern-crate.rs:12:9
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ pub (crate::a) fn cfn() {} //~ ERROR incorrect visibility restriction
|
|||
pub fn privfn() {}
|
||||
mod x {
|
||||
mod y {
|
||||
pub (in x) fn foo() {}
|
||||
pub (in crate::x) fn foo() {}
|
||||
pub (super) fn bar() {}
|
||||
pub (crate) fn qux() {}
|
||||
}
|
||||
|
|
@ -18,9 +18,9 @@ mod y {
|
|||
pub (crate) c: usize,
|
||||
pub (super) s: usize,
|
||||
valid_private: usize,
|
||||
pub (in y) valid_in_x: usize,
|
||||
pub (in crate::y) valid_in_x: usize,
|
||||
pub (a) invalid: usize, //~ ERROR incorrect visibility restriction
|
||||
pub (in x) non_parent_invalid: usize, //~ ERROR visibilities can only be restricted
|
||||
pub (in crate::x) non_parent_invalid: usize, //~ ERROR visibilities can only be restricted
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -76,8 +76,8 @@ LL | pub (in xyz) fn xyz() {}
|
|||
error[E0742]: visibilities can only be restricted to ancestor modules
|
||||
--> $DIR/pub-restricted.rs:23:17
|
||||
|
|
||||
LL | pub (in x) non_parent_invalid: usize,
|
||||
| ^
|
||||
LL | pub (in crate::x) non_parent_invalid: usize,
|
||||
| ^^^^^^^^
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
pub mod foo {
|
||||
pub use foo;
|
||||
pub use crate::foo;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ use future::{Future, IntoFuture};
|
|||
mod future {
|
||||
use std::result;
|
||||
|
||||
use {stream, Stream};
|
||||
use crate::{stream, Stream};
|
||||
|
||||
pub trait Future {
|
||||
type Item;
|
||||
|
|
@ -100,7 +100,7 @@ mod future {
|
|||
}
|
||||
|
||||
mod stream {
|
||||
use IntoFuture;
|
||||
use crate::IntoFuture;
|
||||
|
||||
pub trait Stream {
|
||||
type Item;
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ LL | struct ExplicitlyPadded(Box<ExplicitlyPadded>);
|
|||
error[E0391]: cycle detected when computing layout of `should_pad_explicitly_packed_field::ExplicitlyPadded`
|
||||
|
|
||||
= note: ...which immediately requires computing layout of `should_pad_explicitly_packed_field::ExplicitlyPadded` again
|
||||
= note: cycle used when evaluating trait selection obligation `(): core::mem::transmutability::TransmuteFrom<should_pad_explicitly_packed_field::ExplicitlyPadded, core::mem::transmutability::Assume { alignment: false, lifetimes: false, safety: false, validity: false }>`
|
||||
= note: cycle used when evaluating trait selection obligation `(): core::mem::transmutability::TransmuteFrom<should_pad_explicitly_packed_field::ExplicitlyPadded, ValTree(Branch([Leaf(0x00), Leaf(0x00), Leaf(0x00), Leaf(0x00)]): core::mem::transmutability::Assume)>`
|
||||
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
|
|
|||
|
|
@ -25,19 +25,6 @@ LL | type BadTraitRef = dyn Fn(Ty<'_>) -> &str;
|
|||
= note: lifetimes appearing in an associated or opaque type are not considered constrained
|
||||
= note: consider introducing a named lifetime parameter
|
||||
|
||||
error: item does not constrain `lifetime_params::Ty::{opaque#0}`
|
||||
--> $DIR/constrain_inputs.rs:8:8
|
||||
|
|
||||
LL | fn execute(ty: Ty<'_>) -> &str { todo!() }
|
||||
| ^^^^^^^
|
||||
|
|
||||
= note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]`
|
||||
note: this opaque type is supposed to be constrained
|
||||
--> $DIR/constrain_inputs.rs:4:19
|
||||
|
|
||||
LL | type Ty<'a> = impl Sized;
|
||||
| ^^^^^^^^^^
|
||||
|
||||
error[E0581]: return type references an anonymous lifetime, which is not constrained by the fn input types
|
||||
--> $DIR/constrain_inputs.rs:23:31
|
||||
|
|
||||
|
|
@ -47,19 +34,6 @@ LL | fn execute(ty: Ty<'_>) -> &str { ty() }
|
|||
= note: lifetimes appearing in an associated or opaque type are not considered constrained
|
||||
= note: consider introducing a named lifetime parameter
|
||||
|
||||
error: item does not constrain `lifetime_params_2::Ty::{opaque#0}`
|
||||
--> $DIR/constrain_inputs.rs:23:8
|
||||
|
|
||||
LL | fn execute(ty: Ty<'_>) -> &str { ty() }
|
||||
| ^^^^^^^
|
||||
|
|
||||
= note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]`
|
||||
note: this opaque type is supposed to be constrained
|
||||
--> $DIR/constrain_inputs.rs:19:19
|
||||
|
|
||||
LL | type Ty<'a> = impl FnOnce() -> &'a str;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0581]: return type references an anonymous lifetime, which is not constrained by the fn input types
|
||||
--> $DIR/constrain_inputs.rs:34:37
|
||||
|
|
||||
|
|
@ -78,6 +52,32 @@ LL | type BadTraitRef = dyn Fn(Ty<&str>) -> &str;
|
|||
= note: lifetimes appearing in an associated or opaque type are not considered constrained
|
||||
= note: consider introducing a named lifetime parameter
|
||||
|
||||
error: item does not constrain `lifetime_params::Ty::{opaque#0}`
|
||||
--> $DIR/constrain_inputs.rs:8:8
|
||||
|
|
||||
LL | fn execute(ty: Ty<'_>) -> &str { todo!() }
|
||||
| ^^^^^^^
|
||||
|
|
||||
= note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]`
|
||||
note: this opaque type is supposed to be constrained
|
||||
--> $DIR/constrain_inputs.rs:4:19
|
||||
|
|
||||
LL | type Ty<'a> = impl Sized;
|
||||
| ^^^^^^^^^^
|
||||
|
||||
error: item does not constrain `lifetime_params_2::Ty::{opaque#0}`
|
||||
--> $DIR/constrain_inputs.rs:23:8
|
||||
|
|
||||
LL | fn execute(ty: Ty<'_>) -> &str { ty() }
|
||||
| ^^^^^^^
|
||||
|
|
||||
= note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]`
|
||||
note: this opaque type is supposed to be constrained
|
||||
--> $DIR/constrain_inputs.rs:19:19
|
||||
|
|
||||
LL | type Ty<'a> = impl FnOnce() -> &'a str;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 8 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0581, E0582.
|
||||
|
|
|
|||
|
|
@ -1188,10 +1188,6 @@ cc = ["@m-ou-se"]
|
|||
[assign]
|
||||
warn_non_default_branch.enable = true
|
||||
contributing_url = "https://rustc-dev-guide.rust-lang.org/getting-started.html"
|
||||
users_on_vacation = [
|
||||
"fmease",
|
||||
"jyn514",
|
||||
]
|
||||
|
||||
[[assign.warn_non_default_branch.exceptions]]
|
||||
title = "[beta"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue