Skip to content

Commit 7a66bfe

Browse files
committed
some bugfixes
1 parent ac20dc9 commit 7a66bfe

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

compiler/rustc_builtin_macros/src/autodiff.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ pub fn expand(
8888
//check_builtin_macro_attribute(ecx, meta_item, sym::alloc_error_handler);
8989

9090
// first get the annotable item:
91+
92+
use ast::visit::AssocCtxt;
9193
let (sig, is_impl): (FnSig, bool) = match &item {
9294
Annotatable::Item(ref iitem) => {
9395
let sig = match &iitem.kind {
@@ -99,7 +101,7 @@ pub fn expand(
99101
};
100102
(sig.clone(), false)
101103
},
102-
Annotatable::ImplItem(ref assoc_item) => {
104+
Annotatable::AssocItem(ref assoc_item, AssocCtxt::Impl) => {
103105
let sig = match &assoc_item.kind {
104106
ast::AssocItemKind::Fn(box ast::Fn { sig, .. }) => sig,
105107
_ => {
@@ -130,7 +132,7 @@ pub fn expand(
130132
Annotatable::Item(ref iitem) => {
131133
(iitem.vis.clone(), iitem.ident.clone())
132134
},
133-
Annotatable::ImplItem(ref assoc_item) => {
135+
Annotatable::AssocItem(ref assoc_item, AssocCtxt::Impl) => {
134136
(assoc_item.vis.clone(), assoc_item.ident.clone())
135137
},
136138
_ => {
@@ -240,14 +242,14 @@ pub fn expand(
240242
}
241243
Annotatable::Item(iitem.clone())
242244
},
243-
Annotatable::ImplItem(ref mut assoc_item) => {
245+
Annotatable::AssocItem(ref mut assoc_item, i @ AssocCtxt::Impl) => {
244246
if !assoc_item.attrs.iter().any(|a| a.id == attr.id) {
245247
assoc_item.attrs.push(attr.clone());
246248
}
247249
if !assoc_item.attrs.iter().any(|a| a.id == inline_never.id) {
248250
assoc_item.attrs.push(inline_never.clone());
249251
}
250-
Annotatable::ImplItem(assoc_item.clone())
252+
Annotatable::AssocItem(assoc_item.clone(), i)
251253
},
252254
_ => {
253255
panic!("not supported");
@@ -273,7 +275,7 @@ pub fn expand(
273275
kind: assoc_item,
274276
tokens: None,
275277
});
276-
Annotatable::ImplItem(d_fn)
278+
Annotatable::AssocItem(d_fn, AssocCtxt::Impl)
277279
} else {
278280
let mut d_fn = ecx.item(span, d_ident, thin_vec![attr.clone(), inline_never], ItemKind::Fn(asdf));
279281
d_fn.vis = vis;

compiler/rustc_builtin_macros/src/errors.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ pub(crate) struct AutoDiffInvalidApplication {
191191
pub(crate) span: Span,
192192
}
193193

194+
#[cfg(not(llvm_enzyme))]
194195
#[derive(Diagnostic)]
195196
#[diag(builtin_macros_autodiff_not_build)]
196197
pub(crate) struct AutoDiffSupportNotBuild {

compiler/rustc_middle/src/ty/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ pub use self::visit::{TypeSuperVisitable, TypeVisitable, TypeVisitableExt, TypeV
109109
pub use self::AssocItemContainer::*;
110110
pub use self::BorrowKind::*;
111111
pub use self::IntVarValue::*;
112-
use crate::error::{OpaqueHiddenTypeMismatch, TypeMismatchReason, UnsupportedUnion, AutodiffUnsafeInnerConstRef};
112+
use crate::error::{OpaqueHiddenTypeMismatch, TypeMismatchReason};
113113
use crate::metadata::ModChild;
114114
use crate::middle::privacy::EffectiveVisibilities;
115115
use crate::mir::{Body, CoroutineLayout};
@@ -119,7 +119,6 @@ use crate::ty;
119119
pub use crate::ty::diagnostics::*;
120120
use crate::ty::fast_reject::SimplifiedType;
121121
use crate::ty::util::Discr;
122-
use crate::query::Key;
123122

124123
pub mod abstract_const;
125124
pub mod adjustment;

compiler/rustc_middle/src/ty/typetree.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
use crate::ty::{self, Ty, FieldsShape, TypeAndMut};
1+
use crate::ty::{self, Ty, FieldsShape};
22
use rustc_ast::expand::typetree::{Type, TypeTree, FncTree, Kind};
33
//, Type, Kind, TypeTree, FncTree, FieldsShape};
44
use super::context::TyCtxt;
55
use rustc_span::Span;
66
use super::{ParamEnv, ParamEnvAnd};
77
use crate::error::AutodiffUnsafeInnerConstRef;
8-
use super::adt::*;
9-
use rustc_hir as hir;
108
use rustc_type_ir::Adt;
119
use tracing::trace;
1210

@@ -67,7 +65,7 @@ pub fn fnc_typetrees<'tcx>(tcx: TyCtxt<'tcx>, fn_ty: Ty<'tcx>, da: &mut Vec<Diff
6765
if ty.is_fn_ptr() {
6866
unimplemented!("what to do whith fn ptr?");
6967
}
70-
let inner_ty = ty.builtin_deref(true).unwrap().ty;
68+
let inner_ty = ty.builtin_deref(true).unwrap();
7169
if inner_ty.is_slice() {
7270
// We know that the lenght will be passed as extra arg.
7371
let child = typetree_from_ty(inner_ty, tcx, 1, safety, &mut visited, span);

0 commit comments

Comments
 (0)