diff options
| author | Stuart Cook <Zalathar@users.noreply.github.com> | 2025-09-25 20:31:53 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-25 20:31:53 +1000 |
| commit | fab06469ee33664739620ede53ed18b8c3c40644 (patch) | |
| tree | 5f85a5e611ced8d3b35ad3498d8359e2e2df44c5 /compiler/rustc_attr_parsing/src/attributes/crate_level.rs | |
| parent | 0a34928ad840f9d66d673a8cb6cf293e83efb987 (diff) | |
| parent | 60548ffaa3dafec019e52f39ab7a075d3f11e24e (diff) | |
| download | rust-fab06469ee33664739620ede53ed18b8c3c40644.tar.gz rust-fab06469ee33664739620ede53ed18b8c3c40644.zip | |
Rollup merge of #146667 - calebzulawski:simd-mono-lane-limit, r=lcnr,RalfJung
Add an attribute to check the number of lanes in a SIMD vector after monomorphization Allows std::simd to drop the `LaneCount<N>: SupportedLaneCount` trait and maintain good error messages. Also, extends rust-lang/rust#145967 by including spans in layout errors for all ADTs. r? ``@RalfJung`` cc ``@workingjubilee`` ``@programmerjake``
Diffstat (limited to 'compiler/rustc_attr_parsing/src/attributes/crate_level.rs')
| -rw-r--r-- | compiler/rustc_attr_parsing/src/attributes/crate_level.rs | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/compiler/rustc_attr_parsing/src/attributes/crate_level.rs b/compiler/rustc_attr_parsing/src/attributes/crate_level.rs index 0a340cd5e93..20ec0fd0c7b 100644 --- a/compiler/rustc_attr_parsing/src/attributes/crate_level.rs +++ b/compiler/rustc_attr_parsing/src/attributes/crate_level.rs @@ -1,40 +1,4 @@ -use std::num::IntErrorKind; - -use rustc_hir::limit::Limit; - use super::prelude::*; -use crate::session_diagnostics::LimitInvalid; - -impl<S: Stage> AcceptContext<'_, '_, S> { - fn parse_limit_int(&self, nv: &NameValueParser) -> Option<Limit> { - let Some(limit) = nv.value_as_str() else { - self.expected_string_literal(nv.value_span, Some(nv.value_as_lit())); - return None; - }; - - let error_str = match limit.as_str().parse() { - Ok(i) => return Some(Limit::new(i)), - Err(e) => match e.kind() { - IntErrorKind::PosOverflow => "`limit` is too large", - IntErrorKind::Empty => "`limit` must be a non-negative integer", - IntErrorKind::InvalidDigit => "not a valid integer", - IntErrorKind::NegOverflow => { - panic!( - "`limit` should never negatively overflow since we're parsing into a usize and we'd get Empty instead" - ) - } - IntErrorKind::Zero => { - panic!("zero is a valid `limit` so should have returned Ok() when parsing") - } - kind => panic!("unimplemented IntErrorKind variant: {:?}", kind), - }, - }; - - self.emit_err(LimitInvalid { span: self.attr_span, value_span: nv.value_span, error_str }); - - None - } -} pub(crate) struct CrateNameParser; |
