authorbors <bors@rust-lang.org> 2026-01-12 16:43:20 UTC
committerbors <bors@rust-lang.org> 2026-01-12 16:43:20 UTC
logaefa10405d7b67b3780027484cb02c85d3a3bf36
tree6e2d101397ca5f9eabe717bb052a58eafa215b01
parent137716908d561bfcf0341701ec13a28326926c82
parentdb4c095147b97c28de43dd562f6611add006df89

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

74 files changed, 350 insertions(+), 299 deletions(-)

Cargo.lock-1
......@@ -4360,7 +4360,6 @@ dependencies = [
43604360 "rustc_infer",
43614361 "rustc_macros",
43624362 "rustc_middle",
4363 "rustc_mir_build",
43644363 "rustc_mir_dataflow",
43654364 "rustc_session",
43664365 "rustc_span",
compiler/rustc_ast/src/ast.rs+9-7
......@@ -2109,16 +2109,18 @@ pub struct MacroDef {
21092109 /// `true` if macro was defined with `macro_rules`.
21102110 pub macro_rules: bool,
21112111
2112 /// If this is a macro used for externally implementable items,
2113 /// it refers to an extern item which is its "target". This requires
2114 /// name resolution so can't just be an attribute, so we store it in this field.
2115 pub eii_extern_target: Option<EiiExternTarget>,
2112 /// Corresponds to `#[eii_declaration(...)]`.
2113 /// `#[eii_declaration(...)]` is a built-in attribute macro, not a built-in attribute,
2114 /// because we require some name resolution to occur in the parameters of this attribute.
2115 /// Name resolution isn't possible in attributes otherwise, so we encode it in the AST.
2116 /// During ast lowering, we turn it back into an attribute again
2117 pub eii_declaration: Option<EiiDecl>,
21162118}
21172119
21182120#[derive(Clone, Encodable, Decodable, Debug, HashStable_Generic, Walkable)]
2119pub struct EiiExternTarget {
2121pub struct EiiDecl {
21202122 /// path to the extern item we're targeting
2121 pub extern_item_path: Path,
2123 pub foreign_item: Path,
21222124 pub impl_unsafe: bool,
21232125}
21242126
......@@ -3824,7 +3826,7 @@ pub struct EiiImpl {
38243826 ///
38253827 /// This field is that shortcut: we prefill the extern target to skip a name resolution step,
38263828 /// making sure it never fails. It'd be awful UX if we fail name resolution in code invisible to the user.
3827 pub known_eii_macro_resolution: Option<EiiExternTarget>,
3829 pub known_eii_macro_resolution: Option<EiiDecl>,
38283830 pub impl_safety: Safety,
38293831 pub span: Span,
38303832 pub inner_span: Span,
compiler/rustc_ast/src/visit.rs+1-1
......@@ -489,7 +489,7 @@ macro_rules! common_visitor_and_walkers {
489489 WhereEqPredicate,
490490 WhereRegionPredicate,
491491 YieldKind,
492 EiiExternTarget,
492 EiiDecl,
493493 EiiImpl,
494494 );
495495
compiler/rustc_ast_lowering/src/item.rs+16-19
......@@ -2,7 +2,7 @@ use rustc_abi::ExternAbi;
22use rustc_ast::visit::AssocCtxt;
33use rustc_ast::*;
44use rustc_errors::{E0570, ErrorGuaranteed, struct_span_code_err};
5use rustc_hir::attrs::{AttributeKind, EiiDecl, EiiImplResolution};
5use rustc_hir::attrs::{AttributeKind, EiiImplResolution};
66use rustc_hir::def::{DefKind, PerNS, Res};
77use rustc_hir::def_id::{CRATE_DEF_ID, LocalDefId};
88use rustc_hir::{
......@@ -134,16 +134,16 @@ impl<'hir> LoweringContext<'_, 'hir> {
134134 }
135135 }
136136
137 fn lower_eii_extern_target(
137 fn lower_eii_decl(
138138 &mut self,
139139 id: NodeId,
140 eii_name: Ident,
141 EiiExternTarget { extern_item_path, impl_unsafe }: &EiiExternTarget,
142 ) -> Option<EiiDecl> {
143 self.lower_path_simple_eii(id, extern_item_path).map(|did| EiiDecl {
144 eii_extern_target: did,
140 name: Ident,
141 EiiDecl { foreign_item, impl_unsafe }: &EiiDecl,
142 ) -> Option<hir::attrs::EiiDecl> {
143 self.lower_path_simple_eii(id, foreign_item).map(|did| hir::attrs::EiiDecl {
144 foreign_item: did,
145145 impl_unsafe: *impl_unsafe,
146 name: eii_name,
146 name,
147147 })
148148 }
149149
......@@ -160,7 +160,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
160160 }: &EiiImpl,
161161 ) -> hir::attrs::EiiImpl {
162162 let resolution = if let Some(target) = known_eii_macro_resolution
163 && let Some(decl) = self.lower_eii_extern_target(
163 && let Some(decl) = self.lower_eii_decl(
164164 *node_id,
165165 // the expect is ok here since we always generate this path in the eii macro.
166166 eii_macro_path.segments.last().expect("at least one segment").ident,
......@@ -196,9 +196,9 @@ impl<'hir> LoweringContext<'_, 'hir> {
196196 eii_impls.iter().map(|i| self.lower_eii_impl(i)).collect(),
197197 ))]
198198 }
199 ItemKind::MacroDef(name, MacroDef { eii_extern_target: Some(target), .. }) => self
200 .lower_eii_extern_target(id, *name, target)
201 .map(|decl| vec![hir::Attribute::Parsed(AttributeKind::EiiExternTarget(decl))])
199 ItemKind::MacroDef(name, MacroDef { eii_declaration: Some(target), .. }) => self
200 .lower_eii_decl(id, *name, target)
201 .map(|decl| vec![hir::Attribute::Parsed(AttributeKind::EiiDeclaration(decl))])
202202 .unwrap_or_default(),
203203
204204 ItemKind::ExternCrate(..)
......@@ -242,10 +242,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
242242 vis_span,
243243 span: self.lower_span(i.span),
244244 has_delayed_lints: !self.delayed_lints.is_empty(),
245 eii: find_attr!(
246 attrs,
247 AttributeKind::EiiImpls(..) | AttributeKind::EiiExternTarget(..)
248 ),
245 eii: find_attr!(attrs, AttributeKind::EiiImpls(..) | AttributeKind::EiiDeclaration(..)),
249246 };
250247 self.arena.alloc(item)
251248 }
......@@ -539,7 +536,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
539536 );
540537 hir::ItemKind::TraitAlias(constness, ident, generics, bounds)
541538 }
542 ItemKind::MacroDef(ident, MacroDef { body, macro_rules, eii_extern_target: _ }) => {
539 ItemKind::MacroDef(ident, MacroDef { body, macro_rules, eii_declaration: _ }) => {
543540 let ident = self.lower_ident(*ident);
544541 let body = Box::new(self.lower_delim_args(body));
545542 let def_id = self.local_def_id(id);
......@@ -553,7 +550,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
553550 let macro_def = self.arena.alloc(ast::MacroDef {
554551 body,
555552 macro_rules: *macro_rules,
556 eii_extern_target: None,
553 eii_declaration: None,
557554 });
558555 hir::ItemKind::Macro(ident, macro_def, macro_kinds)
559556 }
......@@ -693,7 +690,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
693690 has_delayed_lints: !this.delayed_lints.is_empty(),
694691 eii: find_attr!(
695692 attrs,
696 AttributeKind::EiiImpls(..) | AttributeKind::EiiExternTarget(..)
693 AttributeKind::EiiImpls(..) | AttributeKind::EiiDeclaration(..)
697694 ),
698695 };
699696 hir::OwnerNode::Item(this.arena.alloc(item))
compiler/rustc_ast_pretty/src/pprust/state.rs+4-4
......@@ -865,10 +865,10 @@ pub trait PrintState<'a>: std::ops::Deref<Target = pp::Printer> + std::ops::Dere
865865 sp: Span,
866866 print_visibility: impl FnOnce(&mut Self),
867867 ) {
868 if let Some(eii_extern_target) = &macro_def.eii_extern_target {
869 self.word("#[eii_extern_target(");
870 self.print_path(&eii_extern_target.extern_item_path, false, 0);
871 if eii_extern_target.impl_unsafe {
868 if let Some(eii_decl) = &macro_def.eii_declaration {
869 self.word("#[eii_declaration(");
870 self.print_path(&eii_decl.foreign_item, false, 0);
871 if eii_decl.impl_unsafe {
872872 self.word(",");
873873 self.space();
874874 self.word("unsafe");
compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs+4-4
......@@ -709,11 +709,11 @@ impl<S: Stage> NoArgsAttributeParser<S> for RustcPassIndirectlyInNonRusticAbisPa
709709 const CREATE: fn(Span) -> AttributeKind = AttributeKind::RustcPassIndirectlyInNonRusticAbis;
710710}
711711
712pub(crate) struct EiiExternItemParser;
712pub(crate) struct EiiForeignItemParser;
713713
714impl<S: Stage> NoArgsAttributeParser<S> for EiiExternItemParser {
715 const PATH: &[Symbol] = &[sym::rustc_eii_extern_item];
714impl<S: Stage> NoArgsAttributeParser<S> for EiiForeignItemParser {
715 const PATH: &[Symbol] = &[sym::rustc_eii_foreign_item];
716716 const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
717717 const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::ForeignFn)]);
718 const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::EiiExternItem;
718 const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::EiiForeignItem;
719719}
compiler/rustc_attr_parsing/src/context.rs+2-2
......@@ -21,7 +21,7 @@ use crate::attributes::allow_unstable::{
2121use crate::attributes::body::CoroutineParser;
2222use crate::attributes::cfi_encoding::CfiEncodingParser;
2323use crate::attributes::codegen_attrs::{
24 ColdParser, CoverageParser, EiiExternItemParser, ExportNameParser, ForceTargetFeatureParser,
24 ColdParser, CoverageParser, EiiForeignItemParser, ExportNameParser, ForceTargetFeatureParser,
2525 NakedParser, NoMangleParser, ObjcClassParser, ObjcSelectorParser, OptimizeParser,
2626 RustcPassIndirectlyInNonRusticAbisParser, SanitizeParser, TargetFeatureParser,
2727 ThreadLocalParser, TrackCallerParser, UsedParser,
......@@ -243,7 +243,7 @@ attribute_parsers!(
243243 Single<WithoutArgs<CoroutineParser>>,
244244 Single<WithoutArgs<DenyExplicitImplParser>>,
245245 Single<WithoutArgs<DoNotImplementViaObjectParser>>,
246 Single<WithoutArgs<EiiExternItemParser>>,
246 Single<WithoutArgs<EiiForeignItemParser>>,
247247 Single<WithoutArgs<ExportStableParser>>,
248248 Single<WithoutArgs<FfiConstParser>>,
249249 Single<WithoutArgs<FfiPureParser>>,
compiler/rustc_builtin_macros/messages.ftl+3-3
......@@ -151,9 +151,9 @@ builtin_macros_derive_path_args_value = traits in `#[derive(...)]` don't accept
151151
152152builtin_macros_duplicate_macro_attribute = duplicated attribute
153153
154builtin_macros_eii_extern_target_expected_list = `#[eii_extern_target(...)]` expects a list of one or two elements
155builtin_macros_eii_extern_target_expected_macro = `#[eii_extern_target(...)]` is only valid on macros
156builtin_macros_eii_extern_target_expected_unsafe = expected this argument to be "unsafe"
154builtin_macros_eii_declaration_expected_list = `#[eii_declaration(...)]` expects a list of one or two elements
155builtin_macros_eii_declaration_expected_macro = `#[eii_declaration(...)]` is only valid on macros
156builtin_macros_eii_declaration_expected_unsafe = expected this argument to be "unsafe"
157157 .note = the second argument is optional
158158
159159builtin_macros_eii_only_once = `#[{$name}]` can only be specified once
compiler/rustc_builtin_macros/src/eii.rs+12-12
......@@ -1,7 +1,7 @@
11use rustc_ast::token::{Delimiter, TokenKind};
22use rustc_ast::tokenstream::{DelimSpacing, DelimSpan, Spacing, TokenStream, TokenTree};
33use rustc_ast::{
4 Attribute, DUMMY_NODE_ID, EiiExternTarget, EiiImpl, ItemKind, MetaItem, Path, Stmt, StmtKind,
4 Attribute, DUMMY_NODE_ID, EiiDecl, EiiImpl, ItemKind, MetaItem, Path, Stmt, StmtKind,
55 Visibility, ast,
66};
77use rustc_ast_pretty::pprust::path_to_string;
......@@ -30,7 +30,7 @@ use crate::errors::{
3030/// }
3131///
3232/// #[rustc_builtin_macro(eii_shared_macro)]
33/// #[eii_extern_target(panic_handler)]
33/// #[eii_declaration(panic_handler)]
3434/// macro panic_handler() {}
3535/// ```
3636pub(crate) fn eii(
......@@ -210,8 +210,8 @@ fn generate_default_impl(
210210 },
211211 span: eii_attr_span,
212212 is_default: true,
213 known_eii_macro_resolution: Some(ast::EiiExternTarget {
214 extern_item_path: ecx.path(
213 known_eii_macro_resolution: Some(ast::EiiDecl {
214 foreign_item: ecx.path(
215215 foreign_item_name.span,
216216 // prefix super to escape the `dflt` module generated below
217217 vec![Ident::from_str_and_span("super", foreign_item_name.span), foreign_item_name],
......@@ -295,9 +295,9 @@ fn generate_foreign_item(
295295 let mut foreign_item_attrs = ThinVec::new();
296296 foreign_item_attrs.extend_from_slice(attrs_from_decl);
297297
298 // Add the rustc_eii_extern_item on the foreign item. Usually, foreign items are mangled.
298 // Add the rustc_eii_foreign_item on the foreign item. Usually, foreign items are mangled.
299299 // This attribute makes sure that we later know that this foreign item's symbol should not be.
300 foreign_item_attrs.push(ecx.attr_word(sym::rustc_eii_extern_item, eii_attr_span));
300 foreign_item_attrs.push(ecx.attr_word(sym::rustc_eii_foreign_item, eii_attr_span));
301301
302302 let abi = match func.sig.header.ext {
303303 // extern "X" fn => extern "X" {}
......@@ -349,7 +349,7 @@ fn generate_foreign_item(
349349/// // This attribute tells the compiler that
350350/// #[builtin_macro(eii_shared_macro)]
351351/// // the metadata to link this macro to the generated foreign item.
352/// #[eii_extern_target(<related_reign_item>)]
352/// #[eii_declaration(<related_foreign_item>)]
353353/// macro macro_name { () => {} }
354354/// ```
355355fn generate_attribute_macro_to_implement(
......@@ -401,9 +401,9 @@ fn generate_attribute_macro_to_implement(
401401 ]),
402402 }),
403403 macro_rules: false,
404 // #[eii_extern_target(foreign_item_ident)]
405 eii_extern_target: Some(ast::EiiExternTarget {
406 extern_item_path: ast::Path::from_ident(foreign_item_name),
404 // #[eii_declaration(foreign_item_ident)]
405 eii_declaration: Some(ast::EiiDecl {
406 foreign_item: ast::Path::from_ident(foreign_item_name),
407407 impl_unsafe,
408408 }),
409409 },
......@@ -412,7 +412,7 @@ fn generate_attribute_macro_to_implement(
412412 })
413413}
414414
415pub(crate) fn eii_extern_target(
415pub(crate) fn eii_declaration(
416416 ecx: &mut ExtCtxt<'_>,
417417 span: Span,
418418 meta_item: &ast::MetaItem,
......@@ -461,7 +461,7 @@ pub(crate) fn eii_extern_target(
461461 false
462462 };
463463
464 d.eii_extern_target = Some(EiiExternTarget { extern_item_path, impl_unsafe });
464 d.eii_declaration = Some(EiiDecl { foreign_item: extern_item_path, impl_unsafe });
465465
466466 // Return the original item and the new methods.
467467 vec![item]
compiler/rustc_builtin_macros/src/errors.rs+3-3
......@@ -1010,21 +1010,21 @@ pub(crate) struct CfgSelectUnreachable {
10101010}
10111011
10121012#[derive(Diagnostic)]
1013#[diag(builtin_macros_eii_extern_target_expected_macro)]
1013#[diag(builtin_macros_eii_declaration_expected_macro)]
10141014pub(crate) struct EiiExternTargetExpectedMacro {
10151015 #[primary_span]
10161016 pub span: Span,
10171017}
10181018
10191019#[derive(Diagnostic)]
1020#[diag(builtin_macros_eii_extern_target_expected_list)]
1020#[diag(builtin_macros_eii_declaration_expected_list)]
10211021pub(crate) struct EiiExternTargetExpectedList {
10221022 #[primary_span]
10231023 pub span: Span,
10241024}
10251025
10261026#[derive(Diagnostic)]
1027#[diag(builtin_macros_eii_extern_target_expected_unsafe)]
1027#[diag(builtin_macros_eii_declaration_expected_unsafe)]
10281028pub(crate) struct EiiExternTargetExpectedUnsafe {
10291029 #[primary_span]
10301030 #[note]
compiler/rustc_builtin_macros/src/lib.rs+1-1
......@@ -119,7 +119,7 @@ pub fn register_builtin_macros(resolver: &mut dyn ResolverExpand) {
119119 derive: derive::Expander { is_const: false },
120120 derive_const: derive::Expander { is_const: true },
121121 eii: eii::eii,
122 eii_extern_target: eii::eii_extern_target,
122 eii_declaration: eii::eii_declaration,
123123 eii_shared_macro: eii::eii_shared_macro,
124124 global_allocator: global_allocator::expand,
125125 test: test::expand_test,
compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs-1
......@@ -1520,7 +1520,6 @@ pub(crate) fn apply_vcall_visibility_metadata<'ll, 'tcx>(
15201520 // Unwrap potential addrspacecast
15211521 let vtable = find_vtable_behind_cast(vtable);
15221522 let trait_ref_self = trait_ref.with_self_ty(cx.tcx, ty);
1523 let trait_ref_self = cx.tcx.erase_and_anonymize_regions(trait_ref_self);
15241523 let trait_def_id = trait_ref_self.def_id;
15251524 let trait_vis = cx.tcx.visibility(trait_def_id);
15261525
compiler/rustc_codegen_ssa/src/codegen_attrs.rs+6-6
......@@ -282,16 +282,16 @@ fn process_builtin_attrs(
282282 AttributeKind::ObjcSelector { methname, .. } => {
283283 codegen_fn_attrs.objc_selector = Some(*methname);
284284 }
285 AttributeKind::EiiExternItem => {
285 AttributeKind::EiiForeignItem => {
286286 codegen_fn_attrs.flags |= CodegenFnAttrFlags::EXTERNALLY_IMPLEMENTABLE_ITEM;
287287 }
288288 AttributeKind::EiiImpls(impls) => {
289289 for i in impls {
290 let extern_item = match i.resolution {
290 let foreign_item = match i.resolution {
291291 EiiImplResolution::Macro(def_id) => {
292292 let Some(extern_item) = find_attr!(
293293 tcx.get_all_attrs(def_id),
294 AttributeKind::EiiExternTarget(target) => target.eii_extern_target
294 AttributeKind::EiiDeclaration(target) => target.foreign_item
295295 ) else {
296296 tcx.dcx().span_delayed_bug(
297297 i.span,
......@@ -301,7 +301,7 @@ fn process_builtin_attrs(
301301 };
302302 extern_item
303303 }
304 EiiImplResolution::Known(decl) => decl.eii_extern_target,
304 EiiImplResolution::Known(decl) => decl.foreign_item,
305305 EiiImplResolution::Error(_eg) => continue,
306306 };
307307
......@@ -316,13 +316,13 @@ fn process_builtin_attrs(
316316 // iterate over all implementations *in the current crate*
317317 // (this is ok since we generate codegen fn attrs in the local crate)
318318 // if any of them is *not default* then don't emit the alias.
319 && tcx.externally_implementable_items(LOCAL_CRATE).get(&extern_item).expect("at least one").1.iter().any(|(_, imp)| !imp.is_default)
319 && tcx.externally_implementable_items(LOCAL_CRATE).get(&foreign_item).expect("at least one").1.iter().any(|(_, imp)| !imp.is_default)
320320 {
321321 continue;
322322 }
323323
324324 codegen_fn_attrs.foreign_item_symbol_aliases.push((
325 extern_item,
325 foreign_item,
326326 if i.is_default { Linkage::LinkOnceAny } else { Linkage::External },
327327 Visibility::Default,
328328 ));
compiler/rustc_const_eval/src/interpret/intrinsics.rs+3-8
......@@ -13,7 +13,7 @@ use rustc_infer::infer::TyCtxtInferExt;
1313use rustc_middle::mir::interpret::{CTFE_ALLOC_SALT, read_target_uint, write_target_uint};
1414use rustc_middle::mir::{self, BinOp, ConstValue, NonDivergingIntrinsic};
1515use rustc_middle::ty::layout::TyAndLayout;
16use rustc_middle::ty::{FloatTy, PolyExistentialPredicate, Ty, TyCtxt, TypeFoldable};
16use rustc_middle::ty::{FloatTy, PolyExistentialPredicate, Ty, TyCtxt};
1717use rustc_middle::{bug, span_bug, ty};
1818use rustc_span::{Symbol, sym};
1919use rustc_trait_selection::traits::{Obligation, ObligationCause, ObligationCtxt};
......@@ -243,13 +243,8 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
243243 ocx.register_obligations(preds.iter().map(|pred: PolyExistentialPredicate<'_>| {
244244 let pred = pred.with_self_ty(tcx, tp_ty);
245245 // Lifetimes can only be 'static because of the bound on T
246 let pred = pred.fold_with(&mut ty::BottomUpFolder {
247 tcx,
248 ty_op: |ty| ty,
249 lt_op: |lt| {
250 if lt == tcx.lifetimes.re_erased { tcx.lifetimes.re_static } else { lt }
251 },
252 ct_op: |ct| ct,
246 let pred = ty::fold_regions(tcx, pred, |r, _| {
247 if r == tcx.lifetimes.re_erased { tcx.lifetimes.re_static } else { r }
253248 });
254249 Obligation::new(tcx, ObligationCause::dummy(), param_env, pred)
255250 }));
compiler/rustc_feature/src/builtin_attrs.rs+1-1
......@@ -962,7 +962,7 @@ pub static BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
962962 EncodeCrossCrate::No, "allow_internal_unsafe side-steps the unsafe_code lint",
963963 ),
964964 gated!(
965 rustc_eii_extern_item, Normal, template!(Word),
965 rustc_eii_foreign_item, Normal, template!(Word),
966966 ErrorFollowing, EncodeCrossCrate::Yes, eii_internals,
967967 "used internally to mark types with a `transparent` representation when it is guaranteed by the documentation",
968968 ),
compiler/rustc_hir/src/attrs/data_structures.rs+3-3
......@@ -43,7 +43,7 @@ pub struct EiiImpl {
4343
4444#[derive(Copy, Clone, Debug, HashStable_Generic, Encodable, Decodable, PrintAttribute)]
4545pub struct EiiDecl {
46 pub eii_extern_target: DefId,
46 pub foreign_item: DefId,
4747 /// whether or not it is unsafe to implement this EII
4848 pub impl_unsafe: bool,
4949 pub name: Ident,
......@@ -744,10 +744,10 @@ pub enum AttributeKind {
744744 Dummy,
745745
746746 /// Implementation detail of `#[eii]`
747 EiiExternItem,
747 EiiDeclaration(EiiDecl),
748748
749749 /// Implementation detail of `#[eii]`
750 EiiExternTarget(EiiDecl),
750 EiiForeignItem,
751751
752752 /// Implementation detail of `#[eii]`
753753 EiiImpls(ThinVec<EiiImpl>),
compiler/rustc_hir/src/attrs/encode_cross_crate.rs+2-2
......@@ -47,8 +47,8 @@ impl AttributeKind {
4747 Doc(_) => Yes,
4848 DocComment { .. } => Yes,
4949 Dummy => No,
50 EiiExternItem => No,
51 EiiExternTarget(_) => Yes,
50 EiiDeclaration(_) => Yes,
51 EiiForeignItem => No,
5252 EiiImpls(..) => No,
5353 ExportName { .. } => Yes,
5454 ExportStable => No,
compiler/rustc_hir_analysis/src/check/check.rs+6-11
......@@ -508,23 +508,18 @@ fn sanity_check_found_hidden_type<'tcx>(
508508 return Ok(());
509509 }
510510 }
511 let strip_vars = |ty: Ty<'tcx>| {
512 ty.fold_with(&mut BottomUpFolder {
513 tcx,
514 ty_op: |t| t,
515 ct_op: |c| c,
516 lt_op: |l| match l.kind() {
517 RegionKind::ReVar(_) => tcx.lifetimes.re_erased,
518 _ => l,
519 },
511 let erase_re_vars = |ty: Ty<'tcx>| {
512 fold_regions(tcx, ty, |r, _| match r.kind() {
513 RegionKind::ReVar(_) => tcx.lifetimes.re_erased,
514 _ => r,
520515 })
521516 };
522517 // Closures frequently end up containing erased lifetimes in their final representation.
523518 // These correspond to lifetime variables that never got resolved, so we patch this up here.
524 ty.ty = strip_vars(ty.ty);
519 ty.ty = erase_re_vars(ty.ty);
525520 // Get the hidden type.
526521 let hidden_ty = tcx.type_of(key.def_id).instantiate(tcx, key.args);
527 let hidden_ty = strip_vars(hidden_ty);
522 let hidden_ty = erase_re_vars(hidden_ty);
528523
529524 // If the hidden types differ, emit a type mismatch diagnostic.
530525 if hidden_ty == ty.ty {
compiler/rustc_hir_analysis/src/check/wfcheck.rs+2-2
......@@ -1205,7 +1205,7 @@ fn check_eiis(tcx: TyCtxt<'_>, def_id: LocalDefId) {
12051205 EiiImplResolution::Macro(def_id) => {
12061206 // we expect this macro to have the `EiiMacroFor` attribute, that points to a function
12071207 // signature that we'd like to compare the function we're currently checking with
1208 if let Some(foreign_item) = find_attr!(tcx.get_all_attrs(*def_id), AttributeKind::EiiExternTarget(EiiDecl {eii_extern_target: t, ..}) => *t)
1208 if let Some(foreign_item) = find_attr!(tcx.get_all_attrs(*def_id), AttributeKind::EiiDeclaration(EiiDecl {foreign_item: t, ..}) => *t)
12091209 {
12101210 (foreign_item, tcx.item_name(*def_id))
12111211 } else {
......@@ -1213,7 +1213,7 @@ fn check_eiis(tcx: TyCtxt<'_>, def_id: LocalDefId) {
12131213 continue;
12141214 }
12151215 }
1216 EiiImplResolution::Known(decl) => (decl.eii_extern_target, decl.name.name),
1216 EiiImplResolution::Known(decl) => (decl.foreign_item, decl.name.name),
12171217 EiiImplResolution::Error(_eg) => continue,
12181218 };
12191219
compiler/rustc_hir_analysis/src/delegation.rs+3-3
......@@ -135,9 +135,6 @@ fn build_generics<'tcx>(
135135 // }
136136 own_params.sort_by_key(|key| key.kind.is_ty_or_const());
137137
138 let param_def_id_to_index =
139 own_params.iter().map(|param| (param.def_id, param.index)).collect();
140
141138 let (parent_count, has_self) = if let Some(def_id) = parent {
142139 let parent_generics = tcx.generics_of(def_id);
143140 let parent_kind = tcx.def_kind(def_id);
......@@ -162,6 +159,9 @@ fn build_generics<'tcx>(
162159 }
163160 }
164161
162 let param_def_id_to_index =
163 own_params.iter().map(|param| (param.def_id, param.index)).collect();
164
165165 ty::Generics {
166166 parent,
167167 parent_count,
compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs+3-2
......@@ -2533,11 +2533,12 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
25332533 let tcx = self.tcx();
25342534
25352535 let FeedConstTy::WithTy(ty) = feed else {
2536 return Const::new_error_with_message(tcx, span, "unsupported const tuple");
2536 return Const::new_error_with_message(tcx, span, "const tuple lack type information");
25372537 };
25382538
25392539 let ty::Tuple(tys) = ty.kind() else {
2540 return Const::new_error_with_message(tcx, span, "const tuple must have a tuple type");
2540 let e = tcx.dcx().span_err(span, format!("expected `{}`, found const tuple", ty));
2541 return Const::new_error(tcx, e);
25412542 };
25422543
25432544 let exprs = exprs
compiler/rustc_metadata/src/eii.rs+5-5
......@@ -31,9 +31,9 @@ pub(crate) fn collect<'tcx>(tcx: TyCtxt<'tcx>, LocalCrate: LocalCrate) -> EiiMap
3131 let decl = match i.resolution {
3232 EiiImplResolution::Macro(macro_defid) => {
3333 // 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)
34 let Some(decl) = find_attr!(tcx.get_all_attrs(macro_defid), AttributeKind::EiiExternTarget(d) => *d)
34 let Some(decl) = find_attr!(tcx.get_all_attrs(macro_defid), AttributeKind::EiiDeclaration(d) => *d)
3535 else {
36 // skip if it doesn't have eii_extern_target (if we resolved to another macro that's not an EII)
36 // skip if it doesn't have eii_declaration (if we resolved to another macro that's not an EII)
3737 tcx.dcx()
3838 .span_delayed_bug(i.span, "resolved to something that's not an EII");
3939 continue;
......@@ -45,7 +45,7 @@ pub(crate) fn collect<'tcx>(tcx: TyCtxt<'tcx>, LocalCrate: LocalCrate) -> EiiMap
4545 };
4646
4747 // FIXME(eii) remove extern target from encoded decl
48 eiis.entry(decl.eii_extern_target)
48 eiis.entry(decl.foreign_item)
4949 .or_insert_with(|| (decl, Default::default()))
5050 .1
5151 .insert(id.into(), *i);
......@@ -53,9 +53,9 @@ pub(crate) fn collect<'tcx>(tcx: TyCtxt<'tcx>, LocalCrate: LocalCrate) -> EiiMap
5353
5454 // if we find a new declaration, add it to the list without a known implementation
5555 if let Some(decl) =
56 find_attr!(tcx.get_all_attrs(id), AttributeKind::EiiExternTarget(d) => *d)
56 find_attr!(tcx.get_all_attrs(id), AttributeKind::EiiDeclaration(d) => *d)
5757 {
58 eiis.entry(decl.eii_extern_target).or_insert((decl, Default::default()));
58 eiis.entry(decl.foreign_item).or_insert((decl, Default::default()));
5959 }
6060 }
6161
compiler/rustc_metadata/src/rmeta/decoder.rs+1-1
......@@ -1536,7 +1536,7 @@ impl<'a> CrateMetadataRef<'a> {
15361536 .get((self, tcx), id)
15371537 .unwrap()
15381538 .decode((self, tcx));
1539 ast::MacroDef { macro_rules, body: Box::new(body), eii_extern_target: None }
1539 ast::MacroDef { macro_rules, body: Box::new(body), eii_declaration: None }
15401540 }
15411541 _ => bug!(),
15421542 }
compiler/rustc_middle/src/hooks/mod.rs+5
......@@ -102,6 +102,11 @@ declare_hooks! {
102102 /// Ensure the given scalar is valid for the given type.
103103 /// This checks non-recursive runtime validity.
104104 hook validate_scalar_in_layout(scalar: crate::ty::ScalarInt, ty: Ty<'tcx>) -> bool;
105
106 /// **Do not call this directly; call the `mir_built` query instead.**
107 ///
108 /// Creates the MIR for a given `DefId`, including unreachable code.
109 hook build_mir_inner_impl(def: LocalDefId) -> mir::Body<'tcx>;
105110}
106111
107112#[cold]
compiler/rustc_mir_build/src/builder/mod.rs+5-3
......@@ -64,9 +64,11 @@ pub(crate) fn closure_saved_names_of_captured_variables<'tcx>(
6464 .collect()
6565}
6666
67/// Create the MIR for a given `DefId`, including unreachable code. Do not call
68/// this directly; instead use the cached version via `mir_built`.
69pub fn build_mir<'tcx>(tcx: TyCtxt<'tcx>, def: LocalDefId) -> Body<'tcx> {
67/// Create the MIR for a given `DefId`, including unreachable code.
68///
69/// This is the implementation of hook `build_mir_inner_impl`, which should only
70/// be called by the query `mir_built`.
71pub(crate) fn build_mir_inner_impl<'tcx>(tcx: TyCtxt<'tcx>, def: LocalDefId) -> Body<'tcx> {
7072 tcx.ensure_done().thir_abstract_const(def);
7173 if let Err(e) = tcx.ensure_ok().check_match(def) {
7274 return construct_error(tcx, def, e);
compiler/rustc_mir_build/src/lib.rs+2-1
......@@ -12,7 +12,7 @@
1212// The `builder` module used to be named `build`, but that was causing GitHub's
1313// "Go to file" feature to silently ignore all files in the module, probably
1414// because it assumes that "build" is a build-output directory. See #134365.
15pub mod builder;
15mod builder;
1616mod check_tail_calls;
1717mod check_unsafety;
1818mod errors;
......@@ -30,4 +30,5 @@ pub fn provide(providers: &mut Providers) {
3030 providers.check_unsafety = check_unsafety::check_unsafety;
3131 providers.check_tail_calls = check_tail_calls::check_tail_calls;
3232 providers.thir_body = thir::cx::thir_body;
33 providers.hooks.build_mir_inner_impl = builder::build_mir_inner_impl;
3334}
compiler/rustc_mir_transform/Cargo.toml-1
......@@ -20,7 +20,6 @@ rustc_index = { path = "../rustc_index" }
2020rustc_infer = { path = "../rustc_infer" }
2121rustc_macros = { path = "../rustc_macros" }
2222rustc_middle = { path = "../rustc_middle" }
23rustc_mir_build = { path = "../rustc_mir_build" }
2423rustc_mir_dataflow = { path = "../rustc_mir_dataflow" }
2524rustc_session = { path = "../rustc_session" }
2625rustc_span = { path = "../rustc_span" }
compiler/rustc_mir_transform/src/lib.rs+4-2
......@@ -30,7 +30,6 @@ use rustc_middle::mir::{
3030use rustc_middle::ty::{self, TyCtxt, TypeVisitableExt};
3131use rustc_middle::util::Providers;
3232use rustc_middle::{bug, query, span_bug};
33use rustc_mir_build::builder::build_mir;
3433use rustc_span::source_map::Spanned;
3534use rustc_span::{DUMMY_SP, sym};
3635use tracing::debug;
......@@ -378,8 +377,11 @@ fn mir_const_qualif(tcx: TyCtxt<'_>, def: LocalDefId) -> ConstQualifs {
378377 validator.qualifs_in_return_place()
379378}
380379
380/// Implementation of the `mir_built` query.
381381fn mir_built(tcx: TyCtxt<'_>, def: LocalDefId) -> &Steal<Body<'_>> {
382 let mut body = build_mir(tcx, def);
382 // Delegate to the main MIR building code in the `rustc_mir_build` crate.
383 // This is the one place that is allowed to call `build_mir_inner_impl`.
384 let mut body = tcx.build_mir_inner_impl(def);
383385
384386 // Identifying trivial consts based on their mir_built is easy, but a little wasteful.
385387 // Trying to push this logic earlier in the compiler and never even produce the Body would
compiler/rustc_next_trait_solver/src/delegate.rs+1-1
......@@ -86,8 +86,8 @@ pub trait SolverDelegate: Deref<Target = Self::Infcx> + Sized {
8686
8787 fn is_transmutable(
8888 &self,
89 dst: <Self::Interner as Interner>::Ty,
9089 src: <Self::Interner as Interner>::Ty,
90 dst: <Self::Interner as Interner>::Ty,
9191 assume: <Self::Interner as Interner>::Const,
9292 ) -> Result<Certainty, NoSolution>;
9393}
compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs+1-1
......@@ -1170,8 +1170,8 @@ where
11701170
11711171 pub(super) fn is_transmutable(
11721172 &mut self,
1173 dst: I::Ty,
11741173 src: I::Ty,
1174 dst: I::Ty,
11751175 assume: I::Const,
11761176 ) -> Result<Certainty, NoSolution> {
11771177 self.delegate.is_transmutable(dst, src, assume)
compiler/rustc_parse/src/parser/item.rs+2-2
......@@ -2283,7 +2283,7 @@ impl<'a> Parser<'a> {
22832283 self.psess.gated_spans.gate(sym::decl_macro, lo.to(self.prev_token.span));
22842284 Ok(ItemKind::MacroDef(
22852285 ident,
2286 ast::MacroDef { body, macro_rules: false, eii_extern_target: None },
2286 ast::MacroDef { body, macro_rules: false, eii_declaration: None },
22872287 ))
22882288 }
22892289
......@@ -2333,7 +2333,7 @@ impl<'a> Parser<'a> {
23332333
23342334 Ok(ItemKind::MacroDef(
23352335 ident,
2336 ast::MacroDef { body, macro_rules: true, eii_extern_target: None },
2336 ast::MacroDef { body, macro_rules: true, eii_declaration: None },
23372337 ))
23382338 }
23392339
compiler/rustc_parse_format/src/lib.rs+22
......@@ -461,6 +461,7 @@ impl<'input> Parser<'input> {
461461 ('?', '}') => self.missing_colon_before_debug_formatter(),
462462 ('?', _) => self.suggest_format_debug(),
463463 ('<' | '^' | '>', _) => self.suggest_format_align(c),
464 (',', _) => self.suggest_unsupported_python_numeric_grouping(),
464465 _ => self.suggest_positional_arg_instead_of_captured_arg(arg),
465466 }
466467 }
......@@ -934,6 +935,27 @@ impl<'input> Parser<'input> {
934935 }
935936 }
936937 }
938
939 fn suggest_unsupported_python_numeric_grouping(&mut self) {
940 if let Some((range, _)) = self.consume_pos(',') {
941 self.errors.insert(
942 0,
943 ParseError {
944 description:
945 "python's numeric grouping `,` is not supported in rust format strings"
946 .to_owned(),
947 note: Some(format!("to print `{{`, you can escape it using `{{{{`",)),
948 label: "expected `}`".to_owned(),
949 span: range,
950 secondary_label: self
951 .last_open_brace
952 .clone()
953 .map(|sp| ("because of this opening brace".to_owned(), sp)),
954 suggestion: Suggestion::None,
955 },
956 );
957 }
958 }
937959}
938960
939961// Assert a reasonable size for `Piece`
compiler/rustc_passes/src/check_attr.rs+3-3
......@@ -224,8 +224,8 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
224224 self.check_rustc_must_implement_one_of(*attr_span, fn_names, hir_id,target)
225225 },
226226 Attribute::Parsed(
227 AttributeKind::EiiExternTarget { .. }
228 | AttributeKind::EiiExternItem
227 AttributeKind::EiiDeclaration { .. }
228 | AttributeKind::EiiForeignItem
229229 | AttributeKind::BodyStability { .. }
230230 | AttributeKind::ConstStabilityIndirect
231231 | AttributeKind::MacroTransparency(_)
......@@ -553,7 +553,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
553553 }
554554
555555 if let EiiImplResolution::Macro(eii_macro) = resolution
556 && find_attr!(self.tcx.get_all_attrs(*eii_macro), AttributeKind::EiiExternTarget(EiiDecl { impl_unsafe, .. }) if *impl_unsafe)
556 && find_attr!(self.tcx.get_all_attrs(*eii_macro), AttributeKind::EiiDeclaration(EiiDecl { impl_unsafe, .. }) if *impl_unsafe)
557557 && !impl_marked_unsafe
558558 {
559559 self.dcx().emit_err(errors::EiiImplRequiresUnsafe {
compiler/rustc_resolve/src/late.rs+3-3
......@@ -1079,7 +1079,7 @@ impl<'ast, 'ra, 'tcx> Visitor<'ast> for LateResolutionVisitor<'_, 'ast, 'ra, 'tc
10791079 self.smart_resolve_path(
10801080 *node_id,
10811081 &None,
1082 &target.extern_item_path,
1082 &target.foreign_item,
10831083 PathSource::Expr(None),
10841084 );
10851085 } else {
......@@ -2931,8 +2931,8 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
29312931 self.parent_scope.macro_rules = self.r.macro_rules_scopes[&def_id];
29322932 }
29332933
2934 if let Some(EiiExternTarget { extern_item_path, impl_unsafe: _ }) =
2935 &macro_def.eii_extern_target
2934 if let Some(EiiDecl { foreign_item: extern_item_path, impl_unsafe: _ }) =
2935 &macro_def.eii_declaration
29362936 {
29372937 self.smart_resolve_path(
29382938 item.id,
compiler/rustc_span/src/symbol.rs+2-2
......@@ -935,7 +935,7 @@ symbols! {
935935 eh_catch_typeinfo,
936936 eh_personality,
937937 eii,
938 eii_extern_target,
938 eii_declaration,
939939 eii_impl,
940940 eii_internals,
941941 eii_shared_macro,
......@@ -1951,7 +1951,7 @@ symbols! {
19511951 rustc_dump_user_args,
19521952 rustc_dump_vtable,
19531953 rustc_effective_visibility,
1954 rustc_eii_extern_item,
1954 rustc_eii_foreign_item,
19551955 rustc_evaluate_where_clauses,
19561956 rustc_expected_cgu_reuse,
19571957 rustc_force_inline,
compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs+1-6
......@@ -2781,11 +2781,6 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
27812781 self.tcx.instantiate_bound_regions_with_erased(trait_pred),
27822782 );
27832783
2784 let src_and_dst = rustc_transmute::Types {
2785 dst: trait_pred.trait_ref.args.type_at(0),
2786 src: trait_pred.trait_ref.args.type_at(1),
2787 };
2788
27892784 let ocx = ObligationCtxt::new(self);
27902785 let Ok(assume) = ocx.structurally_normalize_const(
27912786 &obligation.cause,
......@@ -2812,7 +2807,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
28122807 let err_msg = format!("`{src}` cannot be safely transmuted into `{dst}`");
28132808
28142809 match rustc_transmute::TransmuteTypeEnv::new(self.infcx.tcx)
2815 .is_transmutable(src_and_dst, assume)
2810 .is_transmutable(src, dst, assume)
28162811 {
28172812 Answer::No(reason) => {
28182813 let safe_transmute_explanation = match reason {
compiler/rustc_trait_selection/src/solve/delegate.rs+2-4
......@@ -294,8 +294,8 @@ impl<'tcx> rustc_next_trait_solver::delegate::SolverDelegate for SolverDelegate<
294294 // register candidates. We probably need to register >1 since we may have an OR of ANDs.
295295 fn is_transmutable(
296296 &self,
297 dst: Ty<'tcx>,
298297 src: Ty<'tcx>,
298 dst: Ty<'tcx>,
299299 assume: ty::Const<'tcx>,
300300 ) -> Result<Certainty, NoSolution> {
301301 // Erase regions because we compute layouts in `rustc_transmute`,
......@@ -307,9 +307,7 @@ impl<'tcx> rustc_next_trait_solver::delegate::SolverDelegate for SolverDelegate<
307307 };
308308
309309 // FIXME(transmutability): This really should be returning nested goals for `Answer::If*`
310 match rustc_transmute::TransmuteTypeEnv::new(self.0.tcx)
311 .is_transmutable(rustc_transmute::Types { src, dst }, assume)
312 {
310 match rustc_transmute::TransmuteTypeEnv::new(self.0.tcx).is_transmutable(src, dst, assume) {
313311 rustc_transmute::Answer::Yes => Ok(Certainty::Yes),
314312 rustc_transmute::Answer::No(_) | rustc_transmute::Answer::If(_) => Err(NoSolution),
315313 }
compiler/rustc_trait_selection/src/traits/select/confirmation.rs+1-2
......@@ -365,8 +365,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
365365
366366 debug!(?src, ?dst);
367367 let mut transmute_env = rustc_transmute::TransmuteTypeEnv::new(self.infcx.tcx);
368 let maybe_transmutable =
369 transmute_env.is_transmutable(rustc_transmute::Types { dst, src }, assume);
368 let maybe_transmutable = transmute_env.is_transmutable(src, dst, assume);
370369
371370 let fully_flattened = match maybe_transmutable {
372371 Answer::No(_) => Err(SelectionError::Unimplemented)?,
compiler/rustc_transmute/src/lib.rs+4-14
......@@ -93,15 +93,6 @@ mod rustc {
9393
9494 use super::*;
9595
96 /// The source and destination types of a transmutation.
97 #[derive(Debug, Clone, Copy)]
98 pub struct Types<'tcx> {
99 /// The source type.
100 pub src: Ty<'tcx>,
101 /// The destination type.
102 pub dst: Ty<'tcx>,
103 }
104
10596 pub struct TransmuteTypeEnv<'tcx> {
10697 tcx: TyCtxt<'tcx>,
10798 }
......@@ -113,13 +104,12 @@ mod rustc {
113104
114105 pub fn is_transmutable(
115106 &mut self,
116 types: Types<'tcx>,
107 src: Ty<'tcx>,
108 dst: Ty<'tcx>,
117109 assume: crate::Assume,
118110 ) -> crate::Answer<Region<'tcx>, Ty<'tcx>> {
119 crate::maybe_transmutable::MaybeTransmutableQuery::new(
120 types.src, types.dst, assume, self.tcx,
121 )
122 .answer()
111 crate::maybe_transmutable::MaybeTransmutableQuery::new(src, dst, assume, self.tcx)
112 .answer()
123113 }
124114 }
125115
compiler/rustc_ty_utils/src/instance.rs-2
......@@ -222,8 +222,6 @@ fn resolve_associated_item<'tcx>(
222222 return Err(guar);
223223 }
224224
225 let args = tcx.erase_and_anonymize_regions(args);
226
227225 // We check that the impl item is compatible with the trait item
228226 // because otherwise we may ICE in const eval due to type mismatches,
229227 // signature incompatibilities, etc.
compiler/rustc_type_ir/src/flags.rs+2-2
......@@ -74,7 +74,7 @@ bitflags::bitflags! {
7474 /// Does this have `Projection`?
7575 const HAS_TY_PROJECTION = 1 << 10;
7676 /// Does this have `Free` aliases?
77 const HAS_TY_FREE_ALIAS = 1 << 11;
77 const HAS_TY_FREE_ALIAS = 1 << 11;
7878 /// Does this have `Opaque`?
7979 const HAS_TY_OPAQUE = 1 << 12;
8080 /// Does this have `Inherent`?
......@@ -135,7 +135,7 @@ bitflags::bitflags! {
135135 const HAS_TY_CORO = 1 << 24;
136136
137137 /// Does this have have a `Bound(BoundVarIndexKind::Canonical, _)`?
138 const HAS_CANONICAL_BOUND = 1 << 25;
138 const HAS_CANONICAL_BOUND = 1 << 25;
139139 }
140140}
141141
library/core/src/macros/mod.rs+1-1
......@@ -1912,7 +1912,7 @@ pub(crate) mod builtin {
19121912 /// Impl detail of EII
19131913 #[unstable(feature = "eii_internals", issue = "none")]
19141914 #[rustc_builtin_macro]
1915 pub macro eii_extern_target($item:item) {
1915 pub macro eii_declaration($item:item) {
19161916 /* compiler built-in */
19171917 }
19181918}
library/core/src/prelude/v1.rs+1-1
......@@ -122,4 +122,4 @@ pub use crate::macros::builtin::define_opaque;
122122pub use crate::macros::builtin::{eii, unsafe_eii};
123123
124124#[unstable(feature = "eii_internals", issue = "none")]
125pub use crate::macros::builtin::eii_extern_target;
125pub use crate::macros::builtin::eii_declaration;
library/std/src/prelude/v1.rs+1-1
......@@ -114,7 +114,7 @@ pub use core::prelude::v1::define_opaque;
114114pub use core::prelude::v1::{eii, unsafe_eii};
115115
116116#[unstable(feature = "eii_internals", issue = "none")]
117pub use core::prelude::v1::eii_extern_target;
117pub use core::prelude::v1::eii_declaration;
118118
119119// The file so far is equivalent to core/src/prelude/v1.rs. It is duplicated
120120// rather than glob imported because we want docs to show these re-exports as
library/std/src/sys/net/connection/uefi/tcp4.rs+5-4
......@@ -248,7 +248,7 @@ impl Tcp4 {
248248 fragment_table: [fragment],
249249 };
250250
251 self.read_inner((&raw mut rx_data).cast(), timeout).map(|_| data_len as usize)
251 self.read_inner((&raw mut rx_data).cast(), timeout)
252252 }
253253
254254 pub(crate) fn read_vectored(
......@@ -288,14 +288,14 @@ impl Tcp4 {
288288 );
289289 };
290290
291 self.read_inner(rx_data.as_mut_ptr(), timeout).map(|_| data_length as usize)
291 self.read_inner(rx_data.as_mut_ptr(), timeout)
292292 }
293293
294294 pub(crate) fn read_inner(
295295 &self,
296296 rx_data: *mut tcp4::ReceiveData,
297297 timeout: Option<Duration>,
298 ) -> io::Result<()> {
298 ) -> io::Result<usize> {
299299 let evt = unsafe { self.create_evt() }?;
300300 let completion_token =
301301 tcp4::CompletionToken { event: evt.as_ptr(), status: Status::SUCCESS };
......@@ -313,7 +313,8 @@ impl Tcp4 {
313313 if completion_token.status.is_error() {
314314 Err(io::Error::from_raw_os_error(completion_token.status.as_usize()))
315315 } else {
316 Ok(())
316 let data_length = unsafe { (*rx_data).data_length };
317 Ok(data_length as usize)
317318 }
318319 }
319320
rust-bors.toml+2-1
......@@ -55,7 +55,8 @@ try_failed = [
5555 "-S-waiting-on-crater"
5656]
5757auto_build_succeeded = [
58 "+merged-by-bors"
58 "+merged-by-bors",
59 "-S-waiting-on-bors"
5960]
6061auto_build_failed = [
6162 "+S-waiting-on-review",
src/tools/clippy/clippy_lints/src/matches/significant_drop_in_scrutinee.rs+3-21
......@@ -12,7 +12,7 @@ use rustc_errors::{Applicability, Diag};
1212use rustc_hir::intravisit::{Visitor, walk_expr};
1313use rustc_hir::{Arm, Expr, ExprKind, MatchSource};
1414use rustc_lint::{LateContext, LintContext};
15use rustc_middle::ty::{GenericArgKind, Region, RegionKind, Ty, TyCtxt, TypeVisitable, TypeVisitor};
15use rustc_middle::ty::{GenericArgKind, RegionKind, Ty, TypeVisitableExt};
1616use rustc_span::Span;
1717
1818use super::SIGNIFICANT_DROP_IN_SCRUTINEE;
......@@ -303,13 +303,13 @@ impl<'a, 'tcx> SigDropHelper<'a, 'tcx> {
303303
304304 if self.sig_drop_holder != SigDropHolder::None {
305305 let parent_ty = self.cx.typeck_results().expr_ty(parent_expr);
306 if !ty_has_erased_regions(parent_ty) && !parent_expr.is_syntactic_place_expr() {
306 if !parent_ty.has_erased_regions() && !parent_expr.is_syntactic_place_expr() {
307307 self.replace_current_sig_drop(parent_expr.span, parent_ty.is_unit(), 0);
308308 self.sig_drop_holder = SigDropHolder::Moved;
309309 }
310310
311311 let (peel_ref_ty, peel_ref_times) = ty_peel_refs(parent_ty);
312 if !ty_has_erased_regions(peel_ref_ty) && is_copy(self.cx, peel_ref_ty) {
312 if !peel_ref_ty.has_erased_regions() && is_copy(self.cx, peel_ref_ty) {
313313 self.replace_current_sig_drop(parent_expr.span, peel_ref_ty.is_unit(), peel_ref_times);
314314 self.sig_drop_holder = SigDropHolder::Moved;
315315 }
......@@ -399,24 +399,6 @@ fn ty_peel_refs(mut ty: Ty<'_>) -> (Ty<'_>, usize) {
399399 (ty, n)
400400}
401401
402fn ty_has_erased_regions(ty: Ty<'_>) -> bool {
403 struct V;
404
405 impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for V {
406 type Result = ControlFlow<()>;
407
408 fn visit_region(&mut self, region: Region<'tcx>) -> Self::Result {
409 if region.is_erased() {
410 ControlFlow::Break(())
411 } else {
412 ControlFlow::Continue(())
413 }
414 }
415 }
416
417 ty.visit_with(&mut V).is_break()
418}
419
420402impl<'tcx> Visitor<'tcx> for SigDropHelper<'_, 'tcx> {
421403 fn visit_expr(&mut self, ex: &'tcx Expr<'_>) {
422404 // We've emitted a lint on some neighborhood expression. That lint will suggest to move out the
src/tools/rust-analyzer/crates/hir-ty/src/next_solver/solver.rs+1-1
......@@ -232,8 +232,8 @@ impl<'db> SolverDelegate for SolverContext<'db> {
232232
233233 fn is_transmutable(
234234 &self,
235 _dst: Ty<'db>,
236235 _src: Ty<'db>,
236 _dst: Ty<'db>,
237237 _assume: <Self::Interner as rustc_type_ir::Interner>::Const,
238238 ) -> Result<Certainty, NoSolution> {
239239 // It's better to return some value while not fully implement
tests/ui/const-generics/mgca/adt_expr_arg_tuple_expr_complex.rs deleted-20
......@@ -1,20 +0,0 @@
1#![feature(min_generic_const_args, adt_const_params, unsized_const_params)]
2#![expect(incomplete_features)]
3
4trait Trait {
5 #[type_const]
6 const ASSOC: usize;
7}
8
9fn takes_tuple<const A: (u32, u32)>() {}
10fn takes_nested_tuple<const A: (u32, (u32, u32))>() {}
11
12fn generic_caller<T: Trait, const N: u32, const N2: u32>() {
13 takes_tuple::<{ (N, N + 1) }>(); //~ ERROR complex const arguments must be placed inside of a `const` block
14 takes_tuple::<{ (N, T::ASSOC + 1) }>(); //~ ERROR complex const arguments must be placed inside of a `const` block
15
16 takes_nested_tuple::<{ (N, (N, N + 1)) }>(); //~ ERROR complex const arguments must be placed inside of a `const` block
17 takes_nested_tuple::<{ (N, (N, const { N + 1 })) }>(); //~ ERROR generic parameters may not be used in const operations
18}
19
20fn main() {}
tests/ui/const-generics/mgca/adt_expr_arg_tuple_expr_complex.stderr deleted-26
......@@ -1,26 +0,0 @@
1error: complex const arguments must be placed inside of a `const` block
2 --> $DIR/adt_expr_arg_tuple_expr_complex.rs:13:25
3 |
4LL | takes_tuple::<{ (N, N + 1) }>();
5 | ^^^^^
6
7error: complex const arguments must be placed inside of a `const` block
8 --> $DIR/adt_expr_arg_tuple_expr_complex.rs:14:25
9 |
10LL | takes_tuple::<{ (N, T::ASSOC + 1) }>();
11 | ^^^^^^^^^^^^
12
13error: complex const arguments must be placed inside of a `const` block
14 --> $DIR/adt_expr_arg_tuple_expr_complex.rs:16:36
15 |
16LL | takes_nested_tuple::<{ (N, (N, N + 1)) }>();
17 | ^^^^^
18
19error: generic parameters may not be used in const operations
20 --> $DIR/adt_expr_arg_tuple_expr_complex.rs:17:44
21 |
22LL | takes_nested_tuple::<{ (N, (N, const { N + 1 })) }>();
23 | ^
24
25error: aborting due to 4 previous errors
26
tests/ui/const-generics/mgca/adt_expr_arg_tuple_expr_simple.rs deleted-22
......@@ -1,22 +0,0 @@
1//@ check-pass
2
3#![feature(min_generic_const_args, adt_const_params, unsized_const_params)]
4#![expect(incomplete_features)]
5
6trait Trait {
7 #[type_const]
8 const ASSOC: u32;
9}
10
11fn takes_tuple<const A: (u32, u32)>() {}
12fn takes_nested_tuple<const A: (u32, (u32, u32))>() {}
13
14fn generic_caller<T: Trait, const N: u32, const N2: u32>() {
15 takes_tuple::<{ (N, N2) }>();
16 takes_tuple::<{ (N, T::ASSOC) }>();
17
18 takes_nested_tuple::<{ (N, (N, N2)) }>();
19 takes_nested_tuple::<{ (N, (N, T::ASSOC)) }>();
20}
21
22fn main() {}
tests/ui/const-generics/mgca/tuple_expr_arg_complex.rs created+20
......@@ -0,0 +1,20 @@
1#![feature(min_generic_const_args, adt_const_params, unsized_const_params)]
2#![expect(incomplete_features)]
3
4trait Trait {
5 #[type_const]
6 const ASSOC: usize;
7}
8
9fn takes_tuple<const A: (u32, u32)>() {}
10fn takes_nested_tuple<const A: (u32, (u32, u32))>() {}
11
12fn generic_caller<T: Trait, const N: u32, const N2: u32>() {
13 takes_tuple::<{ (N, N + 1) }>(); //~ ERROR complex const arguments must be placed inside of a `const` block
14 takes_tuple::<{ (N, T::ASSOC + 1) }>(); //~ ERROR complex const arguments must be placed inside of a `const` block
15
16 takes_nested_tuple::<{ (N, (N, N + 1)) }>(); //~ ERROR complex const arguments must be placed inside of a `const` block
17 takes_nested_tuple::<{ (N, (N, const { N + 1 })) }>(); //~ ERROR generic parameters may not be used in const operations
18}
19
20fn main() {}
tests/ui/const-generics/mgca/tuple_expr_arg_complex.stderr created+26
......@@ -0,0 +1,26 @@
1error: complex const arguments must be placed inside of a `const` block
2 --> $DIR/tuple_expr_arg_complex.rs:13:25
3 |
4LL | takes_tuple::<{ (N, N + 1) }>();
5 | ^^^^^
6
7error: complex const arguments must be placed inside of a `const` block
8 --> $DIR/tuple_expr_arg_complex.rs:14:25
9 |
10LL | takes_tuple::<{ (N, T::ASSOC + 1) }>();
11 | ^^^^^^^^^^^^
12
13error: complex const arguments must be placed inside of a `const` block
14 --> $DIR/tuple_expr_arg_complex.rs:16:36
15 |
16LL | takes_nested_tuple::<{ (N, (N, N + 1)) }>();
17 | ^^^^^
18
19error: generic parameters may not be used in const operations
20 --> $DIR/tuple_expr_arg_complex.rs:17:44
21 |
22LL | takes_nested_tuple::<{ (N, (N, const { N + 1 })) }>();
23 | ^
24
25error: aborting due to 4 previous errors
26
tests/ui/const-generics/mgca/tuple_expr_arg_mismatch_type.rs created+8
......@@ -0,0 +1,8 @@
1#![feature(min_generic_const_args)]
2#![expect(incomplete_features)]
3
4pub fn takes_nested_tuple<const N: u32>() {
5 takes_nested_tuple::<{ () }> //~ ERROR expected `u32`, found const tuple
6}
7
8fn main() {}
tests/ui/const-generics/mgca/tuple_expr_arg_mismatch_type.stderr created+8
......@@ -0,0 +1,8 @@
1error: expected `u32`, found const tuple
2 --> $DIR/tuple_expr_arg_mismatch_type.rs:5:28
3 |
4LL | takes_nested_tuple::<{ () }>
5 | ^^
6
7error: aborting due to 1 previous error
8
tests/ui/const-generics/mgca/tuple_expr_arg_simple.rs created+22
......@@ -0,0 +1,22 @@
1//@ check-pass
2
3#![feature(min_generic_const_args, adt_const_params, unsized_const_params)]
4#![expect(incomplete_features)]
5
6trait Trait {
7 #[type_const]
8 const ASSOC: u32;
9}
10
11fn takes_tuple<const A: (u32, u32)>() {}
12fn takes_nested_tuple<const A: (u32, (u32, u32))>() {}
13
14fn generic_caller<T: Trait, const N: u32, const N2: u32>() {
15 takes_tuple::<{ (N, N2) }>();
16 takes_tuple::<{ (N, T::ASSOC) }>();
17
18 takes_nested_tuple::<{ (N, (N, N2)) }>();
19 takes_nested_tuple::<{ (N, (N, T::ASSOC)) }>();
20}
21
22fn main() {}
tests/ui/delegation/ice-issue-150673.rs created+21
......@@ -0,0 +1,21 @@
1#![feature(fn_delegation)]
2#![allow(incomplete_features)]
3
4mod to_reuse {
5 pub fn foo<T>() -> T {
6 unimplemented!()
7 }
8}
9
10struct S<T>(T);
11
12trait Trait {
13 reuse to_reuse::foo;
14}
15
16impl Trait for S {
17//~^ ERROR: missing generics for struct `S`
18 reuse Trait::foo;
19}
20
21fn main() {}
tests/ui/delegation/ice-issue-150673.stderr created+19
......@@ -0,0 +1,19 @@
1error[E0107]: missing generics for struct `S`
2 --> $DIR/ice-issue-150673.rs:16:16
3 |
4LL | impl Trait for S {
5 | ^ expected 1 generic argument
6 |
7note: struct defined here, with 1 generic parameter: `T`
8 --> $DIR/ice-issue-150673.rs:10:8
9 |
10LL | struct S<T>(T);
11 | ^ -
12help: add missing generic argument
13 |
14LL | impl Trait for S<T> {
15 | +++
16
17error: aborting due to 1 previous error
18
19For more information about this error, try `rustc --explain E0107`.
tests/ui/eii/errors.rs+9-9
......@@ -5,19 +5,19 @@
55#![feature(rustc_attrs)]
66#![feature(eii_internals)]
77
8#[eii_extern_target(bar)] //~ ERROR `#[eii_extern_target(...)]` is only valid on macros
8#[eii_declaration(bar)] //~ ERROR `#[eii_declaration(...)]` is only valid on macros
99fn hello() {
10 #[eii_extern_target(bar)] //~ ERROR `#[eii_extern_target(...)]` is only valid on macros
10 #[eii_declaration(bar)] //~ ERROR `#[eii_declaration(...)]` is only valid on macros
1111 let x = 3 + 3;
1212}
1313
14#[eii_extern_target] //~ ERROR `#[eii_extern_target(...)]` expects a list of one or two elements
15#[eii_extern_target()] //~ ERROR `#[eii_extern_target(...)]` expects a list of one or two elements
16#[eii_extern_target(bar, hello)] //~ ERROR expected this argument to be "unsafe"
17#[eii_extern_target(bar, "unsafe", hello)] //~ ERROR `#[eii_extern_target(...)]` expects a list of one or two elements
18#[eii_extern_target(bar, hello, "unsafe")] //~ ERROR `#[eii_extern_target(...)]` expects a list of one or two elements
19#[eii_extern_target = "unsafe"] //~ ERROR `#[eii_extern_target(...)]` expects a list of one or two elements
20#[eii_extern_target(bar)]
14#[eii_declaration] //~ ERROR `#[eii_declaration(...)]` expects a list of one or two elements
15#[eii_declaration()] //~ ERROR `#[eii_declaration(...)]` expects a list of one or two elements
16#[eii_declaration(bar, hello)] //~ ERROR expected this argument to be "unsafe"
17#[eii_declaration(bar, "unsafe", hello)] //~ ERROR `#[eii_declaration(...)]` expects a list of one or two elements
18#[eii_declaration(bar, hello, "unsafe")] //~ ERROR `#[eii_declaration(...)]` expects a list of one or two elements
19#[eii_declaration = "unsafe"] //~ ERROR `#[eii_declaration(...)]` expects a list of one or two elements
20#[eii_declaration(bar)]
2121#[rustc_builtin_macro(eii_shared_macro)]
2222macro foo() {}
2323
tests/ui/eii/errors.stderr+27-27
......@@ -1,56 +1,56 @@
1error: `#[eii_extern_target(...)]` is only valid on macros
1error: `#[eii_declaration(...)]` is only valid on macros
22 --> $DIR/errors.rs:8:1
33 |
4LL | #[eii_extern_target(bar)]
5 | ^^^^^^^^^^^^^^^^^^^^^^^^^
4LL | #[eii_declaration(bar)]
5 | ^^^^^^^^^^^^^^^^^^^^^^^
66
7error: `#[eii_extern_target(...)]` is only valid on macros
7error: `#[eii_declaration(...)]` is only valid on macros
88 --> $DIR/errors.rs:10:5
99 |
10LL | #[eii_extern_target(bar)]
11 | ^^^^^^^^^^^^^^^^^^^^^^^^^
10LL | #[eii_declaration(bar)]
11 | ^^^^^^^^^^^^^^^^^^^^^^^
1212
13error: `#[eii_extern_target(...)]` expects a list of one or two elements
13error: `#[eii_declaration(...)]` expects a list of one or two elements
1414 --> $DIR/errors.rs:14:1
1515 |
16LL | #[eii_extern_target]
17 | ^^^^^^^^^^^^^^^^^^^^
16LL | #[eii_declaration]
17 | ^^^^^^^^^^^^^^^^^^
1818
19error: `#[eii_extern_target(...)]` expects a list of one or two elements
19error: `#[eii_declaration(...)]` expects a list of one or two elements
2020 --> $DIR/errors.rs:15:1
2121 |
22LL | #[eii_extern_target()]
23 | ^^^^^^^^^^^^^^^^^^^^^^
22LL | #[eii_declaration()]
23 | ^^^^^^^^^^^^^^^^^^^^
2424
2525error: expected this argument to be "unsafe"
26 --> $DIR/errors.rs:16:26
26 --> $DIR/errors.rs:16:24
2727 |
28LL | #[eii_extern_target(bar, hello)]
29 | ^^^^^
28LL | #[eii_declaration(bar, hello)]
29 | ^^^^^
3030 |
3131note: the second argument is optional
32 --> $DIR/errors.rs:16:26
32 --> $DIR/errors.rs:16:24
3333 |
34LL | #[eii_extern_target(bar, hello)]
35 | ^^^^^
34LL | #[eii_declaration(bar, hello)]
35 | ^^^^^
3636
37error: `#[eii_extern_target(...)]` expects a list of one or two elements
37error: `#[eii_declaration(...)]` expects a list of one or two elements
3838 --> $DIR/errors.rs:17:1
3939 |
40LL | #[eii_extern_target(bar, "unsafe", hello)]
41 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
40LL | #[eii_declaration(bar, "unsafe", hello)]
41 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4242
43error: `#[eii_extern_target(...)]` expects a list of one or two elements
43error: `#[eii_declaration(...)]` expects a list of one or two elements
4444 --> $DIR/errors.rs:18:1
4545 |
46LL | #[eii_extern_target(bar, hello, "unsafe")]
47 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
46LL | #[eii_declaration(bar, hello, "unsafe")]
47 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4848
49error: `#[eii_extern_target(...)]` expects a list of one or two elements
49error: `#[eii_declaration(...)]` expects a list of one or two elements
5050 --> $DIR/errors.rs:19:1
5151 |
52LL | #[eii_extern_target = "unsafe"]
53 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
52LL | #[eii_declaration = "unsafe"]
53 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5454
5555error: `#[foo]` is only valid on functions
5656 --> $DIR/errors.rs:28:1
tests/ui/eii/type_checking/auxiliary/cross_crate_eii_declaration.rs+1-1
......@@ -5,7 +5,7 @@
55#![feature(rustc_attrs)]
66#![feature(eii_internals)]
77
8#[eii_extern_target(bar)]
8#[eii_declaration(bar)]
99#[rustc_builtin_macro(eii_shared_macro)]
1010pub macro foo() {}
1111
tests/ui/eii/type_checking/subtype_1.rs+1-1
......@@ -6,7 +6,7 @@
66#![feature(rustc_attrs)]
77#![feature(eii_internals)]
88
9#[eii_extern_target(bar)]
9#[eii_declaration(bar)]
1010#[rustc_builtin_macro(eii_shared_macro)]
1111macro foo() {}
1212
tests/ui/eii/type_checking/subtype_2.rs+1-1
......@@ -6,7 +6,7 @@
66#![feature(rustc_attrs)]
77#![feature(eii_internals)]
88
9#[eii_extern_target(bar)]
9#[eii_declaration(bar)]
1010#[rustc_builtin_macro(eii_shared_macro)]
1111macro foo() {}
1212
tests/ui/eii/type_checking/subtype_3.rs+1-1
......@@ -7,7 +7,7 @@
77#![feature(rustc_attrs)]
88#![feature(eii_internals)]
99
10#[eii_extern_target(bar)]
10#[eii_declaration(bar)]
1111#[rustc_builtin_macro(eii_shared_macro)]
1212macro foo() {}
1313
tests/ui/eii/type_checking/subtype_4.rs+1-1
......@@ -7,7 +7,7 @@
77#![feature(rustc_attrs)]
88#![feature(eii_internals)]
99
10#[eii_extern_target(bar)]
10#[eii_declaration(bar)]
1111#[rustc_builtin_macro(eii_shared_macro)]
1212macro foo() {}
1313
tests/ui/eii/type_checking/wrong_ret_ty.rs+1-1
......@@ -5,7 +5,7 @@
55#![feature(rustc_attrs)]
66#![feature(eii_internals)]
77
8#[eii_extern_target(bar)]
8#[eii_declaration(bar)]
99#[rustc_builtin_macro(eii_shared_macro)]
1010macro foo() {}
1111
tests/ui/eii/type_checking/wrong_ty.rs+1-1
......@@ -5,7 +5,7 @@
55#![feature(rustc_attrs)]
66#![feature(eii_internals)]
77
8#[eii_extern_target(bar)]
8#[eii_declaration(bar)]
99#[rustc_builtin_macro(eii_shared_macro)]
1010macro foo() {}
1111
tests/ui/eii/type_checking/wrong_ty_2.rs+1-1
......@@ -5,7 +5,7 @@
55#![feature(rustc_attrs)]
66#![feature(eii_internals)]
77
8#[eii_extern_target(bar)]
8#[eii_declaration(bar)]
99#[rustc_builtin_macro(eii_shared_macro)]
1010macro foo() {}
1111
tests/ui/eii/unsafe_impl_err.rs+1-1
......@@ -5,7 +5,7 @@
55#![feature(rustc_attrs)]
66#![feature(eii_internals)]
77
8#[eii_extern_target(bar, "unsafe")]
8#[eii_declaration(bar, "unsafe")]
99#[rustc_builtin_macro(eii_shared_macro)]
1010macro foo() {}
1111
tests/ui/eii/unsafe_impl_ok.rs+1-1
......@@ -7,7 +7,7 @@
77#![feature(rustc_attrs)]
88#![feature(eii_internals)]
99
10#[eii_extern_target(bar, "unsafe")]
10#[eii_declaration(bar, "unsafe")]
1111#[rustc_builtin_macro(eii_shared_macro)]
1212macro foo() {}
1313
tests/ui/feature-gates/feature-gate-eii-internals.rs+1-1
......@@ -2,7 +2,7 @@
22#![feature(decl_macro)]
33#![feature(rustc_attrs)]
44
5#[eii_extern_target(bar)] //~ ERROR use of unstable library feature `eii_internals`
5#[eii_declaration(bar)] //~ ERROR use of unstable library feature `eii_internals`
66#[rustc_builtin_macro(eii_macro)]
77macro foo() {} //~ ERROR: cannot find a built-in macro with name `foo`
88
tests/ui/feature-gates/feature-gate-eii-internals.stderr+2-2
......@@ -1,8 +1,8 @@
11error[E0658]: use of unstable library feature `eii_internals`
22 --> $DIR/feature-gate-eii-internals.rs:5:3
33 |
4LL | #[eii_extern_target(bar)]
5 | ^^^^^^^^^^^^^^^^^
4LL | #[eii_declaration(bar)]
5 | ^^^^^^^^^^^^^^^
66 |
77 = help: add `#![feature(eii_internals)]` to the crate attributes to enable
88 = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
tests/ui/fmt/format-string-error-2.rs+2
......@@ -86,4 +86,6 @@ raw { \n
8686
8787 println!("{x?}, world!",);
8888 //~^ ERROR invalid format string: expected `}`, found `?`
89 println!("{x,}, world!",);
90 //~^ ERROR invalid format string: python's numeric grouping `,` is not supported in rust format strings
8991}
tests/ui/fmt/format-string-error-2.stderr+11-1
......@@ -188,5 +188,15 @@ LL | println!("{x?}, world!",);
188188 |
189189 = note: to print `{`, you can escape it using `{{`
190190
191error: aborting due to 19 previous errors
191error: invalid format string: python's numeric grouping `,` is not supported in rust format strings
192 --> $DIR/format-string-error-2.rs:89:17
193 |
194LL | println!("{x,}, world!",);
195 | - ^ expected `}` in format string
196 | |
197 | because of this opening brace
198 |
199 = note: to print `{`, you can escape it using `{{`
200
201error: aborting due to 20 previous errors
192202