Skip to content

Commit 80e861c

Browse files
authored
Rollup merge of #137262 - compiler-errors:ast-ir-begone, r=lcnr
Make fewer crates depend on `rustc_ast_ir` I think it simplifies the crate graph and also exposes people less to confusion if downstream crates don't interact with `rustc_ast_ir` directly and instead just use its functionality reexported through more familiar paths. r? oli-obk since you introduced ast-ir
2 parents 4f84ba1 + b78c626 commit 80e861c

File tree

25 files changed

+30
-46
lines changed

25 files changed

+30
-46
lines changed

Cargo.lock

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3748,7 +3748,6 @@ dependencies = [
37483748
"itertools",
37493749
"rustc_abi",
37503750
"rustc_ast",
3751-
"rustc_ast_ir",
37523751
"rustc_attr_parsing",
37533752
"rustc_data_structures",
37543753
"rustc_errors",
@@ -3813,7 +3812,6 @@ dependencies = [
38133812
name = "rustc_infer"
38143813
version = "0.0.0"
38153814
dependencies = [
3816-
"rustc_ast_ir",
38173815
"rustc_data_structures",
38183816
"rustc_errors",
38193817
"rustc_fluent_macro",
@@ -4004,7 +4002,6 @@ dependencies = [
40044002
"rustc_apfloat",
40054003
"rustc_arena",
40064004
"rustc_ast",
4007-
"rustc_ast_ir",
40084005
"rustc_attr_parsing",
40094006
"rustc_data_structures",
40104007
"rustc_error_messages",
@@ -4134,7 +4131,6 @@ name = "rustc_next_trait_solver"
41344131
version = "0.0.0"
41354132
dependencies = [
41364133
"derive-where",
4137-
"rustc_ast_ir",
41384134
"rustc_data_structures",
41394135
"rustc_index",
41404136
"rustc_macros",
@@ -4454,7 +4450,6 @@ dependencies = [
44544450
"itertools",
44554451
"rustc_abi",
44564452
"rustc_ast",
4457-
"rustc_ast_ir",
44584453
"rustc_attr_parsing",
44594454
"rustc_data_structures",
44604455
"rustc_errors",
@@ -4493,7 +4488,6 @@ version = "0.0.0"
44934488
dependencies = [
44944489
"itertools",
44954490
"rustc_abi",
4496-
"rustc_ast_ir",
44974491
"rustc_data_structures",
44984492
"rustc_hir",
44994493
"rustc_infer",
@@ -4509,7 +4503,6 @@ version = "0.0.0"
45094503
dependencies = [
45104504
"itertools",
45114505
"rustc_abi",
4512-
"rustc_ast_ir",
45134506
"rustc_data_structures",
45144507
"rustc_errors",
45154508
"rustc_fluent_macro",

compiler/rustc_ast_ir/src/lib.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
//! Common utilities shared by both `rustc_ast` and `rustc_type_ir`.
2+
//!
3+
//! Don't depend on this crate directly; both of those crates should re-export
4+
//! the functionality. Additionally, if you're in scope of `rustc_middle`, then
5+
//! prefer imports via that too, to avoid needing to directly depend on (e.g.)
6+
//! `rustc_type_ir` for a single import.
7+
18
// tidy-alphabetical-start
29
#![cfg_attr(feature = "nightly", allow(internal_features))]
310
#![cfg_attr(feature = "nightly", feature(never_type))]

compiler/rustc_hir_typeck/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ edition = "2021"
88
itertools = "0.12"
99
rustc_abi = { path = "../rustc_abi" }
1010
rustc_ast = { path = "../rustc_ast" }
11-
rustc_ast_ir = { path = "../rustc_ast_ir" }
1211
rustc_attr_parsing = { path = "../rustc_attr_parsing" }
1312
rustc_data_structures = { path = "../rustc_data_structures" }
1413
rustc_errors = { path = "../rustc_errors" }

compiler/rustc_infer/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ doctest = false
88

99
[dependencies]
1010
# tidy-alphabetical-start
11-
rustc_ast_ir = { path = "../rustc_ast_ir" }
1211
rustc_data_structures = { path = "../rustc_data_structures" }
1312
rustc_errors = { path = "../rustc_errors" }
1413
rustc_fluent_macro = { path = "../rustc_fluent_macro" }

compiler/rustc_infer/src/traits/structural_impls.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
use std::fmt;
22

3-
use rustc_ast_ir::try_visit;
43
use rustc_middle::ty::fold::{FallibleTypeFolder, TypeFoldable};
5-
use rustc_middle::ty::visit::{TypeVisitable, TypeVisitor};
4+
use rustc_middle::ty::visit::{TypeVisitable, TypeVisitor, try_visit};
65
use rustc_middle::ty::{self, TyCtxt};
76

87
use crate::traits;

compiler/rustc_macros/src/type_visitable.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ pub(super) fn type_visitable_derive(
3636
s.add_bounds(synstructure::AddBounds::Generics);
3737
let body_visit = s.each(|bind| {
3838
quote! {
39-
match ::rustc_ast_ir::visit::VisitorResult::branch(
39+
match ::rustc_middle::ty::visit::VisitorResult::branch(
4040
::rustc_middle::ty::visit::TypeVisitable::visit_with(#bind, __visitor)
4141
) {
4242
::core::ops::ControlFlow::Continue(()) => {},
4343
::core::ops::ControlFlow::Break(r) => {
44-
return ::rustc_ast_ir::visit::VisitorResult::from_residual(r);
44+
return ::rustc_middle::ty::visit::VisitorResult::from_residual(r);
4545
},
4646
}
4747
}
@@ -56,7 +56,7 @@ pub(super) fn type_visitable_derive(
5656
__visitor: &mut __V
5757
) -> __V::Result {
5858
match *self { #body_visit }
59-
<__V::Result as ::rustc_ast_ir::visit::VisitorResult>::output()
59+
<__V::Result as ::rustc_middle::ty::visit::VisitorResult>::output()
6060
}
6161
},
6262
)

compiler/rustc_middle/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ rustc_abi = { path = "../rustc_abi" }
1414
rustc_apfloat = "0.2.0"
1515
rustc_arena = { path = "../rustc_arena" }
1616
rustc_ast = { path = "../rustc_ast" }
17-
rustc_ast_ir = { path = "../rustc_ast_ir" }
1817
rustc_attr_parsing = { path = "../rustc_attr_parsing" }
1918
rustc_data_structures = { path = "../rustc_data_structures" }
2019
rustc_error_messages = { path = "../rustc_error_messages" } # Used for intra-doc links

compiler/rustc_middle/src/macros.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ macro_rules! TrivialTypeTraversalImpls {
8383
_: &mut F)
8484
-> F::Result
8585
{
86-
<F::Result as ::rustc_ast_ir::visit::VisitorResult>::output()
86+
<F::Result as ::rustc_middle::ty::visit::VisitorResult>::output()
8787
}
8888
}
8989
)+

compiler/rustc_middle/src/mir/interpret/error.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use std::{convert, fmt, mem, ops};
55

66
use either::Either;
77
use rustc_abi::{Align, Size, VariantIdx, WrappingRange};
8-
use rustc_ast_ir::Mutability;
98
use rustc_data_structures::sync::Lock;
109
use rustc_errors::{DiagArgName, DiagArgValue, DiagMessage, ErrorGuaranteed, IntoDiagArg};
1110
use rustc_macros::{HashStable, TyDecodable, TyEncodable};
@@ -16,7 +15,7 @@ use rustc_span::{DUMMY_SP, Span, Symbol};
1615
use super::{AllocId, AllocRange, ConstAllocation, Pointer, Scalar};
1716
use crate::error;
1817
use crate::mir::{ConstAlloc, ConstValue};
19-
use crate::ty::{self, Ty, TyCtxt, ValTree, layout, tls};
18+
use crate::ty::{self, Mutability, Ty, TyCtxt, ValTree, layout, tls};
2019

2120
#[derive(Debug, Copy, Clone, PartialEq, Eq, HashStable, TyEncodable, TyDecodable)]
2221
pub enum ErrorHandled {

compiler/rustc_middle/src/traits/solve.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
use rustc_ast_ir::try_visit;
21
use rustc_data_structures::intern::Interned;
32
use rustc_macros::HashStable;
43
use rustc_type_ir as ir;
54
pub use rustc_type_ir::solve::*;
65

6+
use crate::ty::visit::try_visit;
77
use crate::ty::{
88
self, FallibleTypeFolder, TyCtxt, TypeFoldable, TypeFolder, TypeVisitable, TypeVisitor,
99
};

0 commit comments

Comments
 (0)