Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
673e443
Bump lodash from 4.17.21 to 4.17.23 in /editors/code
dependabot[bot] Jan 21, 2026
802ee01
fix: offer `toggle_macro_delimiter` in nested macro
A4-Tacks Jan 27, 2026
2755c37
Remove unncecessary `#[serde(default)]`
J3m3 Jan 28, 2026
c851897
Align with internal deserialized data structure
J3m3 Jan 28, 2026
fe9b791
feat: offer block let fallback postfix complete
A4-Tacks Feb 6, 2026
2eec617
internal: remove redundant double call in postfix
A4-Tacks Feb 7, 2026
99c45c5
fix: complete `.let` on block tail prefix expression
A4-Tacks Feb 7, 2026
0c724e5
Refactor handling of associated type shorthand for type parameters, i…
ChayimFriedman2 Feb 12, 2026
5c13e0c
Squash commits for review
tascord Feb 13, 2026
3a8a3c7
Remove resolved FIXME
tascord Feb 14, 2026
b451b42
internal: to use SmolStr in fn_param
A4-Tacks Feb 14, 2026
71e4b03
fix: no complete suggest param in complex pattern
A4-Tacks Feb 14, 2026
25a71ea
Fix predicates of builtin derive traits with two parameters defaultin…
ChayimFriedman2 Feb 15, 2026
1c462c2
fix: complete derive helpers on empty nameref
A4-Tacks Feb 15, 2026
6ac0ee9
add span_source to ProcMacroClientInterface
Shourya742 Feb 16, 2026
2541de3
update utils to include span_source in the interface
Shourya742 Feb 16, 2026
9378836
add span_source implementation in proc-macro-srv-cli
Shourya742 Feb 16, 2026
a7d65c7
add span source implementation to proc-macro-srv
Shourya742 Feb 16, 2026
7f2956e
extend span source and span source result variant in message
Shourya742 Feb 16, 2026
a9d3e24
add span source client implementation
Shourya742 Feb 16, 2026
14e6fe0
Merge pull request #21631 from ChayimFriedman2/cleanup-lowering-cycles
ShoyuVanilla Feb 16, 2026
12cacac
fix: Ensure cpu_profiler feature compiles on Rust edition 2024
Wilfred Feb 17, 2026
c22e240
Merge pull request #21659 from Wilfred/fix_profiler_build
lnicola Feb 17, 2026
3fbdb4d
Merge pull request #21652 from ChayimFriedman2/fix-builtin-derive
ShoyuVanilla Feb 17, 2026
cf246bd
Add some basic flycheck integration tests
Wilfred Feb 17, 2026
90f05e9
Merge pull request #21655 from A4-Tacks/derive-helpers-on-empty
ChayimFriedman2 Feb 18, 2026
d9a252f
Merge pull request #21650 from A4-Tacks/not-suggest-param-in-pat
ChayimFriedman2 Feb 18, 2026
e48f0fc
Merge pull request #21600 from A4-Tacks/let-in-prefix
ChayimFriedman2 Feb 18, 2026
6de75dc
Merge pull request #21598 from A4-Tacks/minor-postfix-double-call
ChayimFriedman2 Feb 18, 2026
0a6961d
fix: prevent path transformation of parameter names matching modules
raushan728 Feb 18, 2026
c48dfe0
Merge pull request #21657 from Shourya742/2026-02-16-add-span-source-…
Veykril Feb 18, 2026
cc3115d
Enable debug printing on more types
Wilfred Feb 17, 2026
e1fa34e
Merge pull request #21661 from Wilfred/initial_flycheck_tests
Veykril Feb 18, 2026
b7d95aa
internal: Add flycheck test for custom check command and debounce
Wilfred Feb 17, 2026
c992256
Only offer block let fallback in match-arm
A4-Tacks Feb 6, 2026
36f9838
Merge pull request #21594 from A4-Tacks/fallback-let-comp-block
ChayimFriedman2 Feb 18, 2026
140672a
Bump rustup-toolchain-install-master
lnicola Feb 18, 2026
ffc185a
Merge pull request #21673 from lnicola/bump-rustup-toolchain-install-…
ShoyuVanilla Feb 18, 2026
053cde5
Switch to env var CARGO_RESOLVER_LOCKFILE_PATH for copied lockfiles f…
ShoyuVanilla Feb 12, 2026
5d19cb9
Append `-Zlockfile-path`
ShoyuVanilla Feb 18, 2026
de77ad6
Merge pull request #21630 from ShoyuVanilla/cargo-lockfile
ShoyuVanilla Feb 18, 2026
1278a87
feat: offer on is_some_and for replace_is_method_with_if_let_method
A4-Tacks Feb 11, 2026
574c7b8
Add handling for cycles in `sizedness_constraint_for_ty()`
ChayimFriedman2 Feb 18, 2026
dd0c3a0
Merge pull request #21664 from ChayimFriedman2/representability
ShoyuVanilla Feb 18, 2026
69b08d5
Merge pull request #21623 from A4-Tacks/replace-is-some-and
ShoyuVanilla Feb 18, 2026
c8cf171
Merge pull request #21666 from Wilfred/flycheck_custom_check
ShoyuVanilla Feb 18, 2026
2a3d765
fix: exclude macro refs in tests when excludeTests is enabled
akashchakrabortymsc-cmd Feb 18, 2026
918214c
style: fix rustfmt formatting
akashchakrabortymsc-cmd Feb 18, 2026
9a57e95
Update vs_code.md flatpak SDK extensions to 25.08 runtime
pjhanzlik Feb 18, 2026
08a7b9a
Remove fixme
A4-Tacks Feb 19, 2026
89832e9
Add partial selection for generate_getter_or_setter
A4-Tacks Aug 1, 2025
5bb10ae
Fix some TryEnum reference assists
A4-Tacks Jan 2, 2026
94f6e7e
fix: filter non-value definitions in path transform
raushan728 Feb 19, 2026
4b02062
Merge pull request #20353 from A4-Tacks/gen-getter-range
ShoyuVanilla Feb 19, 2026
52b92ce
Merge pull request #21540 from J3m3/align-optional-fields
ShoyuVanilla Feb 19, 2026
c9a76c4
style: fix clippy collapsible_if warning
raushan728 Feb 19, 2026
f40376c
Merge pull request #21665 from raushan728/fix-param-name-bug
A4-Tacks Feb 19, 2026
0d226d1
Merge pull request #21676 from pjhanzlik/patch-1
lnicola Feb 19, 2026
348edc5
Merge pull request #21536 from A4-Tacks/toggle-nested-macro-delim
ChayimFriedman2 Feb 19, 2026
9884941
Merge pull request #21505 from rust-lang/dependabot/npm_and_yarn/edit…
ShoyuVanilla Feb 19, 2026
6d80670
test: fix exclude_tests_macro_refs test to use custom macro
akashchakrabortymsc-cmd Feb 19, 2026
5a3f581
style: fix rustfmt formatting
akashchakrabortymsc-cmd Feb 19, 2026
99b50e3
ci: rerun checks
akashchakrabortymsc-cmd Feb 19, 2026
c3dc938
Merge pull request #21675 from akashchakrabortymsc-cmd/fix/exclude-te…
ChayimFriedman2 Feb 19, 2026
102f2ec
Perf + Test Case RE: ShoyuVanilla
tascord Feb 19, 2026
c415833
Merge pull request #21635 from tascord/import-cfg-fixes
ShoyuVanilla Feb 20, 2026
01627b7
Support getting TypeId's Trait and vtable
Feb 2, 2026
7857058
nix vtable_for intrinsic
Feb 18, 2026
b5eb4f6
Do strip references for desugar_try_expr
A4-Tacks Feb 20, 2026
c8d56aa
Merge pull request #21389 from A4-Tacks/assist-try-enum-ref
ChayimFriedman2 Feb 20, 2026
d778d12
fix: generate method assist uses enclosing impl block instead of firs…
akashchakrabortymsc-cmd Feb 20, 2026
aa2da37
style: apply rustfmt
akashchakrabortymsc-cmd Feb 20, 2026
7daabfd
adjust libdir for windows, use lld during enzyme build when needed
ZuseZ4 Feb 18, 2026
4bf4ff1
Enable autodiff in CI for mingw-llvm,linux
ZuseZ4 Feb 19, 2026
c033de9
Move aarch64-apple dist builder to dynamic llvm linking and enable au…
ZuseZ4 Feb 19, 2026
ca3d3b7
fix: remove redundant comment
akashchakrabortymsc-cmd Feb 21, 2026
86d0e71
Merge pull request #21684 from akashchakrabortymsc-cmd/fix/generate-m…
A4-Tacks Feb 21, 2026
fba1ca8
fix: correctly parenthesize inverted condition in convert_if_to_bool_…
akashchakrabortymsc-cmd Feb 21, 2026
e883143
Merge pull request #21688 from akashchakrabortymsc-cmd/fix/convert-if…
A4-Tacks Feb 22, 2026
dbf337f
Fix another case where we forgot to put the type param for `PartialOr…
ChayimFriedman2 Feb 22, 2026
60369b2
Merge pull request #21692 from ChayimFriedman2/builtin-derive-param
ShoyuVanilla Feb 22, 2026
71857c8
Port `#[register_tool]` to the new attribute parsers
JonathanBrouwer Feb 22, 2026
436315d
Use the new parser throughout the compiler
JonathanBrouwer Feb 22, 2026
34d6161
Port `#[rustc_inherit_overflow_checks]` to the new attribute parsers
JonathanBrouwer Feb 22, 2026
5b87b99
fix interpreter tracing output
RalfJung Feb 22, 2026
1b5a80c
Prepare for merging from rust-lang/rust
invalid-email-address Feb 23, 2026
419ee10
Merge ref 'c78a29473a68' from rust-lang/rust
invalid-email-address Feb 23, 2026
d8ffd91
Merge pull request #21694 from rust-lang/rustc-pull
lnicola Feb 23, 2026
04e9918
make TraitImpl unstable
Feb 23, 2026
41bad03
Rollup merge of #153007 - lnicola:sync-from-ra, r=lnicola
jhpratt Feb 23, 2026
218170d
Rollup merge of #152768 - ZuseZ4:autodiff-in-ci-for-all-os, r=Kobzol
jhpratt Feb 23, 2026
598d4c8
Rollup merge of #152003 - 9SonSteroids:trait_info_of, r=oli-obk
jhpratt Feb 23, 2026
66173bb
Rollup merge of #152988 - JonathanBrouwer:register-tool, r=jdonszelmann
jhpratt Feb 23, 2026
ef8d529
Rollup merge of #152989 - JonathanBrouwer:rustc_inherit_overflow_chec…
jhpratt Feb 23, 2026
8472621
Rollup merge of #152991 - RalfJung:interpret-step-trace, r=Kivooeo
jhpratt Feb 23, 2026
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
47 changes: 47 additions & 0 deletions compiler/rustc_attr_parsing/src/attributes/crate_level.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,3 +301,50 @@ impl<S: Stage> NoArgsAttributeParser<S> for DefaultLibAllocatorParser {
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Crate)]);
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::DefaultLibAllocator;
}

pub(crate) struct RegisterToolParser;

impl<S: Stage> CombineAttributeParser<S> for RegisterToolParser {
const PATH: &[Symbol] = &[sym::register_tool];
type Item = Ident;
const CONVERT: ConvertFn<Self::Item> = AttributeKind::RegisterTool;
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(ALL_TARGETS);
const TEMPLATE: AttributeTemplate = template!(List: &["tool1, tool2, ..."]);

fn extend(
cx: &mut AcceptContext<'_, '_, S>,
args: &ArgParser,
) -> impl IntoIterator<Item = Self::Item> {
let ArgParser::List(list) = args else {
cx.expected_list(cx.attr_span, args);
return Vec::new();
};

if list.is_empty() {
cx.warn_empty_attribute(cx.attr_span);
}

let mut res = Vec::new();

for elem in list.mixed() {
let Some(elem) = elem.meta_item() else {
cx.expected_identifier(elem.span());
continue;
};
if let Err(arg_span) = elem.args().no_args() {
cx.expected_no_args(arg_span);
continue;
}

let path = elem.path();
let Some(ident) = path.word() else {
cx.expected_identifier(path.span());
continue;
};

res.push(ident);
}

res
}
}
14 changes: 14 additions & 0 deletions compiler/rustc_attr_parsing/src/attributes/rustc_internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,20 @@ impl<S: Stage> SingleAttributeParser<S> for RustcLegacyConstGenericsParser {
}
}

pub(crate) struct RustcInheritOverflowChecksParser;

impl<S: Stage> NoArgsAttributeParser<S> for RustcInheritOverflowChecksParser {
const PATH: &[Symbol] = &[sym::rustc_inherit_overflow_checks];
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[
Allow(Target::Fn),
Allow(Target::Method(MethodKind::Inherent)),
Allow(Target::Method(MethodKind::TraitImpl)),
Allow(Target::Closure),
]);
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcInheritOverflowChecks;
}

pub(crate) struct RustcLintOptDenyFieldAccessParser;

impl<S: Stage> SingleAttributeParser<S> for RustcLintOptDenyFieldAccessParser {
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_attr_parsing/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ attribute_parsers!(
Combine<DebuggerViualizerParser>,
Combine<ForceTargetFeatureParser>,
Combine<LinkParser>,
Combine<RegisterToolParser>,
Combine<ReprParser>,
Combine<RustcCleanParser>,
Combine<RustcLayoutParser>,
Expand Down Expand Up @@ -286,6 +287,7 @@ attribute_parsers!(
Single<WithoutArgs<RustcEvaluateWhereClausesParser>>,
Single<WithoutArgs<RustcHasIncoherentInherentImplsParser>>,
Single<WithoutArgs<RustcHiddenTypeOfOpaquesParser>>,
Single<WithoutArgs<RustcInheritOverflowChecksParser>>,
Single<WithoutArgs<RustcInsignificantDtorParser>>,
Single<WithoutArgs<RustcIntrinsicConstStableIndirectParser>>,
Single<WithoutArgs<RustcIntrinsicParser>>,
Expand Down
20 changes: 18 additions & 2 deletions compiler/rustc_const_eval/src/const_eval/machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::borrow::{Borrow, Cow};
use std::fmt;
use std::hash::Hash;

use rustc_abi::{Align, Size};
use rustc_abi::{Align, FIRST_VARIANT, Size};
use rustc_ast::Mutability;
use rustc_data_structures::fx::{FxHashMap, FxIndexMap, IndexEntry};
use rustc_errors::msg;
Expand All @@ -24,7 +24,7 @@ use crate::interpret::{
self, AllocId, AllocInit, AllocRange, ConstAllocation, CtfeProvenance, FnArg, Frame,
GlobalAlloc, ImmTy, InterpCx, InterpResult, OpTy, PlaceTy, Pointer, RangeSet, Scalar,
compile_time_machine, err_inval, interp_ok, throw_exhaust, throw_inval, throw_ub,
throw_ub_custom, throw_unsup, throw_unsup_format,
throw_ub_custom, throw_unsup, throw_unsup_format, type_implements_dyn_trait,
};

/// When hitting this many interpreted terminators we emit a deny by default lint
Expand Down Expand Up @@ -598,6 +598,22 @@ impl<'tcx> interpret::Machine<'tcx> for CompileTimeMachine<'tcx> {
}
}

sym::type_id_vtable => {
let tp_ty = ecx.read_type_id(&args[0])?;
let result_ty = ecx.read_type_id(&args[1])?;

let (implements_trait, preds) = type_implements_dyn_trait(ecx, tp_ty, result_ty)?;

if implements_trait {
let vtable_ptr = ecx.get_vtable_ptr(tp_ty, preds)?;
// Writing a non-null pointer into an `Option<NonNull>` will automatically make it `Some`.
ecx.write_pointer(vtable_ptr, dest)?;
} else {
// Write `None`
ecx.write_discriminant(FIRST_VARIANT, dest)?;
}
}

sym::type_of => {
let ty = ecx.read_type_id(&args[0])?;
ecx.write_type_info(ty, dest)?;
Expand Down
45 changes: 2 additions & 43 deletions compiler/rustc_const_eval/src/interpret/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,16 @@
mod simd;

use rustc_abi::{FIRST_VARIANT, FieldIdx, HasDataLayout, Size, VariantIdx};
use rustc_abi::{FieldIdx, HasDataLayout, Size, VariantIdx};
use rustc_apfloat::ieee::{Double, Half, Quad, Single};
use rustc_data_structures::assert_matches;
use rustc_errors::msg;
use rustc_hir::def_id::CRATE_DEF_ID;
use rustc_infer::infer::TyCtxtInferExt;
use rustc_middle::mir::interpret::{CTFE_ALLOC_SALT, read_target_uint, write_target_uint};
use rustc_middle::mir::{self, BinOp, ConstValue, NonDivergingIntrinsic};
use rustc_middle::ty::layout::TyAndLayout;
use rustc_middle::ty::{FloatTy, PolyExistentialPredicate, Ty, TyCtxt, TypeVisitableExt};
use rustc_middle::ty::{FloatTy, Ty, TyCtxt, TypeVisitableExt};
use rustc_middle::{bug, span_bug, ty};
use rustc_span::{Symbol, sym};
use rustc_trait_selection::traits::{Obligation, ObligationCause, ObligationCtxt};
use tracing::trace;

use super::memory::MemoryKind;
Expand Down Expand Up @@ -227,44 +224,6 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {

self.write_scalar(Scalar::from_target_usize(offset, self), dest)?;
}
sym::vtable_for => {
let tp_ty = instance.args.type_at(0);
let result_ty = instance.args.type_at(1);

ensure_monomorphic_enough(tcx, tp_ty)?;
ensure_monomorphic_enough(tcx, result_ty)?;
let ty::Dynamic(preds, _) = result_ty.kind() else {
span_bug!(
self.find_closest_untracked_caller_location(),
"Invalid type provided to vtable_for::<T, U>. U must be dyn Trait, got {result_ty}."
);
};

let (infcx, param_env) =
self.tcx.infer_ctxt().build_with_typing_env(self.typing_env);

let ocx = ObligationCtxt::new(&infcx);
ocx.register_obligations(preds.iter().map(|pred: PolyExistentialPredicate<'_>| {
let pred = pred.with_self_ty(tcx, tp_ty);
// Lifetimes can only be 'static because of the bound on T
let pred = ty::fold_regions(tcx, pred, |r, _| {
if r == tcx.lifetimes.re_erased { tcx.lifetimes.re_static } else { r }
});
Obligation::new(tcx, ObligationCause::dummy(), param_env, pred)
}));
let type_impls_trait = ocx.evaluate_obligations_error_on_ambiguity().is_empty();
// Since `assumed_wf_tys=[]` the choice of LocalDefId is irrelevant, so using the "default"
let regions_are_valid = ocx.resolve_regions(CRATE_DEF_ID, param_env, []).is_empty();

if regions_are_valid && type_impls_trait {
let vtable_ptr = self.get_vtable_ptr(tp_ty, preds)?;
// Writing a non-null pointer into an `Option<NonNull>` will automatically make it `Some`.
self.write_pointer(vtable_ptr, dest)?;
} else {
// Write `None`
self.write_discriminant(FIRST_VARIANT, dest)?;
}
}
sym::variant_count => {
let tp_ty = instance.args.type_at(0);
let ty = match tp_ty.kind() {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_const_eval/src/interpret/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ use self::place::{MemPlace, Place};
pub use self::projection::{OffsetMode, Projectable};
pub use self::stack::{Frame, FrameInfo, LocalState, ReturnContinuation};
pub use self::util::EnteredTraceSpan;
pub(crate) use self::util::create_static_alloc;
pub(crate) use self::util::{create_static_alloc, type_implements_dyn_trait};
pub use self::validity::{CtfeValidationMode, RangeSet, RefTracking};
pub use self::visitor::ValueVisitor;
4 changes: 2 additions & 2 deletions compiler/rustc_const_eval/src/interpret/step.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
span = ?stmt.source_info.span,
tracing_separate_thread = Empty,
)
.or_if_tracing_disabled(|| info!(stmt = ?stmt.kind));
.or_if_tracing_disabled(|| info!("{:?}", stmt.kind));

use rustc_middle::mir::StatementKind::*;

Expand Down Expand Up @@ -490,7 +490,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
span = ?terminator.source_info.span,
tracing_separate_thread = Empty,
)
.or_if_tracing_disabled(|| info!(terminator = ?terminator.kind));
.or_if_tracing_disabled(|| info!("{:?}", terminator.kind));

use rustc_middle::mir::TerminatorKind::*;
match terminator.kind {
Expand Down
45 changes: 42 additions & 3 deletions compiler/rustc_const_eval/src/interpret/util.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,51 @@
use rustc_hir::def_id::LocalDefId;
use rustc_middle::mir;
use rustc_hir::def_id::{CRATE_DEF_ID, LocalDefId};
use rustc_infer::infer::TyCtxtInferExt;
use rustc_infer::traits::{Obligation, ObligationCause};
use rustc_middle::mir::interpret::{AllocInit, Allocation, GlobalAlloc, InterpResult, Pointer};
use rustc_middle::ty::layout::TyAndLayout;
use rustc_middle::ty::{TyCtxt, TypeVisitable, TypeVisitableExt};
use rustc_middle::ty::{PolyExistentialPredicate, Ty, TyCtxt, TypeVisitable, TypeVisitableExt};
use rustc_middle::{mir, span_bug, ty};
use rustc_trait_selection::traits::ObligationCtxt;
use tracing::debug;

use super::{InterpCx, MPlaceTy, MemoryKind, interp_ok, throw_inval};
use crate::const_eval::{CompileTimeInterpCx, CompileTimeMachine, InterpretationResult};
use crate::interpret::Machine;

/// Checks if a type implements predicates.
/// Calls `ensure_monomorphic_enough` on `ty` and `trait_ty` for you.
pub(crate) fn type_implements_dyn_trait<'tcx, M: Machine<'tcx>>(
ecx: &mut InterpCx<'tcx, M>,
ty: Ty<'tcx>,
trait_ty: Ty<'tcx>,
) -> InterpResult<'tcx, (bool, &'tcx ty::List<ty::PolyExistentialPredicate<'tcx>>)> {
ensure_monomorphic_enough(ecx.tcx.tcx, ty)?;
ensure_monomorphic_enough(ecx.tcx.tcx, trait_ty)?;

let ty::Dynamic(preds, _) = trait_ty.kind() else {
span_bug!(
ecx.find_closest_untracked_caller_location(),
"Invalid type provided to type_implements_predicates. U must be dyn Trait, got {trait_ty}."
);
};

let (infcx, param_env) = ecx.tcx.infer_ctxt().build_with_typing_env(ecx.typing_env);

let ocx = ObligationCtxt::new(&infcx);
ocx.register_obligations(preds.iter().map(|pred: PolyExistentialPredicate<'_>| {
let pred = pred.with_self_ty(ecx.tcx.tcx, ty);
// Lifetimes can only be 'static because of the bound on T
let pred = rustc_middle::ty::fold_regions(ecx.tcx.tcx, pred, |r, _| {
if r == ecx.tcx.tcx.lifetimes.re_erased { ecx.tcx.tcx.lifetimes.re_static } else { r }
});
Obligation::new(ecx.tcx.tcx, ObligationCause::dummy(), param_env, pred)
}));
let type_impls_trait = ocx.evaluate_obligations_error_on_ambiguity().is_empty();
// Since `assumed_wf_tys=[]` the choice of LocalDefId is irrelevant, so using the "default"
let regions_are_valid = ocx.resolve_regions(CRATE_DEF_ID, param_env, []).is_empty();

interp_ok((regions_are_valid && type_impls_trait, preds))
}

/// Checks whether a type contains generic parameters which must be instantiated.
///
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_driver_impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -707,8 +707,9 @@ fn print_crate_info(
};
let crate_name = passes::get_crate_name(sess, attrs);
let lint_store = crate::unerased_lint_store(sess);
let registered_tools = rustc_resolve::registered_tools_ast(sess.dcx(), attrs);
let features = rustc_expand::config::features(sess, attrs, crate_name);
let registered_tools =
rustc_resolve::registered_tools_ast(sess.dcx(), attrs, sess, &features);
let lint_levels = rustc_lint::LintLevelsBuilder::crate_root(
sess,
&features,
Expand Down
6 changes: 6 additions & 0 deletions compiler/rustc_hir/src/attrs/data_structures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1136,6 +1136,9 @@ pub enum AttributeKind {
/// Represents `#[reexport_test_harness_main]`
ReexportTestHarnessMain(Symbol),

/// Represents `#[register_tool]`
RegisterTool(ThinVec<Ident>, Span),

/// Represents [`#[repr]`](https://doc.rust-lang.org/stable/reference/type-layout.html#representations).
Repr {
reprs: ThinVec<(ReprAttr, Span)>,
Expand Down Expand Up @@ -1274,6 +1277,9 @@ pub enum AttributeKind {
/// Represents `#[rustc_if_this_changed]`
RustcIfThisChanged(Span, Option<Symbol>),

/// Represents `#[rustc_inherit_overflow_checks]`
RustcInheritOverflowChecks,

/// Represents `#[rustc_insignificant_dtor]`
RustcInsignificantDtor,

Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_hir/src/attrs/encode_cross_crate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ impl AttributeKind {
ProfilerRuntime => No,
RecursionLimit { .. } => No,
ReexportTestHarnessMain(..) => No,
RegisterTool(..) => No,
Repr { .. } => No,
RustcAbi { .. } => No,
RustcAllocator => No,
Expand Down Expand Up @@ -130,6 +131,7 @@ impl AttributeKind {
RustcHasIncoherentInherentImpls => Yes,
RustcHiddenTypeOfOpaques => No,
RustcIfThisChanged(..) => No,
RustcInheritOverflowChecks => No,
RustcInsignificantDtor => Yes,
RustcIntrinsic => Yes,
RustcIntrinsicConstStableIndirect => No,
Expand Down
35 changes: 20 additions & 15 deletions compiler/rustc_hir_analysis/src/check/intrinsic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,12 +213,12 @@ fn intrinsic_operation_unsafety(tcx: TyCtxt<'_>, intrinsic_id: LocalDefId) -> hi
| sym::truncf128
| sym::type_id
| sym::type_id_eq
| sym::type_id_vtable
| sym::type_name
| sym::type_of
| sym::ub_checks
| sym::va_copy
| sym::variant_count
| sym::vtable_for
| sym::wrapping_add
| sym::wrapping_mul
| sym::wrapping_sub
Expand Down Expand Up @@ -323,6 +323,25 @@ pub(crate) fn check_intrinsic_type(
let type_id = tcx.type_of(tcx.lang_items().type_id().unwrap()).no_bound_vars().unwrap();
(0, 0, vec![type_id, type_id], tcx.types.bool)
}
sym::type_id_vtable => {
let dyn_metadata = tcx.require_lang_item(LangItem::DynMetadata, span);
let dyn_metadata_adt_ref = tcx.adt_def(dyn_metadata);
let dyn_metadata_args =
tcx.mk_args(&[Ty::new_ptr(tcx, tcx.types.unit, ty::Mutability::Not).into()]);
let dyn_ty = Ty::new_adt(tcx, dyn_metadata_adt_ref, dyn_metadata_args);

let option_did = tcx.require_lang_item(LangItem::Option, span);
let option_adt_ref = tcx.adt_def(option_did);
let option_args = tcx.mk_args(&[dyn_ty.into()]);
let ret_ty = Ty::new_adt(tcx, option_adt_ref, option_args);

(
0,
0,
vec![tcx.type_of(tcx.lang_items().type_id().unwrap()).no_bound_vars().unwrap(); 2],
ret_ty,
)
}
sym::type_of => (
0,
0,
Expand Down Expand Up @@ -675,20 +694,6 @@ pub(crate) fn check_intrinsic_type(
(0, 0, vec![Ty::new_imm_ptr(tcx, tcx.types.unit)], tcx.types.usize)
}

sym::vtable_for => {
let dyn_metadata = tcx.require_lang_item(LangItem::DynMetadata, span);
let dyn_metadata_adt_ref = tcx.adt_def(dyn_metadata);
let dyn_metadata_args = tcx.mk_args(&[param(1).into()]);
let dyn_ty = Ty::new_adt(tcx, dyn_metadata_adt_ref, dyn_metadata_args);

let option_did = tcx.require_lang_item(LangItem::Option, span);
let option_adt_ref = tcx.adt_def(option_did);
let option_args = tcx.mk_args(&[dyn_ty.into()]);
let ret_ty = Ty::new_adt(tcx, option_adt_ref, option_args);

(2, 0, vec![], ret_ty)
}

// This type check is not particularly useful, but the `where` bounds
// on the definition in `core` do the heavy lifting for checking it.
sym::aggregate_raw_ptr => (3, 0, vec![param(1), param(2)], param(0)),
Expand Down
Loading
Loading