Auto merge of #151003 - matthiaskrgr:rollup-wvnF9sN, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - rust-lang/rust#150861 (Folding/`ReErased` cleanups) - rust-lang/rust#150869 (Emit error instead of delayed bug when meeting mismatch type for const tuple) - rust-lang/rust#150920 (Use a hook to decouple `rustc_mir_transform` from `rustc_mir_build`) - rust-lang/rust#150941 (rustc_parse_format: improve diagnostics for unsupported python numeric grouping) - rust-lang/rust#150972 (Rename EII attributes slightly (being consistent in naming things foreign items, not extern items)) - rust-lang/rust#150980 (Use updated indexes to build reverse map for delegation generics) - rust-lang/rust#150986 (std: Fix size returned by UEFI tcp4 read operations) - rust-lang/rust#150996 (Remove `S-waiting-on-bors` after a PR is merged) r? @ghost
This commit is contained in:
commit
aefa10405d
71 changed files with 286 additions and 235 deletions
|
|
@ -4360,7 +4360,6 @@ dependencies = [
|
|||
"rustc_infer",
|
||||
"rustc_macros",
|
||||
"rustc_middle",
|
||||
"rustc_mir_build",
|
||||
"rustc_mir_dataflow",
|
||||
"rustc_session",
|
||||
"rustc_span",
|
||||
|
|
|
|||
|
|
@ -2109,16 +2109,18 @@ pub struct MacroDef {
|
|||
/// `true` if macro was defined with `macro_rules`.
|
||||
pub macro_rules: bool,
|
||||
|
||||
/// If this is a macro used for externally implementable items,
|
||||
/// it refers to an extern item which is its "target". This requires
|
||||
/// name resolution so can't just be an attribute, so we store it in this field.
|
||||
pub eii_extern_target: Option<EiiExternTarget>,
|
||||
/// Corresponds to `#[eii_declaration(...)]`.
|
||||
/// `#[eii_declaration(...)]` is a built-in attribute macro, not a built-in attribute,
|
||||
/// because we require some name resolution to occur in the parameters of this attribute.
|
||||
/// Name resolution isn't possible in attributes otherwise, so we encode it in the AST.
|
||||
/// During ast lowering, we turn it back into an attribute again
|
||||
pub eii_declaration: Option<EiiDecl>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Encodable, Decodable, Debug, HashStable_Generic, Walkable)]
|
||||
pub struct EiiExternTarget {
|
||||
pub struct EiiDecl {
|
||||
/// path to the extern item we're targeting
|
||||
pub extern_item_path: Path,
|
||||
pub foreign_item: Path,
|
||||
pub impl_unsafe: bool,
|
||||
}
|
||||
|
||||
|
|
@ -3824,7 +3826,7 @@ pub struct EiiImpl {
|
|||
///
|
||||
/// This field is that shortcut: we prefill the extern target to skip a name resolution step,
|
||||
/// making sure it never fails. It'd be awful UX if we fail name resolution in code invisible to the user.
|
||||
pub known_eii_macro_resolution: Option<EiiExternTarget>,
|
||||
pub known_eii_macro_resolution: Option<EiiDecl>,
|
||||
pub impl_safety: Safety,
|
||||
pub span: Span,
|
||||
pub inner_span: Span,
|
||||
|
|
|
|||
|
|
@ -489,7 +489,7 @@ macro_rules! common_visitor_and_walkers {
|
|||
WhereEqPredicate,
|
||||
WhereRegionPredicate,
|
||||
YieldKind,
|
||||
EiiExternTarget,
|
||||
EiiDecl,
|
||||
EiiImpl,
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use rustc_abi::ExternAbi;
|
|||
use rustc_ast::visit::AssocCtxt;
|
||||
use rustc_ast::*;
|
||||
use rustc_errors::{E0570, ErrorGuaranteed, struct_span_code_err};
|
||||
use rustc_hir::attrs::{AttributeKind, EiiDecl, EiiImplResolution};
|
||||
use rustc_hir::attrs::{AttributeKind, EiiImplResolution};
|
||||
use rustc_hir::def::{DefKind, PerNS, Res};
|
||||
use rustc_hir::def_id::{CRATE_DEF_ID, LocalDefId};
|
||||
use rustc_hir::{
|
||||
|
|
@ -134,16 +134,16 @@ impl<'hir> LoweringContext<'_, 'hir> {
|
|||
}
|
||||
}
|
||||
|
||||
fn lower_eii_extern_target(
|
||||
fn lower_eii_decl(
|
||||
&mut self,
|
||||
id: NodeId,
|
||||
eii_name: Ident,
|
||||
EiiExternTarget { extern_item_path, impl_unsafe }: &EiiExternTarget,
|
||||
) -> Option<EiiDecl> {
|
||||
self.lower_path_simple_eii(id, extern_item_path).map(|did| EiiDecl {
|
||||
eii_extern_target: did,
|
||||
name: Ident,
|
||||
EiiDecl { foreign_item, impl_unsafe }: &EiiDecl,
|
||||
) -> Option<hir::attrs::EiiDecl> {
|
||||
self.lower_path_simple_eii(id, foreign_item).map(|did| hir::attrs::EiiDecl {
|
||||
foreign_item: did,
|
||||
impl_unsafe: *impl_unsafe,
|
||||
name: eii_name,
|
||||
name,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -160,7 +160,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
|
|||
}: &EiiImpl,
|
||||
) -> hir::attrs::EiiImpl {
|
||||
let resolution = if let Some(target) = known_eii_macro_resolution
|
||||
&& let Some(decl) = self.lower_eii_extern_target(
|
||||
&& let Some(decl) = self.lower_eii_decl(
|
||||
*node_id,
|
||||
// the expect is ok here since we always generate this path in the eii macro.
|
||||
eii_macro_path.segments.last().expect("at least one segment").ident,
|
||||
|
|
@ -196,9 +196,9 @@ impl<'hir> LoweringContext<'_, 'hir> {
|
|||
eii_impls.iter().map(|i| self.lower_eii_impl(i)).collect(),
|
||||
))]
|
||||
}
|
||||
ItemKind::MacroDef(name, MacroDef { eii_extern_target: Some(target), .. }) => self
|
||||
.lower_eii_extern_target(id, *name, target)
|
||||
.map(|decl| vec![hir::Attribute::Parsed(AttributeKind::EiiExternTarget(decl))])
|
||||
ItemKind::MacroDef(name, MacroDef { eii_declaration: Some(target), .. }) => self
|
||||
.lower_eii_decl(id, *name, target)
|
||||
.map(|decl| vec![hir::Attribute::Parsed(AttributeKind::EiiDeclaration(decl))])
|
||||
.unwrap_or_default(),
|
||||
|
||||
ItemKind::ExternCrate(..)
|
||||
|
|
@ -242,10 +242,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
|
|||
vis_span,
|
||||
span: self.lower_span(i.span),
|
||||
has_delayed_lints: !self.delayed_lints.is_empty(),
|
||||
eii: find_attr!(
|
||||
attrs,
|
||||
AttributeKind::EiiImpls(..) | AttributeKind::EiiExternTarget(..)
|
||||
),
|
||||
eii: find_attr!(attrs, AttributeKind::EiiImpls(..) | AttributeKind::EiiDeclaration(..)),
|
||||
};
|
||||
self.arena.alloc(item)
|
||||
}
|
||||
|
|
@ -539,7 +536,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
|
|||
);
|
||||
hir::ItemKind::TraitAlias(constness, ident, generics, bounds)
|
||||
}
|
||||
ItemKind::MacroDef(ident, MacroDef { body, macro_rules, eii_extern_target: _ }) => {
|
||||
ItemKind::MacroDef(ident, MacroDef { body, macro_rules, eii_declaration: _ }) => {
|
||||
let ident = self.lower_ident(*ident);
|
||||
let body = Box::new(self.lower_delim_args(body));
|
||||
let def_id = self.local_def_id(id);
|
||||
|
|
@ -553,7 +550,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
|
|||
let macro_def = self.arena.alloc(ast::MacroDef {
|
||||
body,
|
||||
macro_rules: *macro_rules,
|
||||
eii_extern_target: None,
|
||||
eii_declaration: None,
|
||||
});
|
||||
hir::ItemKind::Macro(ident, macro_def, macro_kinds)
|
||||
}
|
||||
|
|
@ -693,7 +690,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
|
|||
has_delayed_lints: !this.delayed_lints.is_empty(),
|
||||
eii: find_attr!(
|
||||
attrs,
|
||||
AttributeKind::EiiImpls(..) | AttributeKind::EiiExternTarget(..)
|
||||
AttributeKind::EiiImpls(..) | AttributeKind::EiiDeclaration(..)
|
||||
),
|
||||
};
|
||||
hir::OwnerNode::Item(this.arena.alloc(item))
|
||||
|
|
|
|||
|
|
@ -865,10 +865,10 @@ pub trait PrintState<'a>: std::ops::Deref<Target = pp::Printer> + std::ops::Dere
|
|||
sp: Span,
|
||||
print_visibility: impl FnOnce(&mut Self),
|
||||
) {
|
||||
if let Some(eii_extern_target) = ¯o_def.eii_extern_target {
|
||||
self.word("#[eii_extern_target(");
|
||||
self.print_path(&eii_extern_target.extern_item_path, false, 0);
|
||||
if eii_extern_target.impl_unsafe {
|
||||
if let Some(eii_decl) = ¯o_def.eii_declaration {
|
||||
self.word("#[eii_declaration(");
|
||||
self.print_path(&eii_decl.foreign_item, false, 0);
|
||||
if eii_decl.impl_unsafe {
|
||||
self.word(",");
|
||||
self.space();
|
||||
self.word("unsafe");
|
||||
|
|
|
|||
|
|
@ -709,11 +709,11 @@ impl<S: Stage> NoArgsAttributeParser<S> for RustcPassIndirectlyInNonRusticAbisPa
|
|||
const CREATE: fn(Span) -> AttributeKind = AttributeKind::RustcPassIndirectlyInNonRusticAbis;
|
||||
}
|
||||
|
||||
pub(crate) struct EiiExternItemParser;
|
||||
pub(crate) struct EiiForeignItemParser;
|
||||
|
||||
impl<S: Stage> NoArgsAttributeParser<S> for EiiExternItemParser {
|
||||
const PATH: &[Symbol] = &[sym::rustc_eii_extern_item];
|
||||
impl<S: Stage> NoArgsAttributeParser<S> for EiiForeignItemParser {
|
||||
const PATH: &[Symbol] = &[sym::rustc_eii_foreign_item];
|
||||
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
|
||||
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::ForeignFn)]);
|
||||
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::EiiExternItem;
|
||||
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::EiiForeignItem;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ use crate::attributes::allow_unstable::{
|
|||
use crate::attributes::body::CoroutineParser;
|
||||
use crate::attributes::cfi_encoding::CfiEncodingParser;
|
||||
use crate::attributes::codegen_attrs::{
|
||||
ColdParser, CoverageParser, EiiExternItemParser, ExportNameParser, ForceTargetFeatureParser,
|
||||
ColdParser, CoverageParser, EiiForeignItemParser, ExportNameParser, ForceTargetFeatureParser,
|
||||
NakedParser, NoMangleParser, ObjcClassParser, ObjcSelectorParser, OptimizeParser,
|
||||
RustcPassIndirectlyInNonRusticAbisParser, SanitizeParser, TargetFeatureParser,
|
||||
ThreadLocalParser, TrackCallerParser, UsedParser,
|
||||
|
|
@ -243,7 +243,7 @@ attribute_parsers!(
|
|||
Single<WithoutArgs<CoroutineParser>>,
|
||||
Single<WithoutArgs<DenyExplicitImplParser>>,
|
||||
Single<WithoutArgs<DoNotImplementViaObjectParser>>,
|
||||
Single<WithoutArgs<EiiExternItemParser>>,
|
||||
Single<WithoutArgs<EiiForeignItemParser>>,
|
||||
Single<WithoutArgs<ExportStableParser>>,
|
||||
Single<WithoutArgs<FfiConstParser>>,
|
||||
Single<WithoutArgs<FfiPureParser>>,
|
||||
|
|
|
|||
|
|
@ -151,9 +151,9 @@ builtin_macros_derive_path_args_value = traits in `#[derive(...)]` don't accept
|
|||
|
||||
builtin_macros_duplicate_macro_attribute = duplicated attribute
|
||||
|
||||
builtin_macros_eii_extern_target_expected_list = `#[eii_extern_target(...)]` expects a list of one or two elements
|
||||
builtin_macros_eii_extern_target_expected_macro = `#[eii_extern_target(...)]` is only valid on macros
|
||||
builtin_macros_eii_extern_target_expected_unsafe = expected this argument to be "unsafe"
|
||||
builtin_macros_eii_declaration_expected_list = `#[eii_declaration(...)]` expects a list of one or two elements
|
||||
builtin_macros_eii_declaration_expected_macro = `#[eii_declaration(...)]` is only valid on macros
|
||||
builtin_macros_eii_declaration_expected_unsafe = expected this argument to be "unsafe"
|
||||
.note = the second argument is optional
|
||||
|
||||
builtin_macros_eii_only_once = `#[{$name}]` can only be specified once
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use rustc_ast::token::{Delimiter, TokenKind};
|
||||
use rustc_ast::tokenstream::{DelimSpacing, DelimSpan, Spacing, TokenStream, TokenTree};
|
||||
use rustc_ast::{
|
||||
Attribute, DUMMY_NODE_ID, EiiExternTarget, EiiImpl, ItemKind, MetaItem, Path, Stmt, StmtKind,
|
||||
Attribute, DUMMY_NODE_ID, EiiDecl, EiiImpl, ItemKind, MetaItem, Path, Stmt, StmtKind,
|
||||
Visibility, ast,
|
||||
};
|
||||
use rustc_ast_pretty::pprust::path_to_string;
|
||||
|
|
@ -30,7 +30,7 @@ use crate::errors::{
|
|||
/// }
|
||||
///
|
||||
/// #[rustc_builtin_macro(eii_shared_macro)]
|
||||
/// #[eii_extern_target(panic_handler)]
|
||||
/// #[eii_declaration(panic_handler)]
|
||||
/// macro panic_handler() {}
|
||||
/// ```
|
||||
pub(crate) fn eii(
|
||||
|
|
@ -210,8 +210,8 @@ fn generate_default_impl(
|
|||
},
|
||||
span: eii_attr_span,
|
||||
is_default: true,
|
||||
known_eii_macro_resolution: Some(ast::EiiExternTarget {
|
||||
extern_item_path: ecx.path(
|
||||
known_eii_macro_resolution: Some(ast::EiiDecl {
|
||||
foreign_item: ecx.path(
|
||||
foreign_item_name.span,
|
||||
// prefix super to escape the `dflt` module generated below
|
||||
vec![Ident::from_str_and_span("super", foreign_item_name.span), foreign_item_name],
|
||||
|
|
@ -295,9 +295,9 @@ fn generate_foreign_item(
|
|||
let mut foreign_item_attrs = ThinVec::new();
|
||||
foreign_item_attrs.extend_from_slice(attrs_from_decl);
|
||||
|
||||
// Add the rustc_eii_extern_item on the foreign item. Usually, foreign items are mangled.
|
||||
// Add the rustc_eii_foreign_item on the foreign item. Usually, foreign items are mangled.
|
||||
// This attribute makes sure that we later know that this foreign item's symbol should not be.
|
||||
foreign_item_attrs.push(ecx.attr_word(sym::rustc_eii_extern_item, eii_attr_span));
|
||||
foreign_item_attrs.push(ecx.attr_word(sym::rustc_eii_foreign_item, eii_attr_span));
|
||||
|
||||
let abi = match func.sig.header.ext {
|
||||
// extern "X" fn => extern "X" {}
|
||||
|
|
@ -349,7 +349,7 @@ fn generate_foreign_item(
|
|||
/// // This attribute tells the compiler that
|
||||
/// #[builtin_macro(eii_shared_macro)]
|
||||
/// // the metadata to link this macro to the generated foreign item.
|
||||
/// #[eii_extern_target(<related_reign_item>)]
|
||||
/// #[eii_declaration(<related_foreign_item>)]
|
||||
/// macro macro_name { () => {} }
|
||||
/// ```
|
||||
fn generate_attribute_macro_to_implement(
|
||||
|
|
@ -401,9 +401,9 @@ fn generate_attribute_macro_to_implement(
|
|||
]),
|
||||
}),
|
||||
macro_rules: false,
|
||||
// #[eii_extern_target(foreign_item_ident)]
|
||||
eii_extern_target: Some(ast::EiiExternTarget {
|
||||
extern_item_path: ast::Path::from_ident(foreign_item_name),
|
||||
// #[eii_declaration(foreign_item_ident)]
|
||||
eii_declaration: Some(ast::EiiDecl {
|
||||
foreign_item: ast::Path::from_ident(foreign_item_name),
|
||||
impl_unsafe,
|
||||
}),
|
||||
},
|
||||
|
|
@ -412,7 +412,7 @@ fn generate_attribute_macro_to_implement(
|
|||
})
|
||||
}
|
||||
|
||||
pub(crate) fn eii_extern_target(
|
||||
pub(crate) fn eii_declaration(
|
||||
ecx: &mut ExtCtxt<'_>,
|
||||
span: Span,
|
||||
meta_item: &ast::MetaItem,
|
||||
|
|
@ -461,7 +461,7 @@ pub(crate) fn eii_extern_target(
|
|||
false
|
||||
};
|
||||
|
||||
d.eii_extern_target = Some(EiiExternTarget { extern_item_path, impl_unsafe });
|
||||
d.eii_declaration = Some(EiiDecl { foreign_item: extern_item_path, impl_unsafe });
|
||||
|
||||
// Return the original item and the new methods.
|
||||
vec![item]
|
||||
|
|
|
|||
|
|
@ -1010,21 +1010,21 @@ pub(crate) struct CfgSelectUnreachable {
|
|||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(builtin_macros_eii_extern_target_expected_macro)]
|
||||
#[diag(builtin_macros_eii_declaration_expected_macro)]
|
||||
pub(crate) struct EiiExternTargetExpectedMacro {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(builtin_macros_eii_extern_target_expected_list)]
|
||||
#[diag(builtin_macros_eii_declaration_expected_list)]
|
||||
pub(crate) struct EiiExternTargetExpectedList {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(builtin_macros_eii_extern_target_expected_unsafe)]
|
||||
#[diag(builtin_macros_eii_declaration_expected_unsafe)]
|
||||
pub(crate) struct EiiExternTargetExpectedUnsafe {
|
||||
#[primary_span]
|
||||
#[note]
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ pub fn register_builtin_macros(resolver: &mut dyn ResolverExpand) {
|
|||
derive: derive::Expander { is_const: false },
|
||||
derive_const: derive::Expander { is_const: true },
|
||||
eii: eii::eii,
|
||||
eii_extern_target: eii::eii_extern_target,
|
||||
eii_declaration: eii::eii_declaration,
|
||||
eii_shared_macro: eii::eii_shared_macro,
|
||||
global_allocator: global_allocator::expand,
|
||||
test: test::expand_test,
|
||||
|
|
|
|||
|
|
@ -1520,7 +1520,6 @@ pub(crate) fn apply_vcall_visibility_metadata<'ll, 'tcx>(
|
|||
// Unwrap potential addrspacecast
|
||||
let vtable = find_vtable_behind_cast(vtable);
|
||||
let trait_ref_self = trait_ref.with_self_ty(cx.tcx, ty);
|
||||
let trait_ref_self = cx.tcx.erase_and_anonymize_regions(trait_ref_self);
|
||||
let trait_def_id = trait_ref_self.def_id;
|
||||
let trait_vis = cx.tcx.visibility(trait_def_id);
|
||||
|
||||
|
|
|
|||
|
|
@ -282,16 +282,16 @@ fn process_builtin_attrs(
|
|||
AttributeKind::ObjcSelector { methname, .. } => {
|
||||
codegen_fn_attrs.objc_selector = Some(*methname);
|
||||
}
|
||||
AttributeKind::EiiExternItem => {
|
||||
AttributeKind::EiiForeignItem => {
|
||||
codegen_fn_attrs.flags |= CodegenFnAttrFlags::EXTERNALLY_IMPLEMENTABLE_ITEM;
|
||||
}
|
||||
AttributeKind::EiiImpls(impls) => {
|
||||
for i in impls {
|
||||
let extern_item = match i.resolution {
|
||||
let foreign_item = match i.resolution {
|
||||
EiiImplResolution::Macro(def_id) => {
|
||||
let Some(extern_item) = find_attr!(
|
||||
tcx.get_all_attrs(def_id),
|
||||
AttributeKind::EiiExternTarget(target) => target.eii_extern_target
|
||||
AttributeKind::EiiDeclaration(target) => target.foreign_item
|
||||
) else {
|
||||
tcx.dcx().span_delayed_bug(
|
||||
i.span,
|
||||
|
|
@ -301,7 +301,7 @@ fn process_builtin_attrs(
|
|||
};
|
||||
extern_item
|
||||
}
|
||||
EiiImplResolution::Known(decl) => decl.eii_extern_target,
|
||||
EiiImplResolution::Known(decl) => decl.foreign_item,
|
||||
EiiImplResolution::Error(_eg) => continue,
|
||||
};
|
||||
|
||||
|
|
@ -316,13 +316,13 @@ fn process_builtin_attrs(
|
|||
// iterate over all implementations *in the current crate*
|
||||
// (this is ok since we generate codegen fn attrs in the local crate)
|
||||
// if any of them is *not default* then don't emit the alias.
|
||||
&& tcx.externally_implementable_items(LOCAL_CRATE).get(&extern_item).expect("at least one").1.iter().any(|(_, imp)| !imp.is_default)
|
||||
&& tcx.externally_implementable_items(LOCAL_CRATE).get(&foreign_item).expect("at least one").1.iter().any(|(_, imp)| !imp.is_default)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
codegen_fn_attrs.foreign_item_symbol_aliases.push((
|
||||
extern_item,
|
||||
foreign_item,
|
||||
if i.is_default { Linkage::LinkOnceAny } else { Linkage::External },
|
||||
Visibility::Default,
|
||||
));
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ use rustc_infer::infer::TyCtxtInferExt;
|
|||
use rustc_middle::mir::interpret::{CTFE_ALLOC_SALT, read_target_uint, write_target_uint};
|
||||
use rustc_middle::mir::{self, BinOp, ConstValue, NonDivergingIntrinsic};
|
||||
use rustc_middle::ty::layout::TyAndLayout;
|
||||
use rustc_middle::ty::{FloatTy, PolyExistentialPredicate, Ty, TyCtxt, TypeFoldable};
|
||||
use rustc_middle::ty::{FloatTy, PolyExistentialPredicate, Ty, TyCtxt};
|
||||
use rustc_middle::{bug, span_bug, ty};
|
||||
use rustc_span::{Symbol, sym};
|
||||
use rustc_trait_selection::traits::{Obligation, ObligationCause, ObligationCtxt};
|
||||
|
|
@ -243,13 +243,8 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
|
|||
ocx.register_obligations(preds.iter().map(|pred: PolyExistentialPredicate<'_>| {
|
||||
let pred = pred.with_self_ty(tcx, tp_ty);
|
||||
// Lifetimes can only be 'static because of the bound on T
|
||||
let pred = pred.fold_with(&mut ty::BottomUpFolder {
|
||||
tcx,
|
||||
ty_op: |ty| ty,
|
||||
lt_op: |lt| {
|
||||
if lt == tcx.lifetimes.re_erased { tcx.lifetimes.re_static } else { lt }
|
||||
},
|
||||
ct_op: |ct| ct,
|
||||
let pred = ty::fold_regions(tcx, pred, |r, _| {
|
||||
if r == tcx.lifetimes.re_erased { tcx.lifetimes.re_static } else { r }
|
||||
});
|
||||
Obligation::new(tcx, ObligationCause::dummy(), param_env, pred)
|
||||
}));
|
||||
|
|
|
|||
|
|
@ -962,7 +962,7 @@ pub static BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
|
|||
EncodeCrossCrate::No, "allow_internal_unsafe side-steps the unsafe_code lint",
|
||||
),
|
||||
gated!(
|
||||
rustc_eii_extern_item, Normal, template!(Word),
|
||||
rustc_eii_foreign_item, Normal, template!(Word),
|
||||
ErrorFollowing, EncodeCrossCrate::Yes, eii_internals,
|
||||
"used internally to mark types with a `transparent` representation when it is guaranteed by the documentation",
|
||||
),
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ pub struct EiiImpl {
|
|||
|
||||
#[derive(Copy, Clone, Debug, HashStable_Generic, Encodable, Decodable, PrintAttribute)]
|
||||
pub struct EiiDecl {
|
||||
pub eii_extern_target: DefId,
|
||||
pub foreign_item: DefId,
|
||||
/// whether or not it is unsafe to implement this EII
|
||||
pub impl_unsafe: bool,
|
||||
pub name: Ident,
|
||||
|
|
@ -744,10 +744,10 @@ pub enum AttributeKind {
|
|||
Dummy,
|
||||
|
||||
/// Implementation detail of `#[eii]`
|
||||
EiiExternItem,
|
||||
EiiDeclaration(EiiDecl),
|
||||
|
||||
/// Implementation detail of `#[eii]`
|
||||
EiiExternTarget(EiiDecl),
|
||||
EiiForeignItem,
|
||||
|
||||
/// Implementation detail of `#[eii]`
|
||||
EiiImpls(ThinVec<EiiImpl>),
|
||||
|
|
|
|||
|
|
@ -47,8 +47,8 @@ impl AttributeKind {
|
|||
Doc(_) => Yes,
|
||||
DocComment { .. } => Yes,
|
||||
Dummy => No,
|
||||
EiiExternItem => No,
|
||||
EiiExternTarget(_) => Yes,
|
||||
EiiDeclaration(_) => Yes,
|
||||
EiiForeignItem => No,
|
||||
EiiImpls(..) => No,
|
||||
ExportName { .. } => Yes,
|
||||
ExportStable => No,
|
||||
|
|
|
|||
|
|
@ -508,23 +508,18 @@ fn sanity_check_found_hidden_type<'tcx>(
|
|||
return Ok(());
|
||||
}
|
||||
}
|
||||
let strip_vars = |ty: Ty<'tcx>| {
|
||||
ty.fold_with(&mut BottomUpFolder {
|
||||
tcx,
|
||||
ty_op: |t| t,
|
||||
ct_op: |c| c,
|
||||
lt_op: |l| match l.kind() {
|
||||
RegionKind::ReVar(_) => tcx.lifetimes.re_erased,
|
||||
_ => l,
|
||||
},
|
||||
let erase_re_vars = |ty: Ty<'tcx>| {
|
||||
fold_regions(tcx, ty, |r, _| match r.kind() {
|
||||
RegionKind::ReVar(_) => tcx.lifetimes.re_erased,
|
||||
_ => r,
|
||||
})
|
||||
};
|
||||
// Closures frequently end up containing erased lifetimes in their final representation.
|
||||
// These correspond to lifetime variables that never got resolved, so we patch this up here.
|
||||
ty.ty = strip_vars(ty.ty);
|
||||
ty.ty = erase_re_vars(ty.ty);
|
||||
// Get the hidden type.
|
||||
let hidden_ty = tcx.type_of(key.def_id).instantiate(tcx, key.args);
|
||||
let hidden_ty = strip_vars(hidden_ty);
|
||||
let hidden_ty = erase_re_vars(hidden_ty);
|
||||
|
||||
// If the hidden types differ, emit a type mismatch diagnostic.
|
||||
if hidden_ty == ty.ty {
|
||||
|
|
|
|||
|
|
@ -1205,7 +1205,7 @@ fn check_eiis(tcx: TyCtxt<'_>, def_id: LocalDefId) {
|
|||
EiiImplResolution::Macro(def_id) => {
|
||||
// we expect this macro to have the `EiiMacroFor` attribute, that points to a function
|
||||
// signature that we'd like to compare the function we're currently checking with
|
||||
if let Some(foreign_item) = find_attr!(tcx.get_all_attrs(*def_id), AttributeKind::EiiExternTarget(EiiDecl {eii_extern_target: t, ..}) => *t)
|
||||
if let Some(foreign_item) = find_attr!(tcx.get_all_attrs(*def_id), AttributeKind::EiiDeclaration(EiiDecl {foreign_item: t, ..}) => *t)
|
||||
{
|
||||
(foreign_item, tcx.item_name(*def_id))
|
||||
} else {
|
||||
|
|
@ -1213,7 +1213,7 @@ fn check_eiis(tcx: TyCtxt<'_>, def_id: LocalDefId) {
|
|||
continue;
|
||||
}
|
||||
}
|
||||
EiiImplResolution::Known(decl) => (decl.eii_extern_target, decl.name.name),
|
||||
EiiImplResolution::Known(decl) => (decl.foreign_item, decl.name.name),
|
||||
EiiImplResolution::Error(_eg) => continue,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -135,9 +135,6 @@ fn build_generics<'tcx>(
|
|||
// }
|
||||
own_params.sort_by_key(|key| key.kind.is_ty_or_const());
|
||||
|
||||
let param_def_id_to_index =
|
||||
own_params.iter().map(|param| (param.def_id, param.index)).collect();
|
||||
|
||||
let (parent_count, has_self) = if let Some(def_id) = parent {
|
||||
let parent_generics = tcx.generics_of(def_id);
|
||||
let parent_kind = tcx.def_kind(def_id);
|
||||
|
|
@ -162,6 +159,9 @@ fn build_generics<'tcx>(
|
|||
}
|
||||
}
|
||||
|
||||
let param_def_id_to_index =
|
||||
own_params.iter().map(|param| (param.def_id, param.index)).collect();
|
||||
|
||||
ty::Generics {
|
||||
parent,
|
||||
parent_count,
|
||||
|
|
|
|||
|
|
@ -2533,11 +2533,12 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
|
|||
let tcx = self.tcx();
|
||||
|
||||
let FeedConstTy::WithTy(ty) = feed else {
|
||||
return Const::new_error_with_message(tcx, span, "unsupported const tuple");
|
||||
return Const::new_error_with_message(tcx, span, "const tuple lack type information");
|
||||
};
|
||||
|
||||
let ty::Tuple(tys) = ty.kind() else {
|
||||
return Const::new_error_with_message(tcx, span, "const tuple must have a tuple type");
|
||||
let e = tcx.dcx().span_err(span, format!("expected `{}`, found const tuple", ty));
|
||||
return Const::new_error(tcx, e);
|
||||
};
|
||||
|
||||
let exprs = exprs
|
||||
|
|
|
|||
|
|
@ -31,9 +31,9 @@ pub(crate) fn collect<'tcx>(tcx: TyCtxt<'tcx>, LocalCrate: LocalCrate) -> EiiMap
|
|||
let decl = match i.resolution {
|
||||
EiiImplResolution::Macro(macro_defid) => {
|
||||
// find the decl for this one if it wasn't in yet (maybe it's from the local crate? not very useful but not illegal)
|
||||
let Some(decl) = find_attr!(tcx.get_all_attrs(macro_defid), AttributeKind::EiiExternTarget(d) => *d)
|
||||
let Some(decl) = find_attr!(tcx.get_all_attrs(macro_defid), AttributeKind::EiiDeclaration(d) => *d)
|
||||
else {
|
||||
// skip if it doesn't have eii_extern_target (if we resolved to another macro that's not an EII)
|
||||
// skip if it doesn't have eii_declaration (if we resolved to another macro that's not an EII)
|
||||
tcx.dcx()
|
||||
.span_delayed_bug(i.span, "resolved to something that's not an EII");
|
||||
continue;
|
||||
|
|
@ -45,7 +45,7 @@ pub(crate) fn collect<'tcx>(tcx: TyCtxt<'tcx>, LocalCrate: LocalCrate) -> EiiMap
|
|||
};
|
||||
|
||||
// FIXME(eii) remove extern target from encoded decl
|
||||
eiis.entry(decl.eii_extern_target)
|
||||
eiis.entry(decl.foreign_item)
|
||||
.or_insert_with(|| (decl, Default::default()))
|
||||
.1
|
||||
.insert(id.into(), *i);
|
||||
|
|
@ -53,9 +53,9 @@ pub(crate) fn collect<'tcx>(tcx: TyCtxt<'tcx>, LocalCrate: LocalCrate) -> EiiMap
|
|||
|
||||
// if we find a new declaration, add it to the list without a known implementation
|
||||
if let Some(decl) =
|
||||
find_attr!(tcx.get_all_attrs(id), AttributeKind::EiiExternTarget(d) => *d)
|
||||
find_attr!(tcx.get_all_attrs(id), AttributeKind::EiiDeclaration(d) => *d)
|
||||
{
|
||||
eiis.entry(decl.eii_extern_target).or_insert((decl, Default::default()));
|
||||
eiis.entry(decl.foreign_item).or_insert((decl, Default::default()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1536,7 +1536,7 @@ impl<'a> CrateMetadataRef<'a> {
|
|||
.get((self, tcx), id)
|
||||
.unwrap()
|
||||
.decode((self, tcx));
|
||||
ast::MacroDef { macro_rules, body: Box::new(body), eii_extern_target: None }
|
||||
ast::MacroDef { macro_rules, body: Box::new(body), eii_declaration: None }
|
||||
}
|
||||
_ => bug!(),
|
||||
}
|
||||
|
|
|
|||
|
|
@ -102,6 +102,11 @@ declare_hooks! {
|
|||
/// Ensure the given scalar is valid for the given type.
|
||||
/// This checks non-recursive runtime validity.
|
||||
hook validate_scalar_in_layout(scalar: crate::ty::ScalarInt, ty: Ty<'tcx>) -> bool;
|
||||
|
||||
/// **Do not call this directly; call the `mir_built` query instead.**
|
||||
///
|
||||
/// Creates the MIR for a given `DefId`, including unreachable code.
|
||||
hook build_mir_inner_impl(def: LocalDefId) -> mir::Body<'tcx>;
|
||||
}
|
||||
|
||||
#[cold]
|
||||
|
|
|
|||
|
|
@ -64,9 +64,11 @@ pub(crate) fn closure_saved_names_of_captured_variables<'tcx>(
|
|||
.collect()
|
||||
}
|
||||
|
||||
/// Create the MIR for a given `DefId`, including unreachable code. Do not call
|
||||
/// this directly; instead use the cached version via `mir_built`.
|
||||
pub fn build_mir<'tcx>(tcx: TyCtxt<'tcx>, def: LocalDefId) -> Body<'tcx> {
|
||||
/// Create the MIR for a given `DefId`, including unreachable code.
|
||||
///
|
||||
/// This is the implementation of hook `build_mir_inner_impl`, which should only
|
||||
/// be called by the query `mir_built`.
|
||||
pub(crate) fn build_mir_inner_impl<'tcx>(tcx: TyCtxt<'tcx>, def: LocalDefId) -> Body<'tcx> {
|
||||
tcx.ensure_done().thir_abstract_const(def);
|
||||
if let Err(e) = tcx.ensure_ok().check_match(def) {
|
||||
return construct_error(tcx, def, e);
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
// The `builder` module used to be named `build`, but that was causing GitHub's
|
||||
// "Go to file" feature to silently ignore all files in the module, probably
|
||||
// because it assumes that "build" is a build-output directory. See #134365.
|
||||
pub mod builder;
|
||||
mod builder;
|
||||
mod check_tail_calls;
|
||||
mod check_unsafety;
|
||||
mod errors;
|
||||
|
|
@ -30,4 +30,5 @@ pub fn provide(providers: &mut Providers) {
|
|||
providers.check_unsafety = check_unsafety::check_unsafety;
|
||||
providers.check_tail_calls = check_tail_calls::check_tail_calls;
|
||||
providers.thir_body = thir::cx::thir_body;
|
||||
providers.hooks.build_mir_inner_impl = builder::build_mir_inner_impl;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ rustc_index = { path = "../rustc_index" }
|
|||
rustc_infer = { path = "../rustc_infer" }
|
||||
rustc_macros = { path = "../rustc_macros" }
|
||||
rustc_middle = { path = "../rustc_middle" }
|
||||
rustc_mir_build = { path = "../rustc_mir_build" }
|
||||
rustc_mir_dataflow = { path = "../rustc_mir_dataflow" }
|
||||
rustc_session = { path = "../rustc_session" }
|
||||
rustc_span = { path = "../rustc_span" }
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@ use rustc_middle::mir::{
|
|||
use rustc_middle::ty::{self, TyCtxt, TypeVisitableExt};
|
||||
use rustc_middle::util::Providers;
|
||||
use rustc_middle::{bug, query, span_bug};
|
||||
use rustc_mir_build::builder::build_mir;
|
||||
use rustc_span::source_map::Spanned;
|
||||
use rustc_span::{DUMMY_SP, sym};
|
||||
use tracing::debug;
|
||||
|
|
@ -378,8 +377,11 @@ fn mir_const_qualif(tcx: TyCtxt<'_>, def: LocalDefId) -> ConstQualifs {
|
|||
validator.qualifs_in_return_place()
|
||||
}
|
||||
|
||||
/// Implementation of the `mir_built` query.
|
||||
fn mir_built(tcx: TyCtxt<'_>, def: LocalDefId) -> &Steal<Body<'_>> {
|
||||
let mut body = build_mir(tcx, def);
|
||||
// Delegate to the main MIR building code in the `rustc_mir_build` crate.
|
||||
// This is the one place that is allowed to call `build_mir_inner_impl`.
|
||||
let mut body = tcx.build_mir_inner_impl(def);
|
||||
|
||||
// Identifying trivial consts based on their mir_built is easy, but a little wasteful.
|
||||
// Trying to push this logic earlier in the compiler and never even produce the Body would
|
||||
|
|
|
|||
|
|
@ -86,8 +86,8 @@ pub trait SolverDelegate: Deref<Target = Self::Infcx> + Sized {
|
|||
|
||||
fn is_transmutable(
|
||||
&self,
|
||||
dst: <Self::Interner as Interner>::Ty,
|
||||
src: <Self::Interner as Interner>::Ty,
|
||||
dst: <Self::Interner as Interner>::Ty,
|
||||
assume: <Self::Interner as Interner>::Const,
|
||||
) -> Result<Certainty, NoSolution>;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1170,8 +1170,8 @@ where
|
|||
|
||||
pub(super) fn is_transmutable(
|
||||
&mut self,
|
||||
dst: I::Ty,
|
||||
src: I::Ty,
|
||||
dst: I::Ty,
|
||||
assume: I::Const,
|
||||
) -> Result<Certainty, NoSolution> {
|
||||
self.delegate.is_transmutable(dst, src, assume)
|
||||
|
|
|
|||
|
|
@ -2283,7 +2283,7 @@ impl<'a> Parser<'a> {
|
|||
self.psess.gated_spans.gate(sym::decl_macro, lo.to(self.prev_token.span));
|
||||
Ok(ItemKind::MacroDef(
|
||||
ident,
|
||||
ast::MacroDef { body, macro_rules: false, eii_extern_target: None },
|
||||
ast::MacroDef { body, macro_rules: false, eii_declaration: None },
|
||||
))
|
||||
}
|
||||
|
||||
|
|
@ -2333,7 +2333,7 @@ impl<'a> Parser<'a> {
|
|||
|
||||
Ok(ItemKind::MacroDef(
|
||||
ident,
|
||||
ast::MacroDef { body, macro_rules: true, eii_extern_target: None },
|
||||
ast::MacroDef { body, macro_rules: true, eii_declaration: None },
|
||||
))
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -461,6 +461,7 @@ impl<'input> Parser<'input> {
|
|||
('?', '}') => self.missing_colon_before_debug_formatter(),
|
||||
('?', _) => self.suggest_format_debug(),
|
||||
('<' | '^' | '>', _) => self.suggest_format_align(c),
|
||||
(',', _) => self.suggest_unsupported_python_numeric_grouping(),
|
||||
_ => self.suggest_positional_arg_instead_of_captured_arg(arg),
|
||||
}
|
||||
}
|
||||
|
|
@ -934,6 +935,27 @@ impl<'input> Parser<'input> {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn suggest_unsupported_python_numeric_grouping(&mut self) {
|
||||
if let Some((range, _)) = self.consume_pos(',') {
|
||||
self.errors.insert(
|
||||
0,
|
||||
ParseError {
|
||||
description:
|
||||
"python's numeric grouping `,` is not supported in rust format strings"
|
||||
.to_owned(),
|
||||
note: Some(format!("to print `{{`, you can escape it using `{{{{`",)),
|
||||
label: "expected `}`".to_owned(),
|
||||
span: range,
|
||||
secondary_label: self
|
||||
.last_open_brace
|
||||
.clone()
|
||||
.map(|sp| ("because of this opening brace".to_owned(), sp)),
|
||||
suggestion: Suggestion::None,
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Assert a reasonable size for `Piece`
|
||||
|
|
|
|||
|
|
@ -224,8 +224,8 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
|||
self.check_rustc_must_implement_one_of(*attr_span, fn_names, hir_id,target)
|
||||
},
|
||||
Attribute::Parsed(
|
||||
AttributeKind::EiiExternTarget { .. }
|
||||
| AttributeKind::EiiExternItem
|
||||
AttributeKind::EiiDeclaration { .. }
|
||||
| AttributeKind::EiiForeignItem
|
||||
| AttributeKind::BodyStability { .. }
|
||||
| AttributeKind::ConstStabilityIndirect
|
||||
| AttributeKind::MacroTransparency(_)
|
||||
|
|
@ -553,7 +553,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
|||
}
|
||||
|
||||
if let EiiImplResolution::Macro(eii_macro) = resolution
|
||||
&& find_attr!(self.tcx.get_all_attrs(*eii_macro), AttributeKind::EiiExternTarget(EiiDecl { impl_unsafe, .. }) if *impl_unsafe)
|
||||
&& find_attr!(self.tcx.get_all_attrs(*eii_macro), AttributeKind::EiiDeclaration(EiiDecl { impl_unsafe, .. }) if *impl_unsafe)
|
||||
&& !impl_marked_unsafe
|
||||
{
|
||||
self.dcx().emit_err(errors::EiiImplRequiresUnsafe {
|
||||
|
|
|
|||
|
|
@ -1079,7 +1079,7 @@ impl<'ast, 'ra, 'tcx> Visitor<'ast> for LateResolutionVisitor<'_, 'ast, 'ra, 'tc
|
|||
self.smart_resolve_path(
|
||||
*node_id,
|
||||
&None,
|
||||
&target.extern_item_path,
|
||||
&target.foreign_item,
|
||||
PathSource::Expr(None),
|
||||
);
|
||||
} else {
|
||||
|
|
@ -2931,8 +2931,8 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
|
|||
self.parent_scope.macro_rules = self.r.macro_rules_scopes[&def_id];
|
||||
}
|
||||
|
||||
if let Some(EiiExternTarget { extern_item_path, impl_unsafe: _ }) =
|
||||
¯o_def.eii_extern_target
|
||||
if let Some(EiiDecl { foreign_item: extern_item_path, impl_unsafe: _ }) =
|
||||
¯o_def.eii_declaration
|
||||
{
|
||||
self.smart_resolve_path(
|
||||
item.id,
|
||||
|
|
|
|||
|
|
@ -935,7 +935,7 @@ symbols! {
|
|||
eh_catch_typeinfo,
|
||||
eh_personality,
|
||||
eii,
|
||||
eii_extern_target,
|
||||
eii_declaration,
|
||||
eii_impl,
|
||||
eii_internals,
|
||||
eii_shared_macro,
|
||||
|
|
@ -1951,7 +1951,7 @@ symbols! {
|
|||
rustc_dump_user_args,
|
||||
rustc_dump_vtable,
|
||||
rustc_effective_visibility,
|
||||
rustc_eii_extern_item,
|
||||
rustc_eii_foreign_item,
|
||||
rustc_evaluate_where_clauses,
|
||||
rustc_expected_cgu_reuse,
|
||||
rustc_force_inline,
|
||||
|
|
|
|||
|
|
@ -2781,11 +2781,6 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
|||
self.tcx.instantiate_bound_regions_with_erased(trait_pred),
|
||||
);
|
||||
|
||||
let src_and_dst = rustc_transmute::Types {
|
||||
dst: trait_pred.trait_ref.args.type_at(0),
|
||||
src: trait_pred.trait_ref.args.type_at(1),
|
||||
};
|
||||
|
||||
let ocx = ObligationCtxt::new(self);
|
||||
let Ok(assume) = ocx.structurally_normalize_const(
|
||||
&obligation.cause,
|
||||
|
|
@ -2812,7 +2807,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
|||
let err_msg = format!("`{src}` cannot be safely transmuted into `{dst}`");
|
||||
|
||||
match rustc_transmute::TransmuteTypeEnv::new(self.infcx.tcx)
|
||||
.is_transmutable(src_and_dst, assume)
|
||||
.is_transmutable(src, dst, assume)
|
||||
{
|
||||
Answer::No(reason) => {
|
||||
let safe_transmute_explanation = match reason {
|
||||
|
|
|
|||
|
|
@ -294,8 +294,8 @@ impl<'tcx> rustc_next_trait_solver::delegate::SolverDelegate for SolverDelegate<
|
|||
// register candidates. We probably need to register >1 since we may have an OR of ANDs.
|
||||
fn is_transmutable(
|
||||
&self,
|
||||
dst: Ty<'tcx>,
|
||||
src: Ty<'tcx>,
|
||||
dst: Ty<'tcx>,
|
||||
assume: ty::Const<'tcx>,
|
||||
) -> Result<Certainty, NoSolution> {
|
||||
// Erase regions because we compute layouts in `rustc_transmute`,
|
||||
|
|
@ -307,9 +307,7 @@ impl<'tcx> rustc_next_trait_solver::delegate::SolverDelegate for SolverDelegate<
|
|||
};
|
||||
|
||||
// FIXME(transmutability): This really should be returning nested goals for `Answer::If*`
|
||||
match rustc_transmute::TransmuteTypeEnv::new(self.0.tcx)
|
||||
.is_transmutable(rustc_transmute::Types { src, dst }, assume)
|
||||
{
|
||||
match rustc_transmute::TransmuteTypeEnv::new(self.0.tcx).is_transmutable(src, dst, assume) {
|
||||
rustc_transmute::Answer::Yes => Ok(Certainty::Yes),
|
||||
rustc_transmute::Answer::No(_) | rustc_transmute::Answer::If(_) => Err(NoSolution),
|
||||
}
|
||||
|
|
|
|||
|
|
@ -365,8 +365,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
|
||||
debug!(?src, ?dst);
|
||||
let mut transmute_env = rustc_transmute::TransmuteTypeEnv::new(self.infcx.tcx);
|
||||
let maybe_transmutable =
|
||||
transmute_env.is_transmutable(rustc_transmute::Types { dst, src }, assume);
|
||||
let maybe_transmutable = transmute_env.is_transmutable(src, dst, assume);
|
||||
|
||||
let fully_flattened = match maybe_transmutable {
|
||||
Answer::No(_) => Err(SelectionError::Unimplemented)?,
|
||||
|
|
|
|||
|
|
@ -93,15 +93,6 @@ mod rustc {
|
|||
|
||||
use super::*;
|
||||
|
||||
/// The source and destination types of a transmutation.
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub struct Types<'tcx> {
|
||||
/// The source type.
|
||||
pub src: Ty<'tcx>,
|
||||
/// The destination type.
|
||||
pub dst: Ty<'tcx>,
|
||||
}
|
||||
|
||||
pub struct TransmuteTypeEnv<'tcx> {
|
||||
tcx: TyCtxt<'tcx>,
|
||||
}
|
||||
|
|
@ -113,13 +104,12 @@ mod rustc {
|
|||
|
||||
pub fn is_transmutable(
|
||||
&mut self,
|
||||
types: Types<'tcx>,
|
||||
src: Ty<'tcx>,
|
||||
dst: Ty<'tcx>,
|
||||
assume: crate::Assume,
|
||||
) -> crate::Answer<Region<'tcx>, Ty<'tcx>> {
|
||||
crate::maybe_transmutable::MaybeTransmutableQuery::new(
|
||||
types.src, types.dst, assume, self.tcx,
|
||||
)
|
||||
.answer()
|
||||
crate::maybe_transmutable::MaybeTransmutableQuery::new(src, dst, assume, self.tcx)
|
||||
.answer()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -222,8 +222,6 @@ fn resolve_associated_item<'tcx>(
|
|||
return Err(guar);
|
||||
}
|
||||
|
||||
let args = tcx.erase_and_anonymize_regions(args);
|
||||
|
||||
// We check that the impl item is compatible with the trait item
|
||||
// because otherwise we may ICE in const eval due to type mismatches,
|
||||
// signature incompatibilities, etc.
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ bitflags::bitflags! {
|
|||
/// Does this have `Projection`?
|
||||
const HAS_TY_PROJECTION = 1 << 10;
|
||||
/// Does this have `Free` aliases?
|
||||
const HAS_TY_FREE_ALIAS = 1 << 11;
|
||||
const HAS_TY_FREE_ALIAS = 1 << 11;
|
||||
/// Does this have `Opaque`?
|
||||
const HAS_TY_OPAQUE = 1 << 12;
|
||||
/// Does this have `Inherent`?
|
||||
|
|
@ -135,7 +135,7 @@ bitflags::bitflags! {
|
|||
const HAS_TY_CORO = 1 << 24;
|
||||
|
||||
/// Does this have have a `Bound(BoundVarIndexKind::Canonical, _)`?
|
||||
const HAS_CANONICAL_BOUND = 1 << 25;
|
||||
const HAS_CANONICAL_BOUND = 1 << 25;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1912,7 +1912,7 @@ pub(crate) mod builtin {
|
|||
/// Impl detail of EII
|
||||
#[unstable(feature = "eii_internals", issue = "none")]
|
||||
#[rustc_builtin_macro]
|
||||
pub macro eii_extern_target($item:item) {
|
||||
pub macro eii_declaration($item:item) {
|
||||
/* compiler built-in */
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -122,4 +122,4 @@ pub use crate::macros::builtin::define_opaque;
|
|||
pub use crate::macros::builtin::{eii, unsafe_eii};
|
||||
|
||||
#[unstable(feature = "eii_internals", issue = "none")]
|
||||
pub use crate::macros::builtin::eii_extern_target;
|
||||
pub use crate::macros::builtin::eii_declaration;
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ pub use core::prelude::v1::define_opaque;
|
|||
pub use core::prelude::v1::{eii, unsafe_eii};
|
||||
|
||||
#[unstable(feature = "eii_internals", issue = "none")]
|
||||
pub use core::prelude::v1::eii_extern_target;
|
||||
pub use core::prelude::v1::eii_declaration;
|
||||
|
||||
// The file so far is equivalent to core/src/prelude/v1.rs. It is duplicated
|
||||
// rather than glob imported because we want docs to show these re-exports as
|
||||
|
|
|
|||
|
|
@ -248,7 +248,7 @@ impl Tcp4 {
|
|||
fragment_table: [fragment],
|
||||
};
|
||||
|
||||
self.read_inner((&raw mut rx_data).cast(), timeout).map(|_| data_len as usize)
|
||||
self.read_inner((&raw mut rx_data).cast(), timeout)
|
||||
}
|
||||
|
||||
pub(crate) fn read_vectored(
|
||||
|
|
@ -288,14 +288,14 @@ impl Tcp4 {
|
|||
);
|
||||
};
|
||||
|
||||
self.read_inner(rx_data.as_mut_ptr(), timeout).map(|_| data_length as usize)
|
||||
self.read_inner(rx_data.as_mut_ptr(), timeout)
|
||||
}
|
||||
|
||||
pub(crate) fn read_inner(
|
||||
&self,
|
||||
rx_data: *mut tcp4::ReceiveData,
|
||||
timeout: Option<Duration>,
|
||||
) -> io::Result<()> {
|
||||
) -> io::Result<usize> {
|
||||
let evt = unsafe { self.create_evt() }?;
|
||||
let completion_token =
|
||||
tcp4::CompletionToken { event: evt.as_ptr(), status: Status::SUCCESS };
|
||||
|
|
@ -313,7 +313,8 @@ impl Tcp4 {
|
|||
if completion_token.status.is_error() {
|
||||
Err(io::Error::from_raw_os_error(completion_token.status.as_usize()))
|
||||
} else {
|
||||
Ok(())
|
||||
let data_length = unsafe { (*rx_data).data_length };
|
||||
Ok(data_length as usize)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -55,7 +55,8 @@ try_failed = [
|
|||
"-S-waiting-on-crater"
|
||||
]
|
||||
auto_build_succeeded = [
|
||||
"+merged-by-bors"
|
||||
"+merged-by-bors",
|
||||
"-S-waiting-on-bors"
|
||||
]
|
||||
auto_build_failed = [
|
||||
"+S-waiting-on-review",
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ use rustc_errors::{Applicability, Diag};
|
|||
use rustc_hir::intravisit::{Visitor, walk_expr};
|
||||
use rustc_hir::{Arm, Expr, ExprKind, MatchSource};
|
||||
use rustc_lint::{LateContext, LintContext};
|
||||
use rustc_middle::ty::{GenericArgKind, Region, RegionKind, Ty, TyCtxt, TypeVisitable, TypeVisitor};
|
||||
use rustc_middle::ty::{GenericArgKind, RegionKind, Ty, TypeVisitableExt};
|
||||
use rustc_span::Span;
|
||||
|
||||
use super::SIGNIFICANT_DROP_IN_SCRUTINEE;
|
||||
|
|
@ -303,13 +303,13 @@ impl<'a, 'tcx> SigDropHelper<'a, 'tcx> {
|
|||
|
||||
if self.sig_drop_holder != SigDropHolder::None {
|
||||
let parent_ty = self.cx.typeck_results().expr_ty(parent_expr);
|
||||
if !ty_has_erased_regions(parent_ty) && !parent_expr.is_syntactic_place_expr() {
|
||||
if !parent_ty.has_erased_regions() && !parent_expr.is_syntactic_place_expr() {
|
||||
self.replace_current_sig_drop(parent_expr.span, parent_ty.is_unit(), 0);
|
||||
self.sig_drop_holder = SigDropHolder::Moved;
|
||||
}
|
||||
|
||||
let (peel_ref_ty, peel_ref_times) = ty_peel_refs(parent_ty);
|
||||
if !ty_has_erased_regions(peel_ref_ty) && is_copy(self.cx, peel_ref_ty) {
|
||||
if !peel_ref_ty.has_erased_regions() && is_copy(self.cx, peel_ref_ty) {
|
||||
self.replace_current_sig_drop(parent_expr.span, peel_ref_ty.is_unit(), peel_ref_times);
|
||||
self.sig_drop_holder = SigDropHolder::Moved;
|
||||
}
|
||||
|
|
@ -399,24 +399,6 @@ fn ty_peel_refs(mut ty: Ty<'_>) -> (Ty<'_>, usize) {
|
|||
(ty, n)
|
||||
}
|
||||
|
||||
fn ty_has_erased_regions(ty: Ty<'_>) -> bool {
|
||||
struct V;
|
||||
|
||||
impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for V {
|
||||
type Result = ControlFlow<()>;
|
||||
|
||||
fn visit_region(&mut self, region: Region<'tcx>) -> Self::Result {
|
||||
if region.is_erased() {
|
||||
ControlFlow::Break(())
|
||||
} else {
|
||||
ControlFlow::Continue(())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ty.visit_with(&mut V).is_break()
|
||||
}
|
||||
|
||||
impl<'tcx> Visitor<'tcx> for SigDropHelper<'_, 'tcx> {
|
||||
fn visit_expr(&mut self, ex: &'tcx Expr<'_>) {
|
||||
// We've emitted a lint on some neighborhood expression. That lint will suggest to move out the
|
||||
|
|
|
|||
|
|
@ -232,8 +232,8 @@ impl<'db> SolverDelegate for SolverContext<'db> {
|
|||
|
||||
fn is_transmutable(
|
||||
&self,
|
||||
_dst: Ty<'db>,
|
||||
_src: Ty<'db>,
|
||||
_dst: Ty<'db>,
|
||||
_assume: <Self::Interner as rustc_type_ir::Interner>::Const,
|
||||
) -> Result<Certainty, NoSolution> {
|
||||
// It's better to return some value while not fully implement
|
||||
|
|
|
|||
|
|
@ -1,23 +1,23 @@
|
|||
error: complex const arguments must be placed inside of a `const` block
|
||||
--> $DIR/adt_expr_arg_tuple_expr_complex.rs:13:25
|
||||
--> $DIR/tuple_expr_arg_complex.rs:13:25
|
||||
|
|
||||
LL | takes_tuple::<{ (N, N + 1) }>();
|
||||
| ^^^^^
|
||||
|
||||
error: complex const arguments must be placed inside of a `const` block
|
||||
--> $DIR/adt_expr_arg_tuple_expr_complex.rs:14:25
|
||||
--> $DIR/tuple_expr_arg_complex.rs:14:25
|
||||
|
|
||||
LL | takes_tuple::<{ (N, T::ASSOC + 1) }>();
|
||||
| ^^^^^^^^^^^^
|
||||
|
||||
error: complex const arguments must be placed inside of a `const` block
|
||||
--> $DIR/adt_expr_arg_tuple_expr_complex.rs:16:36
|
||||
--> $DIR/tuple_expr_arg_complex.rs:16:36
|
||||
|
|
||||
LL | takes_nested_tuple::<{ (N, (N, N + 1)) }>();
|
||||
| ^^^^^
|
||||
|
||||
error: generic parameters may not be used in const operations
|
||||
--> $DIR/adt_expr_arg_tuple_expr_complex.rs:17:44
|
||||
--> $DIR/tuple_expr_arg_complex.rs:17:44
|
||||
|
|
||||
LL | takes_nested_tuple::<{ (N, (N, const { N + 1 })) }>();
|
||||
| ^
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
#![feature(min_generic_const_args)]
|
||||
#![expect(incomplete_features)]
|
||||
|
||||
pub fn takes_nested_tuple<const N: u32>() {
|
||||
takes_nested_tuple::<{ () }> //~ ERROR expected `u32`, found const tuple
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
error: expected `u32`, found const tuple
|
||||
--> $DIR/tuple_expr_arg_mismatch_type.rs:5:28
|
||||
|
|
||||
LL | takes_nested_tuple::<{ () }>
|
||||
| ^^
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
21
tests/ui/delegation/ice-issue-150673.rs
Normal file
21
tests/ui/delegation/ice-issue-150673.rs
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#![feature(fn_delegation)]
|
||||
#![allow(incomplete_features)]
|
||||
|
||||
mod to_reuse {
|
||||
pub fn foo<T>() -> T {
|
||||
unimplemented!()
|
||||
}
|
||||
}
|
||||
|
||||
struct S<T>(T);
|
||||
|
||||
trait Trait {
|
||||
reuse to_reuse::foo;
|
||||
}
|
||||
|
||||
impl Trait for S {
|
||||
//~^ ERROR: missing generics for struct `S`
|
||||
reuse Trait::foo;
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
19
tests/ui/delegation/ice-issue-150673.stderr
Normal file
19
tests/ui/delegation/ice-issue-150673.stderr
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
error[E0107]: missing generics for struct `S`
|
||||
--> $DIR/ice-issue-150673.rs:16:16
|
||||
|
|
||||
LL | impl Trait for S {
|
||||
| ^ expected 1 generic argument
|
||||
|
|
||||
note: struct defined here, with 1 generic parameter: `T`
|
||||
--> $DIR/ice-issue-150673.rs:10:8
|
||||
|
|
||||
LL | struct S<T>(T);
|
||||
| ^ -
|
||||
help: add missing generic argument
|
||||
|
|
||||
LL | impl Trait for S<T> {
|
||||
| +++
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0107`.
|
||||
|
|
@ -5,19 +5,19 @@
|
|||
#![feature(rustc_attrs)]
|
||||
#![feature(eii_internals)]
|
||||
|
||||
#[eii_extern_target(bar)] //~ ERROR `#[eii_extern_target(...)]` is only valid on macros
|
||||
#[eii_declaration(bar)] //~ ERROR `#[eii_declaration(...)]` is only valid on macros
|
||||
fn hello() {
|
||||
#[eii_extern_target(bar)] //~ ERROR `#[eii_extern_target(...)]` is only valid on macros
|
||||
#[eii_declaration(bar)] //~ ERROR `#[eii_declaration(...)]` is only valid on macros
|
||||
let x = 3 + 3;
|
||||
}
|
||||
|
||||
#[eii_extern_target] //~ ERROR `#[eii_extern_target(...)]` expects a list of one or two elements
|
||||
#[eii_extern_target()] //~ ERROR `#[eii_extern_target(...)]` expects a list of one or two elements
|
||||
#[eii_extern_target(bar, hello)] //~ ERROR expected this argument to be "unsafe"
|
||||
#[eii_extern_target(bar, "unsafe", hello)] //~ ERROR `#[eii_extern_target(...)]` expects a list of one or two elements
|
||||
#[eii_extern_target(bar, hello, "unsafe")] //~ ERROR `#[eii_extern_target(...)]` expects a list of one or two elements
|
||||
#[eii_extern_target = "unsafe"] //~ ERROR `#[eii_extern_target(...)]` expects a list of one or two elements
|
||||
#[eii_extern_target(bar)]
|
||||
#[eii_declaration] //~ ERROR `#[eii_declaration(...)]` expects a list of one or two elements
|
||||
#[eii_declaration()] //~ ERROR `#[eii_declaration(...)]` expects a list of one or two elements
|
||||
#[eii_declaration(bar, hello)] //~ ERROR expected this argument to be "unsafe"
|
||||
#[eii_declaration(bar, "unsafe", hello)] //~ ERROR `#[eii_declaration(...)]` expects a list of one or two elements
|
||||
#[eii_declaration(bar, hello, "unsafe")] //~ ERROR `#[eii_declaration(...)]` expects a list of one or two elements
|
||||
#[eii_declaration = "unsafe"] //~ ERROR `#[eii_declaration(...)]` expects a list of one or two elements
|
||||
#[eii_declaration(bar)]
|
||||
#[rustc_builtin_macro(eii_shared_macro)]
|
||||
macro foo() {}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,56 +1,56 @@
|
|||
error: `#[eii_extern_target(...)]` is only valid on macros
|
||||
error: `#[eii_declaration(...)]` is only valid on macros
|
||||
--> $DIR/errors.rs:8:1
|
||||
|
|
||||
LL | #[eii_extern_target(bar)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | #[eii_declaration(bar)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: `#[eii_extern_target(...)]` is only valid on macros
|
||||
error: `#[eii_declaration(...)]` is only valid on macros
|
||||
--> $DIR/errors.rs:10:5
|
||||
|
|
||||
LL | #[eii_extern_target(bar)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | #[eii_declaration(bar)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: `#[eii_extern_target(...)]` expects a list of one or two elements
|
||||
error: `#[eii_declaration(...)]` expects a list of one or two elements
|
||||
--> $DIR/errors.rs:14:1
|
||||
|
|
||||
LL | #[eii_extern_target]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
LL | #[eii_declaration]
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: `#[eii_extern_target(...)]` expects a list of one or two elements
|
||||
error: `#[eii_declaration(...)]` expects a list of one or two elements
|
||||
--> $DIR/errors.rs:15:1
|
||||
|
|
||||
LL | #[eii_extern_target()]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | #[eii_declaration()]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: expected this argument to be "unsafe"
|
||||
--> $DIR/errors.rs:16:26
|
||||
--> $DIR/errors.rs:16:24
|
||||
|
|
||||
LL | #[eii_extern_target(bar, hello)]
|
||||
| ^^^^^
|
||||
LL | #[eii_declaration(bar, hello)]
|
||||
| ^^^^^
|
||||
|
|
||||
note: the second argument is optional
|
||||
--> $DIR/errors.rs:16:26
|
||||
--> $DIR/errors.rs:16:24
|
||||
|
|
||||
LL | #[eii_extern_target(bar, hello)]
|
||||
| ^^^^^
|
||||
LL | #[eii_declaration(bar, hello)]
|
||||
| ^^^^^
|
||||
|
||||
error: `#[eii_extern_target(...)]` expects a list of one or two elements
|
||||
error: `#[eii_declaration(...)]` expects a list of one or two elements
|
||||
--> $DIR/errors.rs:17:1
|
||||
|
|
||||
LL | #[eii_extern_target(bar, "unsafe", hello)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | #[eii_declaration(bar, "unsafe", hello)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: `#[eii_extern_target(...)]` expects a list of one or two elements
|
||||
error: `#[eii_declaration(...)]` expects a list of one or two elements
|
||||
--> $DIR/errors.rs:18:1
|
||||
|
|
||||
LL | #[eii_extern_target(bar, hello, "unsafe")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | #[eii_declaration(bar, hello, "unsafe")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: `#[eii_extern_target(...)]` expects a list of one or two elements
|
||||
error: `#[eii_declaration(...)]` expects a list of one or two elements
|
||||
--> $DIR/errors.rs:19:1
|
||||
|
|
||||
LL | #[eii_extern_target = "unsafe"]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | #[eii_declaration = "unsafe"]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: `#[foo]` is only valid on functions
|
||||
--> $DIR/errors.rs:28:1
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
#![feature(rustc_attrs)]
|
||||
#![feature(eii_internals)]
|
||||
|
||||
#[eii_extern_target(bar)]
|
||||
#[eii_declaration(bar)]
|
||||
#[rustc_builtin_macro(eii_shared_macro)]
|
||||
pub macro foo() {}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
#![feature(rustc_attrs)]
|
||||
#![feature(eii_internals)]
|
||||
|
||||
#[eii_extern_target(bar)]
|
||||
#[eii_declaration(bar)]
|
||||
#[rustc_builtin_macro(eii_shared_macro)]
|
||||
macro foo() {}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
#![feature(rustc_attrs)]
|
||||
#![feature(eii_internals)]
|
||||
|
||||
#[eii_extern_target(bar)]
|
||||
#[eii_declaration(bar)]
|
||||
#[rustc_builtin_macro(eii_shared_macro)]
|
||||
macro foo() {}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
#![feature(rustc_attrs)]
|
||||
#![feature(eii_internals)]
|
||||
|
||||
#[eii_extern_target(bar)]
|
||||
#[eii_declaration(bar)]
|
||||
#[rustc_builtin_macro(eii_shared_macro)]
|
||||
macro foo() {}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
#![feature(rustc_attrs)]
|
||||
#![feature(eii_internals)]
|
||||
|
||||
#[eii_extern_target(bar)]
|
||||
#[eii_declaration(bar)]
|
||||
#[rustc_builtin_macro(eii_shared_macro)]
|
||||
macro foo() {}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
#![feature(rustc_attrs)]
|
||||
#![feature(eii_internals)]
|
||||
|
||||
#[eii_extern_target(bar)]
|
||||
#[eii_declaration(bar)]
|
||||
#[rustc_builtin_macro(eii_shared_macro)]
|
||||
macro foo() {}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
#![feature(rustc_attrs)]
|
||||
#![feature(eii_internals)]
|
||||
|
||||
#[eii_extern_target(bar)]
|
||||
#[eii_declaration(bar)]
|
||||
#[rustc_builtin_macro(eii_shared_macro)]
|
||||
macro foo() {}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
#![feature(rustc_attrs)]
|
||||
#![feature(eii_internals)]
|
||||
|
||||
#[eii_extern_target(bar)]
|
||||
#[eii_declaration(bar)]
|
||||
#[rustc_builtin_macro(eii_shared_macro)]
|
||||
macro foo() {}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
#![feature(rustc_attrs)]
|
||||
#![feature(eii_internals)]
|
||||
|
||||
#[eii_extern_target(bar, "unsafe")]
|
||||
#[eii_declaration(bar, "unsafe")]
|
||||
#[rustc_builtin_macro(eii_shared_macro)]
|
||||
macro foo() {}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
#![feature(rustc_attrs)]
|
||||
#![feature(eii_internals)]
|
||||
|
||||
#[eii_extern_target(bar, "unsafe")]
|
||||
#[eii_declaration(bar, "unsafe")]
|
||||
#[rustc_builtin_macro(eii_shared_macro)]
|
||||
macro foo() {}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#![feature(decl_macro)]
|
||||
#![feature(rustc_attrs)]
|
||||
|
||||
#[eii_extern_target(bar)] //~ ERROR use of unstable library feature `eii_internals`
|
||||
#[eii_declaration(bar)] //~ ERROR use of unstable library feature `eii_internals`
|
||||
#[rustc_builtin_macro(eii_macro)]
|
||||
macro foo() {} //~ ERROR: cannot find a built-in macro with name `foo`
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
error[E0658]: use of unstable library feature `eii_internals`
|
||||
--> $DIR/feature-gate-eii-internals.rs:5:3
|
||||
|
|
||||
LL | #[eii_extern_target(bar)]
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
LL | #[eii_declaration(bar)]
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: add `#![feature(eii_internals)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
|
|
|||
|
|
@ -86,4 +86,6 @@ raw { \n
|
|||
|
||||
println!("{x?}, world!",);
|
||||
//~^ ERROR invalid format string: expected `}`, found `?`
|
||||
println!("{x,}, world!",);
|
||||
//~^ ERROR invalid format string: python's numeric grouping `,` is not supported in rust format strings
|
||||
}
|
||||
|
|
|
|||
|
|
@ -188,5 +188,15 @@ LL | println!("{x?}, world!",);
|
|||
|
|
||||
= note: to print `{`, you can escape it using `{{`
|
||||
|
||||
error: aborting due to 19 previous errors
|
||||
error: invalid format string: python's numeric grouping `,` is not supported in rust format strings
|
||||
--> $DIR/format-string-error-2.rs:89:17
|
||||
|
|
||||
LL | println!("{x,}, world!",);
|
||||
| - ^ expected `}` in format string
|
||||
| |
|
||||
| because of this opening brace
|
||||
|
|
||||
= note: to print `{`, you can escape it using `{{`
|
||||
|
||||
error: aborting due to 20 previous errors
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue