Auto merge of #100024 - matthiaskrgr:rollup-36ab4wx, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - #99340 (Fix ICE in Definitions::create_def) - #99629 (Improve `cannot move out of` error message) - #99864 (bootstrap: don't emit warn about duplicated deps with same/different features if some of sets actually empty) - #99911 (Remove some uses of `guess_head_span`) - #99976 (Make Rustdoc exit with correct error code when scraping examples from invalid files) - #100003 (Improve size assertions.) - #100012 (Avoid `Ty` to `String` conversions) - #100020 (better error when python is not found in x - issue #99648) Failed merges: - #99994 (Replace `guess_head_span` with `opt_span`) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
c9e134e1b6
45 changed files with 422 additions and 324 deletions
|
@ -1111,10 +1111,6 @@ pub struct Expr {
|
||||||
pub tokens: Option<LazyTokenStream>,
|
pub tokens: Option<LazyTokenStream>,
|
||||||
}
|
}
|
||||||
|
|
||||||
// `Expr` is used a lot. Make sure it doesn't unintentionally get bigger.
|
|
||||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
|
||||||
rustc_data_structures::static_assert_size!(Expr, 104);
|
|
||||||
|
|
||||||
impl Expr {
|
impl Expr {
|
||||||
/// Returns `true` if this expression would be valid somewhere that expects a value;
|
/// Returns `true` if this expression would be valid somewhere that expects a value;
|
||||||
/// for example, an `if` condition.
|
/// for example, an `if` condition.
|
||||||
|
@ -2883,9 +2879,6 @@ pub enum ItemKind {
|
||||||
MacroDef(MacroDef),
|
MacroDef(MacroDef),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
|
||||||
rustc_data_structures::static_assert_size!(ItemKind, 112);
|
|
||||||
|
|
||||||
impl ItemKind {
|
impl ItemKind {
|
||||||
pub fn article(&self) -> &str {
|
pub fn article(&self) -> &str {
|
||||||
use ItemKind::*;
|
use ItemKind::*;
|
||||||
|
@ -2957,9 +2950,6 @@ pub enum AssocItemKind {
|
||||||
MacCall(MacCall),
|
MacCall(MacCall),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
|
||||||
rustc_data_structures::static_assert_size!(AssocItemKind, 72);
|
|
||||||
|
|
||||||
impl AssocItemKind {
|
impl AssocItemKind {
|
||||||
pub fn defaultness(&self) -> Defaultness {
|
pub fn defaultness(&self) -> Defaultness {
|
||||||
match *self {
|
match *self {
|
||||||
|
@ -3009,9 +2999,6 @@ pub enum ForeignItemKind {
|
||||||
MacCall(MacCall),
|
MacCall(MacCall),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
|
||||||
rustc_data_structures::static_assert_size!(ForeignItemKind, 72);
|
|
||||||
|
|
||||||
impl From<ForeignItemKind> for ItemKind {
|
impl From<ForeignItemKind> for ItemKind {
|
||||||
fn from(foreign_item_kind: ForeignItemKind) -> ItemKind {
|
fn from(foreign_item_kind: ForeignItemKind) -> ItemKind {
|
||||||
match foreign_item_kind {
|
match foreign_item_kind {
|
||||||
|
@ -3038,3 +3025,27 @@ impl TryFrom<ItemKind> for ForeignItemKind {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type ForeignItem = Item<ForeignItemKind>;
|
pub type ForeignItem = Item<ForeignItemKind>;
|
||||||
|
|
||||||
|
// Some nodes are used a lot. Make sure they don't unintentionally get bigger.
|
||||||
|
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||||
|
mod size_asserts {
|
||||||
|
use super::*;
|
||||||
|
// These are in alphabetical order, which is easy to maintain.
|
||||||
|
rustc_data_structures::static_assert_size!(AssocItemKind, 72);
|
||||||
|
rustc_data_structures::static_assert_size!(Attribute, 152);
|
||||||
|
rustc_data_structures::static_assert_size!(Block, 48);
|
||||||
|
rustc_data_structures::static_assert_size!(Expr, 104);
|
||||||
|
rustc_data_structures::static_assert_size!(Fn, 192);
|
||||||
|
rustc_data_structures::static_assert_size!(ForeignItemKind, 72);
|
||||||
|
rustc_data_structures::static_assert_size!(GenericBound, 88);
|
||||||
|
rustc_data_structures::static_assert_size!(Generics, 72);
|
||||||
|
rustc_data_structures::static_assert_size!(Impl, 200);
|
||||||
|
rustc_data_structures::static_assert_size!(Item, 200);
|
||||||
|
rustc_data_structures::static_assert_size!(ItemKind, 112);
|
||||||
|
rustc_data_structures::static_assert_size!(Lit, 48);
|
||||||
|
rustc_data_structures::static_assert_size!(Pat, 120);
|
||||||
|
rustc_data_structures::static_assert_size!(Path, 40);
|
||||||
|
rustc_data_structures::static_assert_size!(PathSegment, 24);
|
||||||
|
rustc_data_structures::static_assert_size!(Stmt, 32);
|
||||||
|
rustc_data_structures::static_assert_size!(Ty, 96);
|
||||||
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ use crate::{
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
explain_borrow::{BorrowExplanation, LaterUseKind},
|
explain_borrow::{BorrowExplanation, LaterUseKind},
|
||||||
IncludingDowncast, RegionName, RegionNameSource, UseSpans,
|
DescribePlaceOpt, RegionName, RegionNameSource, UseSpans,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
@ -137,7 +137,10 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||||
span,
|
span,
|
||||||
desired_action.as_noun(),
|
desired_action.as_noun(),
|
||||||
partially_str,
|
partially_str,
|
||||||
self.describe_place_with_options(moved_place, IncludingDowncast(true)),
|
self.describe_place_with_options(
|
||||||
|
moved_place,
|
||||||
|
DescribePlaceOpt { including_downcast: true, including_tuple_field: true },
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
let reinit_spans = maybe_reinitialized_locations
|
let reinit_spans = maybe_reinitialized_locations
|
||||||
|
@ -274,8 +277,10 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let opt_name =
|
let opt_name = self.describe_place_with_options(
|
||||||
self.describe_place_with_options(place.as_ref(), IncludingDowncast(true));
|
place.as_ref(),
|
||||||
|
DescribePlaceOpt { including_downcast: true, including_tuple_field: true },
|
||||||
|
);
|
||||||
let note_msg = match opt_name {
|
let note_msg = match opt_name {
|
||||||
Some(ref name) => format!("`{}`", name),
|
Some(ref name) => format!("`{}`", name),
|
||||||
None => "value".to_owned(),
|
None => "value".to_owned(),
|
||||||
|
@ -341,12 +346,17 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let (name, desc) =
|
let (name, desc) = match self.describe_place_with_options(
|
||||||
match self.describe_place_with_options(moved_place, IncludingDowncast(true)) {
|
moved_place,
|
||||||
Some(name) => (format!("`{name}`"), format!("`{name}` ")),
|
DescribePlaceOpt { including_downcast: true, including_tuple_field: true },
|
||||||
None => ("the variable".to_string(), String::new()),
|
) {
|
||||||
};
|
Some(name) => (format!("`{name}`"), format!("`{name}` ")),
|
||||||
let path = match self.describe_place_with_options(used_place, IncludingDowncast(true)) {
|
None => ("the variable".to_string(), String::new()),
|
||||||
|
};
|
||||||
|
let path = match self.describe_place_with_options(
|
||||||
|
used_place,
|
||||||
|
DescribePlaceOpt { including_downcast: true, including_tuple_field: true },
|
||||||
|
) {
|
||||||
Some(name) => format!("`{name}`"),
|
Some(name) => format!("`{name}`"),
|
||||||
None => "value".to_string(),
|
None => "value".to_string(),
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,7 +4,7 @@ use itertools::Itertools;
|
||||||
use rustc_const_eval::util::{call_kind, CallDesugaringKind};
|
use rustc_const_eval::util::{call_kind, CallDesugaringKind};
|
||||||
use rustc_errors::{Applicability, Diagnostic};
|
use rustc_errors::{Applicability, Diagnostic};
|
||||||
use rustc_hir as hir;
|
use rustc_hir as hir;
|
||||||
use rustc_hir::def::Namespace;
|
use rustc_hir::def::{CtorKind, Namespace};
|
||||||
use rustc_hir::GeneratorKind;
|
use rustc_hir::GeneratorKind;
|
||||||
use rustc_infer::infer::TyCtxtInferExt;
|
use rustc_infer::infer::TyCtxtInferExt;
|
||||||
use rustc_middle::mir::tcx::PlaceTy;
|
use rustc_middle::mir::tcx::PlaceTy;
|
||||||
|
@ -16,7 +16,7 @@ use rustc_middle::ty::print::Print;
|
||||||
use rustc_middle::ty::{self, DefIdTree, Instance, Ty, TyCtxt};
|
use rustc_middle::ty::{self, DefIdTree, Instance, Ty, TyCtxt};
|
||||||
use rustc_mir_dataflow::move_paths::{InitLocation, LookupResult};
|
use rustc_mir_dataflow::move_paths::{InitLocation, LookupResult};
|
||||||
use rustc_span::def_id::LocalDefId;
|
use rustc_span::def_id::LocalDefId;
|
||||||
use rustc_span::{symbol::sym, Span, DUMMY_SP};
|
use rustc_span::{symbol::sym, Span, Symbol, DUMMY_SP};
|
||||||
use rustc_target::abi::VariantIdx;
|
use rustc_target::abi::VariantIdx;
|
||||||
use rustc_trait_selection::traits::type_known_to_meet_bound_modulo_regions;
|
use rustc_trait_selection::traits::type_known_to_meet_bound_modulo_regions;
|
||||||
|
|
||||||
|
@ -43,7 +43,15 @@ pub(crate) use region_errors::{ErrorConstraintInfo, RegionErrorKind, RegionError
|
||||||
pub(crate) use region_name::{RegionName, RegionNameSource};
|
pub(crate) use region_name::{RegionName, RegionNameSource};
|
||||||
pub(crate) use rustc_const_eval::util::CallKind;
|
pub(crate) use rustc_const_eval::util::CallKind;
|
||||||
|
|
||||||
pub(super) struct IncludingDowncast(pub(super) bool);
|
pub(super) struct DescribePlaceOpt {
|
||||||
|
pub including_downcast: bool,
|
||||||
|
|
||||||
|
/// Enable/Disable tuple fields.
|
||||||
|
/// For example `x` tuple. if it's `true` `x.0`. Otherwise `x`
|
||||||
|
pub including_tuple_field: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(super) struct IncludingTupleField(pub(super) bool);
|
||||||
|
|
||||||
impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||||
/// Adds a suggestion when a closure is invoked twice with a moved variable or when a closure
|
/// Adds a suggestion when a closure is invoked twice with a moved variable or when a closure
|
||||||
|
@ -164,7 +172,10 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||||
/// End-user visible description of `place` if one can be found.
|
/// End-user visible description of `place` if one can be found.
|
||||||
/// If the place is a temporary for instance, `None` will be returned.
|
/// If the place is a temporary for instance, `None` will be returned.
|
||||||
pub(super) fn describe_place(&self, place_ref: PlaceRef<'tcx>) -> Option<String> {
|
pub(super) fn describe_place(&self, place_ref: PlaceRef<'tcx>) -> Option<String> {
|
||||||
self.describe_place_with_options(place_ref, IncludingDowncast(false))
|
self.describe_place_with_options(
|
||||||
|
place_ref,
|
||||||
|
DescribePlaceOpt { including_downcast: false, including_tuple_field: true },
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// End-user visible description of `place` if one can be found. If the place is a temporary
|
/// End-user visible description of `place` if one can be found. If the place is a temporary
|
||||||
|
@ -174,7 +185,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||||
pub(super) fn describe_place_with_options(
|
pub(super) fn describe_place_with_options(
|
||||||
&self,
|
&self,
|
||||||
place: PlaceRef<'tcx>,
|
place: PlaceRef<'tcx>,
|
||||||
including_downcast: IncludingDowncast,
|
opt: DescribePlaceOpt,
|
||||||
) -> Option<String> {
|
) -> Option<String> {
|
||||||
let local = place.local;
|
let local = place.local;
|
||||||
let mut autoderef_index = None;
|
let mut autoderef_index = None;
|
||||||
|
@ -224,7 +235,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ProjectionElem::Downcast(..) if including_downcast.0 => return None,
|
ProjectionElem::Downcast(..) if opt.including_downcast => return None,
|
||||||
ProjectionElem::Downcast(..) => (),
|
ProjectionElem::Downcast(..) => (),
|
||||||
ProjectionElem::Field(field, _ty) => {
|
ProjectionElem::Field(field, _ty) => {
|
||||||
// FIXME(project-rfc_2229#36): print capture precisely here.
|
// FIXME(project-rfc_2229#36): print capture precisely here.
|
||||||
|
@ -238,9 +249,12 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||||
let field_name = self.describe_field(
|
let field_name = self.describe_field(
|
||||||
PlaceRef { local, projection: place.projection.split_at(index).0 },
|
PlaceRef { local, projection: place.projection.split_at(index).0 },
|
||||||
*field,
|
*field,
|
||||||
|
IncludingTupleField(opt.including_tuple_field),
|
||||||
);
|
);
|
||||||
buf.push('.');
|
if let Some(field_name_str) = field_name {
|
||||||
buf.push_str(&field_name);
|
buf.push('.');
|
||||||
|
buf.push_str(&field_name_str);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ProjectionElem::Index(index) => {
|
ProjectionElem::Index(index) => {
|
||||||
|
@ -261,6 +275,18 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||||
ok.ok().map(|_| buf)
|
ok.ok().map(|_| buf)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn describe_name(&self, place: PlaceRef<'tcx>) -> Option<Symbol> {
|
||||||
|
for elem in place.projection.into_iter() {
|
||||||
|
match elem {
|
||||||
|
ProjectionElem::Downcast(Some(name), _) => {
|
||||||
|
return Some(*name);
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
None
|
||||||
|
}
|
||||||
|
|
||||||
/// Appends end-user visible description of the `local` place to `buf`. If `local` doesn't have
|
/// Appends end-user visible description of the `local` place to `buf`. If `local` doesn't have
|
||||||
/// a name, or its name was generated by the compiler, then `Err` is returned
|
/// a name, or its name was generated by the compiler, then `Err` is returned
|
||||||
fn append_local_to_string(&self, local: Local, buf: &mut String) -> Result<(), ()> {
|
fn append_local_to_string(&self, local: Local, buf: &mut String) -> Result<(), ()> {
|
||||||
|
@ -275,7 +301,12 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// End-user visible description of the `field`nth field of `base`
|
/// End-user visible description of the `field`nth field of `base`
|
||||||
fn describe_field(&self, place: PlaceRef<'tcx>, field: Field) -> String {
|
fn describe_field(
|
||||||
|
&self,
|
||||||
|
place: PlaceRef<'tcx>,
|
||||||
|
field: Field,
|
||||||
|
including_tuple_field: IncludingTupleField,
|
||||||
|
) -> Option<String> {
|
||||||
let place_ty = match place {
|
let place_ty = match place {
|
||||||
PlaceRef { local, projection: [] } => PlaceTy::from_ty(self.body.local_decls[local].ty),
|
PlaceRef { local, projection: [] } => PlaceTy::from_ty(self.body.local_decls[local].ty),
|
||||||
PlaceRef { local, projection: [proj_base @ .., elem] } => match elem {
|
PlaceRef { local, projection: [proj_base @ .., elem] } => match elem {
|
||||||
|
@ -289,7 +320,12 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||||
ProjectionElem::Field(_, field_type) => PlaceTy::from_ty(*field_type),
|
ProjectionElem::Field(_, field_type) => PlaceTy::from_ty(*field_type),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
self.describe_field_from_ty(place_ty.ty, field, place_ty.variant_index)
|
self.describe_field_from_ty(
|
||||||
|
place_ty.ty,
|
||||||
|
field,
|
||||||
|
place_ty.variant_index,
|
||||||
|
including_tuple_field,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// End-user visible description of the `field_index`nth field of `ty`
|
/// End-user visible description of the `field_index`nth field of `ty`
|
||||||
|
@ -298,10 +334,11 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||||
ty: Ty<'_>,
|
ty: Ty<'_>,
|
||||||
field: Field,
|
field: Field,
|
||||||
variant_index: Option<VariantIdx>,
|
variant_index: Option<VariantIdx>,
|
||||||
) -> String {
|
including_tuple_field: IncludingTupleField,
|
||||||
|
) -> Option<String> {
|
||||||
if ty.is_box() {
|
if ty.is_box() {
|
||||||
// If the type is a box, the field is described from the boxed type
|
// If the type is a box, the field is described from the boxed type
|
||||||
self.describe_field_from_ty(ty.boxed_ty(), field, variant_index)
|
self.describe_field_from_ty(ty.boxed_ty(), field, variant_index, including_tuple_field)
|
||||||
} else {
|
} else {
|
||||||
match *ty.kind() {
|
match *ty.kind() {
|
||||||
ty::Adt(def, _) => {
|
ty::Adt(def, _) => {
|
||||||
|
@ -311,14 +348,17 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||||
} else {
|
} else {
|
||||||
def.non_enum_variant()
|
def.non_enum_variant()
|
||||||
};
|
};
|
||||||
variant.fields[field.index()].name.to_string()
|
if !including_tuple_field.0 && variant.ctor_kind == CtorKind::Fn {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
Some(variant.fields[field.index()].name.to_string())
|
||||||
}
|
}
|
||||||
ty::Tuple(_) => field.index().to_string(),
|
ty::Tuple(_) => Some(field.index().to_string()),
|
||||||
ty::Ref(_, ty, _) | ty::RawPtr(ty::TypeAndMut { ty, .. }) => {
|
ty::Ref(_, ty, _) | ty::RawPtr(ty::TypeAndMut { ty, .. }) => {
|
||||||
self.describe_field_from_ty(ty, field, variant_index)
|
self.describe_field_from_ty(ty, field, variant_index, including_tuple_field)
|
||||||
}
|
}
|
||||||
ty::Array(ty, _) | ty::Slice(ty) => {
|
ty::Array(ty, _) | ty::Slice(ty) => {
|
||||||
self.describe_field_from_ty(ty, field, variant_index)
|
self.describe_field_from_ty(ty, field, variant_index, including_tuple_field)
|
||||||
}
|
}
|
||||||
ty::Closure(def_id, _) | ty::Generator(def_id, _, _) => {
|
ty::Closure(def_id, _) | ty::Generator(def_id, _, _) => {
|
||||||
// We won't be borrowck'ing here if the closure came from another crate,
|
// We won't be borrowck'ing here if the closure came from another crate,
|
||||||
|
@ -335,7 +375,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.get_root_variable();
|
.get_root_variable();
|
||||||
|
|
||||||
self.infcx.tcx.hir().name(var_id).to_string()
|
Some(self.infcx.tcx.hir().name(var_id).to_string())
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
// Might need a revision when the fields in trait RFC is implemented
|
// Might need a revision when the fields in trait RFC is implemented
|
||||||
|
|
|
@ -6,7 +6,7 @@ use rustc_mir_dataflow::move_paths::{
|
||||||
};
|
};
|
||||||
use rustc_span::Span;
|
use rustc_span::Span;
|
||||||
|
|
||||||
use crate::diagnostics::UseSpans;
|
use crate::diagnostics::{DescribePlaceOpt, UseSpans};
|
||||||
use crate::prefixes::PrefixSet;
|
use crate::prefixes::PrefixSet;
|
||||||
use crate::MirBorrowckCtxt;
|
use crate::MirBorrowckCtxt;
|
||||||
|
|
||||||
|
@ -368,13 +368,31 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
let source = self.borrowed_content_source(deref_base);
|
let source = self.borrowed_content_source(deref_base);
|
||||||
match (self.describe_place(move_place.as_ref()), source.describe_for_named_place())
|
let move_place_ref = move_place.as_ref();
|
||||||
{
|
match (
|
||||||
(Some(place_desc), Some(source_desc)) => self.cannot_move_out_of(
|
self.describe_place_with_options(
|
||||||
|
move_place_ref,
|
||||||
|
DescribePlaceOpt {
|
||||||
|
including_downcast: false,
|
||||||
|
including_tuple_field: false,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
self.describe_name(move_place_ref),
|
||||||
|
source.describe_for_named_place(),
|
||||||
|
) {
|
||||||
|
(Some(place_desc), Some(name), Some(source_desc)) => self.cannot_move_out_of(
|
||||||
|
span,
|
||||||
|
&format!("`{place_desc}` as enum variant `{name}` which is behind a {source_desc}"),
|
||||||
|
),
|
||||||
|
(Some(place_desc), Some(name), None) => self.cannot_move_out_of(
|
||||||
|
span,
|
||||||
|
&format!("`{place_desc}` as enum variant `{name}`"),
|
||||||
|
),
|
||||||
|
(Some(place_desc), _, Some(source_desc)) => self.cannot_move_out_of(
|
||||||
span,
|
span,
|
||||||
&format!("`{place_desc}` which is behind a {source_desc}"),
|
&format!("`{place_desc}` which is behind a {source_desc}"),
|
||||||
),
|
),
|
||||||
(_, _) => self.cannot_move_out_of(
|
(_, _, _) => self.cannot_move_out_of(
|
||||||
span,
|
span,
|
||||||
&source.describe_for_unnamed_place(self.infcx.tcx),
|
&source.describe_for_unnamed_place(self.infcx.tcx),
|
||||||
),
|
),
|
||||||
|
|
|
@ -37,9 +37,6 @@ pub enum Immediate<Prov: Provenance = AllocId> {
|
||||||
Uninit,
|
Uninit,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
|
||||||
rustc_data_structures::static_assert_size!(Immediate, 56);
|
|
||||||
|
|
||||||
impl<Prov: Provenance> From<ScalarMaybeUninit<Prov>> for Immediate<Prov> {
|
impl<Prov: Provenance> From<ScalarMaybeUninit<Prov>> for Immediate<Prov> {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn from(val: ScalarMaybeUninit<Prov>) -> Self {
|
fn from(val: ScalarMaybeUninit<Prov>) -> Self {
|
||||||
|
@ -117,9 +114,6 @@ pub struct ImmTy<'tcx, Prov: Provenance = AllocId> {
|
||||||
pub layout: TyAndLayout<'tcx>,
|
pub layout: TyAndLayout<'tcx>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
|
||||||
rustc_data_structures::static_assert_size!(ImmTy<'_>, 72);
|
|
||||||
|
|
||||||
impl<Prov: Provenance> std::fmt::Display for ImmTy<'_, Prov> {
|
impl<Prov: Provenance> std::fmt::Display for ImmTy<'_, Prov> {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
/// Helper function for printing a scalar to a FmtPrinter
|
/// Helper function for printing a scalar to a FmtPrinter
|
||||||
|
@ -187,9 +181,6 @@ pub enum Operand<Prov: Provenance = AllocId> {
|
||||||
Indirect(MemPlace<Prov>),
|
Indirect(MemPlace<Prov>),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
|
||||||
rustc_data_structures::static_assert_size!(Operand, 64);
|
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct OpTy<'tcx, Prov: Provenance = AllocId> {
|
pub struct OpTy<'tcx, Prov: Provenance = AllocId> {
|
||||||
op: Operand<Prov>, // Keep this private; it helps enforce invariants.
|
op: Operand<Prov>, // Keep this private; it helps enforce invariants.
|
||||||
|
@ -204,9 +195,6 @@ pub struct OpTy<'tcx, Prov: Provenance = AllocId> {
|
||||||
pub align: Option<Align>,
|
pub align: Option<Align>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
|
||||||
rustc_data_structures::static_assert_size!(OpTy<'_>, 88);
|
|
||||||
|
|
||||||
impl<'tcx, Prov: Provenance> std::ops::Deref for OpTy<'tcx, Prov> {
|
impl<'tcx, Prov: Provenance> std::ops::Deref for OpTy<'tcx, Prov> {
|
||||||
type Target = Operand<Prov>;
|
type Target = Operand<Prov>;
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
|
@ -830,3 +818,14 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Some nodes are used a lot. Make sure they don't unintentionally get bigger.
|
||||||
|
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||||
|
mod size_asserts {
|
||||||
|
use super::*;
|
||||||
|
// These are in alphabetical order, which is easy to maintain.
|
||||||
|
rustc_data_structures::static_assert_size!(Immediate, 56);
|
||||||
|
rustc_data_structures::static_assert_size!(ImmTy<'_>, 72);
|
||||||
|
rustc_data_structures::static_assert_size!(Operand, 64);
|
||||||
|
rustc_data_structures::static_assert_size!(OpTy<'_>, 88);
|
||||||
|
}
|
||||||
|
|
|
@ -25,9 +25,6 @@ pub enum MemPlaceMeta<Prov: Provenance = AllocId> {
|
||||||
None,
|
None,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
|
||||||
rustc_data_structures::static_assert_size!(MemPlaceMeta, 24);
|
|
||||||
|
|
||||||
impl<Prov: Provenance> MemPlaceMeta<Prov> {
|
impl<Prov: Provenance> MemPlaceMeta<Prov> {
|
||||||
pub fn unwrap_meta(self) -> Scalar<Prov> {
|
pub fn unwrap_meta(self) -> Scalar<Prov> {
|
||||||
match self {
|
match self {
|
||||||
|
@ -56,9 +53,6 @@ pub struct MemPlace<Prov: Provenance = AllocId> {
|
||||||
pub meta: MemPlaceMeta<Prov>,
|
pub meta: MemPlaceMeta<Prov>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
|
||||||
rustc_data_structures::static_assert_size!(MemPlace, 40);
|
|
||||||
|
|
||||||
/// A MemPlace with its layout. Constructing it is only possible in this module.
|
/// A MemPlace with its layout. Constructing it is only possible in this module.
|
||||||
#[derive(Copy, Clone, Hash, Eq, PartialEq, Debug)]
|
#[derive(Copy, Clone, Hash, Eq, PartialEq, Debug)]
|
||||||
pub struct MPlaceTy<'tcx, Prov: Provenance = AllocId> {
|
pub struct MPlaceTy<'tcx, Prov: Provenance = AllocId> {
|
||||||
|
@ -71,9 +65,6 @@ pub struct MPlaceTy<'tcx, Prov: Provenance = AllocId> {
|
||||||
pub align: Align,
|
pub align: Align,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
|
||||||
rustc_data_structures::static_assert_size!(MPlaceTy<'_>, 64);
|
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug)]
|
#[derive(Copy, Clone, Debug)]
|
||||||
pub enum Place<Prov: Provenance = AllocId> {
|
pub enum Place<Prov: Provenance = AllocId> {
|
||||||
/// A place referring to a value allocated in the `Memory` system.
|
/// A place referring to a value allocated in the `Memory` system.
|
||||||
|
@ -84,9 +75,6 @@ pub enum Place<Prov: Provenance = AllocId> {
|
||||||
Local { frame: usize, local: mir::Local },
|
Local { frame: usize, local: mir::Local },
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
|
||||||
rustc_data_structures::static_assert_size!(Place, 48);
|
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct PlaceTy<'tcx, Prov: Provenance = AllocId> {
|
pub struct PlaceTy<'tcx, Prov: Provenance = AllocId> {
|
||||||
place: Place<Prov>, // Keep this private; it helps enforce invariants.
|
place: Place<Prov>, // Keep this private; it helps enforce invariants.
|
||||||
|
@ -98,9 +86,6 @@ pub struct PlaceTy<'tcx, Prov: Provenance = AllocId> {
|
||||||
pub align: Align,
|
pub align: Align,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
|
||||||
rustc_data_structures::static_assert_size!(PlaceTy<'_>, 72);
|
|
||||||
|
|
||||||
impl<'tcx, Prov: Provenance> std::ops::Deref for PlaceTy<'tcx, Prov> {
|
impl<'tcx, Prov: Provenance> std::ops::Deref for PlaceTy<'tcx, Prov> {
|
||||||
type Target = Place<Prov>;
|
type Target = Place<Prov>;
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
|
@ -901,3 +886,15 @@ where
|
||||||
Ok(mplace)
|
Ok(mplace)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Some nodes are used a lot. Make sure they don't unintentionally get bigger.
|
||||||
|
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||||
|
mod size_asserts {
|
||||||
|
use super::*;
|
||||||
|
// These are in alphabetical order, which is easy to maintain.
|
||||||
|
rustc_data_structures::static_assert_size!(MemPlaceMeta, 24);
|
||||||
|
rustc_data_structures::static_assert_size!(MemPlace, 40);
|
||||||
|
rustc_data_structures::static_assert_size!(MPlaceTy<'_>, 64);
|
||||||
|
rustc_data_structures::static_assert_size!(Place, 48);
|
||||||
|
rustc_data_structures::static_assert_size!(PlaceTy<'_>, 72);
|
||||||
|
}
|
||||||
|
|
|
@ -338,7 +338,12 @@ impl Definitions {
|
||||||
|
|
||||||
/// Adds a definition with a parent definition.
|
/// Adds a definition with a parent definition.
|
||||||
pub fn create_def(&mut self, parent: LocalDefId, data: DefPathData) -> LocalDefId {
|
pub fn create_def(&mut self, parent: LocalDefId, data: DefPathData) -> LocalDefId {
|
||||||
debug!("create_def(parent={:?}, data={:?})", parent, data);
|
// We can't use `Debug` implementation for `LocalDefId` here, since it tries to acquire a
|
||||||
|
// reference to `Definitions` and we're already holding a mutable reference.
|
||||||
|
debug!(
|
||||||
|
"create_def(parent={}, data={data:?})",
|
||||||
|
self.def_path(parent).to_string_no_crate_verbose(),
|
||||||
|
);
|
||||||
|
|
||||||
// The root node must be created with `create_root_def()`.
|
// The root node must be created with `create_root_def()`.
|
||||||
assert!(data != DefPathData::CrateRoot);
|
assert!(data != DefPathData::CrateRoot);
|
||||||
|
|
|
@ -3489,17 +3489,18 @@ impl<'hir> Node<'hir> {
|
||||||
// Some nodes are used a lot. Make sure they don't unintentionally get bigger.
|
// Some nodes are used a lot. Make sure they don't unintentionally get bigger.
|
||||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||||
mod size_asserts {
|
mod size_asserts {
|
||||||
rustc_data_structures::static_assert_size!(super::Block<'static>, 48);
|
use super::*;
|
||||||
rustc_data_structures::static_assert_size!(super::Expr<'static>, 56);
|
// These are in alphabetical order, which is easy to maintain.
|
||||||
rustc_data_structures::static_assert_size!(super::Pat<'static>, 88);
|
rustc_data_structures::static_assert_size!(Block<'static>, 48);
|
||||||
rustc_data_structures::static_assert_size!(super::QPath<'static>, 24);
|
rustc_data_structures::static_assert_size!(Expr<'static>, 56);
|
||||||
rustc_data_structures::static_assert_size!(super::Ty<'static>, 72);
|
rustc_data_structures::static_assert_size!(ForeignItem<'static>, 72);
|
||||||
rustc_data_structures::static_assert_size!(super::GenericBound<'_>, 48);
|
rustc_data_structures::static_assert_size!(GenericBound<'_>, 48);
|
||||||
rustc_data_structures::static_assert_size!(super::Generics<'static>, 56);
|
rustc_data_structures::static_assert_size!(Generics<'static>, 56);
|
||||||
rustc_data_structures::static_assert_size!(super::Impl<'static>, 80);
|
rustc_data_structures::static_assert_size!(ImplItem<'static>, 80);
|
||||||
|
rustc_data_structures::static_assert_size!(Impl<'static>, 80);
|
||||||
rustc_data_structures::static_assert_size!(super::Item<'static>, 80);
|
rustc_data_structures::static_assert_size!(Item<'static>, 80);
|
||||||
rustc_data_structures::static_assert_size!(super::TraitItem<'static>, 88);
|
rustc_data_structures::static_assert_size!(Pat<'static>, 88);
|
||||||
rustc_data_structures::static_assert_size!(super::ImplItem<'static>, 80);
|
rustc_data_structures::static_assert_size!(QPath<'static>, 24);
|
||||||
rustc_data_structures::static_assert_size!(super::ForeignItem<'static>, 72);
|
rustc_data_structures::static_assert_size!(TraitItem<'static>, 88);
|
||||||
|
rustc_data_structures::static_assert_size!(Ty<'static>, 72);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1364,7 +1364,6 @@ impl UnreachablePub {
|
||||||
cx: &LateContext<'_>,
|
cx: &LateContext<'_>,
|
||||||
what: &str,
|
what: &str,
|
||||||
def_id: LocalDefId,
|
def_id: LocalDefId,
|
||||||
span: Span,
|
|
||||||
vis_span: Span,
|
vis_span: Span,
|
||||||
exportable: bool,
|
exportable: bool,
|
||||||
) {
|
) {
|
||||||
|
@ -1373,7 +1372,7 @@ impl UnreachablePub {
|
||||||
if vis_span.from_expansion() {
|
if vis_span.from_expansion() {
|
||||||
applicability = Applicability::MaybeIncorrect;
|
applicability = Applicability::MaybeIncorrect;
|
||||||
}
|
}
|
||||||
let def_span = cx.tcx.sess.source_map().guess_head_span(span);
|
let def_span = cx.tcx.def_span(def_id);
|
||||||
cx.struct_span_lint(UNREACHABLE_PUB, def_span, |lint| {
|
cx.struct_span_lint(UNREACHABLE_PUB, def_span, |lint| {
|
||||||
let mut err = lint.build(fluent::lint::builtin_unreachable_pub);
|
let mut err = lint.build(fluent::lint::builtin_unreachable_pub);
|
||||||
err.set_arg("what", what);
|
err.set_arg("what", what);
|
||||||
|
@ -1399,36 +1398,22 @@ impl<'tcx> LateLintPass<'tcx> for UnreachablePub {
|
||||||
if let hir::ItemKind::Use(_, hir::UseKind::ListStem) = &item.kind {
|
if let hir::ItemKind::Use(_, hir::UseKind::ListStem) = &item.kind {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
self.perform_lint(cx, "item", item.def_id, item.span, item.vis_span, true);
|
self.perform_lint(cx, "item", item.def_id, item.vis_span, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_foreign_item(&mut self, cx: &LateContext<'_>, foreign_item: &hir::ForeignItem<'tcx>) {
|
fn check_foreign_item(&mut self, cx: &LateContext<'_>, foreign_item: &hir::ForeignItem<'tcx>) {
|
||||||
self.perform_lint(
|
self.perform_lint(cx, "item", foreign_item.def_id, foreign_item.vis_span, true);
|
||||||
cx,
|
|
||||||
"item",
|
|
||||||
foreign_item.def_id,
|
|
||||||
foreign_item.span,
|
|
||||||
foreign_item.vis_span,
|
|
||||||
true,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_field_def(&mut self, cx: &LateContext<'_>, field: &hir::FieldDef<'_>) {
|
fn check_field_def(&mut self, cx: &LateContext<'_>, field: &hir::FieldDef<'_>) {
|
||||||
let def_id = cx.tcx.hir().local_def_id(field.hir_id);
|
let def_id = cx.tcx.hir().local_def_id(field.hir_id);
|
||||||
self.perform_lint(cx, "field", def_id, field.span, field.vis_span, false);
|
self.perform_lint(cx, "field", def_id, field.vis_span, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_impl_item(&mut self, cx: &LateContext<'_>, impl_item: &hir::ImplItem<'_>) {
|
fn check_impl_item(&mut self, cx: &LateContext<'_>, impl_item: &hir::ImplItem<'_>) {
|
||||||
// Only lint inherent impl items.
|
// Only lint inherent impl items.
|
||||||
if cx.tcx.associated_item(impl_item.def_id).trait_item_def_id.is_none() {
|
if cx.tcx.associated_item(impl_item.def_id).trait_item_def_id.is_none() {
|
||||||
self.perform_lint(
|
self.perform_lint(cx, "item", impl_item.def_id, impl_item.vis_span, false);
|
||||||
cx,
|
|
||||||
"item",
|
|
||||||
impl_item.def_id,
|
|
||||||
impl_item.span,
|
|
||||||
impl_item.vis_span,
|
|
||||||
false,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -800,9 +800,6 @@ pub struct Place<'tcx> {
|
||||||
pub projection: &'tcx List<PlaceElem<'tcx>>,
|
pub projection: &'tcx List<PlaceElem<'tcx>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
|
||||||
static_assert_size!(Place<'_>, 16);
|
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
#[derive(TyEncodable, TyDecodable, HashStable)]
|
#[derive(TyEncodable, TyDecodable, HashStable)]
|
||||||
pub enum ProjectionElem<V, T> {
|
pub enum ProjectionElem<V, T> {
|
||||||
|
@ -866,11 +863,6 @@ pub enum ProjectionElem<V, T> {
|
||||||
/// and the index is a local.
|
/// and the index is a local.
|
||||||
pub type PlaceElem<'tcx> = ProjectionElem<Local, Ty<'tcx>>;
|
pub type PlaceElem<'tcx> = ProjectionElem<Local, Ty<'tcx>>;
|
||||||
|
|
||||||
// This type is fairly frequently used, so we shouldn't unintentionally increase
|
|
||||||
// its size.
|
|
||||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
|
||||||
static_assert_size!(PlaceElem<'_>, 24);
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// Operands
|
// Operands
|
||||||
|
|
||||||
|
@ -913,9 +905,6 @@ pub enum Operand<'tcx> {
|
||||||
Constant(Box<Constant<'tcx>>),
|
Constant(Box<Constant<'tcx>>),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
|
||||||
static_assert_size!(Operand<'_>, 24);
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// Rvalues
|
// Rvalues
|
||||||
|
|
||||||
|
@ -1067,9 +1056,6 @@ pub enum Rvalue<'tcx> {
|
||||||
CopyForDeref(Place<'tcx>),
|
CopyForDeref(Place<'tcx>),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
|
||||||
static_assert_size!(Rvalue<'_>, 40);
|
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, TyEncodable, TyDecodable, Hash, HashStable)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, TyEncodable, TyDecodable, Hash, HashStable)]
|
||||||
pub enum CastKind {
|
pub enum CastKind {
|
||||||
/// An exposing pointer to address cast. A cast between a pointer and an integer type, or
|
/// An exposing pointer to address cast. A cast between a pointer and an integer type, or
|
||||||
|
@ -1105,9 +1091,6 @@ pub enum AggregateKind<'tcx> {
|
||||||
Generator(LocalDefId, SubstsRef<'tcx>, hir::Movability),
|
Generator(LocalDefId, SubstsRef<'tcx>, hir::Movability),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
|
||||||
static_assert_size!(AggregateKind<'_>, 48);
|
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, TyEncodable, TyDecodable, Hash, HashStable)]
|
#[derive(Copy, Clone, Debug, PartialEq, Eq, TyEncodable, TyDecodable, Hash, HashStable)]
|
||||||
pub enum NullOp {
|
pub enum NullOp {
|
||||||
/// Returns the size of a value of that type
|
/// Returns the size of a value of that type
|
||||||
|
@ -1171,3 +1154,15 @@ pub enum BinOp {
|
||||||
/// The `ptr.offset` operator
|
/// The `ptr.offset` operator
|
||||||
Offset,
|
Offset,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Some nodes are used a lot. Make sure they don't unintentionally get bigger.
|
||||||
|
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||||
|
mod size_asserts {
|
||||||
|
use super::*;
|
||||||
|
// These are in alphabetical order, which is easy to maintain.
|
||||||
|
static_assert_size!(AggregateKind<'_>, 48);
|
||||||
|
static_assert_size!(Operand<'_>, 24);
|
||||||
|
static_assert_size!(Place<'_>, 16);
|
||||||
|
static_assert_size!(PlaceElem<'_>, 24);
|
||||||
|
static_assert_size!(Rvalue<'_>, 40);
|
||||||
|
}
|
||||||
|
|
|
@ -190,10 +190,6 @@ pub enum StmtKind<'tcx> {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
// `Expr` is used a lot. Make sure it doesn't unintentionally get bigger.
|
|
||||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
|
||||||
rustc_data_structures::static_assert_size!(Expr<'_>, 104);
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, Copy, PartialEq, Eq, Hash, HashStable, TyEncodable, TyDecodable)]
|
#[derive(Clone, Debug, Copy, PartialEq, Eq, Hash, HashStable, TyEncodable, TyDecodable)]
|
||||||
#[derive(TypeFoldable, TypeVisitable)]
|
#[derive(TypeFoldable, TypeVisitable)]
|
||||||
pub struct LocalVarId(pub hir::HirId);
|
pub struct LocalVarId(pub hir::HirId);
|
||||||
|
@ -812,3 +808,14 @@ impl<'tcx> fmt::Display for Pat<'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Some nodes are used a lot. Make sure they don't unintentionally get bigger.
|
||||||
|
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||||
|
mod size_asserts {
|
||||||
|
use super::*;
|
||||||
|
// These are in alphabetical order, which is easy to maintain.
|
||||||
|
rustc_data_structures::static_assert_size!(Block, 56);
|
||||||
|
rustc_data_structures::static_assert_size!(Expr<'_>, 104);
|
||||||
|
rustc_data_structures::static_assert_size!(Pat<'_>, 24);
|
||||||
|
rustc_data_structures::static_assert_size!(Stmt<'_>, 120);
|
||||||
|
}
|
||||||
|
|
|
@ -1459,11 +1459,11 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||||
};
|
};
|
||||||
|
|
||||||
format!(
|
format!(
|
||||||
"{}[{}]{}",
|
"{}[{:04x}]{}",
|
||||||
crate_name,
|
crate_name,
|
||||||
// Don't print the whole stable crate id. That's just
|
// Don't print the whole stable crate id. That's just
|
||||||
// annoying in debug output.
|
// annoying in debug output.
|
||||||
&(format!("{:08x}", stable_crate_id.to_u64()))[..4],
|
stable_crate_id.to_u64() >> 8 * 6,
|
||||||
self.def_path(def_id).to_string_no_crate_verbose()
|
self.def_path(def_id).to_string_no_crate_verbose()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use rustc_data_structures::graph::iterate::{
|
use rustc_data_structures::graph::iterate::{
|
||||||
NodeStatus, TriColorDepthFirstSearch, TriColorVisitor,
|
NodeStatus, TriColorDepthFirstSearch, TriColorVisitor,
|
||||||
};
|
};
|
||||||
use rustc_hir::intravisit::FnKind;
|
use rustc_hir::def::DefKind;
|
||||||
use rustc_middle::mir::{BasicBlock, BasicBlocks, Body, Operand, TerminatorKind};
|
use rustc_middle::mir::{BasicBlock, BasicBlocks, Body, Operand, TerminatorKind};
|
||||||
use rustc_middle::ty::subst::{GenericArg, InternalSubsts};
|
use rustc_middle::ty::subst::{GenericArg, InternalSubsts};
|
||||||
use rustc_middle::ty::{self, AssocItem, AssocItemContainer, Instance, TyCtxt};
|
use rustc_middle::ty::{self, AssocItem, AssocItemContainer, Instance, TyCtxt};
|
||||||
|
@ -12,12 +12,7 @@ use std::ops::ControlFlow;
|
||||||
pub(crate) fn check<'tcx>(tcx: TyCtxt<'tcx>, body: &Body<'tcx>) {
|
pub(crate) fn check<'tcx>(tcx: TyCtxt<'tcx>, body: &Body<'tcx>) {
|
||||||
let def_id = body.source.def_id().expect_local();
|
let def_id = body.source.def_id().expect_local();
|
||||||
|
|
||||||
if let Some(fn_kind) = tcx.hir().get_by_def_id(def_id).fn_kind() {
|
if let DefKind::Fn | DefKind::AssocFn = tcx.def_kind(def_id) {
|
||||||
if let FnKind::Closure = fn_kind {
|
|
||||||
// closures can't recur, so they don't matter.
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If this is trait/impl method, extract the trait's substs.
|
// If this is trait/impl method, extract the trait's substs.
|
||||||
let trait_substs = match tcx.opt_associated_item(def_id.to_def_id()) {
|
let trait_substs = match tcx.opt_associated_item(def_id.to_def_id()) {
|
||||||
Some(AssocItem {
|
Some(AssocItem {
|
||||||
|
@ -41,8 +36,8 @@ pub(crate) fn check<'tcx>(tcx: TyCtxt<'tcx>, body: &Body<'tcx>) {
|
||||||
|
|
||||||
vis.reachable_recursive_calls.sort();
|
vis.reachable_recursive_calls.sort();
|
||||||
|
|
||||||
|
let sp = tcx.def_span(def_id);
|
||||||
let hir_id = tcx.hir().local_def_id_to_hir_id(def_id);
|
let hir_id = tcx.hir().local_def_id_to_hir_id(def_id);
|
||||||
let sp = tcx.sess.source_map().guess_head_span(tcx.hir().span_with_body(hir_id));
|
|
||||||
tcx.struct_span_lint_hir(UNCONDITIONAL_RECURSION, hir_id, sp, |lint| {
|
tcx.struct_span_lint_hir(UNCONDITIONAL_RECURSION, hir_id, sp, |lint| {
|
||||||
let mut db = lint.build("function cannot return without recursing");
|
let mut db = lint.build("function cannot return without recursing");
|
||||||
db.span_label(sp, "cannot return without recursing");
|
db.span_label(sp, "cannot return without recursing");
|
||||||
|
|
|
@ -1754,8 +1754,7 @@ impl SearchInterfaceForPrivateItemsVisitor<'_> {
|
||||||
|| self.in_assoc_ty
|
|| self.in_assoc_ty
|
||||||
|| self.tcx.resolutions(()).has_pub_restricted
|
|| self.tcx.resolutions(()).has_pub_restricted
|
||||||
{
|
{
|
||||||
let vis_span =
|
let vis_span = self.tcx.def_span(def_id);
|
||||||
self.tcx.sess.source_map().guess_head_span(self.tcx.def_span(def_id));
|
|
||||||
if kind == "trait" {
|
if kind == "trait" {
|
||||||
self.tcx.sess.emit_err(InPublicInterfaceTraits {
|
self.tcx.sess.emit_err(InPublicInterfaceTraits {
|
||||||
span,
|
span,
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
use crate::dep_graph::DepContext;
|
|
||||||
use crate::query::plumbing::CycleError;
|
use crate::query::plumbing::CycleError;
|
||||||
use crate::query::{QueryContext, QueryStackFrame};
|
use crate::query::{QueryContext, QueryStackFrame};
|
||||||
use rustc_hir::def::DefKind;
|
use rustc_hir::def::DefKind;
|
||||||
|
@ -536,17 +535,13 @@ pub(crate) fn report_cycle<'a>(
|
||||||
) -> DiagnosticBuilder<'a, ErrorGuaranteed> {
|
) -> DiagnosticBuilder<'a, ErrorGuaranteed> {
|
||||||
assert!(!stack.is_empty());
|
assert!(!stack.is_empty());
|
||||||
|
|
||||||
let fix_span = |span: Span, query: &QueryStackFrame| {
|
let span = stack[0].query.default_span(stack[1 % stack.len()].span);
|
||||||
sess.source_map().guess_head_span(query.default_span(span))
|
|
||||||
};
|
|
||||||
|
|
||||||
let span = fix_span(stack[1 % stack.len()].span, &stack[0].query);
|
|
||||||
let mut err =
|
let mut err =
|
||||||
struct_span_err!(sess, span, E0391, "cycle detected when {}", stack[0].query.description);
|
struct_span_err!(sess, span, E0391, "cycle detected when {}", stack[0].query.description);
|
||||||
|
|
||||||
for i in 1..stack.len() {
|
for i in 1..stack.len() {
|
||||||
let query = &stack[i].query;
|
let query = &stack[i].query;
|
||||||
let span = fix_span(stack[(i + 1) % stack.len()].span, query);
|
let span = query.default_span(stack[(i + 1) % stack.len()].span);
|
||||||
err.span_note(span, &format!("...which requires {}...", query.description));
|
err.span_note(span, &format!("...which requires {}...", query.description));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -577,7 +572,7 @@ pub(crate) fn report_cycle<'a>(
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some((span, query)) = usage {
|
if let Some((span, query)) = usage {
|
||||||
err.span_note(fix_span(span, &query), &format!("cycle used when {}", query.description));
|
err.span_note(query.default_span(span), &format!("cycle used when {}", query.description));
|
||||||
}
|
}
|
||||||
|
|
||||||
err
|
err
|
||||||
|
@ -606,8 +601,7 @@ pub fn print_query_stack<CTX: QueryContext>(
|
||||||
Level::FailureNote,
|
Level::FailureNote,
|
||||||
&format!("#{} [{}] {}", i, query_info.query.name, query_info.query.description),
|
&format!("#{} [{}] {}", i, query_info.query.name, query_info.query.description),
|
||||||
);
|
);
|
||||||
diag.span =
|
diag.span = query_info.job.span.into();
|
||||||
tcx.dep_context().sess().source_map().guess_head_span(query_info.job.span).into();
|
|
||||||
handler.force_print_diagnostic(diag);
|
handler.force_print_diagnostic(diag);
|
||||||
|
|
||||||
current_query = query_info.job.parent;
|
current_query = query_info.job.parent;
|
||||||
|
|
|
@ -1587,11 +1587,7 @@ impl<'a> Resolver<'a> {
|
||||||
};
|
};
|
||||||
let def_span = suggestion.res.opt_def_id().and_then(|def_id| match def_id.krate {
|
let def_span = suggestion.res.opt_def_id().and_then(|def_id| match def_id.krate {
|
||||||
LOCAL_CRATE => self.opt_span(def_id),
|
LOCAL_CRATE => self.opt_span(def_id),
|
||||||
_ => Some(
|
_ => Some(self.cstore().get_span_untracked(def_id, self.session)),
|
||||||
self.session
|
|
||||||
.source_map()
|
|
||||||
.guess_head_span(self.cstore().get_span_untracked(def_id, self.session)),
|
|
||||||
),
|
|
||||||
});
|
});
|
||||||
if let Some(def_span) = def_span {
|
if let Some(def_span) = def_span {
|
||||||
if span.overlaps(def_span) {
|
if span.overlaps(def_span) {
|
||||||
|
|
|
@ -136,12 +136,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> {
|
||||||
fn def_span(&self, def_id: DefId) -> Option<Span> {
|
fn def_span(&self, def_id: DefId) -> Option<Span> {
|
||||||
match def_id.krate {
|
match def_id.krate {
|
||||||
LOCAL_CRATE => self.r.opt_span(def_id),
|
LOCAL_CRATE => self.r.opt_span(def_id),
|
||||||
_ => Some(
|
_ => Some(self.r.cstore().get_span_untracked(def_id, self.r.session)),
|
||||||
self.r
|
|
||||||
.session
|
|
||||||
.source_map()
|
|
||||||
.guess_head_span(self.r.cstore().get_span_untracked(def_id, self.r.session)),
|
|
||||||
),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -223,8 +223,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
|
||||||
if let Some(def) = aty.ty_adt_def() {
|
if let Some(def) = aty.ty_adt_def() {
|
||||||
// We also want to be able to select the slice's type's original
|
// We also want to be able to select the slice's type's original
|
||||||
// signature with no type arguments resolved
|
// signature with no type arguments resolved
|
||||||
let type_string = self.tcx.type_of(def.did()).to_string();
|
flags.push((sym::_Self, Some(format!("[{}]", self.tcx.type_of(def.did())))));
|
||||||
flags.push((sym::_Self, Some(format!("[{type_string}]"))));
|
|
||||||
}
|
}
|
||||||
if aty.is_integral() {
|
if aty.is_integral() {
|
||||||
flags.push((sym::_Self, Some("[{integral}]".to_string())));
|
flags.push((sym::_Self, Some("[{integral}]".to_string())));
|
||||||
|
@ -242,10 +241,10 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
|
||||||
if let Some(def) = aty.ty_adt_def() {
|
if let Some(def) = aty.ty_adt_def() {
|
||||||
// We also want to be able to select the array's type's original
|
// We also want to be able to select the array's type's original
|
||||||
// signature with no type arguments resolved
|
// signature with no type arguments resolved
|
||||||
let type_string = self.tcx.type_of(def.did()).to_string();
|
let def_ty = self.tcx.type_of(def.did());
|
||||||
flags.push((sym::_Self, Some(format!("[{type_string}; _]"))));
|
flags.push((sym::_Self, Some(format!("[{def_ty}; _]"))));
|
||||||
if let Some(n) = len {
|
if let Some(n) = len {
|
||||||
flags.push((sym::_Self, Some(format!("[{type_string}; {n}]"))));
|
flags.push((sym::_Self, Some(format!("[{def_ty}; {n}]"))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if aty.is_integral() {
|
if aty.is_integral() {
|
||||||
|
|
|
@ -1946,7 +1946,6 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
|
||||||
));
|
));
|
||||||
|
|
||||||
let original_span = err.span.primary_span().unwrap();
|
let original_span = err.span.primary_span().unwrap();
|
||||||
let original_span = self.tcx.sess.source_map().guess_head_span(original_span);
|
|
||||||
let mut span = MultiSpan::from_span(original_span);
|
let mut span = MultiSpan::from_span(original_span);
|
||||||
|
|
||||||
let message = outer_generator
|
let message = outer_generator
|
||||||
|
|
|
@ -293,6 +293,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
pub(crate) fn if_cause(
|
pub(crate) fn if_cause(
|
||||||
&self,
|
&self,
|
||||||
span: Span,
|
span: Span,
|
||||||
|
cond_span: Span,
|
||||||
then_expr: &'tcx hir::Expr<'tcx>,
|
then_expr: &'tcx hir::Expr<'tcx>,
|
||||||
else_expr: &'tcx hir::Expr<'tcx>,
|
else_expr: &'tcx hir::Expr<'tcx>,
|
||||||
then_ty: Ty<'tcx>,
|
then_ty: Ty<'tcx>,
|
||||||
|
@ -355,10 +356,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
// 6 | | };
|
// 6 | | };
|
||||||
// | |_____^ expected integer, found `()`
|
// | |_____^ expected integer, found `()`
|
||||||
// ```
|
// ```
|
||||||
if block.expr.is_none() && block.stmts.is_empty()
|
if block.expr.is_none() && block.stmts.is_empty() && outer_span.is_some() {
|
||||||
&& let Some(outer_span) = &mut outer_span
|
let sp = if let Some(cs) = cond_span.find_ancestor_inside(span) {
|
||||||
{
|
span.with_hi(cs.hi())
|
||||||
*outer_span = self.tcx.sess.source_map().guess_head_span(*outer_span);
|
} else {
|
||||||
|
span
|
||||||
|
};
|
||||||
|
outer_span = Some(sp);
|
||||||
}
|
}
|
||||||
|
|
||||||
(self.find_block_span(block), block.hir_id)
|
(self.find_block_span(block), block.hir_id)
|
||||||
|
|
|
@ -1003,8 +1003,15 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
let else_diverges = self.diverges.get();
|
let else_diverges = self.diverges.get();
|
||||||
|
|
||||||
let opt_suggest_box_span = self.opt_suggest_box_span(else_ty, orig_expected);
|
let opt_suggest_box_span = self.opt_suggest_box_span(else_ty, orig_expected);
|
||||||
let if_cause =
|
let if_cause = self.if_cause(
|
||||||
self.if_cause(sp, then_expr, else_expr, then_ty, else_ty, opt_suggest_box_span);
|
sp,
|
||||||
|
cond_expr.span,
|
||||||
|
then_expr,
|
||||||
|
else_expr,
|
||||||
|
then_ty,
|
||||||
|
else_ty,
|
||||||
|
opt_suggest_box_span,
|
||||||
|
);
|
||||||
|
|
||||||
coerce.coerce(self, &if_cause, else_expr, else_ty);
|
coerce.coerce(self, &if_cause, else_expr, else_ty);
|
||||||
|
|
||||||
|
|
|
@ -158,34 +158,38 @@ impl Step for ToolBuild {
|
||||||
a transitive dependency has different features activated \
|
a transitive dependency has different features activated \
|
||||||
than in a previous build:\n"
|
than in a previous build:\n"
|
||||||
);
|
);
|
||||||
eprintln!(
|
|
||||||
"the following dependencies are duplicated although they \
|
|
||||||
have the same features enabled:"
|
|
||||||
);
|
|
||||||
let (same, different): (Vec<_>, Vec<_>) =
|
let (same, different): (Vec<_>, Vec<_>) =
|
||||||
duplicates.into_iter().partition(|(_, cur, prev)| cur.2 == prev.2);
|
duplicates.into_iter().partition(|(_, cur, prev)| cur.2 == prev.2);
|
||||||
for (id, cur, prev) in same {
|
if !same.is_empty() {
|
||||||
eprintln!(" {}", id);
|
eprintln!(
|
||||||
// same features
|
"the following dependencies are duplicated although they \
|
||||||
eprintln!(" `{}` ({:?})\n `{}` ({:?})", cur.0, cur.1, prev.0, prev.1);
|
have the same features enabled:"
|
||||||
|
);
|
||||||
|
for (id, cur, prev) in same {
|
||||||
|
eprintln!(" {}", id);
|
||||||
|
// same features
|
||||||
|
eprintln!(" `{}` ({:?})\n `{}` ({:?})", cur.0, cur.1, prev.0, prev.1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
eprintln!("the following dependencies have different features:");
|
if !different.is_empty() {
|
||||||
for (id, cur, prev) in different {
|
eprintln!("the following dependencies have different features:");
|
||||||
eprintln!(" {}", id);
|
for (id, cur, prev) in different {
|
||||||
let cur_features: HashSet<_> = cur.2.into_iter().collect();
|
eprintln!(" {}", id);
|
||||||
let prev_features: HashSet<_> = prev.2.into_iter().collect();
|
let cur_features: HashSet<_> = cur.2.into_iter().collect();
|
||||||
eprintln!(
|
let prev_features: HashSet<_> = prev.2.into_iter().collect();
|
||||||
" `{}` additionally enabled features {:?} at {:?}",
|
eprintln!(
|
||||||
cur.0,
|
" `{}` additionally enabled features {:?} at {:?}",
|
||||||
&cur_features - &prev_features,
|
cur.0,
|
||||||
cur.1
|
&cur_features - &prev_features,
|
||||||
);
|
cur.1
|
||||||
eprintln!(
|
);
|
||||||
" `{}` additionally enabled features {:?} at {:?}",
|
eprintln!(
|
||||||
prev.0,
|
" `{}` additionally enabled features {:?} at {:?}",
|
||||||
&prev_features - &cur_features,
|
prev.0,
|
||||||
prev.1
|
&prev_features - &cur_features,
|
||||||
);
|
prev.1
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
eprintln!();
|
eprintln!();
|
||||||
eprintln!(
|
eprintln!(
|
||||||
|
|
|
@ -122,10 +122,6 @@ pub(crate) struct Crate {
|
||||||
pub(crate) external_traits: Rc<RefCell<FxHashMap<DefId, TraitWithExtraInfo>>>,
|
pub(crate) external_traits: Rc<RefCell<FxHashMap<DefId, TraitWithExtraInfo>>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
// `Crate` is frequently moved by-value. Make sure it doesn't unintentionally get bigger.
|
|
||||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
|
||||||
rustc_data_structures::static_assert_size!(Crate, 72);
|
|
||||||
|
|
||||||
impl Crate {
|
impl Crate {
|
||||||
pub(crate) fn name(&self, tcx: TyCtxt<'_>) -> Symbol {
|
pub(crate) fn name(&self, tcx: TyCtxt<'_>) -> Symbol {
|
||||||
ExternalCrate::LOCAL.name(tcx)
|
ExternalCrate::LOCAL.name(tcx)
|
||||||
|
@ -389,10 +385,6 @@ impl fmt::Debug for Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// `Item` is used a lot. Make sure it doesn't unintentionally get bigger.
|
|
||||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
|
||||||
rustc_data_structures::static_assert_size!(Item, 56);
|
|
||||||
|
|
||||||
pub(crate) fn rustc_span(def_id: DefId, tcx: TyCtxt<'_>) -> Span {
|
pub(crate) fn rustc_span(def_id: DefId, tcx: TyCtxt<'_>) -> Span {
|
||||||
Span::new(def_id.as_local().map_or_else(
|
Span::new(def_id.as_local().map_or_else(
|
||||||
|| tcx.def_span(def_id),
|
|| tcx.def_span(def_id),
|
||||||
|
@ -771,10 +763,6 @@ pub(crate) enum ItemKind {
|
||||||
KeywordItem,
|
KeywordItem,
|
||||||
}
|
}
|
||||||
|
|
||||||
// `ItemKind` is an enum and large variants can bloat up memory usage even for smaller ones
|
|
||||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
|
||||||
rustc_data_structures::static_assert_size!(ItemKind, 112);
|
|
||||||
|
|
||||||
impl ItemKind {
|
impl ItemKind {
|
||||||
/// Some items contain others such as structs (for their fields) and Enums
|
/// Some items contain others such as structs (for their fields) and Enums
|
||||||
/// (for their variants). This method returns those contained items.
|
/// (for their variants). This method returns those contained items.
|
||||||
|
@ -994,10 +982,6 @@ pub(crate) struct DocFragment {
|
||||||
pub(crate) indent: usize,
|
pub(crate) indent: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
// `DocFragment` is used a lot. Make sure it doesn't unintentionally get bigger.
|
|
||||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
|
||||||
rustc_data_structures::static_assert_size!(DocFragment, 32);
|
|
||||||
|
|
||||||
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
|
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
|
||||||
pub(crate) enum DocFragmentKind {
|
pub(crate) enum DocFragmentKind {
|
||||||
/// A doc fragment created from a `///` or `//!` doc comment.
|
/// A doc fragment created from a `///` or `//!` doc comment.
|
||||||
|
@ -1382,10 +1366,6 @@ pub(crate) struct GenericParamDef {
|
||||||
pub(crate) kind: GenericParamDefKind,
|
pub(crate) kind: GenericParamDefKind,
|
||||||
}
|
}
|
||||||
|
|
||||||
// `GenericParamDef` is used in many places. Make sure it doesn't unintentionally get bigger.
|
|
||||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
|
||||||
rustc_data_structures::static_assert_size!(GenericParamDef, 56);
|
|
||||||
|
|
||||||
impl GenericParamDef {
|
impl GenericParamDef {
|
||||||
pub(crate) fn is_synthetic_type_param(&self) -> bool {
|
pub(crate) fn is_synthetic_type_param(&self) -> bool {
|
||||||
match self.kind {
|
match self.kind {
|
||||||
|
@ -1590,10 +1570,6 @@ pub(crate) enum Type {
|
||||||
ImplTrait(Vec<GenericBound>),
|
ImplTrait(Vec<GenericBound>),
|
||||||
}
|
}
|
||||||
|
|
||||||
// `Type` is used a lot. Make sure it doesn't unintentionally get bigger.
|
|
||||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
|
||||||
rustc_data_structures::static_assert_size!(Type, 72);
|
|
||||||
|
|
||||||
impl Type {
|
impl Type {
|
||||||
/// When comparing types for equality, it can help to ignore `&` wrapping.
|
/// When comparing types for equality, it can help to ignore `&` wrapping.
|
||||||
pub(crate) fn without_borrowed_ref(&self) -> &Type {
|
pub(crate) fn without_borrowed_ref(&self) -> &Type {
|
||||||
|
@ -2230,33 +2206,18 @@ pub(crate) enum GenericArg {
|
||||||
Infer,
|
Infer,
|
||||||
}
|
}
|
||||||
|
|
||||||
// `GenericArg` can occur many times in a single `Path`, so make sure it
|
|
||||||
// doesn't increase in size unexpectedly.
|
|
||||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
|
||||||
rustc_data_structures::static_assert_size!(GenericArg, 80);
|
|
||||||
|
|
||||||
#[derive(Clone, PartialEq, Eq, Debug, Hash)]
|
#[derive(Clone, PartialEq, Eq, Debug, Hash)]
|
||||||
pub(crate) enum GenericArgs {
|
pub(crate) enum GenericArgs {
|
||||||
AngleBracketed { args: Box<[GenericArg]>, bindings: ThinVec<TypeBinding> },
|
AngleBracketed { args: Box<[GenericArg]>, bindings: ThinVec<TypeBinding> },
|
||||||
Parenthesized { inputs: Box<[Type]>, output: Option<Box<Type>> },
|
Parenthesized { inputs: Box<[Type]>, output: Option<Box<Type>> },
|
||||||
}
|
}
|
||||||
|
|
||||||
// `GenericArgs` is in every `PathSegment`, so its size can significantly
|
|
||||||
// affect rustdoc's memory usage.
|
|
||||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
|
||||||
rustc_data_structures::static_assert_size!(GenericArgs, 32);
|
|
||||||
|
|
||||||
#[derive(Clone, PartialEq, Eq, Debug, Hash)]
|
#[derive(Clone, PartialEq, Eq, Debug, Hash)]
|
||||||
pub(crate) struct PathSegment {
|
pub(crate) struct PathSegment {
|
||||||
pub(crate) name: Symbol,
|
pub(crate) name: Symbol,
|
||||||
pub(crate) args: GenericArgs,
|
pub(crate) args: GenericArgs,
|
||||||
}
|
}
|
||||||
|
|
||||||
// `PathSegment` usually occurs multiple times in every `Path`, so its size can
|
|
||||||
// significantly affect rustdoc's memory usage.
|
|
||||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
|
||||||
rustc_data_structures::static_assert_size!(PathSegment, 40);
|
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub(crate) struct Typedef {
|
pub(crate) struct Typedef {
|
||||||
pub(crate) type_: Type,
|
pub(crate) type_: Type,
|
||||||
|
@ -2527,3 +2488,19 @@ impl SubstParam {
|
||||||
if let Self::Lifetime(lt) = self { Some(lt) } else { None }
|
if let Self::Lifetime(lt) = self { Some(lt) } else { None }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Some nodes are used a lot. Make sure they don't unintentionally get bigger.
|
||||||
|
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||||
|
mod size_asserts {
|
||||||
|
use super::*;
|
||||||
|
// These are in alphabetical order, which is easy to maintain.
|
||||||
|
rustc_data_structures::static_assert_size!(Crate, 72); // frequently moved by-value
|
||||||
|
rustc_data_structures::static_assert_size!(DocFragment, 32);
|
||||||
|
rustc_data_structures::static_assert_size!(GenericArg, 80);
|
||||||
|
rustc_data_structures::static_assert_size!(GenericArgs, 32);
|
||||||
|
rustc_data_structures::static_assert_size!(GenericParamDef, 56);
|
||||||
|
rustc_data_structures::static_assert_size!(Item, 56);
|
||||||
|
rustc_data_structures::static_assert_size!(ItemKind, 112);
|
||||||
|
rustc_data_structures::static_assert_size!(PathSegment, 40);
|
||||||
|
rustc_data_structures::static_assert_size!(Type, 72);
|
||||||
|
}
|
||||||
|
|
|
@ -304,6 +304,12 @@ pub(crate) fn run(
|
||||||
let mut finder = FindCalls { calls: &mut calls, tcx, map: tcx.hir(), cx, target_crates };
|
let mut finder = FindCalls { calls: &mut calls, tcx, map: tcx.hir(), cx, target_crates };
|
||||||
tcx.hir().visit_all_item_likes_in_crate(&mut finder);
|
tcx.hir().visit_all_item_likes_in_crate(&mut finder);
|
||||||
|
|
||||||
|
// The visitor might have found a type error, which we need to
|
||||||
|
// promote to a fatal error
|
||||||
|
if tcx.sess.diagnostic().has_errors_or_lint_errors().is_some() {
|
||||||
|
return Err(String::from("Compilation failed, aborting rustdoc"));
|
||||||
|
}
|
||||||
|
|
||||||
// Sort call locations within a given file in document order
|
// Sort call locations within a given file in document order
|
||||||
for fn_calls in calls.values_mut() {
|
for fn_calls in calls.values_mut() {
|
||||||
for file_calls in fn_calls.values_mut() {
|
for file_calls in fn_calls.values_mut() {
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
// check-fail
|
||||||
|
// compile-flags: -Z unstable-options --scrape-examples-output-path {{build-base}}/t.calls --scrape-examples-target-crate foobar
|
||||||
|
|
||||||
|
pub fn foo() {
|
||||||
|
INVALID_FUNC();
|
||||||
|
//~^ ERROR could not resolve path
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
error[E0433]: failed to resolve: could not resolve path `INVALID_FUNC`
|
||||||
|
--> $DIR/scrape-examples-fail-if-type-error.rs:5:3
|
||||||
|
|
|
||||||
|
LL | INVALID_FUNC();
|
||||||
|
| ^^^^^^^^^^^^ could not resolve path `INVALID_FUNC`
|
||||||
|
|
|
||||||
|
= note: this error was originally ignored because you are running `rustdoc`
|
||||||
|
= note: try running again with `rustc` or `cargo check` and you may get a more detailed error
|
||||||
|
|
||||||
|
error: Compilation failed, aborting rustdoc
|
||||||
|
|
||||||
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0433`.
|
|
@ -35,7 +35,7 @@ note: cycle used when checking item types in top-level module
|
||||||
--> $DIR/no-const-async.rs:4:1
|
--> $DIR/no-const-async.rs:4:1
|
||||||
|
|
|
|
||||||
LL | pub const async fn x() {}
|
LL | pub const async fn x() {}
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
error[E0507]: cannot move out of `s.0` which is behind a shared reference
|
error[E0507]: cannot move out of `s` which is behind a shared reference
|
||||||
--> $DIR/access-mode-in-closures.rs:8:15
|
--> $DIR/access-mode-in-closures.rs:8:15
|
||||||
|
|
|
|
||||||
LL | match *s { S(v) => v }
|
LL | match *s { S(v) => v }
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
error[E0507]: cannot move out of `f.0` which is behind a shared reference
|
error[E0507]: cannot move out of `f` as enum variant `Foo1` which is behind a shared reference
|
||||||
--> $DIR/borrowck-move-error-with-note.rs:11:11
|
--> $DIR/borrowck-move-error-with-note.rs:11:11
|
||||||
|
|
|
|
||||||
LL | match *f {
|
LL | match *f {
|
||||||
|
|
|
@ -2,18 +2,18 @@ error[E0391]: cycle detected when evaluating type-level constant
|
||||||
--> $DIR/issue-44415.rs:6:17
|
--> $DIR/issue-44415.rs:6:17
|
||||||
|
|
|
|
||||||
LL | bytes: [u8; unsafe { intrinsics::size_of::<Foo>() }],
|
LL | bytes: [u8; unsafe { intrinsics::size_of::<Foo>() }],
|
||||||
| ^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
note: ...which requires const-evaluating + checking `Foo::bytes::{constant#0}`...
|
note: ...which requires const-evaluating + checking `Foo::bytes::{constant#0}`...
|
||||||
--> $DIR/issue-44415.rs:6:17
|
--> $DIR/issue-44415.rs:6:17
|
||||||
|
|
|
|
||||||
LL | bytes: [u8; unsafe { intrinsics::size_of::<Foo>() }],
|
LL | bytes: [u8; unsafe { intrinsics::size_of::<Foo>() }],
|
||||||
| ^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
note: ...which requires const-evaluating + checking `Foo::bytes::{constant#0}`...
|
note: ...which requires const-evaluating + checking `Foo::bytes::{constant#0}`...
|
||||||
--> $DIR/issue-44415.rs:6:17
|
--> $DIR/issue-44415.rs:6:17
|
||||||
|
|
|
|
||||||
LL | bytes: [u8; unsafe { intrinsics::size_of::<Foo>() }],
|
LL | bytes: [u8; unsafe { intrinsics::size_of::<Foo>() }],
|
||||||
| ^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
= note: ...which requires computing layout of `Foo`...
|
= note: ...which requires computing layout of `Foo`...
|
||||||
= note: ...which requires computing layout of `[u8; _]`...
|
= note: ...which requires computing layout of `[u8; _]`...
|
||||||
= note: ...which requires normalizing `[u8; _]`...
|
= note: ...which requires normalizing `[u8; _]`...
|
||||||
|
|
|
@ -8,8 +8,13 @@ LL | trait Foo<X = Box<dyn Foo>> {
|
||||||
note: cycle used when collecting item types in top-level module
|
note: cycle used when collecting item types in top-level module
|
||||||
--> $DIR/cycle-trait-default-type-trait.rs:4:1
|
--> $DIR/cycle-trait-default-type-trait.rs:4:1
|
||||||
|
|
|
|
||||||
LL | trait Foo<X = Box<dyn Foo>> {
|
LL | / trait Foo<X = Box<dyn Foo>> {
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
LL | |
|
||||||
|
LL | |
|
||||||
|
LL | | }
|
||||||
|
LL | |
|
||||||
|
LL | | fn main() { }
|
||||||
|
| |_____________^
|
||||||
|
|
||||||
error[E0391]: cycle detected when computing type of `Foo::X`
|
error[E0391]: cycle detected when computing type of `Foo::X`
|
||||||
--> $DIR/cycle-trait-default-type-trait.rs:4:23
|
--> $DIR/cycle-trait-default-type-trait.rs:4:23
|
||||||
|
@ -21,8 +26,13 @@ LL | trait Foo<X = Box<dyn Foo>> {
|
||||||
note: cycle used when collecting item types in top-level module
|
note: cycle used when collecting item types in top-level module
|
||||||
--> $DIR/cycle-trait-default-type-trait.rs:4:1
|
--> $DIR/cycle-trait-default-type-trait.rs:4:1
|
||||||
|
|
|
|
||||||
LL | trait Foo<X = Box<dyn Foo>> {
|
LL | / trait Foo<X = Box<dyn Foo>> {
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
LL | |
|
||||||
|
LL | |
|
||||||
|
LL | | }
|
||||||
|
LL | |
|
||||||
|
LL | | fn main() { }
|
||||||
|
| |_____________^
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
|
|
@ -13,8 +13,10 @@ LL | trait Chromosome: Chromosome {
|
||||||
note: cycle used when collecting item types in top-level module
|
note: cycle used when collecting item types in top-level module
|
||||||
--> $DIR/cycle-trait-supertrait-direct.rs:3:1
|
--> $DIR/cycle-trait-supertrait-direct.rs:3:1
|
||||||
|
|
|
|
||||||
LL | trait Chromosome: Chromosome {
|
LL | / trait Chromosome: Chromosome {
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
LL | |
|
||||||
|
LL | | }
|
||||||
|
| |_^
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -4,12 +4,10 @@ warning: function cannot return without recursing
|
||||||
LL | / fn no_hrtb<'b, T>(mut t: T)
|
LL | / fn no_hrtb<'b, T>(mut t: T)
|
||||||
LL | | where
|
LL | | where
|
||||||
LL | | T: Bar<&'b isize>,
|
LL | | T: Bar<&'b isize>,
|
||||||
LL | | {
|
| |______________________^ cannot return without recursing
|
||||||
... |
|
...
|
||||||
LL | | no_hrtb(&mut t);
|
LL | no_hrtb(&mut t);
|
||||||
| | --------------- recursive call site
|
| --------------- recursive call site
|
||||||
LL | | }
|
|
||||||
| |_^ cannot return without recursing
|
|
||||||
|
|
|
|
||||||
= note: `#[warn(unconditional_recursion)]` on by default
|
= note: `#[warn(unconditional_recursion)]` on by default
|
||||||
= help: a `loop` may express intention better if this is on purpose
|
= help: a `loop` may express intention better if this is on purpose
|
||||||
|
@ -20,12 +18,10 @@ warning: function cannot return without recursing
|
||||||
LL | / fn bar_hrtb<T>(mut t: T)
|
LL | / fn bar_hrtb<T>(mut t: T)
|
||||||
LL | | where
|
LL | | where
|
||||||
LL | | T: for<'b> Bar<&'b isize>,
|
LL | | T: for<'b> Bar<&'b isize>,
|
||||||
LL | | {
|
| |______________________________^ cannot return without recursing
|
||||||
... |
|
...
|
||||||
LL | | bar_hrtb(&mut t);
|
LL | bar_hrtb(&mut t);
|
||||||
| | ---------------- recursive call site
|
| ---------------- recursive call site
|
||||||
LL | | }
|
|
||||||
| |_^ cannot return without recursing
|
|
||||||
|
|
|
|
||||||
= help: a `loop` may express intention better if this is on purpose
|
= help: a `loop` may express intention better if this is on purpose
|
||||||
|
|
||||||
|
@ -35,14 +31,10 @@ warning: function cannot return without recursing
|
||||||
LL | / fn foo_hrtb_bar_not<'b, T>(mut t: T)
|
LL | / fn foo_hrtb_bar_not<'b, T>(mut t: T)
|
||||||
LL | | where
|
LL | | where
|
||||||
LL | | T: for<'a> Foo<&'a isize> + Bar<&'b isize>,
|
LL | | T: for<'a> Foo<&'a isize> + Bar<&'b isize>,
|
||||||
LL | | {
|
| |_______________________________________________^ cannot return without recursing
|
||||||
... |
|
...
|
||||||
LL | | foo_hrtb_bar_not(&mut t);
|
LL | foo_hrtb_bar_not(&mut t);
|
||||||
| | ------------------------ recursive call site
|
| ------------------------ recursive call site
|
||||||
LL | |
|
|
||||||
LL | |
|
|
||||||
LL | | }
|
|
||||||
| |_^ cannot return without recursing
|
|
||||||
|
|
|
|
||||||
= help: a `loop` may express intention better if this is on purpose
|
= help: a `loop` may express intention better if this is on purpose
|
||||||
|
|
||||||
|
@ -70,12 +62,10 @@ warning: function cannot return without recursing
|
||||||
LL | / fn foo_hrtb_bar_hrtb<T>(mut t: T)
|
LL | / fn foo_hrtb_bar_hrtb<T>(mut t: T)
|
||||||
LL | | where
|
LL | | where
|
||||||
LL | | T: for<'a> Foo<&'a isize> + for<'b> Bar<&'b isize>,
|
LL | | T: for<'a> Foo<&'a isize> + for<'b> Bar<&'b isize>,
|
||||||
LL | | {
|
| |_______________________________________________________^ cannot return without recursing
|
||||||
LL | | // OK -- now we have `T : for<'b> Bar<&'b isize>`.
|
...
|
||||||
LL | | foo_hrtb_bar_hrtb(&mut t);
|
LL | foo_hrtb_bar_hrtb(&mut t);
|
||||||
| | ------------------------- recursive call site
|
| ------------------------- recursive call site
|
||||||
LL | | }
|
|
||||||
| |_^ cannot return without recursing
|
|
||||||
|
|
|
|
||||||
= help: a `loop` may express intention better if this is on purpose
|
= help: a `loop` may express intention better if this is on purpose
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,10 @@ LL | trait T2 : T1 {
|
||||||
note: cycle used when collecting item types in top-level module
|
note: cycle used when collecting item types in top-level module
|
||||||
--> $DIR/issue-12511.rs:1:1
|
--> $DIR/issue-12511.rs:1:1
|
||||||
|
|
|
|
||||||
LL | trait T1 : T2 {
|
LL | / trait T1 : T2 {
|
||||||
| ^^^^^^^^^^^^^
|
LL | |
|
||||||
|
LL | | }
|
||||||
|
| |_^
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
warning: unreachable `pub` item
|
warning: unreachable `pub` item
|
||||||
--> $DIR/unreachable_pub.rs:8:5
|
--> $DIR/unreachable_pub.rs:8:13
|
||||||
|
|
|
|
||||||
LL | pub use std::fmt;
|
LL | pub use std::fmt;
|
||||||
| ---^^^^^^^^^^^^^^
|
| --- ^^^^^^^^
|
||||||
| |
|
| |
|
||||||
| help: consider restricting its visibility: `pub(crate)`
|
| help: consider restricting its visibility: `pub(crate)`
|
||||||
|
|
|
|
||||||
|
@ -93,7 +93,7 @@ warning: unreachable `pub` item
|
||||||
--> $DIR/unreachable_pub.rs:33:5
|
--> $DIR/unreachable_pub.rs:33:5
|
||||||
|
|
|
|
||||||
LL | pub const CARBON: usize = 1;
|
LL | pub const CARBON: usize = 1;
|
||||||
| ---^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ---^^^^^^^^^^^^^^^^^^^^
|
||||||
| |
|
| |
|
||||||
| help: consider restricting its visibility: `pub(crate)`
|
| help: consider restricting its visibility: `pub(crate)`
|
||||||
|
|
|
|
||||||
|
@ -103,7 +103,7 @@ warning: unreachable `pub` item
|
||||||
--> $DIR/unreachable_pub.rs:34:5
|
--> $DIR/unreachable_pub.rs:34:5
|
||||||
|
|
|
|
||||||
LL | pub static NITROGEN: usize = 2;
|
LL | pub static NITROGEN: usize = 2;
|
||||||
| ---^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ---^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
| |
|
| |
|
||||||
| help: consider restricting its visibility: `pub(crate)`
|
| help: consider restricting its visibility: `pub(crate)`
|
||||||
|
|
|
|
||||||
|
@ -113,7 +113,7 @@ warning: unreachable `pub` item
|
||||||
--> $DIR/unreachable_pub.rs:35:5
|
--> $DIR/unreachable_pub.rs:35:5
|
||||||
|
|
|
|
||||||
LL | pub type Oxygen = bool;
|
LL | pub type Oxygen = bool;
|
||||||
| ---^^^^^^^^^^^^^^^^^^^^
|
| ---^^^^^^^^^^^^
|
||||||
| |
|
| |
|
||||||
| help: consider restricting its visibility: `pub(crate)`
|
| help: consider restricting its visibility: `pub(crate)`
|
||||||
|
|
|
|
||||||
|
@ -123,7 +123,7 @@ warning: unreachable `pub` item
|
||||||
--> $DIR/unreachable_pub.rs:38:47
|
--> $DIR/unreachable_pub.rs:38:47
|
||||||
|
|
|
|
||||||
LL | ($visibility: vis, $name: ident) => { $visibility struct $name {} }
|
LL | ($visibility: vis, $name: ident) => { $visibility struct $name {} }
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
...
|
...
|
||||||
LL | define_empty_struct_with_visibility!(pub, Fluorine);
|
LL | define_empty_struct_with_visibility!(pub, Fluorine);
|
||||||
| ---------------------------------------------------
|
| ---------------------------------------------------
|
||||||
|
@ -138,7 +138,7 @@ warning: unreachable `pub` item
|
||||||
--> $DIR/unreachable_pub.rs:44:9
|
--> $DIR/unreachable_pub.rs:44:9
|
||||||
|
|
|
|
||||||
LL | pub fn catalyze() -> bool;
|
LL | pub fn catalyze() -> bool;
|
||||||
| ---^^^^^^^^^^^^^^^^^^^^^^^
|
| ---^^^^^^^^^^^^^^^^^^^^^^
|
||||||
| |
|
| |
|
||||||
| help: consider restricting its visibility: `pub(crate)`
|
| help: consider restricting its visibility: `pub(crate)`
|
||||||
|
|
|
|
||||||
|
|
9
src/test/ui/moves/issue-99470-move-out-of-some.rs
Normal file
9
src/test/ui/moves/issue-99470-move-out-of-some.rs
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
fn main() {
|
||||||
|
let x: &Option<Box<i32>> = &Some(Box::new(0));
|
||||||
|
|
||||||
|
match x {
|
||||||
|
//~^ ERROR cannot move out of `x` as enum variant `Some` which is behind a shared reference
|
||||||
|
&Some(_y) => (),
|
||||||
|
&None => (),
|
||||||
|
}
|
||||||
|
}
|
16
src/test/ui/moves/issue-99470-move-out-of-some.stderr
Normal file
16
src/test/ui/moves/issue-99470-move-out-of-some.stderr
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
error[E0507]: cannot move out of `x` as enum variant `Some` which is behind a shared reference
|
||||||
|
--> $DIR/issue-99470-move-out-of-some.rs:4:11
|
||||||
|
|
|
||||||
|
LL | match x {
|
||||||
|
| ^
|
||||||
|
LL |
|
||||||
|
LL | &Some(_y) => (),
|
||||||
|
| ---------
|
||||||
|
| | |
|
||||||
|
| | data moved here
|
||||||
|
| | move occurs because `_y` has type `Box<i32>`, which does not implement the `Copy` trait
|
||||||
|
| help: consider removing the `&`: `Some(_y)`
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0507`.
|
|
@ -1,4 +1,4 @@
|
||||||
error[E0507]: cannot move out of `hellothere.x.0` which is behind a shared reference
|
error[E0507]: cannot move out of `hellothere.x` as enum variant `Bar` which is behind a shared reference
|
||||||
--> $DIR/moves-based-on-type-block-bad.rs:22:19
|
--> $DIR/moves-based-on-type-block-bad.rs:22:19
|
||||||
|
|
|
|
||||||
LL | match hellothere.x {
|
LL | match hellothere.x {
|
||||||
|
|
|
@ -45,7 +45,7 @@ LL | let a = [A("".to_string())][0];
|
||||||
| move occurs because value has type `A`, which does not implement the `Copy` trait
|
| move occurs because value has type `A`, which does not implement the `Copy` trait
|
||||||
| help: consider borrowing here: `&[A("".to_string())][0]`
|
| help: consider borrowing here: `&[A("".to_string())][0]`
|
||||||
|
|
||||||
error[E0507]: cannot move out of `a.0` which is behind a shared reference
|
error[E0507]: cannot move out of `a` which is behind a shared reference
|
||||||
--> $DIR/move-errors.rs:38:16
|
--> $DIR/move-errors.rs:38:16
|
||||||
|
|
|
|
||||||
LL | let A(s) = *a;
|
LL | let A(s) = *a;
|
||||||
|
@ -134,7 +134,7 @@ LL | F(s, mut t) => (),
|
||||||
|
|
|
|
||||||
= note: move occurs because these variables have types that don't implement the `Copy` trait
|
= note: move occurs because these variables have types that don't implement the `Copy` trait
|
||||||
|
|
||||||
error[E0507]: cannot move out of `x.0` which is behind a shared reference
|
error[E0507]: cannot move out of `x` as enum variant `Err` which is behind a shared reference
|
||||||
--> $DIR/move-errors.rs:110:11
|
--> $DIR/move-errors.rs:110:11
|
||||||
|
|
|
|
||||||
LL | match *x {
|
LL | match *x {
|
||||||
|
|
|
@ -8,8 +8,14 @@ LL | impl dyn ToNbt<Self> {}
|
||||||
note: cycle used when collecting item types in top-level module
|
note: cycle used when collecting item types in top-level module
|
||||||
--> $DIR/issue-23305.rs:1:1
|
--> $DIR/issue-23305.rs:1:1
|
||||||
|
|
|
|
||||||
LL | pub trait ToNbt<T> {
|
LL | / pub trait ToNbt<T> {
|
||||||
| ^^^^^^^^^^^^^^^^^^
|
LL | | fn new(val: T) -> Self;
|
||||||
|
LL | | }
|
||||||
|
LL | |
|
||||||
|
... |
|
||||||
|
LL | |
|
||||||
|
LL | | fn main() {}
|
||||||
|
| |____________^
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
error[E0507]: cannot move out of `s.0` which is behind a shared reference
|
error[E0507]: cannot move out of `s` which is behind a shared reference
|
||||||
--> $DIR/simple.rs:38:17
|
--> $DIR/simple.rs:38:17
|
||||||
|
|
|
|
||||||
LL | let X(_t) = *s;
|
LL | let X(_t) = *s;
|
||||||
|
@ -7,7 +7,7 @@ LL | let X(_t) = *s;
|
||||||
| data moved here
|
| data moved here
|
||||||
| move occurs because `_t` has type `Y`, which does not implement the `Copy` trait
|
| move occurs because `_t` has type `Y`, which does not implement the `Copy` trait
|
||||||
|
|
||||||
error[E0507]: cannot move out of `r.0` which is behind a shared reference
|
error[E0507]: cannot move out of `r` as enum variant `One` which is behind a shared reference
|
||||||
--> $DIR/simple.rs:42:30
|
--> $DIR/simple.rs:42:30
|
||||||
|
|
|
|
||||||
LL | if let Either::One(_t) = *r { }
|
LL | if let Either::One(_t) = *r { }
|
||||||
|
@ -16,7 +16,7 @@ LL | if let Either::One(_t) = *r { }
|
||||||
| data moved here
|
| data moved here
|
||||||
| move occurs because `_t` has type `X`, which does not implement the `Copy` trait
|
| move occurs because `_t` has type `X`, which does not implement the `Copy` trait
|
||||||
|
|
||||||
error[E0507]: cannot move out of `r.0` which is behind a shared reference
|
error[E0507]: cannot move out of `r` as enum variant `One` which is behind a shared reference
|
||||||
--> $DIR/simple.rs:46:33
|
--> $DIR/simple.rs:46:33
|
||||||
|
|
|
|
||||||
LL | while let Either::One(_t) = *r { }
|
LL | while let Either::One(_t) = *r { }
|
||||||
|
@ -25,7 +25,7 @@ LL | while let Either::One(_t) = *r { }
|
||||||
| data moved here
|
| data moved here
|
||||||
| move occurs because `_t` has type `X`, which does not implement the `Copy` trait
|
| move occurs because `_t` has type `X`, which does not implement the `Copy` trait
|
||||||
|
|
||||||
error[E0507]: cannot move out of `r.0` which is behind a shared reference
|
error[E0507]: cannot move out of `r` as enum variant `Two` which is behind a shared reference
|
||||||
--> $DIR/simple.rs:50:11
|
--> $DIR/simple.rs:50:11
|
||||||
|
|
|
|
||||||
LL | match *r {
|
LL | match *r {
|
||||||
|
@ -37,7 +37,7 @@ LL | Either::One(_t)
|
||||||
| data moved here
|
| data moved here
|
||||||
| move occurs because `_t` has type `X`, which does not implement the `Copy` trait
|
| move occurs because `_t` has type `X`, which does not implement the `Copy` trait
|
||||||
|
|
||||||
error[E0507]: cannot move out of `r.0` which is behind a shared reference
|
error[E0507]: cannot move out of `r` as enum variant `One` which is behind a shared reference
|
||||||
--> $DIR/simple.rs:57:11
|
--> $DIR/simple.rs:57:11
|
||||||
|
|
|
|
||||||
LL | match *r {
|
LL | match *r {
|
||||||
|
@ -49,7 +49,7 @@ LL | Either::One(_t) => (),
|
||||||
| data moved here
|
| data moved here
|
||||||
| move occurs because `_t` has type `X`, which does not implement the `Copy` trait
|
| move occurs because `_t` has type `X`, which does not implement the `Copy` trait
|
||||||
|
|
||||||
error[E0507]: cannot move out of `sm.0` which is behind a mutable reference
|
error[E0507]: cannot move out of `sm` which is behind a mutable reference
|
||||||
--> $DIR/simple.rs:66:17
|
--> $DIR/simple.rs:66:17
|
||||||
|
|
|
|
||||||
LL | let X(_t) = *sm;
|
LL | let X(_t) = *sm;
|
||||||
|
@ -58,7 +58,7 @@ LL | let X(_t) = *sm;
|
||||||
| data moved here
|
| data moved here
|
||||||
| move occurs because `_t` has type `Y`, which does not implement the `Copy` trait
|
| move occurs because `_t` has type `Y`, which does not implement the `Copy` trait
|
||||||
|
|
||||||
error[E0507]: cannot move out of `rm.0` which is behind a mutable reference
|
error[E0507]: cannot move out of `rm` as enum variant `One` which is behind a mutable reference
|
||||||
--> $DIR/simple.rs:70:30
|
--> $DIR/simple.rs:70:30
|
||||||
|
|
|
|
||||||
LL | if let Either::One(_t) = *rm { }
|
LL | if let Either::One(_t) = *rm { }
|
||||||
|
@ -67,7 +67,7 @@ LL | if let Either::One(_t) = *rm { }
|
||||||
| data moved here
|
| data moved here
|
||||||
| move occurs because `_t` has type `X`, which does not implement the `Copy` trait
|
| move occurs because `_t` has type `X`, which does not implement the `Copy` trait
|
||||||
|
|
||||||
error[E0507]: cannot move out of `rm.0` which is behind a mutable reference
|
error[E0507]: cannot move out of `rm` as enum variant `One` which is behind a mutable reference
|
||||||
--> $DIR/simple.rs:74:33
|
--> $DIR/simple.rs:74:33
|
||||||
|
|
|
|
||||||
LL | while let Either::One(_t) = *rm { }
|
LL | while let Either::One(_t) = *rm { }
|
||||||
|
@ -76,7 +76,7 @@ LL | while let Either::One(_t) = *rm { }
|
||||||
| data moved here
|
| data moved here
|
||||||
| move occurs because `_t` has type `X`, which does not implement the `Copy` trait
|
| move occurs because `_t` has type `X`, which does not implement the `Copy` trait
|
||||||
|
|
||||||
error[E0507]: cannot move out of `rm.0` which is behind a mutable reference
|
error[E0507]: cannot move out of `rm` as enum variant `Two` which is behind a mutable reference
|
||||||
--> $DIR/simple.rs:78:11
|
--> $DIR/simple.rs:78:11
|
||||||
|
|
|
|
||||||
LL | match *rm {
|
LL | match *rm {
|
||||||
|
@ -88,7 +88,7 @@ LL | Either::One(_t)
|
||||||
| data moved here
|
| data moved here
|
||||||
| move occurs because `_t` has type `X`, which does not implement the `Copy` trait
|
| move occurs because `_t` has type `X`, which does not implement the `Copy` trait
|
||||||
|
|
||||||
error[E0507]: cannot move out of `rm.0` which is behind a mutable reference
|
error[E0507]: cannot move out of `rm` as enum variant `One` which is behind a mutable reference
|
||||||
--> $DIR/simple.rs:85:11
|
--> $DIR/simple.rs:85:11
|
||||||
|
|
|
|
||||||
LL | match *rm {
|
LL | match *rm {
|
||||||
|
@ -100,7 +100,7 @@ LL | Either::One(_t) => (),
|
||||||
| data moved here
|
| data moved here
|
||||||
| move occurs because `_t` has type `X`, which does not implement the `Copy` trait
|
| move occurs because `_t` has type `X`, which does not implement the `Copy` trait
|
||||||
|
|
||||||
error[E0507]: cannot move out of `rm.0` which is behind a mutable reference
|
error[E0507]: cannot move out of `rm` as enum variant `One` which is behind a mutable reference
|
||||||
--> $DIR/simple.rs:93:11
|
--> $DIR/simple.rs:93:11
|
||||||
|
|
|
|
||||||
LL | match *rm {
|
LL | match *rm {
|
||||||
|
@ -226,7 +226,7 @@ LL | Either::One(_t) => (),
|
||||||
| data moved here
|
| data moved here
|
||||||
| move occurs because `_t` has type `X`, which does not implement the `Copy` trait
|
| move occurs because `_t` has type `X`, which does not implement the `Copy` trait
|
||||||
|
|
||||||
error[E0507]: cannot move out of `s.0` which is behind a shared reference
|
error[E0507]: cannot move out of `s` which is behind a shared reference
|
||||||
--> $DIR/simple.rs:168:18
|
--> $DIR/simple.rs:168:18
|
||||||
|
|
|
|
||||||
LL | let &X(_t) = s;
|
LL | let &X(_t) = s;
|
||||||
|
@ -236,7 +236,7 @@ LL | let &X(_t) = s;
|
||||||
| | move occurs because `_t` has type `Y`, which does not implement the `Copy` trait
|
| | move occurs because `_t` has type `Y`, which does not implement the `Copy` trait
|
||||||
| help: consider removing the `&`: `X(_t)`
|
| help: consider removing the `&`: `X(_t)`
|
||||||
|
|
||||||
error[E0507]: cannot move out of `r.0` which is behind a shared reference
|
error[E0507]: cannot move out of `r` as enum variant `One` which is behind a shared reference
|
||||||
--> $DIR/simple.rs:172:31
|
--> $DIR/simple.rs:172:31
|
||||||
|
|
|
|
||||||
LL | if let &Either::One(_t) = r { }
|
LL | if let &Either::One(_t) = r { }
|
||||||
|
@ -246,7 +246,7 @@ LL | if let &Either::One(_t) = r { }
|
||||||
| | move occurs because `_t` has type `X`, which does not implement the `Copy` trait
|
| | move occurs because `_t` has type `X`, which does not implement the `Copy` trait
|
||||||
| help: consider removing the `&`: `Either::One(_t)`
|
| help: consider removing the `&`: `Either::One(_t)`
|
||||||
|
|
||||||
error[E0507]: cannot move out of `r.0` which is behind a shared reference
|
error[E0507]: cannot move out of `r` as enum variant `One` which is behind a shared reference
|
||||||
--> $DIR/simple.rs:176:34
|
--> $DIR/simple.rs:176:34
|
||||||
|
|
|
|
||||||
LL | while let &Either::One(_t) = r { }
|
LL | while let &Either::One(_t) = r { }
|
||||||
|
@ -256,7 +256,7 @@ LL | while let &Either::One(_t) = r { }
|
||||||
| | move occurs because `_t` has type `X`, which does not implement the `Copy` trait
|
| | move occurs because `_t` has type `X`, which does not implement the `Copy` trait
|
||||||
| help: consider removing the `&`: `Either::One(_t)`
|
| help: consider removing the `&`: `Either::One(_t)`
|
||||||
|
|
||||||
error[E0507]: cannot move out of `r.0` which is behind a shared reference
|
error[E0507]: cannot move out of `r` as enum variant `Two` which is behind a shared reference
|
||||||
--> $DIR/simple.rs:180:11
|
--> $DIR/simple.rs:180:11
|
||||||
|
|
|
|
||||||
LL | match r {
|
LL | match r {
|
||||||
|
@ -276,7 +276,7 @@ LL +
|
||||||
LL ~ | &Either::Two(_t) => (),
|
LL ~ | &Either::Two(_t) => (),
|
||||||
|
|
|
|
||||||
|
|
||||||
error[E0507]: cannot move out of `r.0` which is behind a shared reference
|
error[E0507]: cannot move out of `r` as enum variant `One` which is behind a shared reference
|
||||||
--> $DIR/simple.rs:188:11
|
--> $DIR/simple.rs:188:11
|
||||||
|
|
|
|
||||||
LL | match r {
|
LL | match r {
|
||||||
|
@ -289,7 +289,7 @@ LL | &Either::One(_t) => (),
|
||||||
| | move occurs because `_t` has type `X`, which does not implement the `Copy` trait
|
| | move occurs because `_t` has type `X`, which does not implement the `Copy` trait
|
||||||
| help: consider removing the `&`: `Either::One(_t)`
|
| help: consider removing the `&`: `Either::One(_t)`
|
||||||
|
|
||||||
error[E0507]: cannot move out of `r.0` which is behind a shared reference
|
error[E0507]: cannot move out of `r` as enum variant `One` which is behind a shared reference
|
||||||
--> $DIR/simple.rs:195:11
|
--> $DIR/simple.rs:195:11
|
||||||
|
|
|
|
||||||
LL | match r {
|
LL | match r {
|
||||||
|
@ -302,7 +302,7 @@ LL | &Either::One(_t) => (),
|
||||||
| | move occurs because `_t` has type `X`, which does not implement the `Copy` trait
|
| | move occurs because `_t` has type `X`, which does not implement the `Copy` trait
|
||||||
| help: consider removing the `&`: `Either::One(_t)`
|
| help: consider removing the `&`: `Either::One(_t)`
|
||||||
|
|
||||||
error[E0507]: cannot move out of `sm.0` which is behind a mutable reference
|
error[E0507]: cannot move out of `sm` which is behind a mutable reference
|
||||||
--> $DIR/simple.rs:207:22
|
--> $DIR/simple.rs:207:22
|
||||||
|
|
|
|
||||||
LL | let &mut X(_t) = sm;
|
LL | let &mut X(_t) = sm;
|
||||||
|
@ -312,7 +312,7 @@ LL | let &mut X(_t) = sm;
|
||||||
| | move occurs because `_t` has type `Y`, which does not implement the `Copy` trait
|
| | move occurs because `_t` has type `Y`, which does not implement the `Copy` trait
|
||||||
| help: consider removing the `&mut`: `X(_t)`
|
| help: consider removing the `&mut`: `X(_t)`
|
||||||
|
|
||||||
error[E0507]: cannot move out of `rm.0` which is behind a mutable reference
|
error[E0507]: cannot move out of `rm` as enum variant `One` which is behind a mutable reference
|
||||||
--> $DIR/simple.rs:211:35
|
--> $DIR/simple.rs:211:35
|
||||||
|
|
|
|
||||||
LL | if let &mut Either::One(_t) = rm { }
|
LL | if let &mut Either::One(_t) = rm { }
|
||||||
|
@ -322,7 +322,7 @@ LL | if let &mut Either::One(_t) = rm { }
|
||||||
| | move occurs because `_t` has type `X`, which does not implement the `Copy` trait
|
| | move occurs because `_t` has type `X`, which does not implement the `Copy` trait
|
||||||
| help: consider removing the `&mut`: `Either::One(_t)`
|
| help: consider removing the `&mut`: `Either::One(_t)`
|
||||||
|
|
||||||
error[E0507]: cannot move out of `rm.0` which is behind a mutable reference
|
error[E0507]: cannot move out of `rm` as enum variant `One` which is behind a mutable reference
|
||||||
--> $DIR/simple.rs:215:38
|
--> $DIR/simple.rs:215:38
|
||||||
|
|
|
|
||||||
LL | while let &mut Either::One(_t) = rm { }
|
LL | while let &mut Either::One(_t) = rm { }
|
||||||
|
@ -332,7 +332,7 @@ LL | while let &mut Either::One(_t) = rm { }
|
||||||
| | move occurs because `_t` has type `X`, which does not implement the `Copy` trait
|
| | move occurs because `_t` has type `X`, which does not implement the `Copy` trait
|
||||||
| help: consider removing the `&mut`: `Either::One(_t)`
|
| help: consider removing the `&mut`: `Either::One(_t)`
|
||||||
|
|
||||||
error[E0507]: cannot move out of `rm.0` which is behind a mutable reference
|
error[E0507]: cannot move out of `rm` as enum variant `Two` which is behind a mutable reference
|
||||||
--> $DIR/simple.rs:219:11
|
--> $DIR/simple.rs:219:11
|
||||||
|
|
|
|
||||||
LL | match rm {
|
LL | match rm {
|
||||||
|
@ -354,7 +354,7 @@ help: consider removing the `&mut`
|
||||||
LL | Either::Two(_t) => (),
|
LL | Either::Two(_t) => (),
|
||||||
| ~~~~~~~~~~~~~~~
|
| ~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
error[E0507]: cannot move out of `rm.0` which is behind a mutable reference
|
error[E0507]: cannot move out of `rm` as enum variant `One` which is behind a mutable reference
|
||||||
--> $DIR/simple.rs:228:11
|
--> $DIR/simple.rs:228:11
|
||||||
|
|
|
|
||||||
LL | match rm {
|
LL | match rm {
|
||||||
|
@ -367,7 +367,7 @@ LL | &mut Either::One(_t) => (),
|
||||||
| | move occurs because `_t` has type `X`, which does not implement the `Copy` trait
|
| | move occurs because `_t` has type `X`, which does not implement the `Copy` trait
|
||||||
| help: consider removing the `&mut`: `Either::One(_t)`
|
| help: consider removing the `&mut`: `Either::One(_t)`
|
||||||
|
|
||||||
error[E0507]: cannot move out of `rm.0` which is behind a mutable reference
|
error[E0507]: cannot move out of `rm` as enum variant `One` which is behind a mutable reference
|
||||||
--> $DIR/simple.rs:235:11
|
--> $DIR/simple.rs:235:11
|
||||||
|
|
|
|
||||||
LL | match rm {
|
LL | match rm {
|
||||||
|
@ -380,7 +380,7 @@ LL | &mut Either::One(_t) => (),
|
||||||
| | move occurs because `_t` has type `X`, which does not implement the `Copy` trait
|
| | move occurs because `_t` has type `X`, which does not implement the `Copy` trait
|
||||||
| help: consider removing the `&mut`: `Either::One(_t)`
|
| help: consider removing the `&mut`: `Either::One(_t)`
|
||||||
|
|
||||||
error[E0507]: cannot move out of `rm.0` which is behind a mutable reference
|
error[E0507]: cannot move out of `rm` as enum variant `One` which is behind a mutable reference
|
||||||
--> $DIR/simple.rs:242:11
|
--> $DIR/simple.rs:242:11
|
||||||
|
|
|
|
||||||
LL | match rm {
|
LL | match rm {
|
||||||
|
|
|
@ -4,11 +4,10 @@ warning: function cannot return without recursing
|
||||||
LL | / fn recurse<T>(elements: T) -> Vec<char>
|
LL | / fn recurse<T>(elements: T) -> Vec<char>
|
||||||
LL | | where
|
LL | | where
|
||||||
LL | | T: Iterator<Item = ()>,
|
LL | | T: Iterator<Item = ()>,
|
||||||
LL | | {
|
| |___________________________^ cannot return without recursing
|
||||||
LL | | recurse(IteratorOfWrapped(elements).map(|t| t.0))
|
LL | {
|
||||||
| | ------------------------------------------------- recursive call site
|
LL | recurse(IteratorOfWrapped(elements).map(|t| t.0))
|
||||||
LL | | }
|
| ------------------------------------------------- recursive call site
|
||||||
| |_^ cannot return without recursing
|
|
||||||
|
|
|
|
||||||
= note: `#[warn(unconditional_recursion)]` on by default
|
= note: `#[warn(unconditional_recursion)]` on by default
|
||||||
= help: a `loop` may express intention better if this is on purpose
|
= help: a `loop` may express intention better if this is on purpose
|
||||||
|
|
|
@ -14,7 +14,7 @@ note: cycle used when collecting item types in top-level module
|
||||||
--> $DIR/cyclic-trait-resolution.rs:1:1
|
--> $DIR/cyclic-trait-resolution.rs:1:1
|
||||||
|
|
|
|
||||||
LL | trait A: B + A {}
|
LL | trait A: B + A {}
|
||||||
| ^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -2,18 +2,18 @@ error[E0391]: cycle detected when simplifying constant for the type system `Alph
|
||||||
--> $DIR/self-in-enum-definition.rs:5:10
|
--> $DIR/self-in-enum-definition.rs:5:10
|
||||||
|
|
|
|
||||||
LL | V3 = Self::V1 {} as u8 + 2,
|
LL | V3 = Self::V1 {} as u8 + 2,
|
||||||
| ^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
note: ...which requires simplifying constant for the type system `Alpha::V3::{constant#0}`...
|
note: ...which requires simplifying constant for the type system `Alpha::V3::{constant#0}`...
|
||||||
--> $DIR/self-in-enum-definition.rs:5:10
|
--> $DIR/self-in-enum-definition.rs:5:10
|
||||||
|
|
|
|
||||||
LL | V3 = Self::V1 {} as u8 + 2,
|
LL | V3 = Self::V1 {} as u8 + 2,
|
||||||
| ^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^
|
||||||
note: ...which requires const-evaluating + checking `Alpha::V3::{constant#0}`...
|
note: ...which requires const-evaluating + checking `Alpha::V3::{constant#0}`...
|
||||||
--> $DIR/self-in-enum-definition.rs:5:10
|
--> $DIR/self-in-enum-definition.rs:5:10
|
||||||
|
|
|
|
||||||
LL | V3 = Self::V1 {} as u8 + 2,
|
LL | V3 = Self::V1 {} as u8 + 2,
|
||||||
| ^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^
|
||||||
= note: ...which requires computing layout of `Alpha`...
|
= note: ...which requires computing layout of `Alpha`...
|
||||||
= note: ...which again requires simplifying constant for the type system `Alpha::V3::{constant#0}`, completing the cycle
|
= note: ...which again requires simplifying constant for the type system `Alpha::V3::{constant#0}`, completing the cycle
|
||||||
note: cycle used when collecting item types in top-level module
|
note: cycle used when collecting item types in top-level module
|
||||||
|
|
|
@ -41,9 +41,9 @@ fn python() -> &'static str {
|
||||||
} else if python2 {
|
} else if python2 {
|
||||||
PYTHON2
|
PYTHON2
|
||||||
} else {
|
} else {
|
||||||
// We would have returned early if we found that python is installed ...
|
// Python was not found on path, so exit
|
||||||
// maybe this should panic with an error instead?
|
eprintln!("Unable to find python in your PATH. Please check it is installed.");
|
||||||
PYTHON
|
process::exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue