Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3872,6 +3872,7 @@ dependencies = [
"rustc_abi",
"rustc_apfloat",
"rustc_ast",
"rustc_attr_ir",
"rustc_data_structures",
"rustc_errors",
"rustc_hir",
Expand Down Expand Up @@ -4129,6 +4130,7 @@ dependencies = [
"rustc_abi",
"rustc_arena",
"rustc_ast",
"rustc_attr_ir",
"rustc_data_structures",
"rustc_errors",
"rustc_feature",
Expand Down Expand Up @@ -4204,6 +4206,7 @@ name = "rustc_incremental"
version = "0.0.0"
dependencies = [
"rand 0.9.3",
"rustc_attr_ir",
"rustc_data_structures",
"rustc_errors",
"rustc_fs_util",
Expand Down Expand Up @@ -4325,6 +4328,7 @@ dependencies = [
"rustc_apfloat",
"rustc_ast",
"rustc_ast_pretty",
"rustc_attr_ir",
"rustc_attr_parsing",
"rustc_data_structures",
"rustc_errors",
Expand Down Expand Up @@ -4403,6 +4407,7 @@ dependencies = [
"odht",
"rustc_abi",
"rustc_ast",
"rustc_attr_ir",
"rustc_attr_parsing",
"rustc_crate_store",
"rustc_data_structures",
Expand Down Expand Up @@ -4493,10 +4498,10 @@ dependencies = [
"polonius-engine",
"regex",
"rustc_abi",
"rustc_attr_ir",
"rustc_data_structures",
"rustc_errors",
"rustc_graphviz",
"rustc_hir",
"rustc_index",
"rustc_macros",
"rustc_middle",
Expand Down Expand Up @@ -4539,6 +4544,7 @@ version = "0.0.0"
dependencies = [
"rustc_abi",
"rustc_ast",
"rustc_attr_ir",
"rustc_data_structures",
"rustc_errors",
"rustc_hir",
Expand Down Expand Up @@ -4656,6 +4662,7 @@ name = "rustc_privacy"
version = "0.0.0"
dependencies = [
"rustc_ast",
"rustc_attr_ir",
"rustc_data_structures",
"rustc_errors",
"rustc_hir",
Expand Down Expand Up @@ -4913,6 +4920,7 @@ dependencies = [
"itertools",
"rustc_abi",
"rustc_ast",
"rustc_attr_ir",
"rustc_crate_store",
"rustc_data_structures",
"rustc_errors",
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_const_eval/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ either = "1"
rustc_abi = { path = "../rustc_abi" }
rustc_apfloat = "0.2.0"
rustc_ast = { path = "../rustc_ast" }
rustc_attr_ir = { path = "../rustc_attr_ir" }
rustc_data_structures = { path = "../rustc_data_structures" }
rustc_errors = { path = "../rustc_errors" }
rustc_hir = { path = "../rustc_hir" }
Expand Down
20 changes: 9 additions & 11 deletions compiler/rustc_const_eval/src/check_consts/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ use std::num::NonZero;
use std::ops::Deref;
use std::{assert_matches, mem};

use rustc_attr_ir::lang_items::LangItem;
use rustc_attr_ir::{ConstStability, StabilityLevel, find_attr};
use rustc_errors::{Diag, ErrorGuaranteed};
use rustc_hir::attrs::lang_items::LangItem;
use rustc_hir as hir;
use rustc_hir::def::DefKind;
use rustc_hir::def_id::DefId;
use rustc_hir::{self as hir, find_attr};
use rustc_index::bit_set::DenseBitSet;
use rustc_infer::infer::TyCtxtInferExt;
use rustc_middle::mir::visit::Visitor;
Expand Down Expand Up @@ -427,7 +428,7 @@ impl<'mir, 'tcx> Checker<'mir, 'tcx> {
/// Check the const stability of the given item (fn or trait).
fn check_callee_stability(&mut self, def_id: DefId) {
match self.tcx.lookup_const_stability(def_id) {
Some(hir::ConstStability { level: hir::StabilityLevel::Stable { .. }, .. }) => {
Some(ConstStability { level: StabilityLevel::Stable { .. }, .. }) => {
// All good.
}
None => {
Expand All @@ -443,8 +444,8 @@ impl<'mir, 'tcx> Checker<'mir, 'tcx> {
});
}
}
Some(hir::ConstStability {
level: hir::StabilityLevel::Unstable { implied_by: implied_feature, issue, .. },
Some(ConstStability {
level: StabilityLevel::Unstable { implied_by: implied_feature, issue, .. },
feature,
..
}) => {
Expand Down Expand Up @@ -858,8 +859,8 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
});
}
}
Some(hir::ConstStability {
level: hir::StabilityLevel::Unstable { .. },
Some(ConstStability {
level: StabilityLevel::Unstable { .. },
feature,
..
}) => {
Expand All @@ -878,10 +879,7 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
const_stable_indirect,
});
}
Some(hir::ConstStability {
level: hir::StabilityLevel::Stable { .. },
..
}) => {
Some(ConstStability { level: StabilityLevel::Stable { .. }, .. }) => {
// All good. Note that a `#[rustc_const_stable]` intrinsic (meaning it
// can be *directly* invoked from stable const code) does not always
// have the `#[rustc_intrinsic_const_stable_indirect]` attribute (which controls
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_const_eval/src/check_consts/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
//! has interior mutability or needs to be dropped, as well as the visitor that emits errors when
//! it finds operations that are invalid in a certain context.

use rustc_attr_ir::find_attr;
use rustc_errors::DiagCtxtHandle;
use rustc_hir as hir;
use rustc_hir::def_id::{DefId, LocalDefId};
use rustc_hir::{self as hir, find_attr};
use rustc_middle::mir;
use rustc_middle::ty::{self, PolyFnSig, TyCtxt};
use rustc_span::{Symbol, bug};
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_const_eval/src/check_consts/ops.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
//! Concrete error types for all operations which may be invalid in a certain const context.

use hir::ConstContext;
use rustc_attr_ir::lang_items::LangItem;
use rustc_errors::codes::*;
use rustc_errors::{Applicability, Diag, MultiSpan, msg};
use rustc_hir as hir;
use rustc_hir::attrs::lang_items::LangItem;
use rustc_hir::def_id::DefId;
use rustc_infer::infer::TyCtxtInferExt;
use rustc_infer::traits::{ImplSource, Obligation, ObligationCause};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use rustc_hir::find_attr;
use rustc_attr_ir::find_attr;
use rustc_middle::mir::visit::Visitor;
use rustc_middle::mir::{self, BasicBlock, Location};
use rustc_middle::ty::TyCtxt;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_const_eval/src/check_consts/qualifs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
// FIXME(const_trait_impl): This API should be really reworked. It's dangerously general for
// having basically only two use-cases that act in different ways.

use rustc_attr_ir::lang_items::LangItem;
use rustc_errors::ErrorGuaranteed;
use rustc_hir::attrs::lang_items::LangItem;
use rustc_infer::infer::TyCtxtInferExt;
use rustc_middle::mir;
use rustc_middle::mir::*;
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_const_eval/src/const_eval/fn_queries.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use rustc_attr_ir::find_attr;
use rustc_hir::def_id::{DefId, LocalDefId};
use rustc_hir::{
Constness, ExprKind, ForeignItemKind, ImplItem, ImplItemImplKind, ImplItemKind, Item, ItemKind,
Node, TraitItem, TraitItemKind, VariantData, find_attr,
Node, TraitItem, TraitItemKind, VariantData,
};
use rustc_middle::query::Providers;
use rustc_middle::ty::TyCtxt;
Expand Down
7 changes: 4 additions & 3 deletions compiler/rustc_const_eval/src/const_eval/machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ use std::{fmt, mem};

use rustc_abi::{Align, FIRST_VARIANT, FieldIdx, Size, VariantIdx};
use rustc_ast::Mutability;
use rustc_attr_ir::find_attr;
use rustc_attr_ir::lang_items::LangItem;
use rustc_data_structures::fx::{FxHashMap, FxIndexMap, IndexEntry};
use rustc_hir::attrs::lang_items::LangItem;
use rustc_hir::def_id::{DefId, LocalDefId};
use rustc_hir::{self as hir, CRATE_HIR_ID, find_attr};
use rustc_hir::{CRATE_HIR_ID, HirId};
use rustc_lint_defs::builtin::LONG_RUNNING_CONST_EVAL;
use rustc_middle::mir;
use rustc_middle::mir::AssertMessage;
Expand Down Expand Up @@ -394,7 +395,7 @@ impl<'tcx> CompileTimeMachine<'tcx> {
#[inline(always)]
/// Find the first stack frame that is within the current crate, if any.
/// Otherwise, return the crate's HirId
pub fn best_lint_scope(&self, tcx: TyCtxt<'tcx>) -> hir::HirId {
pub fn best_lint_scope(&self, tcx: TyCtxt<'tcx>) -> HirId {
self.stack.iter().find_map(|frame| frame.lint_root(tcx)).unwrap_or(CRATE_HIR_ID)
}
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_const_eval/src/const_eval/type_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ mod adt;
use std::borrow::Cow;

use rustc_abi::{ExternAbi, FieldIdx};
use rustc_hir::attrs::lang_items::LangItem;
use rustc_attr_ir::lang_items::LangItem;
use rustc_middle::ty::layout::TyAndLayout;
use rustc_middle::ty::{self, FnHeader, FnSigKind, FnSigTys, ScalarInt, Ty, TyCtxt};
use rustc_span::{Symbol, span_bug, sym};
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_const_eval/src/interpret/call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ use std::borrow::Cow;

use either::{Left, Right};
use rustc_abi::{self as abi, ExternAbi, FieldIdx, Integer, VariantIdx};
use rustc_attr_ir::find_attr;
use rustc_hir::def_id::DefId;
use rustc_hir::find_attr;
use rustc_middle::mir;
use rustc_middle::ty::layout::{IntegerExt, TyAndLayout};
use rustc_middle::ty::{self, AdtDef, FieldDef, Instance, Ty, VariantDef};
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_const_eval/src/util/caller_location.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use rustc_abi::FieldIdx;
use rustc_hir::attrs::lang_items::LangItem;
use rustc_attr_ir::lang_items::LangItem;
use rustc_middle::mir;
use rustc_middle::ty::{self, TyCtxt};
use rustc_span::{Symbol, bug};
Expand Down
11 changes: 4 additions & 7 deletions compiler/rustc_hir/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,14 @@ pub mod pat_util;
mod stable_hash_impls;
mod target_impls;

// FIXME: Remove this use tree, replace by `rustc_attr_ir` imports
#[doc(hidden)]
pub use attrs::{
Attribute, ConstStability, DefaultBodyStability, Stability, StabilityLevel, StableSince,
UnstableReason, target::Target,
};
#[doc(no_inline)]
pub use hir::*;
// FIXME: Remove this use tree, replace by `rustc_attr_ir` imports
#[doc(hidden)]
pub use rustc_attr_ir::{self as attrs, find_attr};
pub use rustc_attr_ir::{
self as attrs, Attribute, ConstStability, DefaultBodyStability, Stability, StabilityLevel,
StableSince, find_attr, target::Target,
};
pub use rustc_hir_id::*;
pub use rustc_span::def_id;

Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_hir_analysis/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ itertools = "0.15"
rustc_abi = { path = "../rustc_abi" }
rustc_arena = { path = "../rustc_arena" }
rustc_ast = { path = "../rustc_ast" }
rustc_attr_ir = { path = "../rustc_attr_ir" }
rustc_data_structures = { path = "../rustc_data_structures" }
rustc_errors = { path = "../rustc_errors" }
rustc_feature = { path = "../rustc_feature" }
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_hir_analysis/src/check/always_applicable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
//!
//! This is necessary for `Drop` and negative impls to be well-formed.

use rustc_attr_ir::find_attr;
use rustc_data_structures::fx::FxHashSet;
use rustc_errors::codes::*;
use rustc_errors::{ErrorGuaranteed, struct_span_code_err};
Expand Down Expand Up @@ -442,7 +443,7 @@ fn check_drop_xor_pin_drop<'tcx>(
}
(Some(span), None) => {
if tcx.adt_def(adt_def_id).is_pin_project() {
let pin_v2_span = rustc_hir::find_attr!(tcx, adt_def_id, PinV2(attr) => *attr);
let pin_v2_span = find_attr!(tcx, adt_def_id, PinV2(attr) => *attr);
let adt_name = tcx.item_name(adt_def_id);
return Err(tcx.dcx().emit_err(crate::diagnostics::PinV2WithoutPinDrop {
span,
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_hir_analysis/src/check/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ use std::cell::LazyCell;
use std::ops::ControlFlow;

use rustc_abi::{ExternAbi, FieldIdx, MAX_SIMD_LANES, ScalableElt};
use rustc_attr_ir::ReprAttr::ReprPacked;
use rustc_attr_ir::lang_items::LangItem;
use rustc_data_structures::unord::{UnordMap, UnordSet};
use rustc_errors::codes::*;
use rustc_errors::{Diag, DiagCtxtHandle, Diagnostic, Level, MultiSpan};
use rustc_hir as hir;
use rustc_hir::attrs::ReprAttr::ReprPacked;
use rustc_hir::attrs::lang_items::LangItem;
use rustc_hir::def::{CtorKind, DefKind};
use rustc_hir::{Node, find_attr, intravisit};
use rustc_infer::infer::{RegionVariableOrigin, TyCtxtInferExt};
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_hir_analysis/src/check/compare_eii.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
use std::borrow::Cow;
use std::iter;

use rustc_attr_ir::{EiiImplResolution, find_attr};
use rustc_data_structures::fx::FxIndexSet;
use rustc_errors::{Applicability, E0806, struct_span_code_err};
use rustc_hir::attrs::EiiImplResolution;
use rustc_hir::def::DefKind;
use rustc_hir::def_id::{DefId, LocalDefId};
use rustc_hir::{self as hir, FnSig, HirId, ItemKind, find_attr};
use rustc_hir::{self as hir, FnSig, HirId, ItemKind};
use rustc_infer::infer::{self, InferCtxt, TyCtxtInferExt};
use rustc_infer::traits::{ObligationCause, ObligationCauseCode, TraitErrors};
use rustc_middle::ty::error::{ExpectedFound, TypeError};
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_hir_analysis/src/check/entry.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use std::ops::Not;

use rustc_attr_ir::find_attr;
use rustc_hir as hir;
use rustc_hir::{Node, find_attr};
use rustc_hir::Node;
use rustc_infer::infer::TyCtxtInferExt;
use rustc_infer::traits::TraitErrors;
use rustc_middle::ty::{self, TyCtxt, TypingMode, Unnormalized};
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_analysis/src/check/intrinsic.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//! Type-checking for the `#[rustc_intrinsic]` intrinsics that the compiler exposes.

use rustc_attr_ir::lang_items::LangItem;
use rustc_errors::DiagMessage;
use rustc_hir as hir;
use rustc_hir::attrs::lang_items::LangItem;
use rustc_middle::traits::{ObligationCause, ObligationCauseCode};
use rustc_middle::ty::consts::ConstExt;
use rustc_middle::ty::{self, Const, Ty, TyCtxt};
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_analysis/src/check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ use std::num::NonZero;

pub use check::check_abi;
use rustc_abi::VariantIdx;
use rustc_attr_ir::lang_items::LangItem;
use rustc_data_structures::fx::{FxHashSet, FxIndexMap};
use rustc_errors::{ErrorGuaranteed, pluralize, struct_span_code_err};
use rustc_hir::attrs::lang_items::LangItem;
use rustc_hir::def_id::{DefId, LocalDefId};
use rustc_hir::intravisit::Visitor;
use rustc_index::bit_set::DenseBitSet;
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_hir_analysis/src/check/wfcheck.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ use std::ops::{ControlFlow, Deref};
use hir::intravisit::{self, Visitor};
use rustc_abi::{ExternAbi, ScalableElt};
use rustc_ast as ast;
use rustc_attr_ir::lang_items::LangItem;
use rustc_attr_ir::{EiiDecl, EiiImpl, EiiImplResolution, find_attr};
use rustc_data_structures::fx::{FxHashSet, FxIndexMap, FxIndexSet};
use rustc_data_structures::transitive_relation::TransitiveRelationBuilder;
use rustc_errors::codes::*;
use rustc_errors::{Applicability, ErrorGuaranteed, msg, pluralize, struct_span_code_err};
use rustc_hir as hir;
use rustc_hir::attrs::lang_items::LangItem;
use rustc_hir::attrs::{EiiDecl, EiiImpl, EiiImplResolution};
use rustc_hir::def::{DefKind, Res};
use rustc_hir::def_id::{DefId, LocalDefId};
use rustc_hir::{AmbigArg, ItemKind, find_attr};
use rustc_hir::{AmbigArg, ItemKind};
use rustc_infer::infer::outlives::env::OutlivesEnvironment;
use rustc_infer::infer::{BoundRegionConversionTime, SolverRegionConstraint, TyCtxtInferExt};
use rustc_infer::traits::{PredicateObligations, TraitErrors};
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_analysis/src/coherence/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

use std::collections::BTreeMap;

use rustc_attr_ir::lang_items::LangItem;
use rustc_data_structures::fx::FxHashSet;
use rustc_errors::{ErrorGuaranteed, MultiSpan};
use rustc_hir as hir;
use rustc_hir::ItemKind;
use rustc_hir::attrs::lang_items::LangItem;
use rustc_hir::def_id::{DefId, LocalDefId};
use rustc_infer::infer::{self, InferCtxt, RegionResolutionError, SubregionOrigin, TyCtxtInferExt};
use rustc_infer::traits::{Obligation, TraitErrors};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use rustc_attr_ir::lang_items::LangItem;
use rustc_errors::ErrorGuaranteed;
use rustc_hir as hir;
use rustc_hir::ItemKind;
use rustc_hir::attrs::lang_items::LangItem;
use rustc_hir::def_id::{DefId, LocalDefId};
use rustc_infer::infer::{DefineOpaqueTypes, InferCtxt, TyCtxtInferExt};
use rustc_infer::traits::{Obligation, TraitErrors};
Expand Down
Loading
Loading