diff options
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc/Cargo.toml | 8 | ||||
| -rw-r--r-- | compiler/rustc_attr_data_structures/src/attributes.rs | 3 | ||||
| -rw-r--r-- | compiler/rustc_attr_data_structures/src/encode_cross_crate.rs | 1 | ||||
| -rw-r--r-- | compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs | 8 | ||||
| -rw-r--r-- | compiler/rustc_attr_parsing/src/context.rs | 5 | ||||
| -rw-r--r-- | compiler/rustc_borrowck/src/type_check/constraint_conversion.rs | 3 | ||||
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/debuginfo/gdb.rs | 5 | ||||
| -rw-r--r-- | compiler/rustc_driver_impl/Cargo.toml | 2 | ||||
| -rw-r--r-- | compiler/rustc_driver_impl/src/pretty.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_infer/src/infer/canonical/query_response.rs | 22 | ||||
| -rw-r--r-- | compiler/rustc_infer/src/infer/outlives/obligations.rs | 1 | ||||
| -rw-r--r-- | compiler/rustc_infer/src/infer/snapshot/undo_log.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_parse/src/validate_attr.rs | 1 | ||||
| -rw-r--r-- | compiler/rustc_passes/messages.ftl | 4 | ||||
| -rw-r--r-- | compiler/rustc_passes/src/check_attr.rs | 32 | ||||
| -rw-r--r-- | compiler/rustc_passes/src/errors.rs | 8 | ||||
| -rw-r--r-- | compiler/rustc_public/Cargo.toml (renamed from compiler/stable_mir/Cargo.toml) | 4 | ||||
| -rw-r--r-- | compiler/rustc_public/README.md (renamed from compiler/stable_mir/README.md) | 0 | ||||
| -rw-r--r-- | compiler/rustc_public/rust-toolchain.toml (renamed from compiler/stable_mir/rust-toolchain.toml) | 0 | ||||
| -rw-r--r-- | compiler/rustc_public/src/abi.rs (renamed from compiler/stable_mir/src/abi.rs) | 0 | ||||
| -rw-r--r-- | compiler/rustc_public/src/alloc.rs (renamed from compiler/stable_mir/src/alloc.rs) | 10 | ||||
| -rw-r--r-- | compiler/rustc_public/src/compiler_interface.rs (renamed from compiler/stable_mir/src/compiler_interface.rs) | 8 | ||||
| -rw-r--r-- | compiler/rustc_public/src/crate_def.rs (renamed from compiler/stable_mir/src/crate_def.rs) | 0 | ||||
| -rw-r--r-- | compiler/rustc_public/src/error.rs (renamed from compiler/stable_mir/src/error.rs) | 2 | ||||
| -rw-r--r-- | compiler/rustc_public/src/lib.rs (renamed from compiler/stable_mir/src/lib.rs) | 16 | ||||
| -rw-r--r-- | compiler/rustc_public/src/mir.rs (renamed from compiler/stable_mir/src/mir.rs) | 0 | ||||
| -rw-r--r-- | compiler/rustc_public/src/mir/alloc.rs (renamed from compiler/stable_mir/src/mir/alloc.rs) | 0 | ||||
| -rw-r--r-- | compiler/rustc_public/src/mir/body.rs (renamed from compiler/stable_mir/src/mir/body.rs) | 2 | ||||
| -rw-r--r-- | compiler/rustc_public/src/mir/mono.rs (renamed from compiler/stable_mir/src/mir/mono.rs) | 2 | ||||
| -rw-r--r-- | compiler/rustc_public/src/mir/pretty.rs (renamed from compiler/stable_mir/src/mir/pretty.rs) | 0 | ||||
| -rw-r--r-- | compiler/rustc_public/src/mir/visit.rs (renamed from compiler/stable_mir/src/mir/visit.rs) | 0 | ||||
| -rw-r--r-- | compiler/rustc_public/src/rustc_internal/mod.rs (renamed from compiler/stable_mir/src/rustc_internal/mod.rs) | 16 | ||||
| -rw-r--r-- | compiler/rustc_public/src/rustc_internal/pretty.rs (renamed from compiler/stable_mir/src/rustc_internal/pretty.rs) | 0 | ||||
| -rw-r--r-- | compiler/rustc_public/src/target.rs (renamed from compiler/stable_mir/src/target.rs) | 0 | ||||
| -rw-r--r-- | compiler/rustc_public/src/ty.rs (renamed from compiler/stable_mir/src/ty.rs) | 2 | ||||
| -rw-r--r-- | compiler/rustc_public/src/unstable/convert/internal.rs (renamed from compiler/stable_mir/src/unstable/convert/internal.rs) | 4 | ||||
| -rw-r--r-- | compiler/rustc_public/src/unstable/convert/mod.rs (renamed from compiler/stable_mir/src/unstable/convert/mod.rs) | 8 | ||||
| -rw-r--r-- | compiler/rustc_public/src/unstable/convert/stable/abi.rs (renamed from compiler/stable_mir/src/unstable/convert/stable/abi.rs) | 4 | ||||
| -rw-r--r-- | compiler/rustc_public/src/unstable/convert/stable/mir.rs (renamed from compiler/stable_mir/src/unstable/convert/stable/mir.rs) | 8 | ||||
| -rw-r--r-- | compiler/rustc_public/src/unstable/convert/stable/mod.rs (renamed from compiler/stable_mir/src/unstable/convert/stable/mod.rs) | 4 | ||||
| -rw-r--r-- | compiler/rustc_public/src/unstable/convert/stable/ty.rs (renamed from compiler/stable_mir/src/unstable/convert/stable/ty.rs) | 4 | ||||
| -rw-r--r-- | compiler/rustc_public/src/unstable/internal_cx/mod.rs (renamed from compiler/stable_mir/src/unstable/internal_cx/mod.rs) | 0 | ||||
| -rw-r--r-- | compiler/rustc_public/src/unstable/internal_cx/traits.rs (renamed from compiler/stable_mir/src/unstable/internal_cx/traits.rs) | 0 | ||||
| -rw-r--r-- | compiler/rustc_public/src/unstable/mod.rs (renamed from compiler/stable_mir/src/unstable/mod.rs) | 6 | ||||
| -rw-r--r-- | compiler/rustc_public/src/visitor.rs (renamed from compiler/stable_mir/src/visitor.rs) | 0 | ||||
| -rw-r--r-- | compiler/rustc_public_bridge/.gitignore (renamed from compiler/rustc_smir/.gitignore) | 0 | ||||
| -rw-r--r-- | compiler/rustc_public_bridge/Cargo.toml (renamed from compiler/rustc_smir/Cargo.toml) | 2 | ||||
| -rw-r--r-- | compiler/rustc_public_bridge/src/alloc.rs (renamed from compiler/rustc_smir/src/alloc.rs) | 2 | ||||
| -rw-r--r-- | compiler/rustc_public_bridge/src/bridge.rs (renamed from compiler/rustc_smir/src/bridge.rs) | 4 | ||||
| -rw-r--r-- | compiler/rustc_public_bridge/src/builder.rs (renamed from compiler/rustc_smir/src/builder.rs) | 0 | ||||
| -rw-r--r-- | compiler/rustc_public_bridge/src/context/impls.rs (renamed from compiler/rustc_smir/src/context/impls.rs) | 0 | ||||
| -rw-r--r-- | compiler/rustc_public_bridge/src/context/mod.rs (renamed from compiler/rustc_smir/src/context/mod.rs) | 0 | ||||
| -rw-r--r-- | compiler/rustc_public_bridge/src/context/traits.rs (renamed from compiler/rustc_smir/src/context/traits.rs) | 0 | ||||
| -rw-r--r-- | compiler/rustc_public_bridge/src/lib.rs (renamed from compiler/rustc_smir/src/lib.rs) | 6 | ||||
| -rw-r--r-- | compiler/rustc_trait_selection/src/solve/delegate.rs | 8 | ||||
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/query/type_op/custom.rs | 5 |
56 files changed, 137 insertions, 99 deletions
diff --git a/compiler/rustc/Cargo.toml b/compiler/rustc/Cargo.toml index 99414d6264e..3ca75235446 100644 --- a/compiler/rustc/Cargo.toml +++ b/compiler/rustc/Cargo.toml @@ -13,11 +13,11 @@ rustc_codegen_ssa = { path = "../rustc_codegen_ssa" } rustc_driver = { path = "../rustc_driver" } rustc_driver_impl = { path = "../rustc_driver_impl" } -# Make sure rustc_smir ends up in the sysroot, because this -# crate is intended to be used by stable MIR consumers, which are not in-tree. -rustc_smir = { path = "../rustc_smir" } +rustc_public = { path = "../rustc_public" } -stable_mir = { path = "../stable_mir" } +# Make sure rustc_public_bridge ends up in the sysroot, because this +# crate is intended to be used by stable MIR consumers, which are not in-tree. +rustc_public_bridge = { path = "../rustc_public_bridge" } # tidy-alphabetical-end [dependencies.tikv-jemalloc-sys] diff --git a/compiler/rustc_attr_data_structures/src/attributes.rs b/compiler/rustc_attr_data_structures/src/attributes.rs index fe1ef52bd1b..9b14ed88978 100644 --- a/compiler/rustc_attr_data_structures/src/attributes.rs +++ b/compiler/rustc_attr_data_structures/src/attributes.rs @@ -334,6 +334,9 @@ pub enum AttributeKind { /// Represents `#[non_exhaustive]` NonExhaustive(Span), + /// Represents `#[omit_gdb_pretty_printer_section]` + OmitGdbPrettyPrinterSection, + /// Represents `#[optimize(size|speed)]` Optimize(OptimizeAttr, Span), diff --git a/compiler/rustc_attr_data_structures/src/encode_cross_crate.rs b/compiler/rustc_attr_data_structures/src/encode_cross_crate.rs index 1fa762dc45f..494b570c86c 100644 --- a/compiler/rustc_attr_data_structures/src/encode_cross_crate.rs +++ b/compiler/rustc_attr_data_structures/src/encode_cross_crate.rs @@ -52,6 +52,7 @@ impl AttributeKind { NoImplicitPrelude(..) => No, NoMangle(..) => No, NonExhaustive(..) => Yes, + OmitGdbPrettyPrinterSection => No, Optimize(..) => No, ParenSugar(..) => No, PassByValue(..) => Yes, diff --git a/compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs b/compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs index fdec09edaa1..34d9b048348 100644 --- a/compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs +++ b/compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs @@ -334,3 +334,11 @@ impl<S: Stage> CombineAttributeParser<S> for TargetFeatureParser { features } } + +pub(crate) struct OmitGdbPrettyPrinterSectionParser; + +impl<S: Stage> NoArgsAttributeParser<S> for OmitGdbPrettyPrinterSectionParser { + const PATH: &[Symbol] = &[sym::omit_gdb_pretty_printer_section]; + const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error; + const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::OmitGdbPrettyPrinterSection; +} diff --git a/compiler/rustc_attr_parsing/src/context.rs b/compiler/rustc_attr_parsing/src/context.rs index 2194afd88eb..6c70f2ee4ee 100644 --- a/compiler/rustc_attr_parsing/src/context.rs +++ b/compiler/rustc_attr_parsing/src/context.rs @@ -16,8 +16,8 @@ use rustc_span::{DUMMY_SP, ErrorGuaranteed, Span, Symbol, sym}; use crate::attributes::allow_unstable::{AllowConstFnUnstableParser, AllowInternalUnstableParser}; use crate::attributes::codegen_attrs::{ - ColdParser, ExportNameParser, NakedParser, NoMangleParser, OptimizeParser, TargetFeatureParser, - TrackCallerParser, UsedParser, + ColdParser, ExportNameParser, NakedParser, NoMangleParser, OmitGdbPrettyPrinterSectionParser, + OptimizeParser, TargetFeatureParser, TrackCallerParser, UsedParser, }; use crate::attributes::confusables::ConfusablesParser; use crate::attributes::deprecation::DeprecationParser; @@ -175,6 +175,7 @@ attribute_parsers!( Single<WithoutArgs<NoImplicitPreludeParser>>, Single<WithoutArgs<NoMangleParser>>, Single<WithoutArgs<NonExhaustiveParser>>, + Single<WithoutArgs<OmitGdbPrettyPrinterSectionParser>>, Single<WithoutArgs<ParenSugarParser>>, Single<WithoutArgs<PassByValueParser>>, Single<WithoutArgs<PubTransparentParser>>, diff --git a/compiler/rustc_borrowck/src/type_check/constraint_conversion.rs b/compiler/rustc_borrowck/src/type_check/constraint_conversion.rs index 8ed552cfa4f..ca636a8c999 100644 --- a/compiler/rustc_borrowck/src/type_check/constraint_conversion.rs +++ b/compiler/rustc_borrowck/src/type_check/constraint_conversion.rs @@ -159,6 +159,9 @@ impl<'a, 'tcx> ConstraintConversion<'a, 'tcx> { } GenericArgKind::Type(mut t1) => { + // Scraped constraints may have had inference vars. + t1 = self.infcx.resolve_vars_if_possible(t1); + // Normalize the type we receive from a `TypeOutlives` obligation // in the new trait solver. if infcx.next_trait_solver() { diff --git a/compiler/rustc_codegen_llvm/src/debuginfo/gdb.rs b/compiler/rustc_codegen_llvm/src/debuginfo/gdb.rs index 8f0948b8183..49ee96a41d6 100644 --- a/compiler/rustc_codegen_llvm/src/debuginfo/gdb.rs +++ b/compiler/rustc_codegen_llvm/src/debuginfo/gdb.rs @@ -1,13 +1,12 @@ // .debug_gdb_scripts binary section. -use rustc_ast::attr; +use rustc_attr_data_structures::{AttributeKind, find_attr}; use rustc_codegen_ssa::base::collect_debugger_visualizers_transitive; use rustc_codegen_ssa::traits::*; use rustc_hir::def_id::LOCAL_CRATE; use rustc_middle::bug; use rustc_middle::middle::debugger_visualizer::DebuggerVisualizerType; use rustc_session::config::{CrateType, DebugInfo}; -use rustc_span::sym; use crate::builder::Builder; use crate::common::CodegenCx; @@ -87,7 +86,7 @@ pub(crate) fn get_or_insert_gdb_debug_scripts_section_global<'ll>( pub(crate) fn needs_gdb_debug_scripts_section(cx: &CodegenCx<'_, '_>) -> bool { let omit_gdb_pretty_printer_section = - attr::contains_name(cx.tcx.hir_krate_attrs(), sym::omit_gdb_pretty_printer_section); + find_attr!(cx.tcx.hir_krate_attrs(), AttributeKind::OmitGdbPrettyPrinterSection); // To ensure the section `__rustc_debug_gdb_scripts_section__` will not create // ODR violations at link time, this section will not be emitted for rlibs since diff --git a/compiler/rustc_driver_impl/Cargo.toml b/compiler/rustc_driver_impl/Cargo.toml index ce26aa449d9..0d6b49607eb 100644 --- a/compiler/rustc_driver_impl/Cargo.toml +++ b/compiler/rustc_driver_impl/Cargo.toml @@ -41,6 +41,7 @@ rustc_parse = { path = "../rustc_parse" } rustc_passes = { path = "../rustc_passes" } rustc_pattern_analysis = { path = "../rustc_pattern_analysis" } rustc_privacy = { path = "../rustc_privacy" } +rustc_public = { path = "../rustc_public", features = ["rustc_internal"] } rustc_query_system = { path = "../rustc_query_system" } rustc_resolve = { path = "../rustc_resolve" } rustc_session = { path = "../rustc_session" } @@ -50,7 +51,6 @@ rustc_trait_selection = { path = "../rustc_trait_selection" } rustc_ty_utils = { path = "../rustc_ty_utils" } serde_json = "1.0.59" shlex = "1.0" -stable_mir = { path = "../stable_mir", features = ["rustc_internal"] } tracing = { version = "0.1.35" } # tidy-alphabetical-end diff --git a/compiler/rustc_driver_impl/src/pretty.rs b/compiler/rustc_driver_impl/src/pretty.rs index 688307a941f..1604b704033 100644 --- a/compiler/rustc_driver_impl/src/pretty.rs +++ b/compiler/rustc_driver_impl/src/pretty.rs @@ -8,10 +8,10 @@ use rustc_middle::bug; use rustc_middle::mir::{write_mir_graphviz, write_mir_pretty}; use rustc_middle::ty::{self, TyCtxt}; use rustc_mir_build::thir::print::{thir_flat, thir_tree}; +use rustc_public::rustc_internal::pretty::write_smir_pretty; use rustc_session::Session; use rustc_session::config::{OutFileName, PpHirMode, PpMode, PpSourceMode}; use rustc_span::{FileName, Ident}; -use stable_mir::rustc_internal::pretty::write_smir_pretty; use tracing::debug; use {rustc_ast as ast, rustc_hir_pretty as pprust_hir}; diff --git a/compiler/rustc_infer/src/infer/canonical/query_response.rs b/compiler/rustc_infer/src/infer/canonical/query_response.rs index 008ef690008..d5d49e3188a 100644 --- a/compiler/rustc_infer/src/infer/canonical/query_response.rs +++ b/compiler/rustc_infer/src/infer/canonical/query_response.rs @@ -13,7 +13,6 @@ use std::iter; use rustc_index::{Idx, IndexVec}; use rustc_middle::arena::ArenaAllocatable; use rustc_middle::bug; -use rustc_middle::mir::ConstraintCategory; use rustc_middle::ty::{self, BoundVar, GenericArg, GenericArgKind, Ty, TyCtxt, TypeFoldable}; use tracing::{debug, instrument}; @@ -23,7 +22,9 @@ use crate::infer::canonical::{ QueryRegionConstraints, QueryResponse, }; use crate::infer::region_constraints::{Constraint, RegionConstraintData}; -use crate::infer::{DefineOpaqueTypes, InferCtxt, InferOk, InferResult, SubregionOrigin}; +use crate::infer::{ + DefineOpaqueTypes, InferCtxt, InferOk, InferResult, SubregionOrigin, TypeOutlivesConstraint, +}; use crate::traits::query::NoSolution; use crate::traits::{ObligationCause, PredicateObligations, ScrubbedTraitError, TraitEngine}; @@ -117,13 +118,7 @@ impl<'tcx> InferCtxt<'tcx> { let region_obligations = self.take_registered_region_obligations(); debug!(?region_obligations); let region_constraints = self.with_region_constraints(|region_constraints| { - make_query_region_constraints( - tcx, - region_obligations - .iter() - .map(|r_o| (r_o.sup_type, r_o.sub_region, r_o.origin.to_constraint_category())), - region_constraints, - ) + make_query_region_constraints(tcx, region_obligations, region_constraints) }); debug!(?region_constraints); @@ -570,7 +565,7 @@ impl<'tcx> InferCtxt<'tcx> { /// creates query region constraints. pub fn make_query_region_constraints<'tcx>( tcx: TyCtxt<'tcx>, - outlives_obligations: impl Iterator<Item = (Ty<'tcx>, ty::Region<'tcx>, ConstraintCategory<'tcx>)>, + outlives_obligations: Vec<TypeOutlivesConstraint<'tcx>>, region_constraints: &RegionConstraintData<'tcx>, ) -> QueryRegionConstraints<'tcx> { let RegionConstraintData { constraints, verifys } = region_constraints; @@ -599,8 +594,11 @@ pub fn make_query_region_constraints<'tcx>( }; (constraint, origin.to_constraint_category()) }) - .chain(outlives_obligations.map(|(ty, r, constraint_category)| { - (ty::OutlivesPredicate(ty.into(), r), constraint_category) + .chain(outlives_obligations.into_iter().map(|obl| { + ( + ty::OutlivesPredicate(obl.sup_type.into(), obl.sub_region), + obl.origin.to_constraint_category(), + ) })) .collect(); diff --git a/compiler/rustc_infer/src/infer/outlives/obligations.rs b/compiler/rustc_infer/src/infer/outlives/obligations.rs index f272052aaa5..43504bd77c1 100644 --- a/compiler/rustc_infer/src/infer/outlives/obligations.rs +++ b/compiler/rustc_infer/src/infer/outlives/obligations.rs @@ -166,6 +166,7 @@ impl<'tcx> InferCtxt<'tcx> { /// Trait queries just want to pass back type obligations "as is" pub fn take_registered_region_obligations(&self) -> Vec<TypeOutlivesConstraint<'tcx>> { + assert!(!self.in_snapshot(), "cannot take registered region obligations in a snapshot"); std::mem::take(&mut self.inner.borrow_mut().region_obligations) } diff --git a/compiler/rustc_infer/src/infer/snapshot/undo_log.rs b/compiler/rustc_infer/src/infer/snapshot/undo_log.rs index 6193f35f3eb..34e649afedc 100644 --- a/compiler/rustc_infer/src/infer/snapshot/undo_log.rs +++ b/compiler/rustc_infer/src/infer/snapshot/undo_log.rs @@ -1,3 +1,4 @@ +use std::assert_matches::assert_matches; use std::marker::PhantomData; use rustc_data_structures::undo_log::{Rollback, UndoLogs}; @@ -73,7 +74,8 @@ impl<'tcx> Rollback<UndoLog<'tcx>> for InferCtxtInner<'tcx> { } UndoLog::ProjectionCache(undo) => self.projection_cache.reverse(undo), UndoLog::PushTypeOutlivesConstraint => { - self.region_obligations.pop(); + let popped = self.region_obligations.pop(); + assert_matches!(popped, Some(_), "pushed region constraint but could not pop it"); } } } diff --git a/compiler/rustc_parse/src/validate_attr.rs b/compiler/rustc_parse/src/validate_attr.rs index d51b3b9abcf..5c748e956a0 100644 --- a/compiler/rustc_parse/src/validate_attr.rs +++ b/compiler/rustc_parse/src/validate_attr.rs @@ -305,6 +305,7 @@ pub fn check_builtin_meta_item( | sym::naked | sym::no_mangle | sym::non_exhaustive + | sym::omit_gdb_pretty_printer_section | sym::path | sym::ignore | sym::must_use diff --git a/compiler/rustc_passes/messages.ftl b/compiler/rustc_passes/messages.ftl index 0b857b0d693..3418d997b83 100644 --- a/compiler/rustc_passes/messages.ftl +++ b/compiler/rustc_passes/messages.ftl @@ -17,6 +17,10 @@ passes_align_attr_application = `#[align(...)]` should be applied to a function item .label = not a function item +passes_align_on_fields = + attribute should be applied to a function or method + .warn = {-passes_previously_accepted} + passes_align_should_be_repr_align = `#[align(...)]` is not supported on {$item} items .suggestion = use `#[repr(align(...))]` instead diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs index 2186b741e92..820255afe27 100644 --- a/compiler/rustc_passes/src/check_attr.rs +++ b/compiler/rustc_passes/src/check_attr.rs @@ -45,6 +45,7 @@ use rustc_trait_selection::infer::{TyCtxtInferExt, ValuePairs}; use rustc_trait_selection::traits::ObligationCtxt; use tracing::debug; +use crate::errors::AlignOnFields; use crate::{errors, fluent_generated as fluent}; #[derive(LintDiagnostic)] @@ -207,8 +208,8 @@ impl<'tcx> CheckAttrVisitor<'tcx> { Attribute::Parsed(AttributeKind::ExportName { span: attr_span, .. }) => { self.check_export_name(hir_id, *attr_span, span, target) } - Attribute::Parsed(AttributeKind::Align { align, span: repr_span }) => { - self.check_align(span, target, *align, *repr_span) + Attribute::Parsed(AttributeKind::Align { align, span: attr_span }) => { + self.check_align(span, hir_id, target, *align, *attr_span) } Attribute::Parsed(AttributeKind::LinkSection { span: attr_span, .. }) => { self.check_link_section(hir_id, *attr_span, span, target) @@ -250,7 +251,8 @@ impl<'tcx> CheckAttrVisitor<'tcx> { AttributeKind::BodyStability { .. } | AttributeKind::ConstStabilityIndirect | AttributeKind::MacroTransparency(_) - | AttributeKind::Dummy, + | AttributeKind::Dummy + | AttributeKind::OmitGdbPrettyPrinterSection, ) => { /* do nothing */ } Attribute::Parsed(AttributeKind::AsPtr(attr_span)) => { self.check_applied_to_fn_or_method(hir_id, *attr_span, span, target) @@ -380,7 +382,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> { // need to be fixed | sym::cfi_encoding // FIXME(cfi_encoding) | sym::pointee // FIXME(derive_coerce_pointee) - | sym::omit_gdb_pretty_printer_section // FIXME(omit_gdb_pretty_printer_section) | sym::instruction_set // broken on stable!!! | sym::windows_subsystem // broken on stable!!! | sym::patchable_function_entry // FIXME(patchable_function_entry) @@ -1953,22 +1954,37 @@ impl<'tcx> CheckAttrVisitor<'tcx> { } /// Checks if the `#[align]` attributes on `item` are valid. - fn check_align(&self, span: Span, target: Target, align: Align, repr_span: Span) { + fn check_align( + &self, + span: Span, + hir_id: HirId, + target: Target, + align: Align, + attr_span: Span, + ) { match target { Target::Fn | Target::Method(_) | Target::ForeignFn => {} + Target::Field => { + self.tcx.emit_node_span_lint( + UNUSED_ATTRIBUTES, + hir_id, + attr_span, + AlignOnFields { span }, + ); + } Target::Struct | Target::Union | Target::Enum => { self.dcx().emit_err(errors::AlignShouldBeReprAlign { - span: repr_span, + span: attr_span, item: target.name(), align_bytes: align.bytes(), }); } _ => { - self.dcx().emit_err(errors::AlignAttrApplication { hint_span: repr_span, span }); + self.dcx().emit_err(errors::AlignAttrApplication { hint_span: attr_span, span }); } } - self.check_align_value(align, repr_span); + self.check_align_value(align, attr_span); } /// Checks if the `#[repr]` attributes on `item` are valid. diff --git a/compiler/rustc_passes/src/errors.rs b/compiler/rustc_passes/src/errors.rs index 4ad615a2abf..093a2b38804 100644 --- a/compiler/rustc_passes/src/errors.rs +++ b/compiler/rustc_passes/src/errors.rs @@ -604,6 +604,14 @@ pub(crate) struct NoMangle { pub span: Span, } +#[derive(LintDiagnostic)] +#[diag(passes_align_on_fields)] +#[warning] +pub(crate) struct AlignOnFields { + #[label] + pub span: Span, +} + #[derive(Diagnostic)] #[diag(passes_repr_conflicting, code = E0566)] pub(crate) struct ReprConflicting { diff --git a/compiler/stable_mir/Cargo.toml b/compiler/rustc_public/Cargo.toml index 6777abce01d..fa782166e4f 100644 --- a/compiler/stable_mir/Cargo.toml +++ b/compiler/rustc_public/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "stable_mir" +name = "rustc_public" version = "0.1.0-preview" edition = "2024" @@ -8,8 +8,8 @@ edition = "2024" rustc_abi = { path = "../rustc_abi" } rustc_hir = { path = "../rustc_hir" } rustc_middle = { path = "../rustc_middle" } +rustc_public_bridge = { path = "../rustc_public_bridge" } rustc_session = { path = "../rustc_session" } -rustc_smir = { path = "../rustc_smir" } rustc_span = { path = "../rustc_span" } rustc_target = { path = "../rustc_target" } scoped-tls = "1.0" diff --git a/compiler/stable_mir/README.md b/compiler/rustc_public/README.md index ab2546e377a..ab2546e377a 100644 --- a/compiler/stable_mir/README.md +++ b/compiler/rustc_public/README.md diff --git a/compiler/stable_mir/rust-toolchain.toml b/compiler/rustc_public/rust-toolchain.toml index d75e8e33b1c..d75e8e33b1c 100644 --- a/compiler/stable_mir/rust-toolchain.toml +++ b/compiler/rustc_public/rust-toolchain.toml diff --git a/compiler/stable_mir/src/abi.rs b/compiler/rustc_public/src/abi.rs index 7b0882caf1b..7b0882caf1b 100644 --- a/compiler/stable_mir/src/abi.rs +++ b/compiler/rustc_public/src/abi.rs diff --git a/compiler/stable_mir/src/alloc.rs b/compiler/rustc_public/src/alloc.rs index 349b83231e3..d2db6c08bbc 100644 --- a/compiler/stable_mir/src/alloc.rs +++ b/compiler/rustc_public/src/alloc.rs @@ -2,14 +2,14 @@ //! //! This module is responsible for constructing stable components. //! All operations requiring rustc queries must be delegated -//! to `rustc_smir::alloc` to maintain stability guarantees. +//! to `rustc_public_bridge::alloc` to maintain stability guarantees. use rustc_abi::Align; use rustc_middle::mir::ConstValue; use rustc_middle::mir::interpret::AllocRange; -use rustc_smir::bridge::SmirError; -use rustc_smir::context::SmirCtxt; -use rustc_smir::{Tables, alloc}; +use rustc_public_bridge::bridge::SmirError; +use rustc_public_bridge::context::SmirCtxt; +use rustc_public_bridge::{Tables, alloc}; use super::Error; use super::compiler_interface::BridgeTys; @@ -59,7 +59,7 @@ pub(crate) fn try_new_allocation<'tcx>( } ConstValue::Indirect { alloc_id, offset } => { let alloc = alloc::try_new_indirect(alloc_id, cx); - use rustc_smir::context::SmirAllocRange; + use rustc_public_bridge::context::SmirAllocRange; Ok(allocation_filter(&alloc.0, cx.alloc_range(offset, layout.size), tables, cx)) } } diff --git a/compiler/stable_mir/src/compiler_interface.rs b/compiler/rustc_public/src/compiler_interface.rs index 50c2f02e6ad..d15438c2b80 100644 --- a/compiler/stable_mir/src/compiler_interface.rs +++ b/compiler/rustc_public/src/compiler_interface.rs @@ -6,8 +6,8 @@ use std::cell::Cell; use rustc_hir::def::DefKind; -use rustc_smir::context::SmirCtxt; -use rustc_smir::{Bridge, SmirContainer}; +use rustc_public_bridge::context::SmirCtxt; +use rustc_public_bridge::{Bridge, SmirContainer}; use tracing::debug; use crate::abi::{FnAbi, Layout, LayoutShape, ReprOptions}; @@ -68,7 +68,7 @@ impl Bridge for BridgeTys { /// Stable public API for querying compiler information. /// -/// All queries are delegated to [`rustc_smir::context::SmirCtxt`] that provides +/// All queries are delegated to [`rustc_public_bridge::context::SmirCtxt`] that provides /// similar APIs but based on internal rustc constructs. /// /// Do not use this directly. This is currently used in the macro expansion. @@ -567,7 +567,7 @@ impl<'tcx> SmirInterface for SmirContainer<'tcx, BridgeTys> { DefKind::Fn => ForeignItemKind::Fn(tables.fn_def(def_id)), DefKind::Static { .. } => ForeignItemKind::Static(tables.static_def(def_id)), DefKind::ForeignTy => { - use rustc_smir::context::SmirTy; + use rustc_public_bridge::context::SmirTy; ForeignItemKind::Type(tables.intern_ty(cx.new_foreign(def_id))) } def_kind => unreachable!("Unexpected kind for a foreign item: {:?}", def_kind), diff --git a/compiler/stable_mir/src/crate_def.rs b/compiler/rustc_public/src/crate_def.rs index 75228135e4c..75228135e4c 100644 --- a/compiler/stable_mir/src/crate_def.rs +++ b/compiler/rustc_public/src/crate_def.rs diff --git a/compiler/stable_mir/src/error.rs b/compiler/rustc_public/src/error.rs index 702134b0c4c..bc2124d1716 100644 --- a/compiler/stable_mir/src/error.rs +++ b/compiler/rustc_public/src/error.rs @@ -7,7 +7,7 @@ use std::fmt::{Debug, Display, Formatter}; use std::{fmt, io}; -use rustc_smir::bridge::SmirError; +use rustc_public_bridge::bridge::SmirError; macro_rules! error { ($fmt: literal $(,)?) => { Error(format!($fmt)) }; diff --git a/compiler/stable_mir/src/lib.rs b/compiler/rustc_public/src/lib.rs index 0a2e4e71afc..e320c4eca71 100644 --- a/compiler/stable_mir/src/lib.rs +++ b/compiler/rustc_public/src/lib.rs @@ -1,4 +1,4 @@ -//! The WIP stable interface to rustc internals. +//! The WIP public interface to rustc internals. //! //! For more information see <https://github.com/rust-lang/project-stable-mir> //! @@ -22,9 +22,9 @@ use std::fmt::Debug; use std::{fmt, io}; -pub(crate) use rustc_smir::IndexedVal; -use rustc_smir::Tables; -use rustc_smir::context::SmirCtxt; +pub(crate) use rustc_public_bridge::IndexedVal; +use rustc_public_bridge::Tables; +use rustc_public_bridge::context::SmirCtxt; /// Export the rustc_internal APIs. Note that this module has no stability /// guarantees and it is not taken into account for semver. #[cfg(feature = "rustc_internal")] @@ -244,7 +244,7 @@ pub fn opaque<T: Debug>(value: &T) -> Opaque { macro_rules! bridge_impl { ($name: ident, $ty: ty) => { - impl rustc_smir::bridge::$name<compiler_interface::BridgeTys> for $ty { + impl rustc_public_bridge::bridge::$name<compiler_interface::BridgeTys> for $ty { fn new(def: crate::DefId) -> Self { Self(def) } @@ -273,13 +273,15 @@ bridge_impl!(AssocDef, crate::ty::AssocDef); bridge_impl!(OpaqueDef, crate::ty::OpaqueDef); bridge_impl!(StaticDef, crate::mir::mono::StaticDef); -impl rustc_smir::bridge::Prov<compiler_interface::BridgeTys> for crate::ty::Prov { +impl rustc_public_bridge::bridge::Prov<compiler_interface::BridgeTys> for crate::ty::Prov { fn new(aid: crate::mir::alloc::AllocId) -> Self { Self(aid) } } -impl rustc_smir::bridge::Allocation<compiler_interface::BridgeTys> for crate::ty::Allocation { +impl rustc_public_bridge::bridge::Allocation<compiler_interface::BridgeTys> + for crate::ty::Allocation +{ fn new<'tcx>( bytes: Vec<Option<u8>>, ptrs: Vec<(usize, rustc_middle::mir::interpret::AllocId)>, diff --git a/compiler/stable_mir/src/mir.rs b/compiler/rustc_public/src/mir.rs index 413b5152bb3..413b5152bb3 100644 --- a/compiler/stable_mir/src/mir.rs +++ b/compiler/rustc_public/src/mir.rs diff --git a/compiler/stable_mir/src/mir/alloc.rs b/compiler/rustc_public/src/mir/alloc.rs index 9a94551f3ec..9a94551f3ec 100644 --- a/compiler/stable_mir/src/mir/alloc.rs +++ b/compiler/rustc_public/src/mir/alloc.rs diff --git a/compiler/stable_mir/src/mir/body.rs b/compiler/rustc_public/src/mir/body.rs index a9fe3607232..28a7aa6e758 100644 --- a/compiler/stable_mir/src/mir/body.rs +++ b/compiler/rustc_public/src/mir/body.rs @@ -674,7 +674,7 @@ pub enum AggregateKind { Tuple, Adt(AdtDef, VariantIdx, GenericArgs, Option<UserTypeAnnotationIndex>, Option<FieldIdx>), Closure(ClosureDef, GenericArgs), - // FIXME(stable_mir): Movability here is redundant + // FIXME(rustc_public): Movability here is redundant Coroutine(CoroutineDef, GenericArgs, Movability), CoroutineClosure(CoroutineClosureDef, GenericArgs), RawPtr(Ty, Mutability), diff --git a/compiler/stable_mir/src/mir/mono.rs b/compiler/rustc_public/src/mir/mono.rs index c54fcecac9f..c85f0fa36f7 100644 --- a/compiler/stable_mir/src/mir/mono.rs +++ b/compiler/rustc_public/src/mir/mono.rs @@ -1,7 +1,7 @@ use std::fmt::{Debug, Formatter}; use std::io; -use rustc_smir::bridge::SmirError; +use rustc_public_bridge::bridge::SmirError; use serde::Serialize; use crate::abi::FnAbi; diff --git a/compiler/stable_mir/src/mir/pretty.rs b/compiler/rustc_public/src/mir/pretty.rs index f496d80053e..f496d80053e 100644 --- a/compiler/stable_mir/src/mir/pretty.rs +++ b/compiler/rustc_public/src/mir/pretty.rs diff --git a/compiler/stable_mir/src/mir/visit.rs b/compiler/rustc_public/src/mir/visit.rs index 7dc99d1d1e1..7dc99d1d1e1 100644 --- a/compiler/stable_mir/src/mir/visit.rs +++ b/compiler/rustc_public/src/mir/visit.rs diff --git a/compiler/stable_mir/src/rustc_internal/mod.rs b/compiler/rustc_public/src/rustc_internal/mod.rs index c1ed03ade75..5d7c8256d5b 100644 --- a/compiler/stable_mir/src/rustc_internal/mod.rs +++ b/compiler/rustc_public/src/rustc_internal/mod.rs @@ -6,8 +6,8 @@ use std::cell::{Cell, RefCell}; use rustc_middle::ty::TyCtxt; -use rustc_smir::context::SmirCtxt; -use rustc_smir::{Bridge, SmirContainer, Tables}; +use rustc_public_bridge::context::SmirCtxt; +use rustc_public_bridge::{Bridge, SmirContainer, Tables}; use rustc_span::def_id::CrateNum; use scoped_tls::scoped_thread_local; @@ -105,11 +105,11 @@ where /// # extern crate rustc_interface; /// # extern crate rustc_middle; /// # #[macro_use] -/// # extern crate stable_mir; +/// # extern crate rustc_public; /// # /// # fn main() { /// # use std::ops::ControlFlow; -/// # use stable_mir::CompilerError; +/// # use rustc_public::CompilerError; /// fn analyze_code() -> ControlFlow<(), ()> { /// // Your code goes in here. /// # ControlFlow::Continue(()) @@ -125,11 +125,11 @@ where /// # extern crate rustc_interface; /// # extern crate rustc_middle; /// # #[macro_use] -/// # extern crate stable_mir; +/// # extern crate rustc_public; /// # /// # fn main() { /// # use std::ops::ControlFlow; -/// # use stable_mir::CompilerError; +/// # use rustc_public::CompilerError; /// fn analyze_code(extra_args: Vec<String>) -> ControlFlow<(), ()> { /// # let _ = extra_args; /// // Your code goes in here. @@ -187,8 +187,8 @@ macro_rules! run_driver { use rustc_driver::{Callbacks, Compilation, run_compiler}; use rustc_middle::ty::TyCtxt; use rustc_interface::interface; - use stable_mir::rustc_internal; - use stable_mir::CompilerError; + use rustc_public::rustc_internal; + use rustc_public::CompilerError; use std::ops::ControlFlow; pub struct StableMir<B = (), C = (), F = fn($(optional!($with_tcx TyCtxt))?) -> ControlFlow<B, C>> diff --git a/compiler/stable_mir/src/rustc_internal/pretty.rs b/compiler/rustc_public/src/rustc_internal/pretty.rs index 28c5280fe04..28c5280fe04 100644 --- a/compiler/stable_mir/src/rustc_internal/pretty.rs +++ b/compiler/rustc_public/src/rustc_internal/pretty.rs diff --git a/compiler/stable_mir/src/target.rs b/compiler/rustc_public/src/target.rs index 32c3a2a9122..32c3a2a9122 100644 --- a/compiler/stable_mir/src/target.rs +++ b/compiler/rustc_public/src/target.rs diff --git a/compiler/stable_mir/src/ty.rs b/compiler/rustc_public/src/ty.rs index 87d31cf9713..bc67a2f987d 100644 --- a/compiler/stable_mir/src/ty.rs +++ b/compiler/rustc_public/src/ty.rs @@ -560,7 +560,7 @@ pub enum RigidTy { FnDef(FnDef, GenericArgs), FnPtr(PolyFnSig), Closure(ClosureDef, GenericArgs), - // FIXME(stable_mir): Movability here is redundant + // FIXME(rustc_public): Movability here is redundant Coroutine(CoroutineDef, GenericArgs, Movability), CoroutineClosure(CoroutineClosureDef, GenericArgs), Dynamic(Vec<Binder<ExistentialPredicate>>, Region, DynKind), diff --git a/compiler/stable_mir/src/unstable/convert/internal.rs b/compiler/rustc_public/src/unstable/convert/internal.rs index 04b2e572621..8a6238413b0 100644 --- a/compiler/stable_mir/src/unstable/convert/internal.rs +++ b/compiler/rustc_public/src/unstable/convert/internal.rs @@ -3,10 +3,10 @@ //! This module will only include a few constructs to allow users to invoke internal rustc APIs //! due to incomplete stable coverage. -// Prefer importing stable_mir over internal rustc constructs to make this file more readable. +// Prefer importing rustc_public over internal rustc constructs to make this file more readable. use rustc_middle::ty::{self as rustc_ty, Const as InternalConst, Ty as InternalTy}; -use rustc_smir::Tables; +use rustc_public_bridge::Tables; use crate::abi::Layout; use crate::compiler_interface::BridgeTys; diff --git a/compiler/stable_mir/src/unstable/convert/mod.rs b/compiler/rustc_public/src/unstable/convert/mod.rs index aad92325861..85a71e09c3e 100644 --- a/compiler/stable_mir/src/unstable/convert/mod.rs +++ b/compiler/rustc_public/src/unstable/convert/mod.rs @@ -1,15 +1,15 @@ //! This module holds the logic to convert rustc internal ADTs into stable mir ADTs. //! //! The conversion from stable to internal is not meant to be complete, -//! and it should be added as when needed to be passed as input to rustc_smir functions. +//! and it should be added as when needed to be passed as input to rustc_public_bridge functions. //! //! For contributors, please make sure to avoid calling rustc's internal functions and queries. -//! These should be done via `rustc_smir` APIs, but it's possible to access ADT fields directly. +//! These should be done via `rustc_public_bridge` APIs, but it's possible to access ADT fields directly. use std::ops::RangeInclusive; -use rustc_smir::Tables; -use rustc_smir::context::SmirCtxt; +use rustc_public_bridge::Tables; +use rustc_public_bridge::context::SmirCtxt; use super::Stable; use crate::compiler_interface::BridgeTys; diff --git a/compiler/stable_mir/src/unstable/convert/stable/abi.rs b/compiler/rustc_public/src/unstable/convert/stable/abi.rs index 8fdaa69c305..40a8bf614e1 100644 --- a/compiler/stable_mir/src/unstable/convert/stable/abi.rs +++ b/compiler/rustc_public/src/unstable/convert/stable/abi.rs @@ -4,8 +4,8 @@ use rustc_abi::{ArmCall, CanonAbi, InterruptKind, X86Call}; use rustc_middle::ty; -use rustc_smir::Tables; -use rustc_smir::context::SmirCtxt; +use rustc_public_bridge::Tables; +use rustc_public_bridge::context::SmirCtxt; use rustc_target::callconv; use crate::abi::{ diff --git a/compiler/stable_mir/src/unstable/convert/stable/mir.rs b/compiler/rustc_public/src/unstable/convert/stable/mir.rs index ad39fc37600..bd7d4807152 100644 --- a/compiler/stable_mir/src/unstable/convert/stable/mir.rs +++ b/compiler/rustc_public/src/unstable/convert/stable/mir.rs @@ -2,9 +2,9 @@ use rustc_middle::mir::mono::MonoItem; use rustc_middle::{bug, mir}; -use rustc_smir::Tables; -use rustc_smir::bridge::SmirError; -use rustc_smir::context::SmirCtxt; +use rustc_public_bridge::Tables; +use rustc_public_bridge::bridge::SmirError; +use rustc_public_bridge::context::SmirCtxt; use crate::compiler_interface::BridgeTys; use crate::mir::alloc::GlobalAlloc; @@ -821,7 +821,7 @@ impl<'tcx> Stable<'tcx> for mir::interpret::Allocation { tables: &mut Tables<'cx, BridgeTys>, cx: &SmirCtxt<'cx, BridgeTys>, ) -> Self::T { - use rustc_smir::context::SmirAllocRange; + use rustc_public_bridge::context::SmirAllocRange; alloc::allocation_filter( self, cx.alloc_range(rustc_abi::Size::ZERO, self.size()), diff --git a/compiler/stable_mir/src/unstable/convert/stable/mod.rs b/compiler/rustc_public/src/unstable/convert/stable/mod.rs index e7f14bbdfc8..ea78ca50eb3 100644 --- a/compiler/stable_mir/src/unstable/convert/stable/mod.rs +++ b/compiler/rustc_public/src/unstable/convert/stable/mod.rs @@ -1,8 +1,8 @@ //! Conversion of internal Rust compiler items to stable ones. use rustc_abi::FieldIdx; -use rustc_smir::Tables; -use rustc_smir::context::SmirCtxt; +use rustc_public_bridge::Tables; +use rustc_public_bridge::context::SmirCtxt; use super::Stable; use crate::compiler_interface::BridgeTys; diff --git a/compiler/stable_mir/src/unstable/convert/stable/ty.rs b/compiler/rustc_public/src/unstable/convert/stable/ty.rs index 366f7ea01d4..75c29788787 100644 --- a/compiler/stable_mir/src/unstable/convert/stable/ty.rs +++ b/compiler/rustc_public/src/unstable/convert/stable/ty.rs @@ -2,8 +2,8 @@ use rustc_middle::ty::Ty; use rustc_middle::{bug, mir, ty}; -use rustc_smir::Tables; -use rustc_smir::context::SmirCtxt; +use rustc_public_bridge::Tables; +use rustc_public_bridge::context::SmirCtxt; use crate::alloc; use crate::compiler_interface::BridgeTys; diff --git a/compiler/stable_mir/src/unstable/internal_cx/mod.rs b/compiler/rustc_public/src/unstable/internal_cx/mod.rs index 6b0a06e304c..6b0a06e304c 100644 --- a/compiler/stable_mir/src/unstable/internal_cx/mod.rs +++ b/compiler/rustc_public/src/unstable/internal_cx/mod.rs diff --git a/compiler/stable_mir/src/unstable/internal_cx/traits.rs b/compiler/rustc_public/src/unstable/internal_cx/traits.rs index da443cd78f1..da443cd78f1 100644 --- a/compiler/stable_mir/src/unstable/internal_cx/traits.rs +++ b/compiler/rustc_public/src/unstable/internal_cx/traits.rs diff --git a/compiler/stable_mir/src/unstable/mod.rs b/compiler/rustc_public/src/unstable/mod.rs index 51c31e212f5..ce7c41a64fa 100644 --- a/compiler/stable_mir/src/unstable/mod.rs +++ b/compiler/rustc_public/src/unstable/mod.rs @@ -9,8 +9,8 @@ use std::marker::PointeeSized; use rustc_hir::def::DefKind; use rustc_middle::ty::{List, Ty, TyCtxt}; use rustc_middle::{mir, ty}; -use rustc_smir::Tables; -use rustc_smir::context::SmirCtxt; +use rustc_public_bridge::Tables; +use rustc_public_bridge::context::SmirCtxt; use super::compiler_interface::BridgeTys; use crate::{CtorKind, ItemKind}; @@ -21,7 +21,7 @@ mod internal_cx; /// Trait that defines the methods that are fine to call from [`RustcInternal`]. /// /// This trait is only for [`RustcInternal`]. Any other other access to rustc's internals -/// should go through [`rustc_smir::context::SmirCtxt`]. +/// should go through [`rustc_public_bridge::context::SmirCtxt`]. pub trait InternalCx<'tcx>: Copy + Clone { fn tcx(self) -> TyCtxt<'tcx>; diff --git a/compiler/stable_mir/src/visitor.rs b/compiler/rustc_public/src/visitor.rs index 45e2a815470..45e2a815470 100644 --- a/compiler/stable_mir/src/visitor.rs +++ b/compiler/rustc_public/src/visitor.rs diff --git a/compiler/rustc_smir/.gitignore b/compiler/rustc_public_bridge/.gitignore index eb5a316cbd1..eb5a316cbd1 100644 --- a/compiler/rustc_smir/.gitignore +++ b/compiler/rustc_public_bridge/.gitignore diff --git a/compiler/rustc_smir/Cargo.toml b/compiler/rustc_public_bridge/Cargo.toml index b7ea478f731..918de4a393c 100644 --- a/compiler/rustc_smir/Cargo.toml +++ b/compiler/rustc_public_bridge/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "rustc_smir" +name = "rustc_public_bridge" version = "0.0.0" edition = "2024" diff --git a/compiler/rustc_smir/src/alloc.rs b/compiler/rustc_public_bridge/src/alloc.rs index fd3cf24edb5..23bbaddce06 100644 --- a/compiler/rustc_smir/src/alloc.rs +++ b/compiler/rustc_public_bridge/src/alloc.rs @@ -1,7 +1,7 @@ //! Internal memory allocator implementation for StableMIR. //! //! This module handles all direct interactions with rustc queries and performs -//! the actual memory allocations. The stable interface in `stable_mir::alloc` +//! the actual memory allocations. The stable interface in `rustc_public::alloc` //! delegates all query-related operations to this implementation. use rustc_abi::{Size, TyAndLayout}; diff --git a/compiler/rustc_smir/src/bridge.rs b/compiler/rustc_public_bridge/src/bridge.rs index a31eb93d0e8..379a8da5df9 100644 --- a/compiler/rustc_smir/src/bridge.rs +++ b/compiler/rustc_public_bridge/src/bridge.rs @@ -1,8 +1,8 @@ //! Defines a set of traits that is used for abstracting -//! stable_mir's components that are needed in rustc_smir. +//! rustc_public's components that are needed in rustc_public_bridge. //! //! These traits are really useful when programming -//! in stable_mir-agnostic settings. +//! in rustc_public-agnostic settings. use std::fmt::Debug; diff --git a/compiler/rustc_smir/src/builder.rs b/compiler/rustc_public_bridge/src/builder.rs index 2141053d09a..2141053d09a 100644 --- a/compiler/rustc_smir/src/builder.rs +++ b/compiler/rustc_public_bridge/src/builder.rs diff --git a/compiler/rustc_smir/src/context/impls.rs b/compiler/rustc_public_bridge/src/context/impls.rs index fdefad2821b..fdefad2821b 100644 --- a/compiler/rustc_smir/src/context/impls.rs +++ b/compiler/rustc_public_bridge/src/context/impls.rs diff --git a/compiler/rustc_smir/src/context/mod.rs b/compiler/rustc_public_bridge/src/context/mod.rs index da20be2a4b3..da20be2a4b3 100644 --- a/compiler/rustc_smir/src/context/mod.rs +++ b/compiler/rustc_public_bridge/src/context/mod.rs diff --git a/compiler/rustc_smir/src/context/traits.rs b/compiler/rustc_public_bridge/src/context/traits.rs index 8483bee4aad..8483bee4aad 100644 --- a/compiler/rustc_smir/src/context/traits.rs +++ b/compiler/rustc_public_bridge/src/context/traits.rs diff --git a/compiler/rustc_smir/src/lib.rs b/compiler/rustc_public_bridge/src/lib.rs index fbebf98df7d..652a8093a87 100644 --- a/compiler/rustc_smir/src/lib.rs +++ b/compiler/rustc_public_bridge/src/lib.rs @@ -3,7 +3,7 @@ //! This crate is responsible for building Stable MIR components from internal components. //! //! This crate is not intended to be invoked directly by users. -//! This crate is the public API of rustc that will be invoked by the `stable_mir` crate. +//! This crate is the public API of rustc that will be invoked by the `rustc_public` crate. //! //! For more information see <https://github.com/rust-lang/project-stable-mir> //! @@ -42,7 +42,7 @@ pub mod bridge; mod builder; pub mod context; -#[deprecated(note = "please use `stable_mir::rustc_internal` instead")] +#[deprecated(note = "please use `rustc_public::rustc_internal` instead")] pub mod rustc_internal {} /// A container which is used for TLS. @@ -211,7 +211,7 @@ impl<'tcx, B: Bridge> Tables<'tcx, B> { } /// A trait defining types that are used to emulate StableMIR components, which is really -/// useful when programming in stable_mir-agnostic settings. +/// useful when programming in rustc_public-agnostic settings. pub trait Bridge: Sized { type DefId: Copy + Debug + PartialEq + IndexedVal; type AllocId: Copy + Debug + PartialEq + IndexedVal; diff --git a/compiler/rustc_trait_selection/src/solve/delegate.rs b/compiler/rustc_trait_selection/src/solve/delegate.rs index d22529d56a4..1a24254d57f 100644 --- a/compiler/rustc_trait_selection/src/solve/delegate.rs +++ b/compiler/rustc_trait_selection/src/solve/delegate.rs @@ -213,13 +213,7 @@ impl<'tcx> rustc_next_trait_solver::delegate::SolverDelegate for SolverDelegate< // inside of a `probe` whenever we have multiple choices inside of the solver. let region_obligations = self.0.inner.borrow().region_obligations().to_owned(); let region_constraints = self.0.with_region_constraints(|region_constraints| { - make_query_region_constraints( - self.tcx, - region_obligations - .iter() - .map(|r_o| (r_o.sup_type, r_o.sub_region, r_o.origin.to_constraint_category())), - region_constraints, - ) + make_query_region_constraints(self.tcx, region_obligations, region_constraints) }); let mut seen = FxHashSet::default(); diff --git a/compiler/rustc_trait_selection/src/traits/query/type_op/custom.rs b/compiler/rustc_trait_selection/src/traits/query/type_op/custom.rs index 18010603286..3b549244431 100644 --- a/compiler/rustc_trait_selection/src/traits/query/type_op/custom.rs +++ b/compiler/rustc_trait_selection/src/traits/query/type_op/custom.rs @@ -103,10 +103,7 @@ where let region_constraint_data = infcx.take_and_reset_region_constraints(); let region_constraints = query_response::make_query_region_constraints( infcx.tcx, - region_obligations - .iter() - .map(|r_o| (r_o.sup_type, r_o.sub_region, r_o.origin.to_constraint_category())) - .map(|(ty, r, cc)| (infcx.resolve_vars_if_possible(ty), r, cc)), + region_obligations, ®ion_constraint_data, ); |
