Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
5eae716
docs(unstable-book): Document const generics features
popzxc Apr 20, 2026
6315e17
Update unstable feature descriptions (min_generic_const_args, generic…
popzxc Apr 20, 2026
73e44e8
Change generic_const_args feature from unstable to incomplete
popzxc Apr 20, 2026
c4eb1bf
Do not use `const { }` blocks for GCI
popzxc Apr 23, 2026
2aeb041
Revert documentation changes from 08bd077
bushrat011899 Apr 26, 2026
69cc5fa
Remove unnecessary `get_unchecked`
ChrisDenton Apr 27, 2026
b9499e0
move associated type tests out of issues
danieljofficial May 2, 2026
4cca528
add issue links and bless
danieljofficial May 2, 2026
a34cb76
Only include `crate_hash` in `Linker` if incremental compilation is e…
susitsm May 2, 2026
5313fb1
rename `needs_crate_hash` to `needs_hir_hash`.
susitsm May 2, 2026
ecf527f
Relax `T: Sized` bound on `try_as_dyn` / `try_as_dyn_mut`
aobatact May 3, 2026
5dd3e5e
Add a `doc_cfg` regression test to ensure foreign types impls are wor…
GuillaumeGomez May 3, 2026
1e649f1
.mailmap: prefer matching just based on commit emails
DanielEScherzer May 4, 2026
8e0ebb9
c-variadic: gate `va_arg` on `c_variadic_experimental_arch`
folkertdev May 1, 2026
df8d029
rustc: target_features: allow for cfg-only stable target_features
romancardenas Apr 29, 2026
ee9a01a
rustc: target_features: adapt compile errors and warnings for cfg-onl…
romancardenas May 4, 2026
71177d1
Add NodeId to ModuleKind
oli-obk May 4, 2026
fd701b7
Remove most uses of `def_id_to_node_id`
oli-obk May 4, 2026
5ace24b
Update books
rustbot May 4, 2026
f9ddd9f
tests: mark import UI tests as check-pass
SynapLink May 4, 2026
e5b42e5
Fix E0040 suggestion for explicit `Drop::drop` UFCS calls
Unique-Usman May 3, 2026
14d414b
Improve `&pin` reference-pattern suggestions
P8L1 May 4, 2026
7c44e45
Update `browser-ui-test` version to `0.23.5`
GuillaumeGomez May 4, 2026
6c10307
Rollup merge of #155848 - bushrat011899:revert_08bd077, r=Mark-Simula…
GuillaumeGomez May 5, 2026
6b75049
Rollup merge of #155855 - ChrisDenton:remove-unsafe-get, r=Mark-Simul…
GuillaumeGomez May 5, 2026
594a848
Rollup merge of #155543 - popzxc:document-generic-const-features, r=B…
GuillaumeGomez May 5, 2026
8bf58ee
Rollup merge of #155962 - romancardenas:cfg-only-stable-target-featur…
GuillaumeGomez May 5, 2026
be1e98b
Rollup merge of #156043 - folkertdev:c-variadic-avr-assembly-test, r=…
GuillaumeGomez May 5, 2026
7a08b69
Rollup merge of #156082 - danieljofficial:move-tests-associated-types…
GuillaumeGomez May 5, 2026
90cd3d3
Rollup merge of #156087 - P8L1:improve-pin-pattern-suggestions, r=Kiv…
GuillaumeGomez May 5, 2026
e4097f6
Rollup merge of #156092 - susitsm:needs-hir-hash, r=petrochenkov
GuillaumeGomez May 5, 2026
20a4529
Rollup merge of #156103 - Unique-Usman:ua/fixe0040, r=mejrs
GuillaumeGomez May 5, 2026
ca222b8
Rollup merge of #156104 - aobatact:try-as-dyn-unsized, r=oli-obk
GuillaumeGomez May 5, 2026
1e91ddd
Rollup merge of #156122 - GuillaumeGomez:doc-cfg-test, r=Urgau
GuillaumeGomez May 5, 2026
145df99
Rollup merge of #156128 - DanielEScherzer:gg-mailmap, r=GuillaumeGomez
GuillaumeGomez May 5, 2026
e4ed73e
Rollup merge of #156135 - oli-obk:def_id_to_node_id_reduction, r=petr…
GuillaumeGomez May 5, 2026
6c37722
Rollup merge of #156152 - rustbot:docs-update, r=ehuss
GuillaumeGomez May 5, 2026
7bf810e
Rollup merge of #156154 - SynapLink:cleanup/check-pass-import-tests, …
GuillaumeGomez May 5, 2026
ba38fa0
Rollup merge of #156162 - GuillaumeGomez:update-gui-tester, r=Guillau…
GuillaumeGomez May 5, 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
8 changes: 3 additions & 5 deletions .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -259,11 +259,9 @@ Gregor Peach <gregorpeach@gmail.com>
Grzegorz Bartoszek <grzegorz.bartoszek@thaumatec.com>
Guanqun Lu <guanqun.lu@gmail.com>
Guillaume Gomez <contact@guillaume-gomez.fr>
Guillaume Gomez <contact@guillaume-gomez.fr> Guillaume Gomez <guillaume1.gomez@gmail.com>
Guillaume Gomez <contact@guillaume-gomez.fr> ggomez <guillaume1.gomez@gmail.com>
Guillaume Gomez <contact@guillaume-gomez.fr> ggomez <ggomez@ggo.ifr.lan>
Guillaume Gomez <contact@guillaume-gomez.fr> Guillaume Gomez <ggomez@ggo.ifr.lan>
Guillaume Gomez <contact@guillaume-gomez.fr> Guillaume Gomez <guillaume.gomez@huawei.com>
Guillaume Gomez <contact@guillaume-gomez.fr> <guillaume1.gomez@gmail.com>
Guillaume Gomez <contact@guillaume-gomez.fr> <ggomez@ggo.ifr.lan>
Guillaume Gomez <contact@guillaume-gomez.fr> <guillaume.gomez@huawei.com>
gnzlbg <gonzalobg88@gmail.com> <gnzlbg@users.noreply.github.com>
hamidreza kalbasi <hamidrezakalbasi@protonmail.com>
Hanna Kruppe <hanna.kruppe@gmail.com> <robin.kruppe@gmail.com>
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_ast_lowering/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ pub fn lower_to_hir(tcx: TyCtxt<'_>, (): ()) -> mid_hir::Crate<'_> {

// Don't hash unless necessary, because it's expensive.
let opt_hir_hash =
if tcx.needs_crate_hash() { Some(compute_hir_hash(tcx, &owners)) } else { None };
if tcx.needs_hir_hash() { Some(compute_hir_hash(tcx, &owners)) } else { None };

let delayed_resolver = Steal::new((resolver, krate));
mid_hir::Crate::new(owners, delayed_ids, delayed_resolver, opt_hir_hash)
Expand Down
15 changes: 13 additions & 2 deletions compiler/rustc_codegen_llvm/src/intrinsic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use std::ffi::c_uint;
use std::{assert_matches, iter, ptr};

use rustc_abi::{
AddressSpace, Align, BackendRepr, Float, HasDataLayout, Integer, NumScalableVectors, Primitive,
Size, WrappingRange,
AddressSpace, Align, BackendRepr, CVariadicStatus, Float, HasDataLayout, Integer,
NumScalableVectors, Primitive, Size, WrappingRange,
};
use rustc_codegen_ssa::base::{compare_simd_types, wants_msvc_seh, wants_wasm_eh};
use rustc_codegen_ssa::common::{IntPredicate, TypeKind};
Expand All @@ -23,6 +23,7 @@ use rustc_middle::ty::{
};
use rustc_middle::{bug, span_bug};
use rustc_session::config::CrateType;
use rustc_session::errors::feature_err;
use rustc_session::lint::builtin::DEPRECATED_LLVM_INTRINSIC;
use rustc_span::{Span, Symbol, sym};
use rustc_symbol_mangling::{mangle_internal_symbol, symbol_name_for_instance_in_crate};
Expand Down Expand Up @@ -288,6 +289,16 @@ impl<'ll, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> {
}
sym::breakpoint => self.call_intrinsic("llvm.debugtrap", &[], &[]),
sym::va_arg => {
let target = &self.cx.tcx.sess.target;
let stability = target.supports_c_variadic_definitions();
if let CVariadicStatus::Unstable { feature } = stability
&& !self.tcx.features().enabled(feature)
{
let msg =
format!("C-variadic function definitions on this target are unstable");
feature_err(&*self.sess(), feature, span, msg).emit();
}

let BackendRepr::Scalar(scalar) = result.layout.backend_repr else {
bug!("the va_arg intrinsic does not support non-scalar types")
};
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_codegen_ssa/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1212,9 +1212,10 @@ pub(crate) struct UnknownCTargetFeature<'a> {

#[derive(Diagnostic)]
#[diag("unstable feature specified for `-Ctarget-feature`: `{$feature}`")]
#[note("this feature is not stably supported; its behavior can change in the future")]
#[note("{$note}; its behavior can change in the future")]
pub(crate) struct UnstableCTargetFeature<'a> {
pub feature: &'a str,
pub note: &'a str,
}

#[derive(Diagnostic)]
Expand Down
31 changes: 19 additions & 12 deletions compiler/rustc_codegen_ssa/src/target_features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,15 @@ pub(crate) fn from_target_feature_attr(
feature: feature_str,
reason,
});
} else if let Some(nightly_feature) = stability.requires_nightly()
} else if let Some(nightly_feature) = stability.requires_nightly(/* in_cfg */ false)
&& !rust_features.enabled(nightly_feature)
{
feature_err(
&tcx.sess,
nightly_feature,
feature_span,
format!("the target feature `{feature}` is currently unstable"),
)
.emit();
let explain = if stability.is_cfg_stable_toggle_unstable() {
format!("the target feature `{feature}` is allowed in cfg but unstable otherwise")
} else {
format!("the target feature `{feature}` is currently unstable")
};
feature_err(&tcx.sess, nightly_feature, feature_span, explain).emit();
} else {
// Add this and the implied features.
for &name in tcx.implied_target_features(feature) {
Expand Down Expand Up @@ -315,12 +314,19 @@ pub fn cfg_target_feature<'a, const N: usize>(
enabled: if enable { "enabled" } else { "disabled" },
reason,
});
} else if stability.requires_nightly().is_some() {
} else if stability.requires_nightly(/* in_cfg */ false).is_some() {
// An unstable feature. Warn about using it. It makes little sense
// to hard-error here since we just warn about fully unknown
// features above.
sess.dcx()
.emit_warn(errors::UnstableCTargetFeature { feature: base_feature });
let note = if stability.is_cfg_stable_toggle_unstable() {
"this feature is allowed in cfg but unstable otherwise"
} else {
"this feature is not stably supported"
};
sess.dcx().emit_warn(errors::UnstableCTargetFeature {
feature: base_feature,
note,
});
}
}
}
Expand All @@ -346,7 +352,8 @@ pub fn cfg_target_feature<'a, const N: usize>(
// "forbidden" features.
if allow_unstable
|| (gate.in_cfg()
&& (sess.is_nightly_build() || gate.requires_nightly().is_none()))
&& (sess.is_nightly_build()
|| gate.requires_nightly(/* in_cfg */ true).is_none()))
{
Some(Symbol::intern(feature))
} else {
Expand Down
8 changes: 5 additions & 3 deletions compiler/rustc_feature/src/unstable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -563,8 +563,9 @@ declare_features! (
/// Allows defining gen blocks and `gen fn`.
(unstable, gen_blocks, "1.75.0", Some(117078)),
/// Allows using generics in more complex const expressions, based on definitional equality.
(unstable, generic_const_args, "1.95.0", Some(151972)),
/// Allows non-trivial generic constants which have to have wfness manually propagated to callers
(incomplete, generic_const_args, "1.95.0", Some(151972)),
/// Allows non-trivial generic constants which have to be shown to successfully evaluate
/// to a value by being part of an item signature.
(incomplete, generic_const_exprs, "1.56.0", Some(76560)),
/// Allows generic parameters and where-clauses on free & associated const items.
(incomplete, generic_const_items, "1.73.0", Some(113521)),
Expand Down Expand Up @@ -626,7 +627,8 @@ declare_features! (
/// Allows additional const parameter types, such as [u8; 10] or user defined types.
/// User defined types must not have fields more private than the type itself.
(unstable, min_adt_const_params, "1.96.0", Some(154042)),
/// Enables the generic const args MVP (only bare paths, not arbitrary computation).
/// Enables the generic const args MVP (paths to type const items and constructors
/// for ADTs and primitives).
(incomplete, min_generic_const_args, "1.84.0", Some(132980)),
/// A minimal, sound subset of specialization intended to be used by the
/// standard library until the soundness issues with specialization
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_typeck/src/callee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pub(crate) fn check_legal_trait_for_method_call(
if tcx.is_lang_item(trait_id, LangItem::Drop) {
let sugg = if let Some(receiver) = receiver.filter(|s| !s.is_empty()) {
errors::ExplicitDestructorCallSugg::Snippet {
lo: expr_span.shrink_to_lo(),
lo: expr_span.shrink_to_lo().to(receiver.shrink_to_lo()),
hi: receiver.shrink_to_hi().to(expr_span.shrink_to_hi()),
}
} else {
Expand Down
16 changes: 15 additions & 1 deletion compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1007,10 +1007,24 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
debug!(?def_id, ?container, ?container_id);
match container {
ty::AssocContainer::Trait => {
let arg_span = if let hir::Node::Expr(call_expr) =
self.tcx.parent_hir_node(hir_id)
&& let hir::ExprKind::Call(_, args) = call_expr.kind
&& let Some(first_arg) = args.first()
{
let mut arg = first_arg;
while let hir::ExprKind::AddrOf(_, _, inner) = arg.kind {
arg = inner;
}
Some(arg.span)
} else {
None
};

if let Err(e) = callee::check_legal_trait_for_method_call(
tcx,
path_span,
None,
arg_span,
span,
container_id,
self.body_id.to_def_id(),
Expand Down
11 changes: 9 additions & 2 deletions compiler/rustc_hir_typeck/src/pat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1352,7 +1352,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
}

/// Precondition: pat is a `Ref(_)` pattern
// FIXME(pin_ergonomics): add suggestions for `&pin mut` or `&pin const` patterns
fn borrow_pat_suggestion(&self, err: &mut Diag<'_>, pat: &Pat<'_>) {
let tcx = self.tcx;
if let PatKind::Ref(inner, pinned, mutbl) = pat.kind
Expand Down Expand Up @@ -1407,14 +1406,22 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
};

match binding_parent {
hir::Node::Param(hir::Param { ty_span, pat, .. })
if pat.span != *ty_span
&& pinned.is_pinned()
&& !tcx.features().pin_ergonomics() =>
{
// FIXME(pin_ergonomics): Once `pin_ergonomics` is stabilized, remove this
// gate and allow the pinned reference type-position suggestion unconditionally.
}
// Check that there is explicit type (ie this is not a closure param with inferred type)
// so we don't suggest moving something to the type that does not exist
hir::Node::Param(hir::Param { ty_span, pat, .. }) if pat.span != *ty_span => {
err.multipart_suggestion(
format!("to take parameter `{binding}` by reference, move `&{pin_and_mut}` to the type"),
vec![
(pat.span.until(inner.span), "".to_owned()),
(ty_span.shrink_to_lo(), mutbl.ref_prefix_str().to_owned()),
(ty_span.shrink_to_lo(), format!("&{}", pinned.prefix_str(mutbl))),
],
Applicability::MachineApplicable
);
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_interface/src/queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ impl Linker {
Linker {
dep_graph: tcx.dep_graph.clone(),
output_filenames: Arc::clone(tcx.output_filenames(())),
crate_hash: if tcx.needs_crate_hash() {
crate_hash: if tcx.sess.opts.incremental.is_some() {
Some(tcx.crate_hash(LOCAL_CRATE))
} else {
None
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/hir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ impl<'tcx> TyCtxt<'tcx> {
attrs: &SortedMap<ItemLocalId, &[Attribute]>,
define_opaque: Option<&[(Span, LocalDefId)]>,
) -> Hashes {
if !self.needs_crate_hash() {
if !self.needs_hir_hash() {
return Hashes { opt_hash_including_bodies: None, attrs_hash: None };
}

Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_middle/src/ty/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1127,12 +1127,12 @@ impl<'tcx> TyCtxt<'tcx> {
})
}

pub fn needs_crate_hash(self) -> bool {
// Why is the crate hash needed for these configurations?
pub fn needs_hir_hash(self) -> bool {
// Why is the hir hash needed for these configurations?
// - debug_assertions: for the "fingerprint the result" check in
// `rustc_query_impl::execution::execute_job`.
// - incremental: for query lookups.
// - needs_metadata: for putting into crate metadata.
// - needs_metadata: it is included in the crate metadata through the crate_hash query
// - instrument_coverage: for putting into coverage data (see
// `hash_mir_source`).
// - metrics_dir: metrics use the strict version hash in the filenames
Expand Down
18 changes: 12 additions & 6 deletions compiler/rustc_resolve/src/build_reduced_graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ use std::sync::Arc;

use rustc_ast::visit::{self, AssocCtxt, Visitor, WalkItemKind};
use rustc_ast::{
self as ast, AssocItem, AssocItemKind, Block, ConstItem, Delegation, Fn, ForeignItem,
ForeignItemKind, Inline, Item, ItemKind, NodeId, StaticItem, StmtKind, TraitAlias, TyAlias,
self as ast, AssocItem, AssocItemKind, Block, ConstItem, DUMMY_NODE_ID, Delegation, Fn,
ForeignItem, ForeignItemKind, Inline, Item, ItemKind, NodeId, StaticItem, StmtKind, TraitAlias,
TyAlias,
};
use rustc_attr_parsing::AttributeParser;
use rustc_expand::base::ResolverExpand;
Expand Down Expand Up @@ -168,7 +169,12 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
let expn_id = self.cstore().expn_that_defined_untracked(self.tcx, def_id);
let module = self.new_extern_module(
parent,
ModuleKind::Def(def_kind, def_id, Some(self.tcx.item_name(def_id))),
ModuleKind::Def(
def_kind,
def_id,
DUMMY_NODE_ID,
Some(self.tcx.item_name(def_id)),
),
expn_id,
self.def_span(def_id),
// FIXME: Account for `#[no_implicit_prelude]` attributes.
Expand Down Expand Up @@ -251,7 +257,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
// Any inherited visibility resolved directly inside an enum or trait
// (i.e. variants, fields, and trait items) inherits from the visibility
// of the enum or trait.
ModuleKind::Def(DefKind::Enum | DefKind::Trait, def_id, _) => {
ModuleKind::Def(DefKind::Enum | DefKind::Trait, def_id, _, _) => {
self.tcx.visibility(def_id).expect_local()
}
// Otherwise, the visibility is restricted to the nearest parent `mod` item.
Expand Down Expand Up @@ -848,7 +854,7 @@ impl<'a, 'ra, 'tcx> DefCollector<'a, 'ra, 'tcx> {
}
let module = self.r.new_local_module(
Some(parent),
ModuleKind::Def(def_kind, def_id, Some(ident.name)),
ModuleKind::Def(def_kind, def_id, item.id, Some(ident.name)),
expansion.to_expn_id(),
item.span,
parent.no_implicit_prelude
Expand Down Expand Up @@ -882,7 +888,7 @@ impl<'a, 'ra, 'tcx> DefCollector<'a, 'ra, 'tcx> {

let module = self.r.new_local_module(
Some(parent),
ModuleKind::Def(def_kind, def_id, Some(ident.name)),
ModuleKind::Def(def_kind, def_id, item.id, Some(ident.name)),
expansion.to_expn_id(),
item.span,
parent.no_implicit_prelude,
Expand Down
43 changes: 22 additions & 21 deletions compiler/rustc_resolve/src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ use std::ops::ControlFlow;
use itertools::Itertools as _;
use rustc_ast::visit::{self, Visitor};
use rustc_ast::{
self as ast, CRATE_NODE_ID, Crate, ItemKind, ModKind, NodeId, Path, join_path_idents,
self as ast, CRATE_NODE_ID, Crate, DUMMY_NODE_ID, ItemKind, ModKind, NodeId, Path,
join_path_idents,
};
use rustc_ast_pretty::pprust;
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
Expand Down Expand Up @@ -192,11 +193,11 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
}

fn report_with_use_injections(&mut self, krate: &Crate) {
for UseError { mut err, candidates, def_id, instead, suggestion, path, is_call } in
for UseError { mut err, candidates, node_id, instead, suggestion, path, is_call } in
mem::take(&mut self.use_injections)
{
let (span, found_use) = if let Some(def_id) = def_id.as_local() {
UsePlacementFinder::check(krate, self.def_id_to_node_id(def_id))
let (span, found_use) = if node_id != DUMMY_NODE_ID {
UsePlacementFinder::check(krate, node_id)
} else {
(None, FoundUse::No)
};
Expand Down Expand Up @@ -242,7 +243,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
let container = match old_binding.parent_module.unwrap().kind {
// Avoid using TyCtxt::def_kind_descr in the resolver, because it
// indirectly *calls* the resolver, and would cause a query cycle.
ModuleKind::Def(kind, def_id, _) => kind.descr(def_id),
ModuleKind::Def(kind, def_id, _, _) => kind.descr(def_id),
ModuleKind::Block => "block",
};

Expand Down Expand Up @@ -1705,9 +1706,9 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {

let import_suggestions =
self.lookup_import_candidates(ident, Namespace::MacroNS, parent_scope, is_expected);
let (span, found_use) = match parent_scope.module.nearest_parent_mod().as_local() {
Some(def_id) => UsePlacementFinder::check(krate, self.def_id_to_node_id(def_id)),
None => (None, FoundUse::No),
let (span, found_use) = match parent_scope.module.nearest_parent_mod_node_id() {
DUMMY_NODE_ID => (None, FoundUse::No),
node_id => UsePlacementFinder::check(krate, node_id),
};
show_candidates(
self.tcx,
Expand Down Expand Up @@ -1764,7 +1765,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
}

if ident.name == kw::Default
&& let ModuleKind::Def(DefKind::Enum, def_id, _) = parent_scope.module.kind
&& let ModuleKind::Def(DefKind::Enum, def_id, _, _) = parent_scope.module.kind
{
let span = self.def_span(def_id);
let source_map = self.tcx.sess.source_map();
Expand Down Expand Up @@ -1892,19 +1893,19 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
missing a `derive` attribute",
ident.name,
);
let sugg_span = if let ModuleKind::Def(DefKind::Enum, id, _) = parent_scope.module.kind
{
let span = self.def_span(id);
if span.from_expansion() {
None
let sugg_span =
if let ModuleKind::Def(DefKind::Enum, id, _, _) = parent_scope.module.kind {
let span = self.def_span(id);
if span.from_expansion() {
None
} else {
// For enum variants sugg_span is empty but we can get the enum's Span.
Some(span.shrink_to_lo())
}
} else {
// For enum variants sugg_span is empty but we can get the enum's Span.
Some(span.shrink_to_lo())
}
} else {
// For items this `Span` will be populated, everything else it'll be None.
sugg_span
};
// For items this `Span` will be populated, everything else it'll be None.
sugg_span
};
match sugg_span {
Some(span) => {
err.span_suggestion_verbose(
Expand Down
Loading
Loading