diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2025-03-25 09:09:01 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2025-03-25 16:14:27 +1100 |
| commit | 3f32a321bc0962cd3c700a5625dca4e4967918e4 (patch) | |
| tree | 42e5a9a0fdcdd6b41ab33651004e033b043571ed /compiler/rustc_resolve/src/diagnostics.rs | |
| parent | 2469ab195a558b3a09b5ef4319ea8a3f989b621f (diff) | |
| download | rust-3f32a321bc0962cd3c700a5625dca4e4967918e4.tar.gz rust-3f32a321bc0962cd3c700a5625dca4e4967918e4.zip | |
Use `Option<Symbol>` in `ModuleKind::Def`.
This way, `None` represents "crate root without a name" instead of `kw::Empty`. This changes makes it impossible to forget to handle the exceptional case.
Diffstat (limited to 'compiler/rustc_resolve/src/diagnostics.rs')
| -rw-r--r-- | compiler/rustc_resolve/src/diagnostics.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs index 5361af98f3c..d683fd98bd2 100644 --- a/compiler/rustc_resolve/src/diagnostics.rs +++ b/compiler/rustc_resolve/src/diagnostics.rs @@ -2439,7 +2439,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { let Res::Def(DefKind::Macro(MacroKind::Bang), _) = binding.res() else { return None; }; - let module_name = crate_module.kind.name().unwrap(); + let module_name = crate_module.kind.name().unwrap_or(kw::Empty); let import_snippet = match import.kind { ImportKind::Single { source, target, .. } if source != target => { format!("{source} as {target}") |
