diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2024-12-28 18:37:16 +0000 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2025-01-18 21:15:37 +0000 |
| commit | 7175da59d3ce56ededb142385dbbf95a2f6ad1ed (patch) | |
| tree | 39e64b757ae8a74892c59ef0e64eaf0dbc000ec9 /compiler/rustc_const_eval/src/check_consts/check.rs | |
| parent | a47fee50bd2740caa91b6d658fa6e808466de5a5 (diff) | |
| download | rust-7175da59d3ce56ededb142385dbbf95a2f6ad1ed.tar.gz rust-7175da59d3ce56ededb142385dbbf95a2f6ad1ed.zip | |
Structured suggestion for "missing `feature` intrinsic"
```
error: `size_of_val` is not yet stable as a const intrinsic
--> $DIR/const-unstable-intrinsic.rs:17:9
|
LL | unstable_intrinsic::size_of_val(&x);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: add `#![feature(unstable)]` to the crate attributes to enable
help: add `#![feature(unstable)]` to the crate attributes to enable
|
LL + #![feature("unstable")]
|
```
Diffstat (limited to 'compiler/rustc_const_eval/src/check_consts/check.rs')
| -rw-r--r-- | compiler/rustc_const_eval/src/check_consts/check.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/compiler/rustc_const_eval/src/check_consts/check.rs b/compiler/rustc_const_eval/src/check_consts/check.rs index 94fb039512a..844dc2aa593 100644 --- a/compiler/rustc_const_eval/src/check_consts/check.rs +++ b/compiler/rustc_const_eval/src/check_consts/check.rs @@ -819,10 +819,17 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> { feature, .. }) => { + let suggestion = + tcx.hir_crate_items(()).definitions().next().and_then(|id| { + tcx.crate_level_attribute_injection_span( + tcx.local_def_id_to_hir_id(id), + ) + }); self.check_op(ops::IntrinsicUnstable { name: intrinsic.name, feature, const_stable_indirect: is_const_stable, + suggestion, }); } Some(ConstStability { level: StabilityLevel::Stable { .. }, .. }) => { |
