| author | bors <bors@rust-lang.org> 2026-06-11 07:18:20 UTC |
| committer | bors <bors@rust-lang.org> 2026-06-11 07:18:20 UTC |
| log | 32cfe53009803b85afd40ff72768bb058e9936f0 |
| tree | 1d5c091e67a68873b3dffa97bc8b98e3eb889811 |
| parent | 485ec3fbcc12fa14ef6596dabb125ad710499c9e |
| parent | 8a1eb73ffb9fe155af8a8ed5913eac8e814d528c |
Rollup of 31 pull requests
Successful merges:
- rust-lang/rust#141030 (Expand free alias types during variance computation)
- rust-lang/rust#154853 (mgca: Register `ConstArgHasType` when normalizing projection consts)
- rust-lang/rust#155527 (Replace printables table with `unicode_data.rs` tables)
- rust-lang/rust#156629 (Stabilize `core::range::{legacy, RangeFull, RangeTo}`)
- rust-lang/rust#157280 (traits: Allow escaping self types in ExistentialTraitRef::with_self_ty)
- rust-lang/rust#157282 (Fix post-monomorphization error note race in the parallel frontend)
- rust-lang/rust#157352 (Make the retained dep graph deterministic under the parallel frontend)
- rust-lang/rust#157601 (Emit error for unused target expression in glob and list delegations)
- rust-lang/rust#157611 (Update `browser-ui-test` version to `0.24.0`)
- rust-lang/rust#157620 (Add a strategy FnMut to inject behavior into the flush cycle)
- rust-lang/rust#157645 (Windows TLS - Only register the `atexit` hook when `cleanup` can be unloaded)
- rust-lang/rust#157646 (Keep rename-imported main alive in dead-code analysis under `--test`)
- rust-lang/rust#157647 (Start using comptime for reflection intrinsics and their wrapper functions)
- rust-lang/rust#157719 (resolve: Partially revert "Remove a special case for dummy imports")
- rust-lang/rust#155153 (Ensure Send/Sync is not implemented for std::env::Vars{,Os})
- rust-lang/rust#155198 (fix(mgca): Allow specifying generic args (of enum) on enum itself in unit & tuple variant constructions in (direct) const args)
- rust-lang/rust#155323 (refactor `TypeRelativePath::AssocItem` to use `AliasTerm`)
- rust-lang/rust#156497 (fix-155516: Don't suggest wrong unwrap expect)
- rust-lang/rust#156583 (Support defaults for static EIIs)
- rust-lang/rust#157013 (Ensure inferred let pattern types are well-formed)
- rust-lang/rust#157196 (Only suggest reborrowing a moved value where the reborrow is valid)
- rust-lang/rust#157230 (borrowck: avoid ICE describing fields on generic params)
- rust-lang/rust#157288 (platform support: add SNaN erratum to MIPS targets)
- rust-lang/rust#157330 (remove `IsTypeConst` from `hir::TraitItemKind`)
- rust-lang/rust#157350 (compiletest: ignore SVG `y` offset in by-lines comparison)
- rust-lang/rust#157355 (Add `or_try_*` variants for `HashMap` and `BTreeMap` Entry APIs)
- rust-lang/rust#157577 (Fix parser error recovery treating 'dyn' as a strict keyword in Rust 2015 when used in `dyn + dyn`)
- rust-lang/rust#157670 (Rename `errors.rs` file to `diagnostics.rs` (4/N))
- rust-lang/rust#157691 (Move symbol hiding code to a new file)
- rust-lang/rust#157700 (Rename `errors.rs` file to `diagnostics.rs` (5/N))
- rust-lang/rust#157703 (Fix doc link to Instant sub in saturating caveat)
Failed merges:
- rust-lang/rust#157699 (Arg splat experiment - hir FnDecl impl)288 files changed, 7783 insertions(+), 5811 deletions(-)
compiler/rustc_ast/src/ast.rs+5-3| ... | ... | @@ -31,7 +31,8 @@ use rustc_data_structures::tagged_ptr::Tag; |
| 31 | 31 | use rustc_macros::{Decodable, Encodable, StableHash, Walkable}; |
| 32 | 32 | pub use rustc_span::AttrId; |
| 33 | 33 | use rustc_span::{ |
| 34 | ByteSymbol, DUMMY_SP, ErrorGuaranteed, Ident, Span, Spanned, Symbol, kw, respan, sym, | |
| 34 | ByteSymbol, DUMMY_SP, ErrorGuaranteed, Ident, LocalExpnId, Span, Spanned, Symbol, kw, respan, | |
| 35 | sym, | |
| 35 | 36 | }; |
| 36 | 37 | use thin_vec::{ThinVec, thin_vec}; |
| 37 | 38 | |
| ... | ... | @@ -3906,10 +3907,10 @@ pub struct EiiImpl { |
| 3906 | 3907 | pub is_default: bool, |
| 3907 | 3908 | } |
| 3908 | 3909 | |
| 3909 | #[derive(Clone, Encodable, Decodable, Debug, Walkable, PartialEq, Eq)] | |
| 3910 | #[derive(Clone, Copy, Encodable, Decodable, Debug, PartialEq, Eq)] | |
| 3910 | 3911 | pub enum DelegationSource { |
| 3911 | 3912 | Single, |
| 3912 | List, | |
| 3913 | List(LocalExpnId), | |
| 3913 | 3914 | Glob, |
| 3914 | 3915 | } |
| 3915 | 3916 | |
| ... | ... | @@ -3923,6 +3924,7 @@ pub struct Delegation { |
| 3923 | 3924 | pub rename: Option<Ident>, |
| 3924 | 3925 | pub body: Option<Box<Block>>, |
| 3925 | 3926 | /// The item was expanded from a glob delegation item. |
| 3927 | #[visitable(ignore)] | |
| 3926 | 3928 | pub source: DelegationSource, |
| 3927 | 3929 | } |
| 3928 | 3930 |
compiler/rustc_ast/src/visit.rs-1| ... | ... | @@ -431,7 +431,6 @@ macro_rules! common_visitor_and_walkers { |
| 431 | 431 | Delegation, |
| 432 | 432 | DelegationMac, |
| 433 | 433 | DelegationSuffixes, |
| 434 | DelegationSource, | |
| 435 | 434 | DelimArgs, |
| 436 | 435 | DelimSpan, |
| 437 | 436 | EnumDef, |
compiler/rustc_ast_lowering/src/delegation.rs+29-9| ... | ... | @@ -62,7 +62,7 @@ use crate::diagnostics::{ |
| 62 | 62 | }; |
| 63 | 63 | use crate::{ |
| 64 | 64 | AllowReturnTypeNotation, ImplTraitContext, ImplTraitPosition, LoweringContext, ParamMode, |
| 65 | ResolverAstLoweringExt, index_crate, | |
| 65 | index_crate, | |
| 66 | 66 | }; |
| 67 | 67 | |
| 68 | 68 | mod generics; |
| ... | ... | @@ -126,7 +126,7 @@ pub(crate) fn delegations_resolutions( |
| 126 | 126 | let delegation = ast_index[def_id].delegation().expect("processing delegations"); |
| 127 | 127 | let span = delegation.last_segment_span(); |
| 128 | 128 | |
| 129 | if let Some(info) = resolver.delegation_info(def_id) { | |
| 129 | if let Some(info) = tcx.resolutions(()).delegation_infos.get(&def_id) { | |
| 130 | 130 | let res = info.resolution_id.map(|id| check_for_cycles(tcx, id, span).map(|_| id)); |
| 131 | 131 | result.insert(def_id, res.flatten()); |
| 132 | 132 | } else { |
| ... | ... | @@ -143,8 +143,6 @@ pub(crate) fn delegations_resolutions( |
| 143 | 143 | fn check_for_cycles(tcx: TyCtxt<'_>, mut def_id: DefId, span: Span) -> Result<(), ErrorGuaranteed> { |
| 144 | 144 | let mut visited: FxHashSet<DefId> = Default::default(); |
| 145 | 145 | |
| 146 | let (resolver, _) = &*tcx.hir_crate(()).delayed_resolver.borrow(); | |
| 147 | ||
| 148 | 146 | loop { |
| 149 | 147 | visited.insert(def_id); |
| 150 | 148 | |
| ... | ... | @@ -152,7 +150,7 @@ fn check_for_cycles(tcx: TyCtxt<'_>, mut def_id: DefId, span: Span) -> Result<() |
| 152 | 150 | // it means that we refer to another delegation as a callee, so in order to obtain |
| 153 | 151 | // a signature DefId we obtain NodeId of the callee delegation and try to get signature from it. |
| 154 | 152 | if let Some(local_id) = def_id.as_local() |
| 155 | && let Some(info) = resolver.delegation_info(local_id) | |
| 153 | && let Some(info) = tcx.resolutions(()).delegation_infos.get(&local_id) | |
| 156 | 154 | && let Ok(id) = info.resolution_id |
| 157 | 155 | { |
| 158 | 156 | def_id = id; |
| ... | ... | @@ -209,10 +207,11 @@ impl<'hir> LoweringContext<'_, 'hir> { |
| 209 | 207 | |
| 210 | 208 | let mut generics = self.uplift_delegation_generics(delegation, sig_id, is_method); |
| 211 | 209 | |
| 212 | let (body_id, call_expr_id) = | |
| 210 | let (body_id, call_expr_id, unused_target_expr) = | |
| 213 | 211 | self.lower_delegation_body(delegation, sig_id, param_count, &mut generics, span); |
| 214 | 212 | |
| 215 | 213 | let decl = self.lower_delegation_decl( |
| 214 | delegation.source, | |
| 216 | 215 | sig_id, |
| 217 | 216 | param_count, |
| 218 | 217 | c_variadic, |
| ... | ... | @@ -220,6 +219,7 @@ impl<'hir> LoweringContext<'_, 'hir> { |
| 220 | 219 | &generics, |
| 221 | 220 | delegation.id, |
| 222 | 221 | call_expr_id, |
| 222 | unused_target_expr, | |
| 223 | 223 | ); |
| 224 | 224 | |
| 225 | 225 | let sig = self.lower_delegation_sig(sig_id, decl, span); |
| ... | ... | @@ -375,6 +375,7 @@ impl<'hir> LoweringContext<'_, 'hir> { |
| 375 | 375 | |
| 376 | 376 | fn lower_delegation_decl( |
| 377 | 377 | &mut self, |
| 378 | source: DelegationSource, | |
| 378 | 379 | sig_id: DefId, |
| 379 | 380 | param_count: usize, |
| 380 | 381 | c_variadic: bool, |
| ... | ... | @@ -382,6 +383,7 @@ impl<'hir> LoweringContext<'_, 'hir> { |
| 382 | 383 | generics: &GenericsGenerationResults<'hir>, |
| 383 | 384 | call_path_node_id: NodeId, |
| 384 | 385 | call_expr_id: HirId, |
| 386 | unused_target_expr: bool, | |
| 385 | 387 | ) -> &'hir hir::FnDecl<'hir> { |
| 386 | 388 | // The last parameter in C variadic functions is skipped in the signature, |
| 387 | 389 | // like during regular lowering. |
| ... | ... | @@ -406,6 +408,17 @@ impl<'hir> LoweringContext<'_, 'hir> { |
| 406 | 408 | parent_args_segment_id: generics.parent.args_segment_id, |
| 407 | 409 | self_ty_id: generics.self_ty_id, |
| 408 | 410 | propagate_self_ty: generics.propagate_self_ty, |
| 411 | group_id: { | |
| 412 | let id = match source { | |
| 413 | DelegationSource::Single => None, | |
| 414 | DelegationSource::List(expn_id) => Some(expn_id), | |
| 415 | DelegationSource::Glob => { | |
| 416 | Some(self.tcx.expn_that_defined(self.owner.def_id).expect_local()) | |
| 417 | } | |
| 418 | }; | |
| 419 | ||
| 420 | id.map(|id| (id, unused_target_expr)) | |
| 421 | }, | |
| 409 | 422 | })), |
| 410 | 423 | )), |
| 411 | 424 | span, |
| ... | ... | @@ -504,9 +517,10 @@ impl<'hir> LoweringContext<'_, 'hir> { |
| 504 | 517 | param_count: usize, |
| 505 | 518 | generics: &mut GenericsGenerationResults<'hir>, |
| 506 | 519 | span: Span, |
| 507 | ) -> (BodyId, HirId) { | |
| 520 | ) -> (BodyId, HirId, bool) { | |
| 508 | 521 | let block = delegation.body.as_deref(); |
| 509 | 522 | let mut call_expr_id = HirId::INVALID; |
| 523 | let mut unused_target_expr = false; | |
| 510 | 524 | |
| 511 | 525 | let block_id = self.lower_body(|this| { |
| 512 | 526 | let mut parameters: Vec<hir::Param<'_>> = Vec::with_capacity(param_count); |
| ... | ... | @@ -514,6 +528,12 @@ impl<'hir> LoweringContext<'_, 'hir> { |
| 514 | 528 | let mut stmts: &[hir::Stmt<'hir>] = &[]; |
| 515 | 529 | |
| 516 | 530 | let is_method = this.is_method(sig_id, span); |
| 531 | let should_generate_block = this.should_generate_block(delegation, sig_id, is_method); | |
| 532 | ||
| 533 | // Consider non-specified target expression as generated, | |
| 534 | // as we do not want to emit error when target expression is | |
| 535 | // not specified. | |
| 536 | unused_target_expr = block.is_some() && (param_count == 0 || !should_generate_block); | |
| 517 | 537 | |
| 518 | 538 | for idx in 0..param_count { |
| 519 | 539 | let (param, pat_node_id) = this.generate_param(is_method, idx, span); |
| ... | ... | @@ -524,7 +544,7 @@ impl<'hir> LoweringContext<'_, 'hir> { |
| 524 | 544 | |
| 525 | 545 | let arg = if let Some(block) = block |
| 526 | 546 | && idx == 0 |
| 527 | && this.should_generate_block(delegation, sig_id, is_method) | |
| 547 | && should_generate_block | |
| 528 | 548 | { |
| 529 | 549 | let mut self_resolver = SelfResolver { |
| 530 | 550 | ctxt: this, |
| ... | ... | @@ -565,7 +585,7 @@ impl<'hir> LoweringContext<'_, 'hir> { |
| 565 | 585 | |
| 566 | 586 | debug_assert_ne!(call_expr_id, HirId::INVALID); |
| 567 | 587 | |
| 568 | (block_id, call_expr_id) | |
| 588 | (block_id, call_expr_id, unused_target_expr) | |
| 569 | 589 | } |
| 570 | 590 | |
| 571 | 591 | fn finalize_body_lowering( |
compiler/rustc_ast_lowering/src/item.rs+1-1| ... | ... | @@ -1000,7 +1000,7 @@ impl<'hir> LoweringContext<'_, 'hir> { |
| 1000 | 1000 | } else { |
| 1001 | 1001 | None |
| 1002 | 1002 | }; |
| 1003 | hir::TraitItemKind::Const(ty, rhs, rhs_kind.is_type_const().into()) | |
| 1003 | hir::TraitItemKind::Const(ty, rhs) | |
| 1004 | 1004 | }, |
| 1005 | 1005 | ); |
| 1006 | 1006 |
compiler/rustc_ast_lowering/src/lib.rs+1-5| ... | ... | @@ -63,7 +63,7 @@ use rustc_macros::extension; |
| 63 | 63 | use rustc_middle::hir::{self as mid_hir}; |
| 64 | 64 | use rustc_middle::queries::Providers; |
| 65 | 65 | use rustc_middle::span_bug; |
| 66 | use rustc_middle::ty::{DelegationInfo, PerOwnerResolverData, ResolverAstLowering, TyCtxt}; | |
| 66 | use rustc_middle::ty::{PerOwnerResolverData, ResolverAstLowering, TyCtxt}; | |
| 67 | 67 | use rustc_session::errors::add_feature_diagnostics; |
| 68 | 68 | use rustc_span::symbol::{Ident, Symbol, kw, sym}; |
| 69 | 69 | use rustc_span::{DUMMY_SP, DesugaringKind, Span}; |
| ... | ... | @@ -307,10 +307,6 @@ impl<'tcx> ResolverAstLowering<'tcx> { |
| 307 | 307 | self.extra_lifetime_params_map.get(&id).map_or(&[], |v| &v[..]) |
| 308 | 308 | } |
| 309 | 309 | |
| 310 | fn delegation_info(&self, id: LocalDefId) -> Option<&DelegationInfo> { | |
| 311 | self.delegation_infos.get(&id) | |
| 312 | } | |
| 313 | ||
| 314 | 310 | fn owner_def_id(&self, id: NodeId) -> LocalDefId { |
| 315 | 311 | self.owners[&id].def_id |
| 316 | 312 | } |
compiler/rustc_borrowck/src/diagnostics/mod.rs+13-4| ... | ... | @@ -34,6 +34,7 @@ use tracing::debug; |
| 34 | 34 | |
| 35 | 35 | use super::MirBorrowckCtxt; |
| 36 | 36 | use super::borrow_set::BorrowData; |
| 37 | use crate::LocalMutationIsAllowed; | |
| 37 | 38 | use crate::constraints::OutlivesConstraint; |
| 38 | 39 | use crate::nll::ConstraintDescription; |
| 39 | 40 | use crate::session_diagnostics::{ |
| ... | ... | @@ -537,9 +538,9 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { |
| 537 | 538 | Some(self.infcx.tcx.hir_name(var_id).to_string()) |
| 538 | 539 | } |
| 539 | 540 | _ => { |
| 540 | // Might need a revision when the fields in trait RFC is implemented | |
| 541 | // (https://github.com/rust-lang/rfcs/pull/1546) | |
| 542 | bug!("End-user description not implemented for field access on `{:?}`", ty); | |
| 541 | // This can happen for field accesses on `Box<T>`: the field is | |
| 542 | // described from the boxed type, which may have no named fields | |
| 543 | Some(field.index().to_string()) | |
| 543 | 544 | } |
| 544 | 545 | } |
| 545 | 546 | } |
| ... | ... | @@ -1426,11 +1427,19 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { |
| 1426 | 1427 | if let ty::Ref(_, _, hir::Mutability::Mut) = |
| 1427 | 1428 | moved_place.ty(self.body, self.infcx.tcx).ty.kind() |
| 1428 | 1429 | { |
| 1430 | // The `&mut *place` reborrow suggestion is `MachineApplicable`, so | |
| 1431 | // only offer it where `*place` can be borrowed mutably: a value | |
| 1432 | // captured by an `Fn` closure (held via `&self`) cannot, and the | |
| 1433 | // suggestion would otherwise fail to compile with E0596. | |
| 1434 | let reborrow_place = self.infcx.tcx.mk_place_deref(moved_place); | |
| 1435 | let reborrow_is_valid = self | |
| 1436 | .is_mutable(reborrow_place.as_ref(), LocalMutationIsAllowed::No) | |
| 1437 | .is_ok(); | |
| 1429 | 1438 | // Suggest `reborrow` in other place for following situations: |
| 1430 | 1439 | // 1. If we are in a loop this will be suggested later. |
| 1431 | 1440 | // 2. If the moved value is a mut reference, it is used in a |
| 1432 | 1441 | // generic function and the corresponding arg's type is generic param. |
| 1433 | if !is_loop_move && !has_suggest_reborrow { | |
| 1442 | if !is_loop_move && !has_suggest_reborrow && reborrow_is_valid { | |
| 1434 | 1443 | self.suggest_reborrow( |
| 1435 | 1444 | err, |
| 1436 | 1445 | move_span.shrink_to_lo(), |
compiler/rustc_builtin_macros/src/diagnostics.rs+3-2| ... | ... | @@ -1135,8 +1135,9 @@ pub(crate) struct EiiStaticMultipleImplementations { |
| 1135 | 1135 | } |
| 1136 | 1136 | |
| 1137 | 1137 | #[derive(Diagnostic)] |
| 1138 | #[diag("`#[{$name}]` cannot be used on statics with a value")] | |
| 1139 | pub(crate) struct EiiStaticDefault { | |
| 1138 | #[diag("`#[{$name}]` cannot be used on statics with a value on Apple targets")] | |
| 1139 | #[note("see issue #157649 <https://github.com/rust-lang/rust/issues/157649> for more information")] | |
| 1140 | pub(crate) struct EiiStaticDefaultApple { | |
| 1140 | 1141 | #[primary_span] |
| 1141 | 1142 | pub span: Span, |
| 1142 | 1143 | pub name: String, |
compiler/rustc_builtin_macros/src/eii.rs+55-31| ... | ... | @@ -13,7 +13,7 @@ use crate::diagnostics::{ |
| 13 | 13 | EiiAttributeNotSupported, EiiExternTargetExpectedList, EiiExternTargetExpectedMacro, |
| 14 | 14 | EiiExternTargetExpectedUnsafe, EiiMacroExpectedMaxOneArgument, EiiOnlyOnce, |
| 15 | 15 | EiiSharedMacroInStatementPosition, EiiSharedMacroTarget, EiiStaticArgumentRequired, |
| 16 | EiiStaticDefault, EiiStaticMultipleImplementations, EiiStaticMutable, | |
| 16 | EiiStaticDefaultApple, EiiStaticMultipleImplementations, EiiStaticMutable, | |
| 17 | 17 | }; |
| 18 | 18 | |
| 19 | 19 | /// ```rust |
| ... | ... | @@ -86,14 +86,17 @@ fn eii_( |
| 86 | 86 | let (item_span, foreign_item_name) = match kind { |
| 87 | 87 | ItemKind::Fn(func) => (func.sig.span, func.ident), |
| 88 | 88 | ItemKind::Static(stat) => { |
| 89 | // Statics with a default are not supported yet | |
| 90 | if let Some(stat_body) = &stat.expr { | |
| 91 | ecx.dcx().emit_err(EiiStaticDefault { | |
| 92 | span: stat_body.span, | |
| 89 | // See https://github.com/rust-lang/rust/issues/157649 | |
| 90 | if let Some(expr) = &stat.expr | |
| 91 | && ecx.sess.target.is_like_darwin | |
| 92 | { | |
| 93 | ecx.dcx().emit_err(EiiStaticDefaultApple { | |
| 94 | span: expr.span, | |
| 93 | 95 | name: path_to_string(&meta_item.path), |
| 94 | 96 | }); |
| 95 | 97 | return vec![]; |
| 96 | 98 | } |
| 99 | ||
| 97 | 100 | // Statics must have an explicit name for the eii |
| 98 | 101 | if meta_item.is_word() { |
| 99 | 102 | ecx.dcx().emit_err(EiiStaticArgumentRequired { |
| ... | ... | @@ -139,19 +142,17 @@ fn eii_( |
| 139 | 142 | |
| 140 | 143 | let mut module_items = Vec::new(); |
| 141 | 144 | |
| 142 | if let ItemKind::Fn(func) = kind | |
| 143 | && func.body.is_some() | |
| 144 | { | |
| 145 | module_items.push(generate_default_func_impl( | |
| 146 | ecx, | |
| 147 | &func, | |
| 148 | impl_unsafe, | |
| 149 | macro_name, | |
| 150 | eii_attr_span, | |
| 151 | item_span, | |
| 152 | foreign_item_name, | |
| 153 | default_func_attrs, | |
| 154 | )) | |
| 145 | if let Some(default_impl) = generate_default_impl( | |
| 146 | ecx, | |
| 147 | kind, | |
| 148 | impl_unsafe, | |
| 149 | macro_name, | |
| 150 | eii_attr_span, | |
| 151 | item_span, | |
| 152 | foreign_item_name, | |
| 153 | default_func_attrs, | |
| 154 | ) { | |
| 155 | module_items.push(default_impl); | |
| 155 | 156 | } |
| 156 | 157 | |
| 157 | 158 | module_items.push(generate_foreign_item( |
| ... | ... | @@ -266,18 +267,31 @@ fn filter_attrs_for_multiple_eii_attr( |
| 266 | 267 | .collect() |
| 267 | 268 | } |
| 268 | 269 | |
| 269 | fn generate_default_func_impl( | |
| 270 | fn generate_default_impl( | |
| 270 | 271 | ecx: &mut ExtCtxt<'_>, |
| 271 | func: &ast::Fn, | |
| 272 | item_kind: &ItemKind, | |
| 272 | 273 | impl_unsafe: bool, |
| 273 | 274 | macro_name: Ident, |
| 274 | 275 | eii_attr_span: Span, |
| 275 | 276 | item_span: Span, |
| 276 | 277 | foreign_item_name: Ident, |
| 277 | 278 | attrs: ThinVec<Attribute>, |
| 278 | ) -> Box<ast::Item> { | |
| 279 | let mut default_func = func.clone(); | |
| 280 | default_func.eii_impls.push(EiiImpl { | |
| 279 | ) -> Option<Box<ast::Item>> { | |
| 280 | match item_kind { | |
| 281 | ItemKind::Fn(func) => { | |
| 282 | if func.body.is_none() { | |
| 283 | return None; | |
| 284 | } | |
| 285 | } | |
| 286 | ItemKind::Static(stat) => { | |
| 287 | if stat.expr.is_none() { | |
| 288 | return None; | |
| 289 | } | |
| 290 | } | |
| 291 | _ => unreachable!("Target was checked earlier"), | |
| 292 | }; | |
| 293 | ||
| 294 | let eii_impl = EiiImpl { | |
| 281 | 295 | node_id: DUMMY_NODE_ID, |
| 282 | 296 | inner_span: macro_name.span, |
| 283 | 297 | eii_macro_path: ast::Path::from_ident(macro_name), |
| ... | ... | @@ -297,7 +311,18 @@ fn generate_default_func_impl( |
| 297 | 311 | ), |
| 298 | 312 | impl_unsafe, |
| 299 | 313 | }), |
| 300 | }); | |
| 314 | }; | |
| 315 | ||
| 316 | let mut item_kind = item_kind.clone(); | |
| 317 | match &mut item_kind { | |
| 318 | ItemKind::Fn(func) => { | |
| 319 | func.eii_impls.push(eii_impl); | |
| 320 | } | |
| 321 | ItemKind::Static(stat) => { | |
| 322 | stat.eii_impls.push(eii_impl); | |
| 323 | } | |
| 324 | _ => unreachable!("Target was checked earlier"), | |
| 325 | }; | |
| 301 | 326 | |
| 302 | 327 | let anon_mod = |span: Span, stmts: ThinVec<ast::Stmt>| { |
| 303 | 328 | let unit = ecx.ty(item_span, ast::TyKind::Tup(ThinVec::new())); |
| ... | ... | @@ -311,15 +336,12 @@ fn generate_default_func_impl( |
| 311 | 336 | }; |
| 312 | 337 | |
| 313 | 338 | // const _: () = { |
| 314 | // <orig fn> | |
| 339 | // <orig item> | |
| 315 | 340 | // } |
| 316 | anon_mod( | |
| 341 | Some(anon_mod( | |
| 317 | 342 | item_span, |
| 318 | thin_vec![ecx.stmt_item( | |
| 319 | item_span, | |
| 320 | ecx.item(item_span, attrs, ItemKind::Fn(Box::new(default_func))) | |
| 321 | ),], | |
| 322 | ) | |
| 343 | thin_vec![ecx.stmt_item(item_span, ecx.item(item_span, attrs, item_kind))], | |
| 344 | )) | |
| 323 | 345 | } |
| 324 | 346 | |
| 325 | 347 | /// Generates a foreign item, like |
| ... | ... | @@ -405,6 +427,8 @@ fn generate_foreign_static(mut stat: Box<ast::StaticItem>) -> ast::ForeignItemKi |
| 405 | 427 | stat.safety = ast::Safety::Safe(stat.ident.span); |
| 406 | 428 | } |
| 407 | 429 | |
| 430 | stat.expr = None; | |
| 431 | ||
| 408 | 432 | ast::ForeignItemKind::Static(stat) |
| 409 | 433 | } |
| 410 | 434 |
compiler/rustc_builtin_macros/src/test_harness.rs+4-2| ... | ... | @@ -1,6 +1,7 @@ |
| 1 | 1 | // Code that generates a test runner to run all the tests in a crate |
| 2 | 2 | |
| 3 | 3 | use std::mem; |
| 4 | use std::sync::atomic::Ordering; | |
| 4 | 5 | |
| 5 | 6 | use rustc_ast as ast; |
| 6 | 7 | use rustc_ast::attr::contains_name; |
| ... | ... | @@ -202,7 +203,7 @@ impl<'a> MutVisitor for EntryPointCleaner<'a> { |
| 202 | 203 | // clash with the one we're going to add, but mark it as |
| 203 | 204 | // #[allow(dead_code)] to avoid printing warnings. |
| 204 | 205 | match entry_point_type(&item, self.depth == 0) { |
| 205 | EntryPointType::MainNamed | EntryPointType::RustcMainAttr => { | |
| 206 | EntryPointType::RustcMainAttr => { | |
| 206 | 207 | let allow_dead_code = attr::mk_attr_nested_word( |
| 207 | 208 | &self.sess.psess.attr_id_generator, |
| 208 | 209 | ast::AttrStyle::Outer, |
| ... | ... | @@ -213,8 +214,9 @@ impl<'a> MutVisitor for EntryPointCleaner<'a> { |
| 213 | 214 | ); |
| 214 | 215 | item.attrs.retain(|attr| !attr.has_name(sym::rustc_main)); |
| 215 | 216 | item.attrs.push(allow_dead_code); |
| 217 | self.sess.removed_rustc_main_attr.store(true, Ordering::Relaxed); | |
| 216 | 218 | } |
| 217 | EntryPointType::None | EntryPointType::OtherMain => {} | |
| 219 | EntryPointType::None | EntryPointType::MainNamed | EntryPointType::OtherMain => {} | |
| 218 | 220 | }; |
| 219 | 221 | } |
| 220 | 222 | } |
compiler/rustc_codegen_ssa/src/back/archive.rs+3-154| ... | ... | @@ -1,18 +1,16 @@ |
| 1 | use std::env; | |
| 1 | 2 | use std::error::Error; |
| 2 | 3 | use std::ffi::OsString; |
| 3 | 4 | use std::fs::{self, File}; |
| 4 | 5 | use std::io::{self, BufWriter, Write}; |
| 5 | 6 | use std::path::{Path, PathBuf}; |
| 6 | use std::{env, mem}; | |
| 7 | 7 | |
| 8 | 8 | use ar_archive_writer::{ |
| 9 | 9 | ArchiveKind, COFFShortExport, MachineTypes, NewArchiveMember, write_archive_to_stream, |
| 10 | 10 | }; |
| 11 | 11 | pub use ar_archive_writer::{DEFAULT_OBJECT_READER, ObjectReader}; |
| 12 | 12 | use object::read::archive::{ArchiveFile, ArchiveKind as ObjectArchiveKind}; |
| 13 | use object::read::elf::Sym as _; | |
| 14 | use object::read::macho::{FatArch, Nlist}; | |
| 15 | use object::{Endianness, elf, macho}; | |
| 13 | use object::read::macho::FatArch; | |
| 16 | 14 | use rustc_data_structures::fx::{FxHashSet, FxIndexSet}; |
| 17 | 15 | use rustc_data_structures::memmap::Mmap; |
| 18 | 16 | use rustc_fs_util::TempDirBuilder; |
| ... | ... | @@ -24,6 +22,7 @@ use tracing::trace; |
| 24 | 22 | |
| 25 | 23 | use super::metadata::{create_compressed_metadata_file, search_for_section}; |
| 26 | 24 | use super::rmeta_link; |
| 25 | use super::symbol_edit::apply_hide; | |
| 27 | 26 | use crate::common; |
| 28 | 27 | // Public for ArchiveBuilderBuilder::extract_bundled_libs |
| 29 | 28 | pub use crate::errors::ExtractBundledLibsError; |
| ... | ... | @@ -671,153 +670,3 @@ impl<'a> ArArchiveBuilder<'a> { |
| 671 | 670 | fn io_error_context(context: &str, err: io::Error) -> io::Error { |
| 672 | 671 | io::Error::new(io::ErrorKind::Other, format!("{context}: {err}")) |
| 673 | 672 | } |
| 674 | ||
| 675 | // We use the `object` crate for the read-only pass over ELF/Mach-O object files | |
| 676 | // because its `Sym`/`Nlist` traits provide clean access to symbol properties without | |
| 677 | // manual byte parsing. However, `object` does not expose mutable views into the data, | |
| 678 | // so we cannot use it to modify symbol fields in place. Instead, the read-only pass | |
| 679 | // collects byte-level patches (offset + new value), and the write pass | |
| 680 | // (`apply_patches`) applies them to a copy of the byte buffer without any ELF/Mach-O | |
| 681 | // parsing — similar to how linker relocations work. | |
| 682 | ||
| 683 | /// A byte-level patch collected in the read-only pass and applied in the write pass. | |
| 684 | struct Patch { | |
| 685 | offset: usize, | |
| 686 | value: u8, | |
| 687 | } | |
| 688 | ||
| 689 | /// Apply a list of byte patches to `data`, returning the (possibly modified) bytes. | |
| 690 | fn apply_patches(data: &[u8], patches: &[Patch]) -> Vec<u8> { | |
| 691 | let mut buf = data.to_vec(); | |
| 692 | for p in patches { | |
| 693 | buf[p.offset] = p.value; | |
| 694 | } | |
| 695 | buf | |
| 696 | } | |
| 697 | ||
| 698 | // --------------------------------------------------------------------------- | |
| 699 | // ELF hide – read-only pass uses `object` crate, write pass uses `Patch` list | |
| 700 | // --------------------------------------------------------------------------- | |
| 701 | ||
| 702 | fn elf_hide_patches_impl<'data, Elf: object::read::elf::FileHeader<Endian = Endianness>>( | |
| 703 | data: &'data [u8], | |
| 704 | st_other_offset: usize, | |
| 705 | exported: &FxHashSet<String>, | |
| 706 | ) -> Option<Vec<Patch>> | |
| 707 | where | |
| 708 | u64: From<Elf::Word>, | |
| 709 | { | |
| 710 | let header = Elf::parse(data).ok()?; | |
| 711 | let endian = header.endian().ok()?; | |
| 712 | let sections = header.sections(endian, data).ok()?; | |
| 713 | let symtab = sections.symbols(endian, data, elf::SHT_SYMTAB).ok()?; | |
| 714 | ||
| 715 | let data_ptr = data.as_ptr() as usize; | |
| 716 | let strings = symtab.strings(); | |
| 717 | let mut patches = Vec::new(); | |
| 718 | ||
| 719 | for sym in symtab.iter() { | |
| 720 | let binding = sym.st_bind(); | |
| 721 | if binding != elf::STB_GLOBAL && binding != elf::STB_WEAK { | |
| 722 | continue; | |
| 723 | } | |
| 724 | if sym.is_undefined(endian) { | |
| 725 | continue; | |
| 726 | } | |
| 727 | let Ok(name_bytes) = sym.name(endian, strings) else { continue }; | |
| 728 | let Ok(name) = str::from_utf8(name_bytes) else { continue }; | |
| 729 | if !exported.contains(name) { | |
| 730 | let sym_addr = sym as *const Elf::Sym as usize; | |
| 731 | let offset = sym_addr - data_ptr + st_other_offset; | |
| 732 | let new_vis = (sym.st_other() & !0x03) | elf::STV_HIDDEN; | |
| 733 | patches.push(Patch { offset, value: new_vis }); | |
| 734 | } | |
| 735 | } | |
| 736 | ||
| 737 | Some(patches) | |
| 738 | } | |
| 739 | ||
| 740 | // --------------------------------------------------------------------------- | |
| 741 | // Mach-O hide – same architecture: read-only pass via `object`, write via patches | |
| 742 | // --------------------------------------------------------------------------- | |
| 743 | ||
| 744 | fn macho_hide_patches_impl<'data, Mach: object::read::macho::MachHeader<Endian = Endianness>>( | |
| 745 | data: &'data [u8], | |
| 746 | n_type_offset: usize, | |
| 747 | exported: &FxHashSet<String>, | |
| 748 | ) -> Option<Vec<Patch>> { | |
| 749 | let header = Mach::parse(data, 0).ok()?; | |
| 750 | let endian = header.endian().ok()?; | |
| 751 | let mut commands = header.load_commands(endian, data, 0).ok()?; | |
| 752 | ||
| 753 | let symtab_cmd = loop { | |
| 754 | let cmd = commands.next().ok()??; | |
| 755 | if let Some(st) = cmd.symtab().ok().flatten() { | |
| 756 | break st; | |
| 757 | } | |
| 758 | }; | |
| 759 | let symtab: object::read::macho::SymbolTable<'_, Mach, &_> = | |
| 760 | symtab_cmd.symbols(endian, data).ok()?; | |
| 761 | ||
| 762 | let data_ptr = data.as_ptr() as usize; | |
| 763 | let strings = symtab.strings(); | |
| 764 | let mut patches = Vec::new(); | |
| 765 | ||
| 766 | for nlist in symtab.iter() { | |
| 767 | if nlist.is_stab() { | |
| 768 | continue; | |
| 769 | } | |
| 770 | if nlist.is_undefined() { | |
| 771 | continue; | |
| 772 | } | |
| 773 | if nlist.n_type() & macho::N_EXT == 0 { | |
| 774 | continue; | |
| 775 | } | |
| 776 | let Ok(name_bytes) = nlist.name(endian, strings) else { continue }; | |
| 777 | let Ok(name) = str::from_utf8(name_bytes) else { continue }; | |
| 778 | let name = name.strip_prefix('_').unwrap_or(name); | |
| 779 | if !exported.contains(name) { | |
| 780 | let nlist_addr = nlist as *const Mach::Nlist as usize; | |
| 781 | let offset = nlist_addr - data_ptr + n_type_offset; | |
| 782 | patches.push(Patch { offset, value: nlist.n_type() | macho::N_PEXT }); | |
| 783 | } | |
| 784 | } | |
| 785 | ||
| 786 | Some(patches) | |
| 787 | } | |
| 788 | ||
| 789 | // --------------------------------------------------------------------------- | |
| 790 | // Unified dispatch: top-level detection via `object::File::parse` | |
| 791 | // --------------------------------------------------------------------------- | |
| 792 | ||
| 793 | fn hide_patches(data: &[u8], exported: &FxHashSet<String>) -> Option<Vec<Patch>> { | |
| 794 | let file = object::File::parse(data).ok()?; | |
| 795 | match file { | |
| 796 | object::File::Elf64(_) => elf_hide_patches_impl::<elf::FileHeader64<Endianness>>( | |
| 797 | data, | |
| 798 | mem::offset_of!(elf::Sym64<Endianness>, st_other), | |
| 799 | exported, | |
| 800 | ), | |
| 801 | object::File::Elf32(_) => elf_hide_patches_impl::<elf::FileHeader32<Endianness>>( | |
| 802 | data, | |
| 803 | mem::offset_of!(elf::Sym32<Endianness>, st_other), | |
| 804 | exported, | |
| 805 | ), | |
| 806 | object::File::MachO64(_) => macho_hide_patches_impl::<macho::MachHeader64<Endianness>>( | |
| 807 | data, | |
| 808 | mem::offset_of!(macho::Nlist64<Endianness>, n_type), | |
| 809 | exported, | |
| 810 | ), | |
| 811 | object::File::MachO32(_) => macho_hide_patches_impl::<macho::MachHeader32<Endianness>>( | |
| 812 | data, | |
| 813 | mem::offset_of!(macho::Nlist32<Endianness>, n_type), | |
| 814 | exported, | |
| 815 | ), | |
| 816 | _ => None, | |
| 817 | } | |
| 818 | } | |
| 819 | ||
| 820 | fn apply_hide(data: &[u8], exported: &FxHashSet<String>) -> Vec<u8> { | |
| 821 | let patches = hide_patches(data, exported).unwrap_or_default(); | |
| 822 | apply_patches(data, &patches) | |
| 823 | } |
compiler/rustc_codegen_ssa/src/back/mod.rs+1| ... | ... | @@ -11,6 +11,7 @@ pub mod lto; |
| 11 | 11 | pub mod metadata; |
| 12 | 12 | pub mod rmeta_link; |
| 13 | 13 | pub(crate) mod rpath; |
| 14 | mod symbol_edit; | |
| 14 | 15 | pub mod symbol_export; |
| 15 | 16 | pub mod write; |
| 16 | 17 |
compiler/rustc_codegen_ssa/src/back/symbol_edit.rs created+156| ... | ... | @@ -0,0 +1,156 @@ |
| 1 | // We use the `object` crate for the read-only pass over ELF/Mach-O object files | |
| 2 | // because its `Sym`/`Nlist` traits provide clean access to symbol properties without | |
| 3 | // manual byte parsing. However, `object` does not expose mutable views into the data, | |
| 4 | // so we cannot use it to modify symbol fields in place. Instead, the read-only pass | |
| 5 | // collects byte-level patches (offset + new value), and the write pass | |
| 6 | // (`apply_patches`) applies them to a copy of the byte buffer without any ELF/Mach-O | |
| 7 | // parsing — similar to how linker relocations work. | |
| 8 | ||
| 9 | use std::mem; | |
| 10 | ||
| 11 | use object::read::elf::Sym as _; | |
| 12 | use object::read::macho::Nlist; | |
| 13 | use object::{Endianness, elf, macho}; | |
| 14 | use rustc_data_structures::fx::FxHashSet; | |
| 15 | ||
| 16 | /// A byte-level patch collected in the read-only pass and applied in the write pass. | |
| 17 | struct Patch { | |
| 18 | offset: usize, | |
| 19 | value: u8, | |
| 20 | } | |
| 21 | ||
| 22 | /// Apply a list of byte patches to `data`, returning the (possibly modified) bytes. | |
| 23 | fn apply_patches(data: &[u8], patches: &[Patch]) -> Vec<u8> { | |
| 24 | let mut buf = data.to_vec(); | |
| 25 | for p in patches { | |
| 26 | buf[p.offset] = p.value; | |
| 27 | } | |
| 28 | buf | |
| 29 | } | |
| 30 | ||
| 31 | // --------------------------------------------------------------------------- | |
| 32 | // ELF hide – read-only pass uses `object` crate, write pass uses `Patch` list | |
| 33 | // --------------------------------------------------------------------------- | |
| 34 | ||
| 35 | fn elf_hide_patches_impl<'data, Elf: object::read::elf::FileHeader<Endian = Endianness>>( | |
| 36 | data: &'data [u8], | |
| 37 | st_other_offset: usize, | |
| 38 | exported: &FxHashSet<String>, | |
| 39 | ) -> Option<Vec<Patch>> | |
| 40 | where | |
| 41 | u64: From<Elf::Word>, | |
| 42 | { | |
| 43 | let header = Elf::parse(data).ok()?; | |
| 44 | let endian = header.endian().ok()?; | |
| 45 | let sections = header.sections(endian, data).ok()?; | |
| 46 | let symtab = sections.symbols(endian, data, elf::SHT_SYMTAB).ok()?; | |
| 47 | ||
| 48 | let data_ptr = data.as_ptr() as usize; | |
| 49 | let strings = symtab.strings(); | |
| 50 | let mut patches = Vec::new(); | |
| 51 | ||
| 52 | for sym in symtab.iter() { | |
| 53 | let binding = sym.st_bind(); | |
| 54 | if binding != elf::STB_GLOBAL && binding != elf::STB_WEAK { | |
| 55 | continue; | |
| 56 | } | |
| 57 | if sym.is_undefined(endian) { | |
| 58 | continue; | |
| 59 | } | |
| 60 | let Ok(name_bytes) = sym.name(endian, strings) else { continue }; | |
| 61 | let Ok(name) = str::from_utf8(name_bytes) else { continue }; | |
| 62 | if !exported.contains(name) { | |
| 63 | let sym_addr = sym as *const Elf::Sym as usize; | |
| 64 | let offset = sym_addr - data_ptr + st_other_offset; | |
| 65 | let new_vis = (sym.st_other() & !0x03) | elf::STV_HIDDEN; | |
| 66 | patches.push(Patch { offset, value: new_vis }); | |
| 67 | } | |
| 68 | } | |
| 69 | ||
| 70 | Some(patches) | |
| 71 | } | |
| 72 | ||
| 73 | // --------------------------------------------------------------------------- | |
| 74 | // Mach-O hide – same architecture: read-only pass via `object`, write via patches | |
| 75 | // --------------------------------------------------------------------------- | |
| 76 | ||
| 77 | fn macho_hide_patches_impl<'data, Mach: object::read::macho::MachHeader<Endian = Endianness>>( | |
| 78 | data: &'data [u8], | |
| 79 | n_type_offset: usize, | |
| 80 | exported: &FxHashSet<String>, | |
| 81 | ) -> Option<Vec<Patch>> { | |
| 82 | let header = Mach::parse(data, 0).ok()?; | |
| 83 | let endian = header.endian().ok()?; | |
| 84 | let mut commands = header.load_commands(endian, data, 0).ok()?; | |
| 85 | ||
| 86 | let symtab_cmd = loop { | |
| 87 | let cmd = commands.next().ok()??; | |
| 88 | if let Some(st) = cmd.symtab().ok().flatten() { | |
| 89 | break st; | |
| 90 | } | |
| 91 | }; | |
| 92 | let symtab: object::read::macho::SymbolTable<'_, Mach, &_> = | |
| 93 | symtab_cmd.symbols(endian, data).ok()?; | |
| 94 | ||
| 95 | let data_ptr = data.as_ptr() as usize; | |
| 96 | let strings = symtab.strings(); | |
| 97 | let mut patches = Vec::new(); | |
| 98 | ||
| 99 | for nlist in symtab.iter() { | |
| 100 | if nlist.is_stab() { | |
| 101 | continue; | |
| 102 | } | |
| 103 | if nlist.is_undefined() { | |
| 104 | continue; | |
| 105 | } | |
| 106 | if nlist.n_type() & macho::N_EXT == 0 { | |
| 107 | continue; | |
| 108 | } | |
| 109 | let Ok(name_bytes) = nlist.name(endian, strings) else { continue }; | |
| 110 | let Ok(name) = str::from_utf8(name_bytes) else { continue }; | |
| 111 | let name = name.strip_prefix('_').unwrap_or(name); | |
| 112 | if !exported.contains(name) { | |
| 113 | let nlist_addr = nlist as *const Mach::Nlist as usize; | |
| 114 | let offset = nlist_addr - data_ptr + n_type_offset; | |
| 115 | patches.push(Patch { offset, value: nlist.n_type() | macho::N_PEXT }); | |
| 116 | } | |
| 117 | } | |
| 118 | ||
| 119 | Some(patches) | |
| 120 | } | |
| 121 | ||
| 122 | // --------------------------------------------------------------------------- | |
| 123 | // Unified dispatch: top-level detection via `object::File::parse` | |
| 124 | // --------------------------------------------------------------------------- | |
| 125 | ||
| 126 | fn hide_patches(data: &[u8], exported: &FxHashSet<String>) -> Option<Vec<Patch>> { | |
| 127 | let file = object::File::parse(data).ok()?; | |
| 128 | match file { | |
| 129 | object::File::Elf64(_) => elf_hide_patches_impl::<elf::FileHeader64<Endianness>>( | |
| 130 | data, | |
| 131 | mem::offset_of!(elf::Sym64<Endianness>, st_other), | |
| 132 | exported, | |
| 133 | ), | |
| 134 | object::File::Elf32(_) => elf_hide_patches_impl::<elf::FileHeader32<Endianness>>( | |
| 135 | data, | |
| 136 | mem::offset_of!(elf::Sym32<Endianness>, st_other), | |
| 137 | exported, | |
| 138 | ), | |
| 139 | object::File::MachO64(_) => macho_hide_patches_impl::<macho::MachHeader64<Endianness>>( | |
| 140 | data, | |
| 141 | mem::offset_of!(macho::Nlist64<Endianness>, n_type), | |
| 142 | exported, | |
| 143 | ), | |
| 144 | object::File::MachO32(_) => macho_hide_patches_impl::<macho::MachHeader32<Endianness>>( | |
| 145 | data, | |
| 146 | mem::offset_of!(macho::Nlist32<Endianness>, n_type), | |
| 147 | exported, | |
| 148 | ), | |
| 149 | _ => None, | |
| 150 | } | |
| 151 | } | |
| 152 | ||
| 153 | pub(super) fn apply_hide(data: &[u8], exported: &FxHashSet<String>) -> Vec<u8> { | |
| 154 | let patches = hide_patches(data, exported).unwrap_or_default(); | |
| 155 | apply_patches(data, &patches) | |
| 156 | } |
compiler/rustc_data_structures/src/graph/linked_graph/mod.rs+3-1| ... | ... | @@ -45,17 +45,19 @@ mod tests; |
| 45 | 45 | /// This graph implementation predates the later [graph traits](crate::graph), |
| 46 | 46 | /// and does not implement those traits, so it has its own implementations of a |
| 47 | 47 | /// few basic graph algorithms. |
| 48 | #[derive(Clone)] | |
| 48 | 49 | pub struct LinkedGraph<N, E> { |
| 49 | 50 | nodes: IndexVec<NodeIndex, Node<N>>, |
| 50 | 51 | edges: Vec<Edge<E>>, |
| 51 | 52 | } |
| 52 | 53 | |
| 54 | #[derive(Clone)] | |
| 53 | 55 | pub struct Node<N> { |
| 54 | 56 | first_edge: [EdgeIndex; 2], // see module comment |
| 55 | 57 | pub data: Option<N>, |
| 56 | 58 | } |
| 57 | 59 | |
| 58 | #[derive(Debug)] | |
| 60 | #[derive(Clone, Debug)] | |
| 59 | 61 | pub struct Edge<E> { |
| 60 | 62 | next_edge: [EdgeIndex; 2], // see module comment |
| 61 | 63 | source: NodeIndex, |
compiler/rustc_data_structures/src/marker.rs+1| ... | ... | @@ -64,6 +64,7 @@ already_send!( |
| 64 | 64 | [std::io::Error][std::fs::File][std::panic::Location<'_>][rustc_arena::DroplessArena] |
| 65 | 65 | [jobserver_crate::Client][jobserver_crate::HelperThread][crate::memmap::Mmap] |
| 66 | 66 | [crate::profiling::SelfProfiler][crate::owned_slice::OwnedSlice] |
| 67 | [rustc_serialize::opaque::FileEncoder<'_>] | |
| 67 | 68 | ); |
| 68 | 69 | |
| 69 | 70 | #[cfg(target_has_atomic = "64")] |
compiler/rustc_errors/src/lib.rs+49-23| ... | ... | @@ -24,6 +24,7 @@ use std::io::Write; |
| 24 | 24 | use std::num::NonZero; |
| 25 | 25 | use std::ops::DerefMut; |
| 26 | 26 | use std::path::{Path, PathBuf}; |
| 27 | use std::thread::ThreadId; | |
| 27 | 28 | use std::{assert_matches, fmt, panic}; |
| 28 | 29 | |
| 29 | 30 | use Level::*; |
| ... | ... | @@ -297,11 +298,12 @@ impl<'a> std::ops::Deref for DiagCtxtHandle<'a> { |
| 297 | 298 | struct DiagCtxtInner { |
| 298 | 299 | flags: DiagCtxtFlags, |
| 299 | 300 | |
| 300 | /// The error guarantees from all emitted errors. The length gives the error count. | |
| 301 | err_guars: Vec<ErrorGuaranteed>, | |
| 302 | /// The error guarantee from all emitted lint errors. The length gives the | |
| 303 | /// lint error count. | |
| 304 | lint_err_guars: Vec<ErrorGuaranteed>, | |
| 301 | /// The error guarantees from all emitted errors, each paired with the | |
| 302 | /// thread that emitted it. The length gives the error count. | |
| 303 | err_guars: Vec<(ErrorGuaranteed, ThreadId)>, | |
| 304 | /// The error guarantee from all emitted lint errors, each paired with the | |
| 305 | /// thread that emitted it. The length gives the lint error count. | |
| 306 | lint_err_guars: Vec<(ErrorGuaranteed, ThreadId)>, | |
| 305 | 307 | /// The delayed bugs and their error guarantees. |
| 306 | 308 | delayed_bugs: Vec<(DelayedDiagInner, ErrorGuaranteed)>, |
| 307 | 309 | |
| ... | ... | @@ -343,7 +345,7 @@ struct DiagCtxtInner { |
| 343 | 345 | /// `emit_stashed_diagnostics` by the time the `DiagCtxtInner` is dropped, |
| 344 | 346 | /// otherwise an assertion failure will occur. |
| 345 | 347 | stashed_diagnostics: |
| 346 | FxIndexMap<StashKey, FxIndexMap<Span, (DiagInner, Option<ErrorGuaranteed>)>>, | |
| 348 | FxIndexMap<StashKey, FxIndexMap<Span, (DiagInner, Option<ErrorGuaranteed>, ThreadId)>>, | |
| 347 | 349 | |
| 348 | 350 | future_breakage_diagnostics: Vec<DiagInner>, |
| 349 | 351 | |
| ... | ... | @@ -613,7 +615,7 @@ impl<'a> DiagCtxtHandle<'a> { |
| 613 | 615 | .stashed_diagnostics |
| 614 | 616 | .entry(key) |
| 615 | 617 | .or_default() |
| 616 | .insert(span.with_parent(None), (diag, guar)); | |
| 618 | .insert(span.with_parent(None), (diag, guar, std::thread::current().id())); | |
| 617 | 619 | |
| 618 | 620 | guar |
| 619 | 621 | } |
| ... | ... | @@ -623,7 +625,7 @@ impl<'a> DiagCtxtHandle<'a> { |
| 623 | 625 | /// error. |
| 624 | 626 | pub fn steal_non_err(self, span: Span, key: StashKey) -> Option<Diag<'a, ()>> { |
| 625 | 627 | // FIXME(#120456) - is `swap_remove` correct? |
| 626 | let (diag, guar) = self.inner.borrow_mut().stashed_diagnostics.get_mut(&key).and_then( | |
| 628 | let (diag, guar, _) = self.inner.borrow_mut().stashed_diagnostics.get_mut(&key).and_then( | |
| 627 | 629 | |stashed_diagnostics| stashed_diagnostics.swap_remove(&span.with_parent(None)), |
| 628 | 630 | )?; |
| 629 | 631 | assert!(!diag.is_error()); |
| ... | ... | @@ -648,7 +650,7 @@ impl<'a> DiagCtxtHandle<'a> { |
| 648 | 650 | let err = self.inner.borrow_mut().stashed_diagnostics.get_mut(&key).and_then( |
| 649 | 651 | |stashed_diagnostics| stashed_diagnostics.swap_remove(&span.with_parent(None)), |
| 650 | 652 | ); |
| 651 | err.map(|(err, guar)| { | |
| 653 | err.map(|(err, guar, _)| { | |
| 652 | 654 | // The use of `::<ErrorGuaranteed>` is safe because level is `Level::Error`. |
| 653 | 655 | assert_eq!(err.level, Error); |
| 654 | 656 | assert!(guar.is_some()); |
| ... | ... | @@ -673,7 +675,7 @@ impl<'a> DiagCtxtHandle<'a> { |
| 673 | 675 | |stashed_diagnostics| stashed_diagnostics.swap_remove(&span.with_parent(None)), |
| 674 | 676 | ); |
| 675 | 677 | match old_err { |
| 676 | Some((old_err, guar)) => { | |
| 678 | Some((old_err, guar, _)) => { | |
| 677 | 679 | assert_eq!(old_err.level, Error); |
| 678 | 680 | assert!(guar.is_some()); |
| 679 | 681 | // Because `old_err` has already been counted, it can only be |
| ... | ... | @@ -710,7 +712,27 @@ impl<'a> DiagCtxtHandle<'a> { |
| 710 | 712 | + inner |
| 711 | 713 | .stashed_diagnostics |
| 712 | 714 | .values() |
| 713 | .map(|a| a.values().filter(|(_, guar)| guar.is_some()).count()) | |
| 715 | .map(|a| a.values().filter(|(_, guar, _)| guar.is_some()).count()) | |
| 716 | .sum::<usize>() | |
| 717 | } | |
| 718 | ||
| 719 | /// The number of errors that have been emitted on the *current thread*. | |
| 720 | /// | |
| 721 | /// Like [`DiagCtxtHandle::err_count`], but only counts errors whose recorded | |
| 722 | /// emitting thread is the calling thread. | |
| 723 | pub fn err_count_on_current_thread(&self) -> usize { | |
| 724 | let inner = self.inner.borrow(); | |
| 725 | let current = std::thread::current().id(); | |
| 726 | inner.err_guars.iter().filter(|(_, thread)| *thread == current).count() | |
| 727 | + inner.lint_err_guars.iter().filter(|(_, thread)| *thread == current).count() | |
| 728 | + inner | |
| 729 | .stashed_diagnostics | |
| 730 | .values() | |
| 731 | .map(|a| { | |
| 732 | a.values() | |
| 733 | .filter(|(_, guar, thread)| guar.is_some() && *thread == current) | |
| 734 | .count() | |
| 735 | }) | |
| 714 | 736 | .sum::<usize>() |
| 715 | 737 | } |
| 716 | 738 | |
| ... | ... | @@ -879,7 +901,8 @@ impl<'a> DiagCtxtHandle<'a> { |
| 879 | 901 | // This `unchecked_error_guaranteed` is valid. It is where the |
| 880 | 902 | // `ErrorGuaranteed` for unused_extern errors originates. |
| 881 | 903 | #[allow(deprecated)] |
| 882 | inner.lint_err_guars.push(ErrorGuaranteed::unchecked_error_guaranteed()); | |
| 904 | let guar = ErrorGuaranteed::unchecked_error_guaranteed(); | |
| 905 | inner.lint_err_guars.push((guar, std::thread::current().id())); | |
| 883 | 906 | inner.panic_if_treat_err_as_bug(); |
| 884 | 907 | } |
| 885 | 908 | |
| ... | ... | @@ -1178,7 +1201,7 @@ impl DiagCtxtInner { |
| 1178 | 1201 | let mut guar = None; |
| 1179 | 1202 | let has_errors = !self.err_guars.is_empty(); |
| 1180 | 1203 | for (_, stashed_diagnostics) in std::mem::take(&mut self.stashed_diagnostics).into_iter() { |
| 1181 | for (_, (diag, _guar)) in stashed_diagnostics { | |
| 1204 | for (_, (diag, _guar, _thread)) in stashed_diagnostics { | |
| 1182 | 1205 | if !diag.is_error() { |
| 1183 | 1206 | // Unless they're forced, don't flush stashed warnings when |
| 1184 | 1207 | // there are errors, to avoid causing warning overload. The |
| ... | ... | @@ -1347,13 +1370,14 @@ impl DiagCtxtInner { |
| 1347 | 1370 | // `ErrorGuaranteed` for errors and lint errors originates. |
| 1348 | 1371 | #[allow(deprecated)] |
| 1349 | 1372 | let guar = ErrorGuaranteed::unchecked_error_guaranteed(); |
| 1373 | let thread = std::thread::current().id(); | |
| 1350 | 1374 | if is_lint { |
| 1351 | self.lint_err_guars.push(guar); | |
| 1375 | self.lint_err_guars.push((guar, thread)); | |
| 1352 | 1376 | } else { |
| 1353 | 1377 | if let Some(taint) = taint { |
| 1354 | 1378 | taint.set(Some(guar)); |
| 1355 | 1379 | } |
| 1356 | self.err_guars.push(guar); | |
| 1380 | self.err_guars.push((guar, thread)); | |
| 1357 | 1381 | } |
| 1358 | 1382 | self.panic_if_treat_err_as_bug(); |
| 1359 | 1383 | Some(guar) |
| ... | ... | @@ -1377,12 +1401,12 @@ impl DiagCtxtInner { |
| 1377 | 1401 | } |
| 1378 | 1402 | |
| 1379 | 1403 | fn has_errors_excluding_lint_errors(&self) -> Option<ErrorGuaranteed> { |
| 1380 | self.err_guars.get(0).copied().or_else(|| { | |
| 1381 | if let Some((_diag, guar)) = self | |
| 1404 | self.err_guars.get(0).map(|(guar, _)| *guar).or_else(|| { | |
| 1405 | if let Some((_diag, guar, _)) = self | |
| 1382 | 1406 | .stashed_diagnostics |
| 1383 | 1407 | .values() |
| 1384 | 1408 | .flat_map(|stashed_diagnostics| stashed_diagnostics.values()) |
| 1385 | .find(|(diag, guar)| guar.is_some() && diag.is_lint.is_none()) | |
| 1409 | .find(|(diag, guar, _)| guar.is_some() && diag.is_lint.is_none()) | |
| 1386 | 1410 | { |
| 1387 | 1411 | *guar |
| 1388 | 1412 | } else { |
| ... | ... | @@ -1392,13 +1416,15 @@ impl DiagCtxtInner { |
| 1392 | 1416 | } |
| 1393 | 1417 | |
| 1394 | 1418 | fn has_errors(&self) -> Option<ErrorGuaranteed> { |
| 1395 | self.err_guars.get(0).copied().or_else(|| self.lint_err_guars.get(0).copied()).or_else( | |
| 1396 | || { | |
| 1419 | self.err_guars | |
| 1420 | .get(0) | |
| 1421 | .map(|(guar, _)| *guar) | |
| 1422 | .or_else(|| self.lint_err_guars.get(0).map(|(guar, _)| *guar)) | |
| 1423 | .or_else(|| { | |
| 1397 | 1424 | self.stashed_diagnostics.values().find_map(|stashed_diagnostics| { |
| 1398 | stashed_diagnostics.values().find_map(|(_, guar)| *guar) | |
| 1425 | stashed_diagnostics.values().find_map(|(_, guar, _)| *guar) | |
| 1399 | 1426 | }) |
| 1400 | }, | |
| 1401 | ) | |
| 1427 | }) | |
| 1402 | 1428 | } |
| 1403 | 1429 | |
| 1404 | 1430 | fn has_errors_or_delayed_bugs(&self) -> Option<ErrorGuaranteed> { |
compiler/rustc_expand/src/base.rs+4-4| ... | ... | @@ -32,7 +32,7 @@ use rustc_span::{DUMMY_SP, Ident, Span, Symbol, kw}; |
| 32 | 32 | use smallvec::{SmallVec, smallvec}; |
| 33 | 33 | use thin_vec::ThinVec; |
| 34 | 34 | |
| 35 | use crate::errors; | |
| 35 | use crate::diagnostics; | |
| 36 | 36 | use crate::expand::{self, AstFragment, Invocation}; |
| 37 | 37 | use crate::mbe::macro_rules::ParserAnyMacro; |
| 38 | 38 | use crate::module::DirOwnership; |
| ... | ... | @@ -954,7 +954,7 @@ impl SyntaxExtension { |
| 954 | 954 | let stability = find_attr!(attrs, Stability { stability, .. } => *stability); |
| 955 | 955 | |
| 956 | 956 | if let Some(sp) = find_attr!(attrs, RustcBodyStability{ span, .. } => *span) { |
| 957 | sess.dcx().emit_err(errors::MacroBodyStability { | |
| 957 | sess.dcx().emit_err(diagnostics::MacroBodyStability { | |
| 958 | 958 | span: sp, |
| 959 | 959 | head_span: sess.source_map().guess_head_span(span), |
| 960 | 960 | }); |
| ... | ... | @@ -1358,7 +1358,7 @@ impl<'a> ExtCtxt<'a> { |
| 1358 | 1358 | |
| 1359 | 1359 | pub fn trace_macros_diag(&mut self) { |
| 1360 | 1360 | for (span, notes) in self.expansions.iter() { |
| 1361 | let mut db = self.dcx().create_note(errors::TraceMacro { span: *span }); | |
| 1361 | let mut db = self.dcx().create_note(diagnostics::TraceMacro { span: *span }); | |
| 1362 | 1362 | for note in notes { |
| 1363 | 1363 | db.note(note.clone()); |
| 1364 | 1364 | } |
| ... | ... | @@ -1401,7 +1401,7 @@ pub fn resolve_path(sess: &Session, path: impl Into<PathBuf>, span: Span) -> PRe |
| 1401 | 1401 | let callsite = span.source_callsite(); |
| 1402 | 1402 | let source_map = sess.source_map(); |
| 1403 | 1403 | let Some(mut base_path) = source_map.span_to_filename(callsite).into_local_path() else { |
| 1404 | return Err(sess.dcx().create_err(errors::ResolveRelativePath { | |
| 1404 | return Err(sess.dcx().create_err(diagnostics::ResolveRelativePath { | |
| 1405 | 1405 | span, |
| 1406 | 1406 | path: source_map |
| 1407 | 1407 | .filename_for_diagnostics(&source_map.span_to_filename(callsite)) |
compiler/rustc_expand/src/config.rs+2-2| ... | ... | @@ -31,7 +31,7 @@ use rustc_session::errors::feature_err; |
| 31 | 31 | use rustc_span::{STDLIB_STABLE_CRATES, Span, Symbol, sym}; |
| 32 | 32 | use tracing::instrument; |
| 33 | 33 | |
| 34 | use crate::errors::{ | |
| 34 | use crate::diagnostics::{ | |
| 35 | 35 | CrateNameInCfgAttr, CrateTypeInCfgAttr, FeatureNotAllowed, FeatureRemoved, |
| 36 | 36 | FeatureRemovedReason, InvalidCfg, RemoveExprNotSupported, |
| 37 | 37 | }; |
| ... | ... | @@ -282,7 +282,7 @@ impl<'a> StripUnconfigured<'a> { |
| 282 | 282 | rustc_lint_defs::builtin::UNUSED_ATTRIBUTES, |
| 283 | 283 | cfg_attr.span, |
| 284 | 284 | ast::CRATE_NODE_ID, |
| 285 | crate::errors::CfgAttrNoAttributes, | |
| 285 | crate::diagnostics::CfgAttrNoAttributes, | |
| 286 | 286 | ); |
| 287 | 287 | } |
| 288 | 288 |
compiler/rustc_expand/src/diagnostics.rs created+665| ... | ... | @@ -0,0 +1,665 @@ |
| 1 | use std::borrow::Cow; | |
| 2 | ||
| 3 | use rustc_errors::codes::*; | |
| 4 | use rustc_hir::limit::Limit; | |
| 5 | use rustc_macros::{Diagnostic, Subdiagnostic}; | |
| 6 | use rustc_span::{Ident, MacroRulesNormalizedIdent, Span, Symbol}; | |
| 7 | ||
| 8 | #[derive(Diagnostic)] | |
| 9 | #[diag("`#[cfg_attr]` does not expand to any attributes")] | |
| 10 | pub(crate) struct CfgAttrNoAttributes; | |
| 11 | ||
| 12 | #[derive(Diagnostic)] | |
| 13 | #[diag( | |
| 14 | "attempted to repeat an expression containing no syntax variables matched as repeating at this depth" | |
| 15 | )] | |
| 16 | pub(crate) struct NoSyntaxVarsExprRepeat { | |
| 17 | #[primary_span] | |
| 18 | pub span: Span, | |
| 19 | #[subdiagnostic] | |
| 20 | pub typo_repeatable: Option<VarTypoSuggestionRepeatable>, | |
| 21 | #[subdiagnostic] | |
| 22 | pub typo_unrepeatable: Option<VarTypoSuggestionUnrepeatable>, | |
| 23 | #[subdiagnostic] | |
| 24 | pub typo_unrepeatable_label: Option<VarTypoSuggestionUnrepeatableLabel>, | |
| 25 | #[subdiagnostic] | |
| 26 | pub var_no_typo: Option<VarNoTypo>, | |
| 27 | #[subdiagnostic] | |
| 28 | pub no_repeatable_var: Option<NoRepeatableVar>, | |
| 29 | } | |
| 30 | ||
| 31 | #[derive(Subdiagnostic)] | |
| 32 | #[multipart_suggestion( | |
| 33 | "there's a macro metavariable with a similar name", | |
| 34 | applicability = "maybe-incorrect", | |
| 35 | style = "verbose" | |
| 36 | )] | |
| 37 | pub(crate) struct VarTypoSuggestionRepeatable { | |
| 38 | #[suggestion_part(code = "{name}")] | |
| 39 | pub span: Span, | |
| 40 | pub name: Symbol, | |
| 41 | } | |
| 42 | ||
| 43 | #[derive(Subdiagnostic)] | |
| 44 | #[label("argument not found")] | |
| 45 | pub(crate) struct VarTypoSuggestionUnrepeatable { | |
| 46 | #[primary_span] | |
| 47 | pub span: Span, | |
| 48 | } | |
| 49 | ||
| 50 | #[derive(Subdiagnostic)] | |
| 51 | #[label("this similarly named macro metavariable is unrepeatable")] | |
| 52 | pub(crate) struct VarTypoSuggestionUnrepeatableLabel { | |
| 53 | #[primary_span] | |
| 54 | pub span: Span, | |
| 55 | } | |
| 56 | ||
| 57 | #[derive(Subdiagnostic)] | |
| 58 | #[label("expected a repeatable metavariable: {$msg}")] | |
| 59 | pub(crate) struct VarNoTypo { | |
| 60 | #[primary_span] | |
| 61 | pub span: Span, | |
| 62 | pub msg: String, | |
| 63 | } | |
| 64 | ||
| 65 | #[derive(Subdiagnostic)] | |
| 66 | #[label( | |
| 67 | "this macro metavariable is not repeatable and there are no other repeatable metavariables" | |
| 68 | )] | |
| 69 | pub(crate) struct NoRepeatableVar { | |
| 70 | #[primary_span] | |
| 71 | pub span: Span, | |
| 72 | } | |
| 73 | ||
| 74 | #[derive(Diagnostic)] | |
| 75 | #[diag("this must repeat at least once")] | |
| 76 | pub(crate) struct MustRepeatOnce { | |
| 77 | #[primary_span] | |
| 78 | pub span: Span, | |
| 79 | } | |
| 80 | ||
| 81 | #[derive(Diagnostic)] | |
| 82 | #[diag("`count` can not be placed inside the innermost repetition")] | |
| 83 | pub(crate) struct CountRepetitionMisplaced { | |
| 84 | #[primary_span] | |
| 85 | pub span: Span, | |
| 86 | } | |
| 87 | ||
| 88 | #[derive(Diagnostic)] | |
| 89 | #[diag("variable `{$ident}` is still repeating at this depth")] | |
| 90 | pub(crate) struct MacroVarStillRepeating { | |
| 91 | #[primary_span] | |
| 92 | pub span: Span, | |
| 93 | pub ident: MacroRulesNormalizedIdent, | |
| 94 | } | |
| 95 | ||
| 96 | #[derive(Diagnostic)] | |
| 97 | #[diag("variable `{$ident}` is still repeating at this depth")] | |
| 98 | pub(crate) struct MetaVarStillRepeatingLint { | |
| 99 | #[label("expected repetition")] | |
| 100 | pub label: Span, | |
| 101 | pub ident: MacroRulesNormalizedIdent, | |
| 102 | } | |
| 103 | ||
| 104 | #[derive(Diagnostic)] | |
| 105 | #[diag("meta-variable repeats with different Kleene operator")] | |
| 106 | pub(crate) struct MetaVariableWrongOperator { | |
| 107 | #[label("expected repetition")] | |
| 108 | pub binder: Span, | |
| 109 | #[label("conflicting repetition")] | |
| 110 | pub occurrence: Span, | |
| 111 | } | |
| 112 | ||
| 113 | #[derive(Diagnostic)] | |
| 114 | #[diag("{$msg}")] | |
| 115 | pub(crate) struct MetaVarsDifSeqMatchers { | |
| 116 | #[primary_span] | |
| 117 | pub span: Span, | |
| 118 | pub msg: String, | |
| 119 | } | |
| 120 | ||
| 121 | #[derive(Diagnostic)] | |
| 122 | #[diag("unknown macro variable `{$name}`")] | |
| 123 | pub(crate) struct UnknownMacroVariable { | |
| 124 | pub name: MacroRulesNormalizedIdent, | |
| 125 | } | |
| 126 | ||
| 127 | #[derive(Diagnostic)] | |
| 128 | #[diag("cannot resolve relative path in non-file source `{$path}`")] | |
| 129 | pub(crate) struct ResolveRelativePath { | |
| 130 | #[primary_span] | |
| 131 | pub span: Span, | |
| 132 | pub path: String, | |
| 133 | } | |
| 134 | ||
| 135 | #[derive(Diagnostic)] | |
| 136 | #[diag("macros cannot have body stability attributes")] | |
| 137 | pub(crate) struct MacroBodyStability { | |
| 138 | #[primary_span] | |
| 139 | #[label("invalid body stability attribute")] | |
| 140 | pub span: Span, | |
| 141 | #[label("body stability attribute affects this macro")] | |
| 142 | pub head_span: Span, | |
| 143 | } | |
| 144 | ||
| 145 | #[derive(Diagnostic)] | |
| 146 | #[diag("feature has been removed", code = E0557)] | |
| 147 | #[note("removed in {$removed_rustc_version}{$pull_note}")] | |
| 148 | pub(crate) struct FeatureRemoved<'a> { | |
| 149 | #[primary_span] | |
| 150 | #[label("feature has been removed")] | |
| 151 | pub span: Span, | |
| 152 | #[subdiagnostic] | |
| 153 | pub reason: Option<FeatureRemovedReason<'a>>, | |
| 154 | pub removed_rustc_version: &'a str, | |
| 155 | pub pull_note: String, | |
| 156 | } | |
| 157 | ||
| 158 | #[derive(Subdiagnostic)] | |
| 159 | #[note("{$reason}")] | |
| 160 | pub(crate) struct FeatureRemovedReason<'a> { | |
| 161 | pub reason: &'a str, | |
| 162 | } | |
| 163 | ||
| 164 | #[derive(Diagnostic)] | |
| 165 | #[diag("the feature `{$name}` is not in the list of allowed features", code = E0725)] | |
| 166 | pub(crate) struct FeatureNotAllowed { | |
| 167 | #[primary_span] | |
| 168 | pub span: Span, | |
| 169 | pub name: Symbol, | |
| 170 | } | |
| 171 | ||
| 172 | #[derive(Diagnostic)] | |
| 173 | #[diag("recursion limit reached while expanding `{$descr}`")] | |
| 174 | #[help( | |
| 175 | "consider increasing the recursion limit by adding a `#![recursion_limit = \"{$suggested_limit}\"]` attribute to your crate (`{$crate_name}`)" | |
| 176 | )] | |
| 177 | pub(crate) struct RecursionLimitReached { | |
| 178 | #[primary_span] | |
| 179 | pub span: Span, | |
| 180 | pub descr: String, | |
| 181 | pub suggested_limit: Limit, | |
| 182 | pub crate_name: Symbol, | |
| 183 | } | |
| 184 | ||
| 185 | #[derive(Diagnostic)] | |
| 186 | #[diag("removing an expression is not supported in this position")] | |
| 187 | pub(crate) struct RemoveExprNotSupported { | |
| 188 | #[primary_span] | |
| 189 | pub span: Span, | |
| 190 | } | |
| 191 | ||
| 192 | #[derive(Diagnostic)] | |
| 193 | pub(crate) enum InvalidCfg { | |
| 194 | #[diag("`cfg` is not followed by parentheses")] | |
| 195 | NotFollowedByParens { | |
| 196 | #[primary_span] | |
| 197 | #[suggestion( | |
| 198 | "expected syntax is", | |
| 199 | code = "cfg(/* predicate */)", | |
| 200 | applicability = "has-placeholders" | |
| 201 | )] | |
| 202 | span: Span, | |
| 203 | }, | |
| 204 | #[diag("`cfg` predicate is not specified")] | |
| 205 | NoPredicate { | |
| 206 | #[primary_span] | |
| 207 | #[suggestion( | |
| 208 | "expected syntax is", | |
| 209 | code = "cfg(/* predicate */)", | |
| 210 | applicability = "has-placeholders" | |
| 211 | )] | |
| 212 | span: Span, | |
| 213 | }, | |
| 214 | #[diag("multiple `cfg` predicates are specified")] | |
| 215 | MultiplePredicates { | |
| 216 | #[primary_span] | |
| 217 | span: Span, | |
| 218 | }, | |
| 219 | #[diag("`cfg` predicate key cannot be a literal")] | |
| 220 | PredicateLiteral { | |
| 221 | #[primary_span] | |
| 222 | span: Span, | |
| 223 | }, | |
| 224 | } | |
| 225 | ||
| 226 | #[derive(Diagnostic)] | |
| 227 | #[diag("non-{$kind} macro in {$kind} position: {$name}")] | |
| 228 | pub(crate) struct WrongFragmentKind<'a> { | |
| 229 | #[primary_span] | |
| 230 | pub span: Span, | |
| 231 | pub kind: &'a str, | |
| 232 | pub name: String, | |
| 233 | } | |
| 234 | ||
| 235 | #[derive(Diagnostic)] | |
| 236 | #[diag("key-value macro attributes are not supported")] | |
| 237 | pub(crate) struct UnsupportedKeyValue { | |
| 238 | #[primary_span] | |
| 239 | pub span: Span, | |
| 240 | } | |
| 241 | ||
| 242 | #[derive(Diagnostic)] | |
| 243 | #[diag("macro expansion ignores {$descr} and any tokens following")] | |
| 244 | #[note("the usage of `{$macro_path}!` is likely invalid in {$kind_name} context")] | |
| 245 | pub(crate) struct IncompleteParse<'a> { | |
| 246 | #[primary_span] | |
| 247 | pub span: Span, | |
| 248 | pub descr: String, | |
| 249 | #[label("caused by the macro expansion here")] | |
| 250 | pub label_span: Span, | |
| 251 | pub macro_path: String, | |
| 252 | pub kind_name: &'a str, | |
| 253 | #[note("macros cannot expand to match arms")] | |
| 254 | pub expands_to_match_arm: bool, | |
| 255 | ||
| 256 | #[suggestion( | |
| 257 | "you might be missing a semicolon here", | |
| 258 | style = "verbose", | |
| 259 | code = ";", | |
| 260 | applicability = "maybe-incorrect" | |
| 261 | )] | |
| 262 | pub add_semicolon: Option<Span>, | |
| 263 | } | |
| 264 | ||
| 265 | #[derive(Diagnostic)] | |
| 266 | #[diag("removing {$descr} is not supported in this position")] | |
| 267 | pub(crate) struct RemoveNodeNotSupported { | |
| 268 | #[primary_span] | |
| 269 | pub span: Span, | |
| 270 | pub descr: &'static str, | |
| 271 | } | |
| 272 | ||
| 273 | #[derive(Diagnostic)] | |
| 274 | #[diag("circular modules: {$modules}")] | |
| 275 | pub(crate) struct ModuleCircular { | |
| 276 | #[primary_span] | |
| 277 | pub span: Span, | |
| 278 | pub modules: String, | |
| 279 | } | |
| 280 | ||
| 281 | #[derive(Diagnostic)] | |
| 282 | #[diag("cannot declare a file module inside a block unless it has a path attribute")] | |
| 283 | #[note("file modules are usually placed outside of blocks, at the top level of the file")] | |
| 284 | pub(crate) struct ModuleInBlock { | |
| 285 | #[primary_span] | |
| 286 | pub span: Span, | |
| 287 | #[subdiagnostic] | |
| 288 | pub name: Option<ModuleInBlockName>, | |
| 289 | } | |
| 290 | ||
| 291 | #[derive(Subdiagnostic)] | |
| 292 | #[help("maybe `use` the module `{$name}` instead of redeclaring it")] | |
| 293 | pub(crate) struct ModuleInBlockName { | |
| 294 | #[primary_span] | |
| 295 | pub span: Span, | |
| 296 | pub name: Ident, | |
| 297 | } | |
| 298 | ||
| 299 | #[derive(Diagnostic)] | |
| 300 | #[diag("file not found for module `{$name}`", code = E0583)] | |
| 301 | #[help("to create the module `{$name}`, create file \"{$default_path}\" or \"{$secondary_path}\"")] | |
| 302 | #[note( | |
| 303 | "if there is a `mod {$name}` elsewhere in the crate already, import it with `use crate::...` instead" | |
| 304 | )] | |
| 305 | pub(crate) struct ModuleFileNotFound { | |
| 306 | #[primary_span] | |
| 307 | pub span: Span, | |
| 308 | pub name: Ident, | |
| 309 | pub default_path: String, | |
| 310 | pub secondary_path: String, | |
| 311 | } | |
| 312 | ||
| 313 | #[derive(Diagnostic)] | |
| 314 | #[diag("file for module `{$name}` found at both \"{$default_path}\" and \"{$secondary_path}\"", code = E0761)] | |
| 315 | #[help("delete or rename one of them to remove the ambiguity")] | |
| 316 | pub(crate) struct ModuleMultipleCandidates { | |
| 317 | #[primary_span] | |
| 318 | pub span: Span, | |
| 319 | pub name: Ident, | |
| 320 | pub default_path: String, | |
| 321 | pub secondary_path: String, | |
| 322 | } | |
| 323 | ||
| 324 | #[derive(Diagnostic)] | |
| 325 | #[diag("trace_macro")] | |
| 326 | pub(crate) struct TraceMacro { | |
| 327 | #[primary_span] | |
| 328 | pub span: Span, | |
| 329 | } | |
| 330 | ||
| 331 | #[derive(Diagnostic)] | |
| 332 | #[diag("proc macro panicked")] | |
| 333 | pub(crate) struct ProcMacroPanicked { | |
| 334 | #[primary_span] | |
| 335 | pub span: Span, | |
| 336 | #[subdiagnostic] | |
| 337 | pub message: Option<ProcMacroPanickedHelp>, | |
| 338 | } | |
| 339 | ||
| 340 | #[derive(Subdiagnostic)] | |
| 341 | #[help("message: {$message}")] | |
| 342 | pub(crate) struct ProcMacroPanickedHelp { | |
| 343 | pub message: String, | |
| 344 | } | |
| 345 | ||
| 346 | #[derive(Diagnostic)] | |
| 347 | #[diag("proc-macro derive panicked")] | |
| 348 | pub(crate) struct ProcMacroDerivePanicked { | |
| 349 | #[primary_span] | |
| 350 | pub span: Span, | |
| 351 | #[subdiagnostic] | |
| 352 | pub message: Option<ProcMacroDerivePanickedHelp>, | |
| 353 | } | |
| 354 | ||
| 355 | #[derive(Subdiagnostic)] | |
| 356 | #[help("message: {$message}")] | |
| 357 | pub(crate) struct ProcMacroDerivePanickedHelp { | |
| 358 | pub message: String, | |
| 359 | } | |
| 360 | ||
| 361 | #[derive(Diagnostic)] | |
| 362 | #[diag("custom attribute panicked")] | |
| 363 | pub(crate) struct CustomAttributePanicked { | |
| 364 | #[primary_span] | |
| 365 | pub span: Span, | |
| 366 | #[subdiagnostic] | |
| 367 | pub message: Option<CustomAttributePanickedHelp>, | |
| 368 | } | |
| 369 | ||
| 370 | #[derive(Subdiagnostic)] | |
| 371 | #[help("message: {$message}")] | |
| 372 | pub(crate) struct CustomAttributePanickedHelp { | |
| 373 | pub message: String, | |
| 374 | } | |
| 375 | ||
| 376 | #[derive(Diagnostic)] | |
| 377 | #[diag("proc-macro derive produced unparsable tokens")] | |
| 378 | pub(crate) struct ProcMacroDeriveTokens { | |
| 379 | #[primary_span] | |
| 380 | pub span: Span, | |
| 381 | } | |
| 382 | ||
| 383 | #[derive(Diagnostic)] | |
| 384 | #[diag("duplicate matcher binding")] | |
| 385 | pub(crate) struct DuplicateMatcherBinding { | |
| 386 | #[primary_span] | |
| 387 | #[label("duplicate binding")] | |
| 388 | pub span: Span, | |
| 389 | #[label("previous binding")] | |
| 390 | pub prev: Span, | |
| 391 | } | |
| 392 | ||
| 393 | #[derive(Diagnostic)] | |
| 394 | #[diag("duplicate matcher binding")] | |
| 395 | pub(crate) struct DuplicateMatcherBindingLint { | |
| 396 | #[label("duplicate binding")] | |
| 397 | pub span: Span, | |
| 398 | #[label("previous binding")] | |
| 399 | pub prev: Span, | |
| 400 | } | |
| 401 | ||
| 402 | #[derive(Diagnostic)] | |
| 403 | #[diag("missing fragment specifier")] | |
| 404 | #[note("fragment specifiers must be provided")] | |
| 405 | #[help("{$valid}")] | |
| 406 | pub(crate) struct MissingFragmentSpecifier { | |
| 407 | #[primary_span] | |
| 408 | pub span: Span, | |
| 409 | #[suggestion( | |
| 410 | "try adding a specifier here", | |
| 411 | style = "verbose", | |
| 412 | code = ":spec", | |
| 413 | applicability = "maybe-incorrect" | |
| 414 | )] | |
| 415 | pub add_span: Span, | |
| 416 | pub valid: &'static str, | |
| 417 | } | |
| 418 | ||
| 419 | #[derive(Diagnostic)] | |
| 420 | #[diag("invalid fragment specifier `{$fragment}`")] | |
| 421 | #[help("{$help}")] | |
| 422 | pub(crate) struct InvalidFragmentSpecifier { | |
| 423 | #[primary_span] | |
| 424 | pub span: Span, | |
| 425 | pub fragment: Ident, | |
| 426 | pub help: &'static str, | |
| 427 | } | |
| 428 | ||
| 429 | #[derive(Diagnostic)] | |
| 430 | #[diag("expected `(` or `{\"{\"}`, found `{$token}`")] | |
| 431 | pub(crate) struct ExpectedParenOrBrace<'a> { | |
| 432 | #[primary_span] | |
| 433 | pub span: Span, | |
| 434 | pub token: Cow<'a, str>, | |
| 435 | } | |
| 436 | ||
| 437 | #[derive(Diagnostic)] | |
| 438 | #[diag("empty {$kind} delegation is not supported")] | |
| 439 | pub(crate) struct EmptyDelegationMac { | |
| 440 | #[primary_span] | |
| 441 | pub span: Span, | |
| 442 | pub kind: String, | |
| 443 | } | |
| 444 | ||
| 445 | #[derive(Diagnostic)] | |
| 446 | #[diag("glob delegation is only supported in impls")] | |
| 447 | pub(crate) struct GlobDelegationOutsideImpls { | |
| 448 | #[primary_span] | |
| 449 | pub span: Span, | |
| 450 | } | |
| 451 | ||
| 452 | #[derive(Diagnostic)] | |
| 453 | #[diag("`crate_name` within an `#![cfg_attr]` attribute is forbidden")] | |
| 454 | pub(crate) struct CrateNameInCfgAttr { | |
| 455 | #[primary_span] | |
| 456 | pub span: Span, | |
| 457 | } | |
| 458 | ||
| 459 | #[derive(Diagnostic)] | |
| 460 | #[diag("`crate_type` within an `#![cfg_attr]` attribute is forbidden")] | |
| 461 | pub(crate) struct CrateTypeInCfgAttr { | |
| 462 | #[primary_span] | |
| 463 | pub span: Span, | |
| 464 | } | |
| 465 | ||
| 466 | #[derive(Diagnostic)] | |
| 467 | #[diag("qualified path without a trait in glob delegation")] | |
| 468 | pub(crate) struct GlobDelegationTraitlessQpath { | |
| 469 | #[primary_span] | |
| 470 | pub span: Span, | |
| 471 | } | |
| 472 | ||
| 473 | pub(crate) use metavar_exprs::*; | |
| 474 | mod metavar_exprs { | |
| 475 | use super::*; | |
| 476 | ||
| 477 | #[derive(Diagnostic, Default)] | |
| 478 | #[diag("unexpected trailing tokens")] | |
| 479 | pub(crate) struct MveExtraTokens { | |
| 480 | #[primary_span] | |
| 481 | #[suggestion( | |
| 482 | "try removing {$extra_count -> | |
| 483 | [one] this token | |
| 484 | *[other] these tokens | |
| 485 | }", | |
| 486 | code = "", | |
| 487 | applicability = "machine-applicable" | |
| 488 | )] | |
| 489 | pub span: Span, | |
| 490 | #[label("for this metavariable expression")] | |
| 491 | pub ident_span: Span, | |
| 492 | pub extra_count: usize, | |
| 493 | ||
| 494 | // The rest is only used for specific diagnostics and can be default if neither | |
| 495 | // `note` is `Some`. | |
| 496 | #[note( | |
| 497 | "the `{$name}` metavariable expression takes {$min_or_exact_args -> | |
| 498 | [zero] no arguments | |
| 499 | [one] a single argument | |
| 500 | *[other] {$min_or_exact_args} arguments | |
| 501 | }" | |
| 502 | )] | |
| 503 | pub exact_args_note: Option<()>, | |
| 504 | #[note( | |
| 505 | "the `{$name}` metavariable expression takes between {$min_or_exact_args} and {$max_args} arguments" | |
| 506 | )] | |
| 507 | pub range_args_note: Option<()>, | |
| 508 | pub min_or_exact_args: usize, | |
| 509 | pub max_args: usize, | |
| 510 | pub name: String, | |
| 511 | } | |
| 512 | ||
| 513 | #[derive(Diagnostic)] | |
| 514 | #[note("metavariable expressions use function-like parentheses syntax")] | |
| 515 | #[diag("expected `(`")] | |
| 516 | pub(crate) struct MveMissingParen { | |
| 517 | #[primary_span] | |
| 518 | #[label("for this this metavariable expression")] | |
| 519 | pub ident_span: Span, | |
| 520 | #[label("unexpected token")] | |
| 521 | pub unexpected_span: Option<Span>, | |
| 522 | #[suggestion( | |
| 523 | "try adding parentheses", | |
| 524 | code = "( /* ... */ )", | |
| 525 | applicability = "has-placeholders" | |
| 526 | )] | |
| 527 | pub insert_span: Option<Span>, | |
| 528 | } | |
| 529 | ||
| 530 | #[derive(Diagnostic)] | |
| 531 | #[note("valid metavariable expressions are {$valid_expr_list}")] | |
| 532 | #[diag("unrecognized metavariable expression")] | |
| 533 | pub(crate) struct MveUnrecognizedExpr { | |
| 534 | #[primary_span] | |
| 535 | #[label("not a valid metavariable expression")] | |
| 536 | pub span: Span, | |
| 537 | pub valid_expr_list: &'static str, | |
| 538 | } | |
| 539 | ||
| 540 | #[derive(Diagnostic)] | |
| 541 | #[diag("variable `{$key}` is not recognized in meta-variable expression")] | |
| 542 | pub(crate) struct MveUnrecognizedVar { | |
| 543 | #[primary_span] | |
| 544 | pub span: Span, | |
| 545 | pub key: MacroRulesNormalizedIdent, | |
| 546 | } | |
| 547 | ||
| 548 | #[derive(Diagnostic)] | |
| 549 | #[diag(r#"`${"{"}concat(..){"}"}` is not generating a valid identifier"#)] | |
| 550 | pub(crate) struct ConcatInvalidIdent { | |
| 551 | #[primary_span] | |
| 552 | pub span: Span, | |
| 553 | #[subdiagnostic] | |
| 554 | pub reason: InvalidIdentReason, | |
| 555 | } | |
| 556 | ||
| 557 | #[derive(Subdiagnostic)] | |
| 558 | pub(crate) enum InvalidIdentReason { | |
| 559 | #[note(r#"this `${"{"}concat(..){"}"}` invocation generated an empty ident"#)] | |
| 560 | Empty, | |
| 561 | #[note(r#"this `${"{"}concat(..){"}"}` invocation generated `{$symbol}`, but {$start} is neither '_' nor XID_Start"#)] | |
| 562 | #[note( | |
| 563 | "see <https://doc.rust-lang.org/reference/identifiers.html> for the definition of valid identifiers" | |
| 564 | )] | |
| 565 | InvalidStart { symbol: Symbol, start: char }, | |
| 566 | #[note(r#"this `${"{"}concat(..){"}"}` invocation generated `{$symbol}`, but {$not_continue} is not XID_Continue"#)] | |
| 567 | #[note( | |
| 568 | "see <https://doc.rust-lang.org/reference/identifiers.html> for the definition of valid identifiers" | |
| 569 | )] | |
| 570 | InvalidContinue { symbol: Symbol, not_continue: char }, | |
| 571 | } | |
| 572 | ||
| 573 | impl InvalidIdentReason { | |
| 574 | pub(crate) fn new(symbol: Symbol) -> Self { | |
| 575 | let mut chars = symbol.as_str().chars(); | |
| 576 | if let Some(start) = chars.next() { | |
| 577 | if rustc_lexer::is_id_start(start) { | |
| 578 | let not_continue = chars | |
| 579 | .find(|c| !rustc_lexer::is_id_continue(*c)) | |
| 580 | .expect("InvalidIdentReason: cannot find invalid ident reason"); | |
| 581 | InvalidIdentReason::InvalidContinue { symbol, not_continue } | |
| 582 | } else { | |
| 583 | InvalidIdentReason::InvalidStart { symbol, start } | |
| 584 | } | |
| 585 | } else { | |
| 586 | InvalidIdentReason::Empty | |
| 587 | } | |
| 588 | } | |
| 589 | } | |
| 590 | } | |
| 591 | ||
| 592 | #[derive(Diagnostic)] | |
| 593 | #[diag("`{$rule_kw}` rule argument matchers require parentheses")] | |
| 594 | pub(crate) struct MacroArgsBadDelim { | |
| 595 | #[primary_span] | |
| 596 | pub span: Span, | |
| 597 | #[subdiagnostic] | |
| 598 | pub sugg: MacroArgsBadDelimSugg, | |
| 599 | pub rule_kw: Symbol, | |
| 600 | } | |
| 601 | ||
| 602 | #[derive(Subdiagnostic)] | |
| 603 | #[multipart_suggestion( | |
| 604 | "the delimiters should be `(` and `)`", | |
| 605 | applicability = "machine-applicable" | |
| 606 | )] | |
| 607 | pub(crate) struct MacroArgsBadDelimSugg { | |
| 608 | #[suggestion_part(code = "(")] | |
| 609 | pub open: Span, | |
| 610 | #[suggestion_part(code = ")")] | |
| 611 | pub close: Span, | |
| 612 | } | |
| 613 | ||
| 614 | #[derive(Diagnostic)] | |
| 615 | #[diag("unused doc comment")] | |
| 616 | #[help( | |
| 617 | "to document an item produced by a macro, the macro must produce the documentation as part of its expansion" | |
| 618 | )] | |
| 619 | pub(crate) struct MacroCallUnusedDocComment { | |
| 620 | #[label("rustdoc does not generate documentation for macro invocations")] | |
| 621 | pub span: Span, | |
| 622 | } | |
| 623 | ||
| 624 | #[derive(Diagnostic)] | |
| 625 | #[diag( | |
| 626 | "the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro" | |
| 627 | )] | |
| 628 | pub(crate) struct OrPatternsBackCompat { | |
| 629 | #[suggestion( | |
| 630 | "use pat_param to preserve semantics", | |
| 631 | code = "{suggestion}", | |
| 632 | applicability = "machine-applicable" | |
| 633 | )] | |
| 634 | pub span: Span, | |
| 635 | pub suggestion: String, | |
| 636 | } | |
| 637 | ||
| 638 | #[derive(Diagnostic)] | |
| 639 | #[diag("trailing semicolon in macro used in expression position")] | |
| 640 | pub(crate) struct TrailingMacro { | |
| 641 | #[note("macro invocations at the end of a block are treated as expressions")] | |
| 642 | #[note( | |
| 643 | "to ignore the value produced by the macro, add a semicolon after the invocation of `{$name}`" | |
| 644 | )] | |
| 645 | pub is_trailing: bool, | |
| 646 | pub name: Ident, | |
| 647 | } | |
| 648 | ||
| 649 | #[derive(Diagnostic)] | |
| 650 | #[diag("unused attribute `{$attr_name}`")] | |
| 651 | pub(crate) struct UnusedBuiltinAttribute { | |
| 652 | #[note( | |
| 653 | "the built-in attribute `{$attr_name}` will be ignored, since it's applied to the macro invocation `{$macro_name}`" | |
| 654 | )] | |
| 655 | pub invoc_span: Span, | |
| 656 | pub attr_name: Symbol, | |
| 657 | pub macro_name: String, | |
| 658 | #[suggestion( | |
| 659 | "remove the attribute", | |
| 660 | code = "", | |
| 661 | applicability = "machine-applicable", | |
| 662 | style = "tool-only" | |
| 663 | )] | |
| 664 | pub attr_span: Span, | |
| 665 | } |
compiler/rustc_expand/src/errors.rs deleted-665| ... | ... | @@ -1,665 +0,0 @@ |
| 1 | use std::borrow::Cow; | |
| 2 | ||
| 3 | use rustc_errors::codes::*; | |
| 4 | use rustc_hir::limit::Limit; | |
| 5 | use rustc_macros::{Diagnostic, Subdiagnostic}; | |
| 6 | use rustc_span::{Ident, MacroRulesNormalizedIdent, Span, Symbol}; | |
| 7 | ||
| 8 | #[derive(Diagnostic)] | |
| 9 | #[diag("`#[cfg_attr]` does not expand to any attributes")] | |
| 10 | pub(crate) struct CfgAttrNoAttributes; | |
| 11 | ||
| 12 | #[derive(Diagnostic)] | |
| 13 | #[diag( | |
| 14 | "attempted to repeat an expression containing no syntax variables matched as repeating at this depth" | |
| 15 | )] | |
| 16 | pub(crate) struct NoSyntaxVarsExprRepeat { | |
| 17 | #[primary_span] | |
| 18 | pub span: Span, | |
| 19 | #[subdiagnostic] | |
| 20 | pub typo_repeatable: Option<VarTypoSuggestionRepeatable>, | |
| 21 | #[subdiagnostic] | |
| 22 | pub typo_unrepeatable: Option<VarTypoSuggestionUnrepeatable>, | |
| 23 | #[subdiagnostic] | |
| 24 | pub typo_unrepeatable_label: Option<VarTypoSuggestionUnrepeatableLabel>, | |
| 25 | #[subdiagnostic] | |
| 26 | pub var_no_typo: Option<VarNoTypo>, | |
| 27 | #[subdiagnostic] | |
| 28 | pub no_repeatable_var: Option<NoRepeatableVar>, | |
| 29 | } | |
| 30 | ||
| 31 | #[derive(Subdiagnostic)] | |
| 32 | #[multipart_suggestion( | |
| 33 | "there's a macro metavariable with a similar name", | |
| 34 | applicability = "maybe-incorrect", | |
| 35 | style = "verbose" | |
| 36 | )] | |
| 37 | pub(crate) struct VarTypoSuggestionRepeatable { | |
| 38 | #[suggestion_part(code = "{name}")] | |
| 39 | pub span: Span, | |
| 40 | pub name: Symbol, | |
| 41 | } | |
| 42 | ||
| 43 | #[derive(Subdiagnostic)] | |
| 44 | #[label("argument not found")] | |
| 45 | pub(crate) struct VarTypoSuggestionUnrepeatable { | |
| 46 | #[primary_span] | |
| 47 | pub span: Span, | |
| 48 | } | |
| 49 | ||
| 50 | #[derive(Subdiagnostic)] | |
| 51 | #[label("this similarly named macro metavariable is unrepeatable")] | |
| 52 | pub(crate) struct VarTypoSuggestionUnrepeatableLabel { | |
| 53 | #[primary_span] | |
| 54 | pub span: Span, | |
| 55 | } | |
| 56 | ||
| 57 | #[derive(Subdiagnostic)] | |
| 58 | #[label("expected a repeatable metavariable: {$msg}")] | |
| 59 | pub(crate) struct VarNoTypo { | |
| 60 | #[primary_span] | |
| 61 | pub span: Span, | |
| 62 | pub msg: String, | |
| 63 | } | |
| 64 | ||
| 65 | #[derive(Subdiagnostic)] | |
| 66 | #[label( | |
| 67 | "this macro metavariable is not repeatable and there are no other repeatable metavariables" | |
| 68 | )] | |
| 69 | pub(crate) struct NoRepeatableVar { | |
| 70 | #[primary_span] | |
| 71 | pub span: Span, | |
| 72 | } | |
| 73 | ||
| 74 | #[derive(Diagnostic)] | |
| 75 | #[diag("this must repeat at least once")] | |
| 76 | pub(crate) struct MustRepeatOnce { | |
| 77 | #[primary_span] | |
| 78 | pub span: Span, | |
| 79 | } | |
| 80 | ||
| 81 | #[derive(Diagnostic)] | |
| 82 | #[diag("`count` can not be placed inside the innermost repetition")] | |
| 83 | pub(crate) struct CountRepetitionMisplaced { | |
| 84 | #[primary_span] | |
| 85 | pub span: Span, | |
| 86 | } | |
| 87 | ||
| 88 | #[derive(Diagnostic)] | |
| 89 | #[diag("variable `{$ident}` is still repeating at this depth")] | |
| 90 | pub(crate) struct MacroVarStillRepeating { | |
| 91 | #[primary_span] | |
| 92 | pub span: Span, | |
| 93 | pub ident: MacroRulesNormalizedIdent, | |
| 94 | } | |
| 95 | ||
| 96 | #[derive(Diagnostic)] | |
| 97 | #[diag("variable `{$ident}` is still repeating at this depth")] | |
| 98 | pub(crate) struct MetaVarStillRepeatingLint { | |
| 99 | #[label("expected repetition")] | |
| 100 | pub label: Span, | |
| 101 | pub ident: MacroRulesNormalizedIdent, | |
| 102 | } | |
| 103 | ||
| 104 | #[derive(Diagnostic)] | |
| 105 | #[diag("meta-variable repeats with different Kleene operator")] | |
| 106 | pub(crate) struct MetaVariableWrongOperator { | |
| 107 | #[label("expected repetition")] | |
| 108 | pub binder: Span, | |
| 109 | #[label("conflicting repetition")] | |
| 110 | pub occurrence: Span, | |
| 111 | } | |
| 112 | ||
| 113 | #[derive(Diagnostic)] | |
| 114 | #[diag("{$msg}")] | |
| 115 | pub(crate) struct MetaVarsDifSeqMatchers { | |
| 116 | #[primary_span] | |
| 117 | pub span: Span, | |
| 118 | pub msg: String, | |
| 119 | } | |
| 120 | ||
| 121 | #[derive(Diagnostic)] | |
| 122 | #[diag("unknown macro variable `{$name}`")] | |
| 123 | pub(crate) struct UnknownMacroVariable { | |
| 124 | pub name: MacroRulesNormalizedIdent, | |
| 125 | } | |
| 126 | ||
| 127 | #[derive(Diagnostic)] | |
| 128 | #[diag("cannot resolve relative path in non-file source `{$path}`")] | |
| 129 | pub(crate) struct ResolveRelativePath { | |
| 130 | #[primary_span] | |
| 131 | pub span: Span, | |
| 132 | pub path: String, | |
| 133 | } | |
| 134 | ||
| 135 | #[derive(Diagnostic)] | |
| 136 | #[diag("macros cannot have body stability attributes")] | |
| 137 | pub(crate) struct MacroBodyStability { | |
| 138 | #[primary_span] | |
| 139 | #[label("invalid body stability attribute")] | |
| 140 | pub span: Span, | |
| 141 | #[label("body stability attribute affects this macro")] | |
| 142 | pub head_span: Span, | |
| 143 | } | |
| 144 | ||
| 145 | #[derive(Diagnostic)] | |
| 146 | #[diag("feature has been removed", code = E0557)] | |
| 147 | #[note("removed in {$removed_rustc_version}{$pull_note}")] | |
| 148 | pub(crate) struct FeatureRemoved<'a> { | |
| 149 | #[primary_span] | |
| 150 | #[label("feature has been removed")] | |
| 151 | pub span: Span, | |
| 152 | #[subdiagnostic] | |
| 153 | pub reason: Option<FeatureRemovedReason<'a>>, | |
| 154 | pub removed_rustc_version: &'a str, | |
| 155 | pub pull_note: String, | |
| 156 | } | |
| 157 | ||
| 158 | #[derive(Subdiagnostic)] | |
| 159 | #[note("{$reason}")] | |
| 160 | pub(crate) struct FeatureRemovedReason<'a> { | |
| 161 | pub reason: &'a str, | |
| 162 | } | |
| 163 | ||
| 164 | #[derive(Diagnostic)] | |
| 165 | #[diag("the feature `{$name}` is not in the list of allowed features", code = E0725)] | |
| 166 | pub(crate) struct FeatureNotAllowed { | |
| 167 | #[primary_span] | |
| 168 | pub span: Span, | |
| 169 | pub name: Symbol, | |
| 170 | } | |
| 171 | ||
| 172 | #[derive(Diagnostic)] | |
| 173 | #[diag("recursion limit reached while expanding `{$descr}`")] | |
| 174 | #[help( | |
| 175 | "consider increasing the recursion limit by adding a `#![recursion_limit = \"{$suggested_limit}\"]` attribute to your crate (`{$crate_name}`)" | |
| 176 | )] | |
| 177 | pub(crate) struct RecursionLimitReached { | |
| 178 | #[primary_span] | |
| 179 | pub span: Span, | |
| 180 | pub descr: String, | |
| 181 | pub suggested_limit: Limit, | |
| 182 | pub crate_name: Symbol, | |
| 183 | } | |
| 184 | ||
| 185 | #[derive(Diagnostic)] | |
| 186 | #[diag("removing an expression is not supported in this position")] | |
| 187 | pub(crate) struct RemoveExprNotSupported { | |
| 188 | #[primary_span] | |
| 189 | pub span: Span, | |
| 190 | } | |
| 191 | ||
| 192 | #[derive(Diagnostic)] | |
| 193 | pub(crate) enum InvalidCfg { | |
| 194 | #[diag("`cfg` is not followed by parentheses")] | |
| 195 | NotFollowedByParens { | |
| 196 | #[primary_span] | |
| 197 | #[suggestion( | |
| 198 | "expected syntax is", | |
| 199 | code = "cfg(/* predicate */)", | |
| 200 | applicability = "has-placeholders" | |
| 201 | )] | |
| 202 | span: Span, | |
| 203 | }, | |
| 204 | #[diag("`cfg` predicate is not specified")] | |
| 205 | NoPredicate { | |
| 206 | #[primary_span] | |
| 207 | #[suggestion( | |
| 208 | "expected syntax is", | |
| 209 | code = "cfg(/* predicate */)", | |
| 210 | applicability = "has-placeholders" | |
| 211 | )] | |
| 212 | span: Span, | |
| 213 | }, | |
| 214 | #[diag("multiple `cfg` predicates are specified")] | |
| 215 | MultiplePredicates { | |
| 216 | #[primary_span] | |
| 217 | span: Span, | |
| 218 | }, | |
| 219 | #[diag("`cfg` predicate key cannot be a literal")] | |
| 220 | PredicateLiteral { | |
| 221 | #[primary_span] | |
| 222 | span: Span, | |
| 223 | }, | |
| 224 | } | |
| 225 | ||
| 226 | #[derive(Diagnostic)] | |
| 227 | #[diag("non-{$kind} macro in {$kind} position: {$name}")] | |
| 228 | pub(crate) struct WrongFragmentKind<'a> { | |
| 229 | #[primary_span] | |
| 230 | pub span: Span, | |
| 231 | pub kind: &'a str, | |
| 232 | pub name: String, | |
| 233 | } | |
| 234 | ||
| 235 | #[derive(Diagnostic)] | |
| 236 | #[diag("key-value macro attributes are not supported")] | |
| 237 | pub(crate) struct UnsupportedKeyValue { | |
| 238 | #[primary_span] | |
| 239 | pub span: Span, | |
| 240 | } | |
| 241 | ||
| 242 | #[derive(Diagnostic)] | |
| 243 | #[diag("macro expansion ignores {$descr} and any tokens following")] | |
| 244 | #[note("the usage of `{$macro_path}!` is likely invalid in {$kind_name} context")] | |
| 245 | pub(crate) struct IncompleteParse<'a> { | |
| 246 | #[primary_span] | |
| 247 | pub span: Span, | |
| 248 | pub descr: String, | |
| 249 | #[label("caused by the macro expansion here")] | |
| 250 | pub label_span: Span, | |
| 251 | pub macro_path: String, | |
| 252 | pub kind_name: &'a str, | |
| 253 | #[note("macros cannot expand to match arms")] | |
| 254 | pub expands_to_match_arm: bool, | |
| 255 | ||
| 256 | #[suggestion( | |
| 257 | "you might be missing a semicolon here", | |
| 258 | style = "verbose", | |
| 259 | code = ";", | |
| 260 | applicability = "maybe-incorrect" | |
| 261 | )] | |
| 262 | pub add_semicolon: Option<Span>, | |
| 263 | } | |
| 264 | ||
| 265 | #[derive(Diagnostic)] | |
| 266 | #[diag("removing {$descr} is not supported in this position")] | |
| 267 | pub(crate) struct RemoveNodeNotSupported { | |
| 268 | #[primary_span] | |
| 269 | pub span: Span, | |
| 270 | pub descr: &'static str, | |
| 271 | } | |
| 272 | ||
| 273 | #[derive(Diagnostic)] | |
| 274 | #[diag("circular modules: {$modules}")] | |
| 275 | pub(crate) struct ModuleCircular { | |
| 276 | #[primary_span] | |
| 277 | pub span: Span, | |
| 278 | pub modules: String, | |
| 279 | } | |
| 280 | ||
| 281 | #[derive(Diagnostic)] | |
| 282 | #[diag("cannot declare a file module inside a block unless it has a path attribute")] | |
| 283 | #[note("file modules are usually placed outside of blocks, at the top level of the file")] | |
| 284 | pub(crate) struct ModuleInBlock { | |
| 285 | #[primary_span] | |
| 286 | pub span: Span, | |
| 287 | #[subdiagnostic] | |
| 288 | pub name: Option<ModuleInBlockName>, | |
| 289 | } | |
| 290 | ||
| 291 | #[derive(Subdiagnostic)] | |
| 292 | #[help("maybe `use` the module `{$name}` instead of redeclaring it")] | |
| 293 | pub(crate) struct ModuleInBlockName { | |
| 294 | #[primary_span] | |
| 295 | pub span: Span, | |
| 296 | pub name: Ident, | |
| 297 | } | |
| 298 | ||
| 299 | #[derive(Diagnostic)] | |
| 300 | #[diag("file not found for module `{$name}`", code = E0583)] | |
| 301 | #[help("to create the module `{$name}`, create file \"{$default_path}\" or \"{$secondary_path}\"")] | |
| 302 | #[note( | |
| 303 | "if there is a `mod {$name}` elsewhere in the crate already, import it with `use crate::...` instead" | |
| 304 | )] | |
| 305 | pub(crate) struct ModuleFileNotFound { | |
| 306 | #[primary_span] | |
| 307 | pub span: Span, | |
| 308 | pub name: Ident, | |
| 309 | pub default_path: String, | |
| 310 | pub secondary_path: String, | |
| 311 | } | |
| 312 | ||
| 313 | #[derive(Diagnostic)] | |
| 314 | #[diag("file for module `{$name}` found at both \"{$default_path}\" and \"{$secondary_path}\"", code = E0761)] | |
| 315 | #[help("delete or rename one of them to remove the ambiguity")] | |
| 316 | pub(crate) struct ModuleMultipleCandidates { | |
| 317 | #[primary_span] | |
| 318 | pub span: Span, | |
| 319 | pub name: Ident, | |
| 320 | pub default_path: String, | |
| 321 | pub secondary_path: String, | |
| 322 | } | |
| 323 | ||
| 324 | #[derive(Diagnostic)] | |
| 325 | #[diag("trace_macro")] | |
| 326 | pub(crate) struct TraceMacro { | |
| 327 | #[primary_span] | |
| 328 | pub span: Span, | |
| 329 | } | |
| 330 | ||
| 331 | #[derive(Diagnostic)] | |
| 332 | #[diag("proc macro panicked")] | |
| 333 | pub(crate) struct ProcMacroPanicked { | |
| 334 | #[primary_span] | |
| 335 | pub span: Span, | |
| 336 | #[subdiagnostic] | |
| 337 | pub message: Option<ProcMacroPanickedHelp>, | |
| 338 | } | |
| 339 | ||
| 340 | #[derive(Subdiagnostic)] | |
| 341 | #[help("message: {$message}")] | |
| 342 | pub(crate) struct ProcMacroPanickedHelp { | |
| 343 | pub message: String, | |
| 344 | } | |
| 345 | ||
| 346 | #[derive(Diagnostic)] | |
| 347 | #[diag("proc-macro derive panicked")] | |
| 348 | pub(crate) struct ProcMacroDerivePanicked { | |
| 349 | #[primary_span] | |
| 350 | pub span: Span, | |
| 351 | #[subdiagnostic] | |
| 352 | pub message: Option<ProcMacroDerivePanickedHelp>, | |
| 353 | } | |
| 354 | ||
| 355 | #[derive(Subdiagnostic)] | |
| 356 | #[help("message: {$message}")] | |
| 357 | pub(crate) struct ProcMacroDerivePanickedHelp { | |
| 358 | pub message: String, | |
| 359 | } | |
| 360 | ||
| 361 | #[derive(Diagnostic)] | |
| 362 | #[diag("custom attribute panicked")] | |
| 363 | pub(crate) struct CustomAttributePanicked { | |
| 364 | #[primary_span] | |
| 365 | pub span: Span, | |
| 366 | #[subdiagnostic] | |
| 367 | pub message: Option<CustomAttributePanickedHelp>, | |
| 368 | } | |
| 369 | ||
| 370 | #[derive(Subdiagnostic)] | |
| 371 | #[help("message: {$message}")] | |
| 372 | pub(crate) struct CustomAttributePanickedHelp { | |
| 373 | pub message: String, | |
| 374 | } | |
| 375 | ||
| 376 | #[derive(Diagnostic)] | |
| 377 | #[diag("proc-macro derive produced unparsable tokens")] | |
| 378 | pub(crate) struct ProcMacroDeriveTokens { | |
| 379 | #[primary_span] | |
| 380 | pub span: Span, | |
| 381 | } | |
| 382 | ||
| 383 | #[derive(Diagnostic)] | |
| 384 | #[diag("duplicate matcher binding")] | |
| 385 | pub(crate) struct DuplicateMatcherBinding { | |
| 386 | #[primary_span] | |
| 387 | #[label("duplicate binding")] | |
| 388 | pub span: Span, | |
| 389 | #[label("previous binding")] | |
| 390 | pub prev: Span, | |
| 391 | } | |
| 392 | ||
| 393 | #[derive(Diagnostic)] | |
| 394 | #[diag("duplicate matcher binding")] | |
| 395 | pub(crate) struct DuplicateMatcherBindingLint { | |
| 396 | #[label("duplicate binding")] | |
| 397 | pub span: Span, | |
| 398 | #[label("previous binding")] | |
| 399 | pub prev: Span, | |
| 400 | } | |
| 401 | ||
| 402 | #[derive(Diagnostic)] | |
| 403 | #[diag("missing fragment specifier")] | |
| 404 | #[note("fragment specifiers must be provided")] | |
| 405 | #[help("{$valid}")] | |
| 406 | pub(crate) struct MissingFragmentSpecifier { | |
| 407 | #[primary_span] | |
| 408 | pub span: Span, | |
| 409 | #[suggestion( | |
| 410 | "try adding a specifier here", | |
| 411 | style = "verbose", | |
| 412 | code = ":spec", | |
| 413 | applicability = "maybe-incorrect" | |
| 414 | )] | |
| 415 | pub add_span: Span, | |
| 416 | pub valid: &'static str, | |
| 417 | } | |
| 418 | ||
| 419 | #[derive(Diagnostic)] | |
| 420 | #[diag("invalid fragment specifier `{$fragment}`")] | |
| 421 | #[help("{$help}")] | |
| 422 | pub(crate) struct InvalidFragmentSpecifier { | |
| 423 | #[primary_span] | |
| 424 | pub span: Span, | |
| 425 | pub fragment: Ident, | |
| 426 | pub help: &'static str, | |
| 427 | } | |
| 428 | ||
| 429 | #[derive(Diagnostic)] | |
| 430 | #[diag("expected `(` or `{\"{\"}`, found `{$token}`")] | |
| 431 | pub(crate) struct ExpectedParenOrBrace<'a> { | |
| 432 | #[primary_span] | |
| 433 | pub span: Span, | |
| 434 | pub token: Cow<'a, str>, | |
| 435 | } | |
| 436 | ||
| 437 | #[derive(Diagnostic)] | |
| 438 | #[diag("empty {$kind} delegation is not supported")] | |
| 439 | pub(crate) struct EmptyDelegationMac { | |
| 440 | #[primary_span] | |
| 441 | pub span: Span, | |
| 442 | pub kind: String, | |
| 443 | } | |
| 444 | ||
| 445 | #[derive(Diagnostic)] | |
| 446 | #[diag("glob delegation is only supported in impls")] | |
| 447 | pub(crate) struct GlobDelegationOutsideImpls { | |
| 448 | #[primary_span] | |
| 449 | pub span: Span, | |
| 450 | } | |
| 451 | ||
| 452 | #[derive(Diagnostic)] | |
| 453 | #[diag("`crate_name` within an `#![cfg_attr]` attribute is forbidden")] | |
| 454 | pub(crate) struct CrateNameInCfgAttr { | |
| 455 | #[primary_span] | |
| 456 | pub span: Span, | |
| 457 | } | |
| 458 | ||
| 459 | #[derive(Diagnostic)] | |
| 460 | #[diag("`crate_type` within an `#![cfg_attr]` attribute is forbidden")] | |
| 461 | pub(crate) struct CrateTypeInCfgAttr { | |
| 462 | #[primary_span] | |
| 463 | pub span: Span, | |
| 464 | } | |
| 465 | ||
| 466 | #[derive(Diagnostic)] | |
| 467 | #[diag("qualified path without a trait in glob delegation")] | |
| 468 | pub(crate) struct GlobDelegationTraitlessQpath { | |
| 469 | #[primary_span] | |
| 470 | pub span: Span, | |
| 471 | } | |
| 472 | ||
| 473 | pub(crate) use metavar_exprs::*; | |
| 474 | mod metavar_exprs { | |
| 475 | use super::*; | |
| 476 | ||
| 477 | #[derive(Diagnostic, Default)] | |
| 478 | #[diag("unexpected trailing tokens")] | |
| 479 | pub(crate) struct MveExtraTokens { | |
| 480 | #[primary_span] | |
| 481 | #[suggestion( | |
| 482 | "try removing {$extra_count -> | |
| 483 | [one] this token | |
| 484 | *[other] these tokens | |
| 485 | }", | |
| 486 | code = "", | |
| 487 | applicability = "machine-applicable" | |
| 488 | )] | |
| 489 | pub span: Span, | |
| 490 | #[label("for this metavariable expression")] | |
| 491 | pub ident_span: Span, | |
| 492 | pub extra_count: usize, | |
| 493 | ||
| 494 | // The rest is only used for specific diagnostics and can be default if neither | |
| 495 | // `note` is `Some`. | |
| 496 | #[note( | |
| 497 | "the `{$name}` metavariable expression takes {$min_or_exact_args -> | |
| 498 | [zero] no arguments | |
| 499 | [one] a single argument | |
| 500 | *[other] {$min_or_exact_args} arguments | |
| 501 | }" | |
| 502 | )] | |
| 503 | pub exact_args_note: Option<()>, | |
| 504 | #[note( | |
| 505 | "the `{$name}` metavariable expression takes between {$min_or_exact_args} and {$max_args} arguments" | |
| 506 | )] | |
| 507 | pub range_args_note: Option<()>, | |
| 508 | pub min_or_exact_args: usize, | |
| 509 | pub max_args: usize, | |
| 510 | pub name: String, | |
| 511 | } | |
| 512 | ||
| 513 | #[derive(Diagnostic)] | |
| 514 | #[note("metavariable expressions use function-like parentheses syntax")] | |
| 515 | #[diag("expected `(`")] | |
| 516 | pub(crate) struct MveMissingParen { | |
| 517 | #[primary_span] | |
| 518 | #[label("for this this metavariable expression")] | |
| 519 | pub ident_span: Span, | |
| 520 | #[label("unexpected token")] | |
| 521 | pub unexpected_span: Option<Span>, | |
| 522 | #[suggestion( | |
| 523 | "try adding parentheses", | |
| 524 | code = "( /* ... */ )", | |
| 525 | applicability = "has-placeholders" | |
| 526 | )] | |
| 527 | pub insert_span: Option<Span>, | |
| 528 | } | |
| 529 | ||
| 530 | #[derive(Diagnostic)] | |
| 531 | #[note("valid metavariable expressions are {$valid_expr_list}")] | |
| 532 | #[diag("unrecognized metavariable expression")] | |
| 533 | pub(crate) struct MveUnrecognizedExpr { | |
| 534 | #[primary_span] | |
| 535 | #[label("not a valid metavariable expression")] | |
| 536 | pub span: Span, | |
| 537 | pub valid_expr_list: &'static str, | |
| 538 | } | |
| 539 | ||
| 540 | #[derive(Diagnostic)] | |
| 541 | #[diag("variable `{$key}` is not recognized in meta-variable expression")] | |
| 542 | pub(crate) struct MveUnrecognizedVar { | |
| 543 | #[primary_span] | |
| 544 | pub span: Span, | |
| 545 | pub key: MacroRulesNormalizedIdent, | |
| 546 | } | |
| 547 | ||
| 548 | #[derive(Diagnostic)] | |
| 549 | #[diag(r#"`${"{"}concat(..){"}"}` is not generating a valid identifier"#)] | |
| 550 | pub(crate) struct ConcatInvalidIdent { | |
| 551 | #[primary_span] | |
| 552 | pub span: Span, | |
| 553 | #[subdiagnostic] | |
| 554 | pub reason: InvalidIdentReason, | |
| 555 | } | |
| 556 | ||
| 557 | #[derive(Subdiagnostic)] | |
| 558 | pub(crate) enum InvalidIdentReason { | |
| 559 | #[note(r#"this `${"{"}concat(..){"}"}` invocation generated an empty ident"#)] | |
| 560 | Empty, | |
| 561 | #[note(r#"this `${"{"}concat(..){"}"}` invocation generated `{$symbol}`, but {$start} is neither '_' nor XID_Start"#)] | |
| 562 | #[note( | |
| 563 | "see <https://doc.rust-lang.org/reference/identifiers.html> for the definition of valid identifiers" | |
| 564 | )] | |
| 565 | InvalidStart { symbol: Symbol, start: char }, | |
| 566 | #[note(r#"this `${"{"}concat(..){"}"}` invocation generated `{$symbol}`, but {$not_continue} is not XID_Continue"#)] | |
| 567 | #[note( | |
| 568 | "see <https://doc.rust-lang.org/reference/identifiers.html> for the definition of valid identifiers" | |
| 569 | )] | |
| 570 | InvalidContinue { symbol: Symbol, not_continue: char }, | |
| 571 | } | |
| 572 | ||
| 573 | impl InvalidIdentReason { | |
| 574 | pub(crate) fn new(symbol: Symbol) -> Self { | |
| 575 | let mut chars = symbol.as_str().chars(); | |
| 576 | if let Some(start) = chars.next() { | |
| 577 | if rustc_lexer::is_id_start(start) { | |
| 578 | let not_continue = chars | |
| 579 | .find(|c| !rustc_lexer::is_id_continue(*c)) | |
| 580 | .expect("InvalidIdentReason: cannot find invalid ident reason"); | |
| 581 | InvalidIdentReason::InvalidContinue { symbol, not_continue } | |
| 582 | } else { | |
| 583 | InvalidIdentReason::InvalidStart { symbol, start } | |
| 584 | } | |
| 585 | } else { | |
| 586 | InvalidIdentReason::Empty | |
| 587 | } | |
| 588 | } | |
| 589 | } | |
| 590 | } | |
| 591 | ||
| 592 | #[derive(Diagnostic)] | |
| 593 | #[diag("`{$rule_kw}` rule argument matchers require parentheses")] | |
| 594 | pub(crate) struct MacroArgsBadDelim { | |
| 595 | #[primary_span] | |
| 596 | pub span: Span, | |
| 597 | #[subdiagnostic] | |
| 598 | pub sugg: MacroArgsBadDelimSugg, | |
| 599 | pub rule_kw: Symbol, | |
| 600 | } | |
| 601 | ||
| 602 | #[derive(Subdiagnostic)] | |
| 603 | #[multipart_suggestion( | |
| 604 | "the delimiters should be `(` and `)`", | |
| 605 | applicability = "machine-applicable" | |
| 606 | )] | |
| 607 | pub(crate) struct MacroArgsBadDelimSugg { | |
| 608 | #[suggestion_part(code = "(")] | |
| 609 | pub open: Span, | |
| 610 | #[suggestion_part(code = ")")] | |
| 611 | pub close: Span, | |
| 612 | } | |
| 613 | ||
| 614 | #[derive(Diagnostic)] | |
| 615 | #[diag("unused doc comment")] | |
| 616 | #[help( | |
| 617 | "to document an item produced by a macro, the macro must produce the documentation as part of its expansion" | |
| 618 | )] | |
| 619 | pub(crate) struct MacroCallUnusedDocComment { | |
| 620 | #[label("rustdoc does not generate documentation for macro invocations")] | |
| 621 | pub span: Span, | |
| 622 | } | |
| 623 | ||
| 624 | #[derive(Diagnostic)] | |
| 625 | #[diag( | |
| 626 | "the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro" | |
| 627 | )] | |
| 628 | pub(crate) struct OrPatternsBackCompat { | |
| 629 | #[suggestion( | |
| 630 | "use pat_param to preserve semantics", | |
| 631 | code = "{suggestion}", | |
| 632 | applicability = "machine-applicable" | |
| 633 | )] | |
| 634 | pub span: Span, | |
| 635 | pub suggestion: String, | |
| 636 | } | |
| 637 | ||
| 638 | #[derive(Diagnostic)] | |
| 639 | #[diag("trailing semicolon in macro used in expression position")] | |
| 640 | pub(crate) struct TrailingMacro { | |
| 641 | #[note("macro invocations at the end of a block are treated as expressions")] | |
| 642 | #[note( | |
| 643 | "to ignore the value produced by the macro, add a semicolon after the invocation of `{$name}`" | |
| 644 | )] | |
| 645 | pub is_trailing: bool, | |
| 646 | pub name: Ident, | |
| 647 | } | |
| 648 | ||
| 649 | #[derive(Diagnostic)] | |
| 650 | #[diag("unused attribute `{$attr_name}`")] | |
| 651 | pub(crate) struct UnusedBuiltinAttribute { | |
| 652 | #[note( | |
| 653 | "the built-in attribute `{$attr_name}` will be ignored, since it's applied to the macro invocation `{$macro_name}`" | |
| 654 | )] | |
| 655 | pub invoc_span: Span, | |
| 656 | pub attr_name: Symbol, | |
| 657 | pub macro_name: String, | |
| 658 | #[suggestion( | |
| 659 | "remove the attribute", | |
| 660 | code = "", | |
| 661 | applicability = "machine-applicable", | |
| 662 | style = "tool-only" | |
| 663 | )] | |
| 664 | pub attr_span: Span, | |
| 665 | } |
compiler/rustc_expand/src/expand.rs+24-14| ... | ... | @@ -8,9 +8,9 @@ use rustc_ast::tokenstream::TokenStream; |
| 8 | 8 | use rustc_ast::visit::{self, AssocCtxt, Visitor, VisitorResult, try_visit, walk_list}; |
| 9 | 9 | use rustc_ast::{ |
| 10 | 10 | self as ast, AssocItemKind, AstNodeWrapper, AttrArgs, AttrItemKind, AttrStyle, AttrVec, |
| 11 | DUMMY_NODE_ID, DelegationSuffixes, EarlyParsedAttribute, ExprKind, ForeignItemKind, HasAttrs, | |
| 12 | HasNodeId, Inline, ItemKind, MacStmtStyle, MetaItemInner, MetaItemKind, ModKind, NodeId, | |
| 13 | PatKind, StmtKind, TyKind, token, | |
| 11 | DUMMY_NODE_ID, DelegationSource, DelegationSuffixes, EarlyParsedAttribute, ExprKind, | |
| 12 | ForeignItemKind, HasAttrs, HasNodeId, Inline, ItemKind, MacStmtStyle, MetaItemInner, | |
| 13 | MetaItemKind, ModKind, NodeId, PatKind, StmtKind, TyKind, token, | |
| 14 | 14 | }; |
| 15 | 15 | use rustc_ast_pretty::pprust; |
| 16 | 16 | use rustc_attr_parsing::parser::AllowExprMetavar; |
| ... | ... | @@ -38,7 +38,7 @@ use smallvec::SmallVec; |
| 38 | 38 | |
| 39 | 39 | use crate::base::*; |
| 40 | 40 | use crate::config::{StripUnconfigured, attr_into_trace}; |
| 41 | use crate::errors::{ | |
| 41 | use crate::diagnostics::{ | |
| 42 | 42 | EmptyDelegationMac, GlobDelegationOutsideImpls, GlobDelegationTraitlessQpath, IncompleteParse, |
| 43 | 43 | RecursionLimitReached, RemoveExprNotSupported, RemoveNodeNotSupported, UnsupportedKeyValue, |
| 44 | 44 | WrongFragmentKind, |
| ... | ... | @@ -992,7 +992,12 @@ impl<'a, 'b> MacroExpander<'a, 'b> { |
| 992 | 992 | |
| 993 | 993 | type Node = AstNodeWrapper<Box<ast::AssocItem>, ImplItemTag>; |
| 994 | 994 | let single_delegations = build_single_delegations::<Node>( |
| 995 | self.cx, deleg, &item, &suffixes, item.span, true, | |
| 995 | self.cx, | |
| 996 | deleg, | |
| 997 | &item, | |
| 998 | &suffixes, | |
| 999 | item.span, | |
| 1000 | DelegationSource::Glob, | |
| 996 | 1001 | ); |
| 997 | 1002 | // `-Zmacro-stats` ignores these because they don't seem important. |
| 998 | 1003 | fragment_kind.expect_from_annotatables(single_delegations.map(|item| { |
| ... | ... | @@ -2041,8 +2046,12 @@ fn build_single_delegations<'a, Node: InvocationCollectorNode>( |
| 2041 | 2046 | item: &'a ast::Item<Node::ItemKind>, |
| 2042 | 2047 | suffixes: &'a [(Ident, Option<Ident>)], |
| 2043 | 2048 | item_span: Span, |
| 2044 | from_glob: bool, | |
| 2049 | source: DelegationSource, | |
| 2045 | 2050 | ) -> impl Iterator<Item = ast::Item<Node::ItemKind>> + 'a { |
| 2051 | debug_assert_ne!(source, DelegationSource::Single); | |
| 2052 | ||
| 2053 | let from_glob = source == DelegationSource::Glob; | |
| 2054 | ||
| 2046 | 2055 | if suffixes.is_empty() { |
| 2047 | 2056 | // Report an error for now, to avoid keeping stem for resolution and |
| 2048 | 2057 | // stability checks. |
| ... | ... | @@ -2066,11 +2075,7 @@ fn build_single_delegations<'a, Node: InvocationCollectorNode>( |
| 2066 | 2075 | ident: rename.unwrap_or(ident), |
| 2067 | 2076 | rename, |
| 2068 | 2077 | body: deleg.body.clone(), |
| 2069 | source: if from_glob { | |
| 2070 | ast::DelegationSource::Glob | |
| 2071 | } else { | |
| 2072 | ast::DelegationSource::List | |
| 2073 | }, | |
| 2078 | source, | |
| 2074 | 2079 | })), |
| 2075 | 2080 | tokens: None, |
| 2076 | 2081 | } |
| ... | ... | @@ -2278,7 +2283,7 @@ impl<'a, 'b> InvocationCollector<'a, 'b> { |
| 2278 | 2283 | UNUSED_DOC_COMMENTS, |
| 2279 | 2284 | current_span, |
| 2280 | 2285 | self.cx.current_expansion.lint_node_id, |
| 2281 | crate::errors::MacroCallUnusedDocComment { span: attr.span }, | |
| 2286 | crate::diagnostics::MacroCallUnusedDocComment { span: attr.span }, | |
| 2282 | 2287 | ); |
| 2283 | 2288 | } else if rustc_attr_parsing::is_builtin_attr(attr) |
| 2284 | 2289 | && !AttributeParser::is_parsed_attribute(&attr.path()) |
| ... | ... | @@ -2288,7 +2293,7 @@ impl<'a, 'b> InvocationCollector<'a, 'b> { |
| 2288 | 2293 | UNUSED_ATTRIBUTES, |
| 2289 | 2294 | attr.span, |
| 2290 | 2295 | self.cx.current_expansion.lint_node_id, |
| 2291 | crate::errors::UnusedBuiltinAttribute { | |
| 2296 | crate::diagnostics::UnusedBuiltinAttribute { | |
| 2292 | 2297 | attr_name, |
| 2293 | 2298 | macro_name: pprust::path_to_string(&call.path), |
| 2294 | 2299 | invoc_span: call.path.span, |
| ... | ... | @@ -2414,7 +2419,12 @@ impl<'a, 'b> InvocationCollector<'a, 'b> { |
| 2414 | 2419 | }; |
| 2415 | 2420 | |
| 2416 | 2421 | let single_delegations = build_single_delegations::<Node>( |
| 2417 | self.cx, deleg, item, suffixes, item.span, false, | |
| 2422 | self.cx, | |
| 2423 | deleg, | |
| 2424 | item, | |
| 2425 | suffixes, | |
| 2426 | item.span, | |
| 2427 | DelegationSource::List(LocalExpnId::fresh_empty()), | |
| 2418 | 2428 | ); |
| 2419 | 2429 | Node::flatten_outputs(single_delegations.map(|item| { |
| 2420 | 2430 | let mut item = Node::from_item(item); |
compiler/rustc_expand/src/lib.rs+1-1| ... | ... | @@ -10,7 +10,7 @@ |
| 10 | 10 | // tidy-alphabetical-end |
| 11 | 11 | |
| 12 | 12 | mod build; |
| 13 | mod errors; | |
| 13 | mod diagnostics; | |
| 14 | 14 | mod mbe; |
| 15 | 15 | mod placeholders; |
| 16 | 16 | mod proc_macro_server; |
compiler/rustc_expand/src/mbe/macro_check.rs+10-10| ... | ... | @@ -114,7 +114,7 @@ use rustc_session::parse::ParseSess; |
| 114 | 114 | use rustc_span::{ErrorGuaranteed, MacroRulesNormalizedIdent, Span, kw}; |
| 115 | 115 | use smallvec::SmallVec; |
| 116 | 116 | |
| 117 | use crate::errors; | |
| 117 | use crate::diagnostics; | |
| 118 | 118 | use crate::mbe::{KleeneToken, TokenTree}; |
| 119 | 119 | |
| 120 | 120 | /// Stack represented as linked list. |
| ... | ... | @@ -247,7 +247,7 @@ fn check_binders( |
| 247 | 247 | psess, |
| 248 | 248 | span, |
| 249 | 249 | node_id, |
| 250 | errors::DuplicateMatcherBindingLint { span, prev: prev_info.span }, | |
| 250 | diagnostics::DuplicateMatcherBindingLint { span, prev: prev_info.span }, | |
| 251 | 251 | ); |
| 252 | 252 | } else if get_binder_info(macros, binders, name).is_none() { |
| 253 | 253 | // 2. The meta-variable is free: This is a binder. |
| ... | ... | @@ -266,11 +266,11 @@ fn check_binders( |
| 266 | 266 | if let Some(prev_info) = get_binder_info(macros, binders, name) { |
| 267 | 267 | // Duplicate binders at the top-level macro definition are errors. The lint is only |
| 268 | 268 | // for nested macro definitions. |
| 269 | *guar = Some( | |
| 270 | psess | |
| 271 | .dcx() | |
| 272 | .emit_err(errors::DuplicateMatcherBinding { span, prev: prev_info.span }), | |
| 273 | ); | |
| 269 | *guar = | |
| 270 | Some(psess.dcx().emit_err(diagnostics::DuplicateMatcherBinding { | |
| 271 | span, | |
| 272 | prev: prev_info.span, | |
| 273 | })); | |
| 274 | 274 | } else { |
| 275 | 275 | binders.insert(name, BinderInfo { span, ops: ops.into() }); |
| 276 | 276 | } |
| ... | ... | @@ -578,7 +578,7 @@ fn check_ops_is_prefix( |
| 578 | 578 | return; |
| 579 | 579 | } |
| 580 | 580 | } |
| 581 | buffer_lint(psess, span, node_id, errors::UnknownMacroVariable { name }); | |
| 581 | buffer_lint(psess, span, node_id, diagnostics::UnknownMacroVariable { name }); | |
| 582 | 582 | } |
| 583 | 583 | |
| 584 | 584 | /// Returns whether `binder_ops` is a prefix of `occurrence_ops`. |
| ... | ... | @@ -613,7 +613,7 @@ fn ops_is_prefix( |
| 613 | 613 | psess, |
| 614 | 614 | span, |
| 615 | 615 | node_id, |
| 616 | errors::MetaVarStillRepeatingLint { label: binder.span, ident }, | |
| 616 | diagnostics::MetaVarStillRepeatingLint { label: binder.span, ident }, | |
| 617 | 617 | ); |
| 618 | 618 | return; |
| 619 | 619 | } |
| ... | ... | @@ -623,7 +623,7 @@ fn ops_is_prefix( |
| 623 | 623 | psess, |
| 624 | 624 | span, |
| 625 | 625 | node_id, |
| 626 | errors::MetaVariableWrongOperator { | |
| 626 | diagnostics::MetaVariableWrongOperator { | |
| 627 | 627 | binder: binder.span, |
| 628 | 628 | occurrence: occurrence.span, |
| 629 | 629 | }, |
compiler/rustc_expand/src/mbe/macro_rules.rs+7-7| ... | ... | @@ -30,14 +30,14 @@ use rustc_span::hygiene::Transparency; |
| 30 | 30 | use rustc_span::{Ident, Span, Symbol, kw, sym}; |
| 31 | 31 | use tracing::{debug, instrument, trace, trace_span}; |
| 32 | 32 | |
| 33 | use super::SequenceRepetition; | |
| 33 | 34 | use super::diagnostics::{FailedMacro, failed_to_match_macro}; |
| 34 | 35 | use super::macro_parser::{NamedMatches, NamedParseResult}; |
| 35 | use super::{SequenceRepetition, diagnostics}; | |
| 36 | 36 | use crate::base::{ |
| 37 | 37 | AttrProcMacro, BangProcMacro, DummyResult, ExpandResult, ExtCtxt, MacResult, |
| 38 | 38 | MacroExpanderResult, SyntaxExtension, SyntaxExtensionKind, TTMacroExpander, |
| 39 | 39 | }; |
| 40 | use crate::errors; | |
| 40 | use crate::diagnostics; | |
| 41 | 41 | use crate::expand::{AstFragment, AstFragmentKind, ensure_complete_parse, parse_ast_fragment}; |
| 42 | 42 | use crate::mbe::macro_check::check_meta_variables; |
| 43 | 43 | use crate::mbe::macro_parser::{Error, ErrorReported, Failure, MatcherLoc, Success, TtParser}; |
| ... | ... | @@ -81,7 +81,7 @@ impl<'a, 'b> ParserAnyMacro<'a, 'b> { |
| 81 | 81 | let fragment = match parse_ast_fragment(parser, kind) { |
| 82 | 82 | Ok(f) => f, |
| 83 | 83 | Err(err) => { |
| 84 | let guar = diagnostics::emit_frag_parse_err( | |
| 84 | let guar = super::diagnostics::emit_frag_parse_err( | |
| 85 | 85 | err, |
| 86 | 86 | parser, |
| 87 | 87 | snapshot, |
| ... | ... | @@ -104,7 +104,7 @@ impl<'a, 'b> ParserAnyMacro<'a, 'b> { |
| 104 | 104 | SEMICOLON_IN_EXPRESSIONS_FROM_MACROS, |
| 105 | 105 | parser.token.span, |
| 106 | 106 | lint_node_id, |
| 107 | errors::TrailingMacro { is_trailing: is_trailing_mac, name: macro_ident }, | |
| 107 | diagnostics::TrailingMacro { is_trailing: is_trailing_mac, name: macro_ident }, | |
| 108 | 108 | ); |
| 109 | 109 | } |
| 110 | 110 | parser.bump(); |
| ... | ... | @@ -903,9 +903,9 @@ fn check_args_parens(sess: &Session, rule_kw: Symbol, args: &tokenstream::TokenT |
| 903 | 903 | if let tokenstream::TokenTree::Delimited(dspan, _, delim, _) = args |
| 904 | 904 | && *delim != Delimiter::Parenthesis |
| 905 | 905 | { |
| 906 | sess.dcx().emit_err(errors::MacroArgsBadDelim { | |
| 906 | sess.dcx().emit_err(diagnostics::MacroArgsBadDelim { | |
| 907 | 907 | span: dspan.entire(), |
| 908 | sugg: errors::MacroArgsBadDelimSugg { open: dspan.open, close: dspan.close }, | |
| 908 | sugg: diagnostics::MacroArgsBadDelimSugg { open: dspan.open, close: dspan.close }, | |
| 909 | 909 | rule_kw, |
| 910 | 910 | }); |
| 911 | 911 | } |
| ... | ... | @@ -1539,7 +1539,7 @@ fn check_matcher_core<'tt>( |
| 1539 | 1539 | RUST_2021_INCOMPATIBLE_OR_PATTERNS, |
| 1540 | 1540 | span, |
| 1541 | 1541 | ast::CRATE_NODE_ID, |
| 1542 | errors::OrPatternsBackCompat { span, suggestion }, | |
| 1542 | diagnostics::OrPatternsBackCompat { span, suggestion }, | |
| 1543 | 1543 | ); |
| 1544 | 1544 | } |
| 1545 | 1545 | match is_in_follow(next_token, kind) { |
compiler/rustc_expand/src/mbe/metavar_expr.rs+9-6| ... | ... | @@ -7,7 +7,7 @@ use rustc_macros::{Decodable, Encodable}; |
| 7 | 7 | use rustc_session::parse::ParseSess; |
| 8 | 8 | use rustc_span::{Ident, Span, Symbol, sym}; |
| 9 | 9 | |
| 10 | use crate::errors; | |
| 10 | use crate::diagnostics; | |
| 11 | 11 | |
| 12 | 12 | pub(crate) const RAW_IDENT_ERR: &str = "`${concat(..)}` currently does not support raw identifiers"; |
| 13 | 13 | pub(crate) const UNSUPPORTED_CONCAT_ELEM_ERR: &str = "expected identifier or string literal"; |
| ... | ... | @@ -51,15 +51,18 @@ impl MetaVarExpr { |
| 51 | 51 | Some(tt) => (Some(tt.span()), None), |
| 52 | 52 | None => (None, Some(ident.span.shrink_to_hi())), |
| 53 | 53 | }; |
| 54 | let err = | |
| 55 | errors::MveMissingParen { ident_span: ident.span, unexpected_span, insert_span }; | |
| 54 | let err = diagnostics::MveMissingParen { | |
| 55 | ident_span: ident.span, | |
| 56 | unexpected_span, | |
| 57 | insert_span, | |
| 58 | }; | |
| 56 | 59 | return Err(psess.dcx().create_err(err)); |
| 57 | 60 | }; |
| 58 | 61 | |
| 59 | 62 | // Ensure there are no trailing tokens in the braces, e.g. `${foo() extra}` |
| 60 | 63 | if iter.peek().is_some() { |
| 61 | 64 | let span = iter_span(&iter).expect("checked is_some above"); |
| 62 | let err = errors::MveExtraTokens { | |
| 65 | let err = diagnostics::MveExtraTokens { | |
| 63 | 66 | span, |
| 64 | 67 | ident_span: ident.span, |
| 65 | 68 | extra_count: iter.count(), |
| ... | ... | @@ -79,7 +82,7 @@ impl MetaVarExpr { |
| 79 | 82 | sym::index => MetaVarExpr::Index(parse_depth(&mut iter, psess, ident.span)?), |
| 80 | 83 | sym::len => MetaVarExpr::Len(parse_depth(&mut iter, psess, ident.span)?), |
| 81 | 84 | _ => { |
| 82 | let err = errors::MveUnrecognizedExpr { | |
| 85 | let err = diagnostics::MveUnrecognizedExpr { | |
| 83 | 86 | span: ident.span, |
| 84 | 87 | valid_expr_list: "`count`, `ignore`, `index`, `len`, and `concat`", |
| 85 | 88 | }; |
| ... | ... | @@ -129,7 +132,7 @@ fn check_trailing_tokens<'psess>( |
| 129 | 132 | other => unreachable!("unknown MVEs should be rejected earlier (got `{other}`)"), |
| 130 | 133 | }; |
| 131 | 134 | |
| 132 | let err = errors::MveExtraTokens { | |
| 135 | let err = diagnostics::MveExtraTokens { | |
| 133 | 136 | span: iter_span(iter).expect("checked is_none above"), |
| 134 | 137 | ident_span: ident.span, |
| 135 | 138 | extra_count: iter.count(), |
compiler/rustc_expand/src/mbe/quoted.rs+4-4| ... | ... | @@ -9,7 +9,7 @@ use rustc_session::errors::feature_err; |
| 9 | 9 | use rustc_span::edition::Edition; |
| 10 | 10 | use rustc_span::{Ident, Span, kw, sym}; |
| 11 | 11 | |
| 12 | use crate::errors; | |
| 12 | use crate::diagnostics; | |
| 13 | 13 | use crate::mbe::macro_parser::count_metavar_decls; |
| 14 | 14 | use crate::mbe::{Delimited, KleeneOp, KleeneToken, MetaVarExpr, SequenceRepetition, TokenTree}; |
| 15 | 15 | |
| ... | ... | @@ -94,7 +94,7 @@ fn parse( |
| 94 | 94 | // Emit a missing-fragment diagnostic and return a `TokenTree` fallback so parsing can |
| 95 | 95 | // continue. |
| 96 | 96 | let missing_fragment_specifier = |span, add_span| { |
| 97 | sess.dcx().emit_err(errors::MissingFragmentSpecifier { | |
| 97 | sess.dcx().emit_err(diagnostics::MissingFragmentSpecifier { | |
| 98 | 98 | span, |
| 99 | 99 | add_span, |
| 100 | 100 | valid: VALID_FRAGMENT_NAMES_MSG, |
| ... | ... | @@ -163,7 +163,7 @@ fn parse( |
| 163 | 163 | if !span.from_expansion() { edition } else { span.edition() } |
| 164 | 164 | }; |
| 165 | 165 | let kind = NonterminalKind::from_symbol(fragment.name, edition).unwrap_or_else(|| { |
| 166 | sess.dcx().emit_err(errors::InvalidFragmentSpecifier { | |
| 166 | sess.dcx().emit_err(diagnostics::InvalidFragmentSpecifier { | |
| 167 | 167 | span, |
| 168 | 168 | fragment, |
| 169 | 169 | help: VALID_FRAGMENT_NAMES_MSG, |
| ... | ... | @@ -299,7 +299,7 @@ fn parse_tree<'a>( |
| 299 | 299 | _ => { |
| 300 | 300 | let token = |
| 301 | 301 | pprust::token_kind_to_string(&delim.as_open_token_kind()); |
| 302 | sess.dcx().emit_err(errors::ExpectedParenOrBrace { | |
| 302 | sess.dcx().emit_err(diagnostics::ExpectedParenOrBrace { | |
| 303 | 303 | span: delim_span.entire(), |
| 304 | 304 | token, |
| 305 | 305 | }); |
compiler/rustc_expand/src/mbe/transcribe.rs+1-1| ... | ... | @@ -17,7 +17,7 @@ use rustc_span::{ |
| 17 | 17 | }; |
| 18 | 18 | use smallvec::{SmallVec, smallvec}; |
| 19 | 19 | |
| 20 | use crate::errors::{ | |
| 20 | use crate::diagnostics::{ | |
| 21 | 21 | ConcatInvalidIdent, CountRepetitionMisplaced, InvalidIdentReason, MacroVarStillRepeating, |
| 22 | 22 | MetaVarsDifSeqMatchers, MustRepeatOnce, MveUnrecognizedVar, NoRepeatableVar, |
| 23 | 23 | NoSyntaxVarsExprRepeat, VarNoTypo, VarTypoSuggestionRepeatable, VarTypoSuggestionUnrepeatable, |
compiler/rustc_expand/src/module.rs+1-1| ... | ... | @@ -14,7 +14,7 @@ use rustc_span::{Ident, Span, sym}; |
| 14 | 14 | use thin_vec::ThinVec; |
| 15 | 15 | |
| 16 | 16 | use crate::base::ModuleData; |
| 17 | use crate::errors::{ | |
| 17 | use crate::diagnostics::{ | |
| 18 | 18 | ModuleCircular, ModuleFileNotFound, ModuleInBlock, ModuleInBlockName, ModuleMultipleCandidates, |
| 19 | 19 | }; |
| 20 | 20 |
compiler/rustc_expand/src/proc_macro.rs+10-8| ... | ... | @@ -11,7 +11,7 @@ use rustc_span::profiling::SpannedEventArgRecorder; |
| 11 | 11 | use rustc_span::{LocalExpnId, Span}; |
| 12 | 12 | |
| 13 | 13 | use crate::base::{self, *}; |
| 14 | use crate::{errors, proc_macro_server}; | |
| 14 | use crate::{diagnostics, proc_macro_server}; | |
| 15 | 15 | |
| 16 | 16 | fn exec_strategy(sess: &Session) -> impl pm::bridge::server::ExecutionStrategy + 'static { |
| 17 | 17 | pm::bridge::server::MaybeCrossThread { |
| ... | ... | @@ -47,9 +47,11 @@ impl base::BangProcMacro for BangProcMacro { |
| 47 | 47 | let strategy = exec_strategy(ecx.sess); |
| 48 | 48 | let server = proc_macro_server::Rustc::new(ecx); |
| 49 | 49 | self.client.run1(&strategy, server, input, proc_macro_backtrace).map_err(|e| { |
| 50 | ecx.dcx().emit_err(errors::ProcMacroPanicked { | |
| 50 | ecx.dcx().emit_err(diagnostics::ProcMacroPanicked { | |
| 51 | 51 | span, |
| 52 | message: e.into_string().map(|message| errors::ProcMacroPanickedHelp { message }), | |
| 52 | message: e | |
| 53 | .into_string() | |
| 54 | .map(|message| diagnostics::ProcMacroPanickedHelp { message }), | |
| 53 | 55 | }) |
| 54 | 56 | }) |
| 55 | 57 | } |
| ... | ... | @@ -74,11 +76,11 @@ impl base::AttrProcMacro for AttrProcMacro { |
| 74 | 76 | let server = proc_macro_server::Rustc::new(ecx); |
| 75 | 77 | self.client.run2(&strategy, server, annotation, annotated, proc_macro_backtrace).map_err( |
| 76 | 78 | |e| { |
| 77 | ecx.dcx().emit_err(errors::CustomAttributePanicked { | |
| 79 | ecx.dcx().emit_err(diagnostics::CustomAttributePanicked { | |
| 78 | 80 | span, |
| 79 | 81 | message: e |
| 80 | 82 | .into_string() |
| 81 | .map(|message| errors::CustomAttributePanickedHelp { message }), | |
| 83 | .map(|message| diagnostics::CustomAttributePanickedHelp { message }), | |
| 82 | 84 | }) |
| 83 | 85 | }, |
| 84 | 86 | ) |
| ... | ... | @@ -154,7 +156,7 @@ impl MultiItemModifier for DeriveProcMacro { |
| 154 | 156 | |
| 155 | 157 | // fail if there have been errors emitted |
| 156 | 158 | if ecx.dcx().err_count() > error_count_before { |
| 157 | ecx.dcx().emit_err(errors::ProcMacroDeriveTokens { span }); | |
| 159 | ecx.dcx().emit_err(diagnostics::ProcMacroDeriveTokens { span }); | |
| 158 | 160 | } |
| 159 | 161 | |
| 160 | 162 | ExpandResult::Ready(items) |
| ... | ... | @@ -202,11 +204,11 @@ fn expand_derive_macro( |
| 202 | 204 | let invoc_expn_data = invoc_id.expn_data(); |
| 203 | 205 | let span = invoc_expn_data.call_site; |
| 204 | 206 | ecx.dcx().emit_err({ |
| 205 | errors::ProcMacroDerivePanicked { | |
| 207 | diagnostics::ProcMacroDerivePanicked { | |
| 206 | 208 | span, |
| 207 | 209 | message: e |
| 208 | 210 | .into_string() |
| 209 | .map(|message| errors::ProcMacroDerivePanickedHelp { message }), | |
| 211 | .map(|message| diagnostics::ProcMacroDerivePanickedHelp { message }), | |
| 210 | 212 | } |
| 211 | 213 | }); |
| 212 | 214 | Err(()) |
compiler/rustc_hir/src/hir.rs+8-27| ... | ... | @@ -25,7 +25,8 @@ use rustc_index::IndexVec; |
| 25 | 25 | use rustc_macros::{Decodable, Encodable, StableHash}; |
| 26 | 26 | use rustc_span::def_id::LocalDefId; |
| 27 | 27 | use rustc_span::{ |
| 28 | BytePos, DUMMY_SP, DesugaringKind, ErrorGuaranteed, Ident, Span, Spanned, Symbol, kw, sym, | |
| 28 | BytePos, DUMMY_SP, DesugaringKind, ErrorGuaranteed, Ident, LocalExpnId, Span, Spanned, Symbol, | |
| 29 | kw, sym, | |
| 29 | 30 | }; |
| 30 | 31 | use rustc_target::asm::InlineAsmRegOrRegClass; |
| 31 | 32 | use smallvec::SmallVec; |
| ... | ... | @@ -3319,7 +3320,7 @@ impl<'hir> TraitItem<'hir> { |
| 3319 | 3320 | |
| 3320 | 3321 | expect_methods_self_kind! { |
| 3321 | 3322 | expect_const, (&'hir Ty<'hir>, Option<ConstItemRhs<'hir>>), |
| 3322 | TraitItemKind::Const(ty, rhs, _), (ty, *rhs); | |
| 3323 | TraitItemKind::Const(ty, rhs), (ty, *rhs); | |
| 3323 | 3324 | |
| 3324 | 3325 | expect_fn, (&FnSig<'hir>, &TraitFn<'hir>), |
| 3325 | 3326 | TraitItemKind::Fn(ty, trfn), (ty, trfn); |
| ... | ... | @@ -3339,32 +3340,11 @@ pub enum TraitFn<'hir> { |
| 3339 | 3340 | Provided(BodyId), |
| 3340 | 3341 | } |
| 3341 | 3342 | |
| 3342 | #[derive(Debug, Clone, Copy, PartialEq, Eq, StableHash)] | |
| 3343 | pub enum IsTypeConst { | |
| 3344 | No, | |
| 3345 | Yes, | |
| 3346 | } | |
| 3347 | ||
| 3348 | impl From<bool> for IsTypeConst { | |
| 3349 | fn from(value: bool) -> Self { | |
| 3350 | if value { Self::Yes } else { Self::No } | |
| 3351 | } | |
| 3352 | } | |
| 3353 | ||
| 3354 | impl From<IsTypeConst> for bool { | |
| 3355 | fn from(value: IsTypeConst) -> Self { | |
| 3356 | matches!(value, IsTypeConst::Yes) | |
| 3357 | } | |
| 3358 | } | |
| 3359 | ||
| 3360 | 3343 | /// Represents a trait method or associated constant or type |
| 3361 | 3344 | #[derive(Debug, Clone, Copy, StableHash)] |
| 3362 | 3345 | pub enum TraitItemKind<'hir> { |
| 3363 | // FIXME(mgca) eventually want to move the option that is around `ConstItemRhs<'hir>` | |
| 3364 | // into `ConstItemRhs`, much like `ast::ConstItemRhsKind`, but for now mark whether | |
| 3365 | // this node is a TypeConst with a flag. | |
| 3366 | 3346 | /// An associated constant with an optional value (otherwise `impl`s must contain a value). |
| 3367 | Const(&'hir Ty<'hir>, Option<ConstItemRhs<'hir>>, IsTypeConst), | |
| 3347 | Const(&'hir Ty<'hir>, Option<ConstItemRhs<'hir>>), | |
| 3368 | 3348 | /// An associated function with an optional body. |
| 3369 | 3349 | Fn(FnSig<'hir>, TraitFn<'hir>), |
| 3370 | 3350 | /// An associated type with (possibly empty) bounds and optional concrete |
| ... | ... | @@ -3877,6 +3857,7 @@ pub struct DelegationInfo { |
| 3877 | 3857 | pub child_args_segment_id: Option<HirId>, |
| 3878 | 3858 | pub self_ty_id: Option<HirId>, |
| 3879 | 3859 | pub propagate_self_ty: bool, |
| 3860 | pub group_id: Option<(LocalExpnId, bool /* unused_target_expr */)>, | |
| 3880 | 3861 | } |
| 3881 | 3862 | |
| 3882 | 3863 | #[derive(Debug, Clone, Copy, PartialEq, Eq, StableHash)] |
| ... | ... | @@ -5009,7 +4990,7 @@ impl<'hir> OwnerNode<'hir> { |
| 5009 | 4990 | | OwnerNode::TraitItem(TraitItem { |
| 5010 | 4991 | kind: |
| 5011 | 4992 | TraitItemKind::Fn(_, TraitFn::Provided(body)) |
| 5012 | | TraitItemKind::Const(_, Some(ConstItemRhs::Body(body)), _), | |
| 4993 | | TraitItemKind::Const(_, Some(ConstItemRhs::Body(body))), | |
| 5013 | 4994 | .. |
| 5014 | 4995 | }) |
| 5015 | 4996 | | OwnerNode::ImplItem(ImplItem { |
| ... | ... | @@ -5236,7 +5217,7 @@ impl<'hir> Node<'hir> { |
| 5236 | 5217 | _ => None, |
| 5237 | 5218 | }, |
| 5238 | 5219 | Node::TraitItem(it) => match it.kind { |
| 5239 | TraitItemKind::Const(ty, _, _) => Some(ty), | |
| 5220 | TraitItemKind::Const(ty, _) => Some(ty), | |
| 5240 | 5221 | TraitItemKind::Type(_, ty) => ty, |
| 5241 | 5222 | _ => None, |
| 5242 | 5223 | }, |
| ... | ... | @@ -5280,7 +5261,7 @@ impl<'hir> Node<'hir> { |
| 5280 | 5261 | | Node::TraitItem(TraitItem { |
| 5281 | 5262 | owner_id, |
| 5282 | 5263 | kind: |
| 5283 | TraitItemKind::Const(_, Some(ConstItemRhs::Body(body)), _) | |
| 5264 | TraitItemKind::Const(_, Some(ConstItemRhs::Body(body))) | |
| 5284 | 5265 | | TraitItemKind::Fn(_, TraitFn::Provided(body)), |
| 5285 | 5266 | .. |
| 5286 | 5267 | }) |
compiler/rustc_hir/src/intravisit.rs+1-1| ... | ... | @@ -1273,7 +1273,7 @@ pub fn walk_trait_item<'v, V: Visitor<'v>>( |
| 1273 | 1273 | try_visit!(visitor.visit_defaultness(&defaultness)); |
| 1274 | 1274 | try_visit!(visitor.visit_id(hir_id)); |
| 1275 | 1275 | match *kind { |
| 1276 | TraitItemKind::Const(ref ty, default, _) => { | |
| 1276 | TraitItemKind::Const(ref ty, default) => { | |
| 1277 | 1277 | try_visit!(visitor.visit_ty_unambig(ty)); |
| 1278 | 1278 | visit_opt!(visitor, visit_const_item_rhs, default); |
| 1279 | 1279 | } |
compiler/rustc_hir_analysis/src/check/check.rs+1-8| ... | ... | @@ -974,7 +974,6 @@ pub(crate) fn check_item_type(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Result<(), |
| 974 | 974 | tcx.ensure_ok().generics_of(def_id); |
| 975 | 975 | tcx.ensure_ok().type_of(def_id); |
| 976 | 976 | tcx.ensure_ok().predicates_of(def_id); |
| 977 | check_type_alias_type_params_are_used(tcx, def_id); | |
| 978 | 977 | let ty = tcx.type_of(def_id).instantiate_identity(); |
| 979 | 978 | let span = tcx.def_span(def_id); |
| 980 | 979 | if tcx.type_alias_is_lazy(def_id) { |
| ... | ... | @@ -988,8 +987,8 @@ pub(crate) fn check_item_type(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Result<(), |
| 988 | 987 | check_where_clauses(wfcx, def_id); |
| 989 | 988 | Ok(()) |
| 990 | 989 | })); |
| 991 | check_variances_for_type_defn(tcx, def_id); | |
| 992 | 990 | } else { |
| 991 | check_type_alias_type_params_are_used(tcx, def_id); | |
| 993 | 992 | res = res.and(enter_wf_checking_ctxt(tcx, def_id, |wfcx| { |
| 994 | 993 | // HACK: We sometimes incidentally check that const arguments have the correct |
| 995 | 994 | // type as a side effect of the anon const desugaring. To make this "consistent" |
| ... | ... | @@ -2064,12 +2063,6 @@ fn detect_discriminant_duplicate<'tcx>(tcx: TyCtxt<'tcx>, adt: ty::AdtDef<'tcx>) |
| 2064 | 2063 | } |
| 2065 | 2064 | |
| 2066 | 2065 | fn check_type_alias_type_params_are_used<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) { |
| 2067 | if tcx.type_alias_is_lazy(def_id) { | |
| 2068 | // Since we compute the variances for lazy type aliases and already reject bivariant | |
| 2069 | // parameters as unused, we can and should skip this check for lazy type aliases. | |
| 2070 | return; | |
| 2071 | } | |
| 2072 | ||
| 2073 | 2066 | let generics = tcx.generics_of(def_id); |
| 2074 | 2067 | if generics.own_counts().types == 0 { |
| 2075 | 2068 | return; |
compiler/rustc_hir_analysis/src/check/wfcheck.rs+4-19| ... | ... | @@ -2049,12 +2049,6 @@ pub(super) fn check_variances_for_type_defn<'tcx>(tcx: TyCtxt<'tcx>, def_id: Loc |
| 2049 | 2049 | DefKind::Enum | DefKind::Struct | DefKind::Union => { |
| 2050 | 2050 | // Ok |
| 2051 | 2051 | } |
| 2052 | DefKind::TyAlias => { | |
| 2053 | assert!( | |
| 2054 | tcx.type_alias_is_lazy(def_id), | |
| 2055 | "should not be computing variance of non-free type alias" | |
| 2056 | ); | |
| 2057 | } | |
| 2058 | 2052 | kind => span_bug!(tcx.def_span(def_id), "cannot compute the variances of {kind:?}"), |
| 2059 | 2053 | } |
| 2060 | 2054 | |
| ... | ... | @@ -2206,7 +2200,6 @@ fn report_bivariance<'tcx>( |
| 2206 | 2200 | errors::UnusedGenericParameterHelp::AdtNoPhantomData { param_name } |
| 2207 | 2201 | } |
| 2208 | 2202 | } |
| 2209 | ItemKind::TyAlias(..) => errors::UnusedGenericParameterHelp::TyAlias { param_name }, | |
| 2210 | 2203 | item_kind => bug!("report_bivariance: unexpected item kind: {item_kind:?}"), |
| 2211 | 2204 | }; |
| 2212 | 2205 | |
| ... | ... | @@ -2288,9 +2281,6 @@ impl<'tcx> IsProbablyCyclical<'tcx> { |
| 2288 | 2281 | .visit_with(self) |
| 2289 | 2282 | }) |
| 2290 | 2283 | } |
| 2291 | DefKind::TyAlias if self.tcx.type_alias_is_lazy(def_id) => { | |
| 2292 | self.tcx.type_of(def_id).instantiate_identity().skip_norm_wip().visit_with(self) | |
| 2293 | } | |
| 2294 | 2284 | _ => ControlFlow::Continue(()), |
| 2295 | 2285 | } |
| 2296 | 2286 | } |
| ... | ... | @@ -2300,17 +2290,12 @@ impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for IsProbablyCyclical<'tcx> { |
| 2300 | 2290 | type Result = ControlFlow<(), ()>; |
| 2301 | 2291 | |
| 2302 | 2292 | fn visit_ty(&mut self, ty: Ty<'tcx>) -> ControlFlow<(), ()> { |
| 2303 | let def_id = match ty.kind() { | |
| 2304 | ty::Adt(adt_def, _) => Some(adt_def.did()), | |
| 2305 | &ty::Alias(ty::AliasTy { kind: ty::Free { def_id }, .. }) => Some(def_id), | |
| 2306 | _ => None, | |
| 2307 | }; | |
| 2308 | if let Some(def_id) = def_id { | |
| 2309 | if def_id == self.item_def_id { | |
| 2293 | if let Some(adt_def) = ty.ty_adt_def() { | |
| 2294 | if adt_def.did() == self.item_def_id { | |
| 2310 | 2295 | return ControlFlow::Break(()); |
| 2311 | 2296 | } |
| 2312 | if self.seen.insert(def_id) { | |
| 2313 | self.visit_def(def_id)?; | |
| 2297 | if self.seen.insert(adt_def.did()) { | |
| 2298 | self.visit_def(adt_def.did())?; | |
| 2314 | 2299 | } |
| 2315 | 2300 | } |
| 2316 | 2301 | ty.super_visit_with(self) |
compiler/rustc_hir_analysis/src/collect.rs+4-5| ... | ... | @@ -1673,8 +1673,7 @@ fn is_anon_const_rhs_of_const_item<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) |
| 1673 | 1673 | let (Node::Item(hir::Item { kind: hir::ItemKind::Const(_, _, _, ct_rhs), .. }) |
| 1674 | 1674 | | Node::ImplItem(hir::ImplItem { kind: hir::ImplItemKind::Const(_, ct_rhs), .. }) |
| 1675 | 1675 | | Node::TraitItem(hir::TraitItem { |
| 1676 | kind: hir::TraitItemKind::Const(_, Some(ct_rhs), _), | |
| 1677 | .. | |
| 1676 | kind: hir::TraitItemKind::Const(_, Some(ct_rhs)), .. | |
| 1678 | 1677 | })) = grandparent_node |
| 1679 | 1678 | else { |
| 1680 | 1679 | return false; |
| ... | ... | @@ -1718,9 +1717,9 @@ fn const_of_item<'tcx>( |
| 1718 | 1717 | ) -> ty::EarlyBinder<'tcx, Const<'tcx>> { |
| 1719 | 1718 | let ct_rhs = match tcx.hir_node_by_def_id(def_id) { |
| 1720 | 1719 | hir::Node::Item(hir::Item { kind: hir::ItemKind::Const(.., ct), .. }) => *ct, |
| 1721 | hir::Node::TraitItem(hir::TraitItem { | |
| 1722 | kind: hir::TraitItemKind::Const(_, ct, _), .. | |
| 1723 | }) => ct.expect("no default value for trait assoc const"), | |
| 1720 | hir::Node::TraitItem(hir::TraitItem { kind: hir::TraitItemKind::Const(_, ct), .. }) => { | |
| 1721 | ct.expect("no default value for trait assoc const") | |
| 1722 | } | |
| 1724 | 1723 | hir::Node::ImplItem(hir::ImplItem { kind: hir::ImplItemKind::Const(.., ct), .. }) => *ct, |
| 1725 | 1724 | _ => { |
| 1726 | 1725 | span_bug!(tcx.def_span(def_id), "`const_of_item` expected a const or assoc const item") |
compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs+1-1| ... | ... | @@ -860,7 +860,7 @@ impl<'a, 'tcx> Visitor<'tcx> for BoundVarContext<'a, 'tcx> { |
| 860 | 860 | } |
| 861 | 861 | }) |
| 862 | 862 | } |
| 863 | Const(_, _, _) => self.visit_early(trait_item.hir_id(), trait_item.generics, |this| { | |
| 863 | Const(_, _) => self.visit_early(trait_item.hir_id(), trait_item.generics, |this| { | |
| 864 | 864 | intravisit::walk_trait_item(this, trait_item) |
| 865 | 865 | }), |
| 866 | 866 | } |
compiler/rustc_hir_analysis/src/collect/type_of.rs+1-1| ... | ... | @@ -62,7 +62,7 @@ pub(super) fn type_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::EarlyBinder<'_ |
| 62 | 62 | let args = ty::GenericArgs::identity_for_item(tcx, def_id); |
| 63 | 63 | Ty::new_fn_def(tcx, def_id.to_def_id(), args) |
| 64 | 64 | } |
| 65 | TraitItemKind::Const(ty, rhs, _) => rhs | |
| 65 | TraitItemKind::Const(ty, rhs) => rhs | |
| 66 | 66 | .and_then(|rhs| { |
| 67 | 67 | ty.is_suggestable_infer_ty().then(|| { |
| 68 | 68 | infer_placeholder_type( |
compiler/rustc_hir_analysis/src/delegation.rs+4-17| ... | ... | @@ -5,9 +5,9 @@ |
| 5 | 5 | use std::debug_assert_matches; |
| 6 | 6 | |
| 7 | 7 | use rustc_data_structures::fx::FxHashMap; |
| 8 | use rustc_hir::PathSegment; | |
| 8 | 9 | use rustc_hir::def::DefKind; |
| 9 | 10 | use rustc_hir::def_id::{DefId, LocalDefId}; |
| 10 | use rustc_hir::{DelegationInfo, PathSegment}; | |
| 11 | 11 | use rustc_middle::ty::{ |
| 12 | 12 | self, EarlyBinder, Ty, TyCtxt, TypeFoldable, TypeFolder, TypeSuperFoldable, TypeVisitableExt, |
| 13 | 13 | }; |
| ... | ... | @@ -71,19 +71,6 @@ enum SelfPositionKind { |
| 71 | 71 | None, |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | pub fn opt_get_delegation_info( | |
| 75 | tcx: TyCtxt<'_>, | |
| 76 | delegation_id: LocalDefId, | |
| 77 | ) -> Option<&DelegationInfo> { | |
| 78 | tcx.hir_node(tcx.local_def_id_to_hir_id(delegation_id)) | |
| 79 | .fn_sig() | |
| 80 | .and_then(|sig| sig.decl.opt_delegation_info()) | |
| 81 | } | |
| 82 | ||
| 83 | fn get_delegation_info(tcx: TyCtxt<'_>, delegation_id: LocalDefId) -> &DelegationInfo { | |
| 84 | opt_get_delegation_info(tcx, delegation_id).expect("processing delegation") | |
| 85 | } | |
| 86 | ||
| 87 | 74 | fn create_self_position_kind( |
| 88 | 75 | tcx: TyCtxt<'_>, |
| 89 | 76 | delegation_id: LocalDefId, |
| ... | ... | @@ -96,7 +83,7 @@ fn create_self_position_kind( |
| 96 | 83 | | (FnKind::AssocTrait, FnKind::Free) => SelfPositionKind::Zero, |
| 97 | 84 | |
| 98 | 85 | (FnKind::Free, FnKind::AssocTrait) => { |
| 99 | let propagate_self_ty = get_delegation_info(tcx, delegation_id).propagate_self_ty; | |
| 86 | let propagate_self_ty = tcx.hir_delegation_info(delegation_id).propagate_self_ty; | |
| 100 | 87 | SelfPositionKind::AfterLifetimes(propagate_self_ty) |
| 101 | 88 | } |
| 102 | 89 | |
| ... | ... | @@ -282,7 +269,7 @@ fn get_parent_and_inheritance_kind<'tcx>( |
| 282 | 269 | } |
| 283 | 270 | |
| 284 | 271 | fn get_delegation_self_ty_or_err(tcx: TyCtxt<'_>, delegation_id: LocalDefId) -> Ty<'_> { |
| 285 | get_delegation_info(tcx, delegation_id) | |
| 272 | tcx.hir_delegation_info(delegation_id) | |
| 286 | 273 | .self_ty_id |
| 287 | 274 | .map(|id| { |
| 288 | 275 | let ctx = ItemCtxt::new(tcx, delegation_id); |
| ... | ... | @@ -644,7 +631,7 @@ pub(crate) fn delegation_user_specified_args<'tcx>( |
| 644 | 631 | tcx: TyCtxt<'tcx>, |
| 645 | 632 | delegation_id: LocalDefId, |
| 646 | 633 | ) -> (&'tcx [ty::GenericArg<'tcx>], &'tcx [ty::GenericArg<'tcx>]) { |
| 647 | let info = get_delegation_info(tcx, delegation_id); | |
| 634 | let info = tcx.hir_delegation_info(delegation_id); | |
| 648 | 635 | |
| 649 | 636 | let get_segment = |hir_id| -> Option<(&'tcx PathSegment<'tcx>, DefId)> { |
| 650 | 637 | let segment = tcx.hir_node(hir_id).expect_path_segment(); |
compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs+62-35| ... | ... | @@ -297,7 +297,7 @@ pub enum PermitVariants { |
| 297 | 297 | |
| 298 | 298 | #[derive(Debug, Clone, Copy)] |
| 299 | 299 | enum TypeRelativePath<'tcx> { |
| 300 | AssocItem(DefId, GenericArgsRef<'tcx>), | |
| 300 | AssocItem(ty::AliasTerm<'tcx>), | |
| 301 | 301 | Variant { adt: Ty<'tcx>, variant_did: DefId }, |
| 302 | 302 | Ctor { ctor_def_id: DefId, args: GenericArgsRef<'tcx> }, |
| 303 | 303 | } |
| ... | ... | @@ -1356,15 +1356,10 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { |
| 1356 | 1356 | span, |
| 1357 | 1357 | LowerTypeRelativePathMode::Type(permit_variants), |
| 1358 | 1358 | )? { |
| 1359 | TypeRelativePath::AssocItem(def_id, args) => { | |
| 1360 | let alias_ty = ty::AliasTy::new_from_args( | |
| 1361 | tcx, | |
| 1362 | ty::AliasTyKind::new_from_def_id(tcx, def_id), | |
| 1363 | args, | |
| 1364 | ); | |
| 1365 | let ty = Ty::new_alias(tcx, alias_ty); | |
| 1359 | TypeRelativePath::AssocItem(alias_term) => { | |
| 1360 | let ty = alias_term.expect_ty().to_ty(tcx); | |
| 1366 | 1361 | let ty = self.check_param_uses_if_mcg(ty, span, false); |
| 1367 | Ok((ty, tcx.def_kind(def_id), def_id)) | |
| 1362 | Ok((ty, tcx.def_kind(alias_term.def_id()), alias_term.def_id())) | |
| 1368 | 1363 | } |
| 1369 | 1364 | TypeRelativePath::Variant { adt, variant_did } => { |
| 1370 | 1365 | let adt = self.check_param_uses_if_mcg(adt, span, false); |
| ... | ... | @@ -1396,16 +1391,9 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { |
| 1396 | 1391 | span, |
| 1397 | 1392 | LowerTypeRelativePathMode::Const, |
| 1398 | 1393 | )? { |
| 1399 | TypeRelativePath::AssocItem(def_id, args) => { | |
| 1400 | self.require_type_const_attribute(def_id, span)?; | |
| 1401 | let ct = Const::new_unevaluated( | |
| 1402 | tcx, | |
| 1403 | ty::UnevaluatedConst::new( | |
| 1404 | tcx, | |
| 1405 | ty::UnevaluatedConstKind::new_from_def_id(tcx, def_id), | |
| 1406 | args, | |
| 1407 | ), | |
| 1408 | ); | |
| 1394 | TypeRelativePath::AssocItem(alias_term) => { | |
| 1395 | self.require_type_const_attribute(alias_term.def_id(), span)?; | |
| 1396 | let ct = Const::new_unevaluated(tcx, alias_term.expect_ct()); | |
| 1409 | 1397 | let ct = self.check_param_uses_if_mcg(ct, span, false); |
| 1410 | 1398 | Ok(ct) |
| 1411 | 1399 | } |
| ... | ... | @@ -1487,7 +1475,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { |
| 1487 | 1475 | } |
| 1488 | 1476 | |
| 1489 | 1477 | // FIXME(inherent_associated_types, #106719): Support self types other than ADTs. |
| 1490 | if let Some((did, args)) = self.probe_inherent_assoc_item( | |
| 1478 | if let Some(alias_term) = self.probe_inherent_assoc_item( | |
| 1491 | 1479 | segment, |
| 1492 | 1480 | adt_def.did(), |
| 1493 | 1481 | self_ty, |
| ... | ... | @@ -1495,7 +1483,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { |
| 1495 | 1483 | span, |
| 1496 | 1484 | mode.assoc_tag(), |
| 1497 | 1485 | )? { |
| 1498 | return Ok(TypeRelativePath::AssocItem(did, args)); | |
| 1486 | return Ok(TypeRelativePath::AssocItem(alias_term)); | |
| 1499 | 1487 | } |
| 1500 | 1488 | } |
| 1501 | 1489 | |
| ... | ... | @@ -1529,7 +1517,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { |
| 1529 | 1517 | ); |
| 1530 | 1518 | } |
| 1531 | 1519 | |
| 1532 | Ok(TypeRelativePath::AssocItem(item_def_id, args)) | |
| 1520 | Ok(TypeRelativePath::AssocItem(ty::AliasTerm::new_from_def_id(tcx, item_def_id, args))) | |
| 1533 | 1521 | } |
| 1534 | 1522 | |
| 1535 | 1523 | /// Resolve a [type-relative](hir::QPath::TypeRelative) (and type-level) path. |
| ... | ... | @@ -1609,7 +1597,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { |
| 1609 | 1597 | block: HirId, |
| 1610 | 1598 | span: Span, |
| 1611 | 1599 | assoc_tag: ty::AssocTag, |
| 1612 | ) -> Result<Option<(DefId, GenericArgsRef<'tcx>)>, ErrorGuaranteed> { | |
| 1600 | ) -> Result<Option<ty::AliasTerm<'tcx>>, ErrorGuaranteed> { | |
| 1613 | 1601 | let tcx = self.tcx(); |
| 1614 | 1602 | |
| 1615 | 1603 | if !tcx.features().inherent_associated_types() { |
| ... | ... | @@ -1692,7 +1680,18 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { |
| 1692 | 1680 | .chain(args.into_iter().skip(parent_args.len())), |
| 1693 | 1681 | ); |
| 1694 | 1682 | |
| 1695 | Ok(Some((assoc_item, args))) | |
| 1683 | let kind = match assoc_tag { | |
| 1684 | ty::AssocTag::Type => ty::AliasTermKind::InherentTy { def_id: assoc_item }, | |
| 1685 | ty::AssocTag::Const => { | |
| 1686 | // FIXME(mgca): drop once `InherentConst` accepts IAC-shaped args (issue #156181) | |
| 1687 | // without this, `new_from_args` errors (#155341). | |
| 1688 | self.require_type_const_attribute(assoc_item, span)?; | |
| 1689 | ty::AliasTermKind::InherentConst { def_id: assoc_item } | |
| 1690 | } | |
| 1691 | ty::AssocTag::Fn => unreachable!(), | |
| 1692 | }; | |
| 1693 | ||
| 1694 | Ok(Some(ty::AliasTerm::new_from_args(tcx, kind, args))) | |
| 1696 | 1695 | } |
| 1697 | 1696 | |
| 1698 | 1697 | /// Given name and kind search for the assoc item in the provided scope and check if it's accessible[^1]. |
| ... | ... | @@ -2713,33 +2712,61 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { |
| 2713 | 2712 | ), |
| 2714 | 2713 | ) |
| 2715 | 2714 | } |
| 2716 | Res::Def(DefKind::Ctor(ctor_of, CtorKind::Const), did) => { | |
| 2715 | Res::Def(kind @ DefKind::Ctor(ctor_of, CtorKind::Const), did) => { | |
| 2717 | 2716 | assert_eq!(opt_self_ty, None); |
| 2718 | let [leading_segments @ .., segment] = path.segments else { bug!() }; | |
| 2719 | let _ = self | |
| 2720 | .prohibit_generic_args(leading_segments.iter(), GenericsArgsErrExtend::None); | |
| 2717 | let generic_segments = | |
| 2718 | self.probe_generic_path_segments(path.segments, opt_self_ty, kind, did, span); | |
| 2719 | let indices: FxHashSet<_> = | |
| 2720 | generic_segments.iter().map(|GenericPathSegment(_, index)| index).collect(); | |
| 2721 | let _ = self.prohibit_generic_args( | |
| 2722 | path.segments.iter().enumerate().filter_map(|(index, seg)| { | |
| 2723 | if !indices.contains(&index) { Some(seg) } else { None } | |
| 2724 | }), | |
| 2725 | GenericsArgsErrExtend::DefVariant(&path.segments), | |
| 2726 | ); | |
| 2721 | 2727 | |
| 2722 | 2728 | let parent_did = tcx.parent(did); |
| 2723 | 2729 | let generics_did = match ctor_of { |
| 2724 | 2730 | CtorOf::Variant => tcx.parent(parent_did), |
| 2725 | 2731 | CtorOf::Struct => parent_did, |
| 2726 | 2732 | }; |
| 2727 | let args = self.lower_generic_args_of_path_segment(span, generics_did, segment); | |
| 2728 | ||
| 2733 | let args = self.lower_generic_args_of_path_segment( | |
| 2734 | span, | |
| 2735 | generics_did, | |
| 2736 | &path.segments[generic_segments[0].1], | |
| 2737 | ); | |
| 2729 | 2738 | self.construct_const_ctor_value(did, ctor_of, args) |
| 2730 | 2739 | } |
| 2731 | Res::Def(DefKind::Ctor(_, CtorKind::Fn), did) => { | |
| 2740 | Res::Def(DefKind::Ctor(ctor_of, CtorKind::Fn), did) => { | |
| 2732 | 2741 | assert_eq!(opt_self_ty, None); |
| 2733 | let [leading_segments @ .., segment] = path.segments else { bug!() }; | |
| 2734 | let _ = self | |
| 2735 | .prohibit_generic_args(leading_segments.iter(), GenericsArgsErrExtend::None); | |
| 2742 | let generic_segments = self.probe_generic_path_segments( | |
| 2743 | path.segments, | |
| 2744 | opt_self_ty, | |
| 2745 | DefKind::Ctor(ctor_of, CtorKind::Const), | |
| 2746 | did, | |
| 2747 | span, | |
| 2748 | ); | |
| 2749 | let indices: FxHashSet<_> = | |
| 2750 | generic_segments.iter().map(|GenericPathSegment(_, index)| index).collect(); | |
| 2751 | let _ = self.prohibit_generic_args( | |
| 2752 | path.segments.iter().enumerate().filter_map(|(index, seg)| { | |
| 2753 | if !indices.contains(&index) { Some(seg) } else { None } | |
| 2754 | }), | |
| 2755 | GenericsArgsErrExtend::DefVariant(&path.segments), | |
| 2756 | ); | |
| 2757 | ||
| 2736 | 2758 | let parent_did = tcx.parent(did); |
| 2737 | 2759 | let generics_did = if let DefKind::Ctor(CtorOf::Variant, _) = tcx.def_kind(did) { |
| 2738 | 2760 | tcx.parent(parent_did) |
| 2739 | 2761 | } else { |
| 2740 | 2762 | parent_did |
| 2741 | 2763 | }; |
| 2742 | let args = self.lower_generic_args_of_path_segment(span, generics_did, segment); | |
| 2764 | let args = self.lower_generic_args_of_path_segment( | |
| 2765 | span, | |
| 2766 | generics_did, | |
| 2767 | &path.segments[generic_segments[0].1], | |
| 2768 | ); | |
| 2769 | ||
| 2743 | 2770 | ty::Const::zero_sized(tcx, Ty::new_fn_def(tcx, did, args)) |
| 2744 | 2771 | } |
| 2745 | 2772 | Res::Def(DefKind::AssocConst { .. }, did) => { |
compiler/rustc_hir_analysis/src/hir_wf_check.rs+1-1| ... | ... | @@ -139,7 +139,7 @@ pub(super) fn diagnostic_hir_wf_check<'tcx>( |
| 139 | 139 | }, |
| 140 | 140 | hir::Node::TraitItem(item) => match item.kind { |
| 141 | 141 | hir::TraitItemKind::Type(_, ty) => ty.into_iter().collect(), |
| 142 | hir::TraitItemKind::Const(ty, _, _) => vec![ty], | |
| 142 | hir::TraitItemKind::Const(ty, _) => vec![ty], | |
| 143 | 143 | ref item => bug!("Unexpected TraitItem {:?}", item), |
| 144 | 144 | }, |
| 145 | 145 | hir::Node::Item(item) => match item.kind { |
compiler/rustc_hir_analysis/src/variance/constraints.rs+4-16| ... | ... | @@ -79,9 +79,6 @@ pub(crate) fn add_constraints_from_crate<'a, 'tcx>( |
| 79 | 79 | } |
| 80 | 80 | } |
| 81 | 81 | DefKind::Fn | DefKind::AssocFn => constraint_cx.build_constraints_for_item(def_id), |
| 82 | DefKind::TyAlias if tcx.type_alias_is_lazy(def_id) => { | |
| 83 | constraint_cx.build_constraints_for_item(def_id) | |
| 84 | } | |
| 85 | 82 | _ => {} |
| 86 | 83 | } |
| 87 | 84 | } |
| ... | ... | @@ -107,15 +104,6 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> { |
| 107 | 104 | let current_item = &CurrentItem { inferred_start }; |
| 108 | 105 | let ty = tcx.type_of(def_id).instantiate_identity().skip_norm_wip(); |
| 109 | 106 | |
| 110 | // The type as returned by `type_of` is the underlying type and generally not a free alias. | |
| 111 | // Therefore we need to check the `DefKind` first. | |
| 112 | if let DefKind::TyAlias = tcx.def_kind(def_id) | |
| 113 | && tcx.type_alias_is_lazy(def_id) | |
| 114 | { | |
| 115 | self.add_constraints_from_ty(current_item, ty, self.covariant); | |
| 116 | return; | |
| 117 | } | |
| 118 | ||
| 119 | 107 | match ty.kind() { |
| 120 | 108 | ty::Adt(def, _) => { |
| 121 | 109 | // Not entirely obvious: constraints on structs/enums do not |
| ... | ... | @@ -216,14 +204,13 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> { |
| 216 | 204 | /// Adds constraints appropriate for an instance of `ty` appearing |
| 217 | 205 | /// in a context with the generics defined in `generics` and |
| 218 | 206 | /// ambient variance `variance` |
| 207 | #[instrument(level = "debug", skip(self, current))] | |
| 219 | 208 | fn add_constraints_from_ty( |
| 220 | 209 | &mut self, |
| 221 | 210 | current: &CurrentItem, |
| 222 | 211 | ty: Ty<'tcx>, |
| 223 | 212 | variance: VarianceTermPtr<'a>, |
| 224 | 213 | ) { |
| 225 | debug!("add_constraints_from_ty(ty={:?}, variance={:?})", ty, variance); | |
| 226 | ||
| 227 | 214 | match *ty.kind() { |
| 228 | 215 | ty::Bool |
| 229 | 216 | | ty::Char |
| ... | ... | @@ -281,8 +268,9 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> { |
| 281 | 268 | self.add_constraints_from_invariant_args(current, args, variance); |
| 282 | 269 | } |
| 283 | 270 | |
| 284 | ty::Alias(ty::AliasTy { kind: ty::Free { def_id }, args, .. }) => { | |
| 285 | self.add_constraints_from_args(current, def_id, args, variance); | |
| 271 | ty::Alias(ty::AliasTy { kind: ty::Free { .. }, .. }) => { | |
| 272 | let ty = self.tcx().expand_free_alias_tys(ty); | |
| 273 | self.add_constraints_from_ty(current, ty, variance); | |
| 286 | 274 | } |
| 287 | 275 | |
| 288 | 276 | ty::Dynamic(data, r) => { |
compiler/rustc_hir_analysis/src/variance/dump.rs+3-5| ... | ... | @@ -38,18 +38,16 @@ pub(crate) fn variances(tcx: TyCtxt<'_>) { |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | match tcx.def_kind(id) { |
| 41 | DefKind::AssocFn | DefKind::Fn | DefKind::Enum | DefKind::Struct | DefKind::Union => {} | |
| 42 | DefKind::TyAlias if tcx.type_alias_is_lazy(id) => {} | |
| 41 | DefKind::AssocFn | DefKind::Fn | DefKind::Enum | DefKind::Struct | DefKind::Union => { | |
| 42 | tcx.dcx().span_err(tcx.def_span(id), format_variances(tcx, id.def_id)); | |
| 43 | } | |
| 43 | 44 | kind => { |
| 44 | 45 | let message = format!( |
| 45 | 46 | "attr parsing didn't report an error for `#[{}]` on {kind:?}", |
| 46 | 47 | rustc_span::sym::rustc_dump_variances, |
| 47 | 48 | ); |
| 48 | 49 | tcx.dcx().span_delayed_bug(tcx.def_span(id), message); |
| 49 | continue; | |
| 50 | 50 | } |
| 51 | 51 | } |
| 52 | ||
| 53 | tcx.dcx().span_err(tcx.def_span(id), format_variances(tcx, id.def_id)); | |
| 54 | 52 | } |
| 55 | 53 | } |
compiler/rustc_hir_analysis/src/variance/mod.rs-5| ... | ... | @@ -52,11 +52,6 @@ pub(super) fn variances_of(tcx: TyCtxt<'_>, item_def_id: LocalDefId) -> &[ty::Va |
| 52 | 52 | let crate_map = tcx.crate_variances(()); |
| 53 | 53 | return crate_map.variances.get(&item_def_id.to_def_id()).copied().unwrap_or(&[]); |
| 54 | 54 | } |
| 55 | DefKind::TyAlias if tcx.type_alias_is_lazy(item_def_id) => { | |
| 56 | // These are inferred. | |
| 57 | let crate_map = tcx.crate_variances(()); | |
| 58 | return crate_map.variances.get(&item_def_id.to_def_id()).copied().unwrap_or(&[]); | |
| 59 | } | |
| 60 | 55 | DefKind::AssocTy => match tcx.opt_rpitit_info(item_def_id.to_def_id()) { |
| 61 | 56 | Some(ty::ImplTraitInTraitData::Trait { opaque_def_id, .. }) => { |
| 62 | 57 | return variance_of_opaque( |
compiler/rustc_hir_analysis/src/variance/terms.rs-3| ... | ... | @@ -99,9 +99,6 @@ pub(crate) fn determine_parameters_to_be_inferred<'a, 'tcx>( |
| 99 | 99 | } |
| 100 | 100 | } |
| 101 | 101 | DefKind::Fn | DefKind::AssocFn => terms_cx.add_inferreds_for_item(def_id), |
| 102 | DefKind::TyAlias if tcx.type_alias_is_lazy(def_id) => { | |
| 103 | terms_cx.add_inferreds_for_item(def_id) | |
| 104 | } | |
| 105 | 102 | _ => {} |
| 106 | 103 | } |
| 107 | 104 | } |
compiler/rustc_hir_pretty/src/lib.rs+1-1| ... | ... | @@ -951,7 +951,7 @@ impl<'a> State<'a> { |
| 951 | 951 | self.maybe_print_comment(ti.span.lo()); |
| 952 | 952 | self.print_attrs(self.attrs(ti.hir_id())); |
| 953 | 953 | match ti.kind { |
| 954 | hir::TraitItemKind::Const(ty, default, _) => { | |
| 954 | hir::TraitItemKind::Const(ty, default) => { | |
| 955 | 955 | self.print_associated_const(ti.ident, ti.generics, ty, default); |
| 956 | 956 | } |
| 957 | 957 | hir::TraitItemKind::Fn(ref sig, hir::TraitFn::Required(arg_idents)) => { |
compiler/rustc_hir_typeck/src/callee.rs+3-2| ... | ... | @@ -7,7 +7,6 @@ use rustc_hir::def::{self, CtorKind, Namespace, Res}; |
| 7 | 7 | use rustc_hir::def_id::DefId; |
| 8 | 8 | use rustc_hir::{self as hir, HirId, LangItem, find_attr}; |
| 9 | 9 | use rustc_hir_analysis::autoderef::Autoderef; |
| 10 | use rustc_hir_analysis::delegation::opt_get_delegation_info; | |
| 11 | 10 | use rustc_infer::infer::BoundRegionConversionTime; |
| 12 | 11 | use rustc_infer::traits::{Obligation, ObligationCause, ObligationCauseCode}; |
| 13 | 12 | use rustc_middle::ty::adjustment::{ |
| ... | ... | @@ -701,7 +700,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { |
| 701 | 700 | // by comparing their hir ids (otherwise we will encounter errors in nested delegations, |
| 702 | 701 | // see tests\ui\delegation\impl-reuse-pass.rs:237). |
| 703 | 702 | let parent_def = self.tcx.hir_get_parent_item(call_expr.hir_id).def_id; |
| 704 | let Some(info) = opt_get_delegation_info(self.tcx, parent_def) else { return None }; | |
| 703 | let Some(info) = self.tcx.hir_opt_delegation_info(parent_def) else { | |
| 704 | return None; | |
| 705 | }; | |
| 705 | 706 | |
| 706 | 707 | if call_expr.hir_id != info.call_expr_id { |
| 707 | 708 | return None; |
compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs+13-2| ... | ... | @@ -13,7 +13,6 @@ use rustc_hir::def_id::DefId; |
| 13 | 13 | use rustc_hir::intravisit::Visitor; |
| 14 | 14 | use rustc_hir::{Expr, ExprKind, FnRetTy, HirId, LangItem, Node, QPath, is_range_literal}; |
| 15 | 15 | use rustc_hir_analysis::check::potentially_plural_count; |
| 16 | use rustc_hir_analysis::delegation::opt_get_delegation_info; | |
| 17 | 16 | use rustc_hir_analysis::hir_ty_lowering::{HirTyLowerer, ResolvedStructPath}; |
| 18 | 17 | use rustc_index::IndexVec; |
| 19 | 18 | use rustc_infer::infer::{BoundRegionConversionTime, DefineOpaqueTypes, InferOk, TypeTrace}; |
| ... | ... | @@ -341,7 +340,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { |
| 341 | 340 | |
| 342 | 341 | // If we are processing first arg of delegation then we could have adjusted it |
| 343 | 342 | // in `execute_delegation_aware_arguments_check`. |
| 344 | let checked_ty = opt_get_delegation_info(self.tcx, self.body_id) | |
| 343 | let checked_ty = self | |
| 344 | .tcx | |
| 345 | .hir_opt_delegation_info(self.body_id) | |
| 345 | 346 | .and_then(|_| self.typeck_results.borrow().node_type_opt(provided_arg.hir_id)) |
| 346 | 347 | .unwrap_or_else(|| self.check_expr_with_expectation(provided_arg, expectation)); |
| 347 | 348 | |
| ... | ... | @@ -902,6 +903,16 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { |
| 902 | 903 | |
| 903 | 904 | // Type check the pattern. Override if necessary to avoid knock-on errors. |
| 904 | 905 | self.check_pat_top(decl.pat, decl_ty, ty_span, origin_expr, Some(decl.origin)); |
| 906 | if decl.ty.is_none() | |
| 907 | && decl.init.is_none() | |
| 908 | && !matches!(decl.pat.kind, hir::PatKind::Binding(.., None) | hir::PatKind::Wild) | |
| 909 | { | |
| 910 | self.register_wf_obligation( | |
| 911 | decl_ty.into(), | |
| 912 | decl.pat.span, | |
| 913 | ObligationCauseCode::WellFormed(None), | |
| 914 | ); | |
| 915 | } | |
| 905 | 916 | let pat_ty = self.node_ty(decl.pat.hir_id); |
| 906 | 917 | self.overwrite_local_ty_if_err(decl.hir_id, decl.pat, pat_ty); |
| 907 | 918 |
compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs+13| ... | ... | @@ -2272,6 +2272,19 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { |
| 2272 | 2272 | expected: Ty<'tcx>, |
| 2273 | 2273 | found: Ty<'tcx>, |
| 2274 | 2274 | ) -> bool { |
| 2275 | // don't suggest missing `.expect()` or `?` in destructuring assignments LHS. | |
| 2276 | // If the immediate parent is an Assign Expr, and the LHS and the RHS of that Expr | |
| 2277 | // overlap with each other, it's guaranteed that the expression came from desugaring | |
| 2278 | // a destructuring assignment. | |
| 2279 | let parent_node = self.tcx.parent_hir_node(expr.hir_id); | |
| 2280 | if let hir::Node::Expr(e) = parent_node | |
| 2281 | && let hir::ExprKind::Assign(lhs, rhs, _) = e.kind | |
| 2282 | && rhs.hir_id == expr.hir_id | |
| 2283 | && lhs.span.overlaps(rhs.span) | |
| 2284 | { | |
| 2285 | return false; | |
| 2286 | } | |
| 2287 | ||
| 2275 | 2288 | let ty::Adt(adt, args) = found.kind() else { |
| 2276 | 2289 | return false; |
| 2277 | 2290 | }; |
compiler/rustc_hir_typeck/src/lib.rs+1-3| ... | ... | @@ -286,9 +286,7 @@ fn extend_err_with_const_context( |
| 286 | 286 | ) { |
| 287 | 287 | match node { |
| 288 | 288 | hir::Node::ImplItem(hir::ImplItem { kind: hir::ImplItemKind::Const(ty, _), .. }) |
| 289 | | hir::Node::TraitItem(hir::TraitItem { | |
| 290 | kind: hir::TraitItemKind::Const(ty, _, _), .. | |
| 291 | }) => { | |
| 289 | | hir::Node::TraitItem(hir::TraitItem { kind: hir::TraitItemKind::Const(ty, _), .. }) => { | |
| 292 | 290 | // Point at the `Type` in `const NAME: Type = value;`. |
| 293 | 291 | err.span_label(ty.span, "expected because of the type of the associated constant"); |
| 294 | 292 | } |
compiler/rustc_incremental/src/assert_dep_graph.rs+27-18| ... | ... | @@ -57,8 +57,14 @@ use crate::errors; |
| 57 | 57 | #[allow(missing_docs)] |
| 58 | 58 | pub(crate) fn assert_dep_graph(tcx: TyCtxt<'_>) { |
| 59 | 59 | tcx.dep_graph.with_ignore(|| { |
| 60 | // Clone the retained dep graph once and share it between the graph dump and the path | |
| 61 | // checks below, rather than locking and cloning it separately for each. | |
| 62 | let retained_dep_graph = tcx.dep_graph.retained_dep_graph(); | |
| 63 | ||
| 60 | 64 | if tcx.sess.opts.unstable_opts.dump_dep_graph { |
| 61 | tcx.dep_graph.with_retained_dep_graph(dump_graph); | |
| 65 | if let Some(graph) = &retained_dep_graph { | |
| 66 | dump_graph(graph); | |
| 67 | } | |
| 62 | 68 | } |
| 63 | 69 | |
| 64 | 70 | if !tcx.sess.opts.unstable_opts.query_dep_graph { |
| ... | ... | @@ -92,7 +98,7 @@ pub(crate) fn assert_dep_graph(tcx: TyCtxt<'_>) { |
| 92 | 98 | } |
| 93 | 99 | |
| 94 | 100 | // Check paths. |
| 95 | check_paths(tcx, &if_this_changed, &then_this_would_need); | |
| 101 | check_paths(tcx, retained_dep_graph.as_ref(), &if_this_changed, &then_this_would_need); | |
| 96 | 102 | }) |
| 97 | 103 | } |
| 98 | 104 | |
| ... | ... | @@ -172,30 +178,33 @@ impl<'tcx> Visitor<'tcx> for IfThisChanged<'tcx> { |
| 172 | 178 | } |
| 173 | 179 | } |
| 174 | 180 | |
| 175 | fn check_paths<'tcx>(tcx: TyCtxt<'tcx>, if_this_changed: &Sources, then_this_would_need: &Targets) { | |
| 176 | // Return early here so as not to construct the query, which is not cheap. | |
| 181 | fn check_paths<'tcx>( | |
| 182 | tcx: TyCtxt<'tcx>, | |
| 183 | retained_dep_graph: Option<&RetainedDepGraph>, | |
| 184 | if_this_changed: &Sources, | |
| 185 | then_this_would_need: &Targets, | |
| 186 | ) { | |
| 177 | 187 | if if_this_changed.is_empty() { |
| 178 | 188 | for &(target_span, _, _, _) in then_this_would_need { |
| 179 | 189 | tcx.dcx().emit_err(errors::MissingIfThisChanged { span: target_span }); |
| 180 | 190 | } |
| 181 | 191 | return; |
| 182 | 192 | } |
| 183 | tcx.dep_graph.with_retained_dep_graph(|query| { | |
| 184 | for &(_, source_def_id, ref source_dep_node) in if_this_changed { | |
| 185 | let dependents = query.transitive_predecessors(source_dep_node); | |
| 186 | for &(target_span, ref target_pass, _, ref target_dep_node) in then_this_would_need { | |
| 187 | if !dependents.contains(&target_dep_node) { | |
| 188 | tcx.dcx().emit_err(errors::NoPath { | |
| 189 | span: target_span, | |
| 190 | source: tcx.def_path_str(source_def_id), | |
| 191 | target: *target_pass, | |
| 192 | }); | |
| 193 | } else { | |
| 194 | tcx.dcx().emit_err(errors::Ok { span: target_span }); | |
| 195 | } | |
| 193 | let Some(query) = retained_dep_graph else { return }; | |
| 194 | for &(_, source_def_id, ref source_dep_node) in if_this_changed { | |
| 195 | let dependents = query.transitive_predecessors(source_dep_node); | |
| 196 | for &(target_span, ref target_pass, _, ref target_dep_node) in then_this_would_need { | |
| 197 | if !dependents.contains(&target_dep_node) { | |
| 198 | tcx.dcx().emit_err(errors::NoPath { | |
| 199 | span: target_span, | |
| 200 | source: tcx.def_path_str(source_def_id), | |
| 201 | target: *target_pass, | |
| 202 | }); | |
| 203 | } else { | |
| 204 | tcx.dcx().emit_err(errors::Ok { span: target_span }); | |
| 196 | 205 | } |
| 197 | 206 | } |
| 198 | }); | |
| 207 | } | |
| 199 | 208 | } |
| 200 | 209 | |
| 201 | 210 | fn dump_graph(graph: &RetainedDepGraph) { |
compiler/rustc_incremental/src/persist/file_format.rs+2-2| ... | ... | @@ -28,7 +28,7 @@ const FILE_MAGIC: &[u8] = b"RSIC"; |
| 28 | 28 | /// Change this if the header format changes. |
| 29 | 29 | const HEADER_FORMAT_VERSION: u16 = 0; |
| 30 | 30 | |
| 31 | pub(crate) fn write_file_header(stream: &mut FileEncoder, sess: &Session) { | |
| 31 | pub(crate) fn write_file_header(stream: &mut FileEncoder<'_>, sess: &Session) { | |
| 32 | 32 | stream.emit_raw_bytes(FILE_MAGIC); |
| 33 | 33 | stream.emit_raw_bytes(&u16::to_le_bytes(HEADER_FORMAT_VERSION)); |
| 34 | 34 | |
| ... | ... | @@ -41,7 +41,7 @@ pub(crate) fn write_file_header(stream: &mut FileEncoder, sess: &Session) { |
| 41 | 41 | |
| 42 | 42 | pub(crate) fn save_in<F>(sess: &Session, path_buf: PathBuf, name: &str, encode: F) |
| 43 | 43 | where |
| 44 | F: FnOnce(FileEncoder) -> FileEncodeResult, | |
| 44 | F: FnOnce(FileEncoder<'static>) -> FileEncodeResult, | |
| 45 | 45 | { |
| 46 | 46 | debug!("save: storing data in {}", path_buf.display()); |
| 47 | 47 |
compiler/rustc_incremental/src/persist/save.rs+1-1| ... | ... | @@ -131,7 +131,7 @@ pub fn save_work_product_index( |
| 131 | 131 | }); |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | fn encode_work_product_index(work_products: &WorkProductMap, encoder: &mut FileEncoder) { | |
| 134 | fn encode_work_product_index(work_products: &WorkProductMap, encoder: &mut FileEncoder<'_>) { | |
| 135 | 135 | let serialized_products: Vec<_> = work_products |
| 136 | 136 | .to_sorted_stable_ord() |
| 137 | 137 | .into_iter() |
compiler/rustc_interface/src/passes.rs+2| ... | ... | @@ -1083,6 +1083,8 @@ fn run_required_analyses(tcx: TyCtxt<'_>) { |
| 1083 | 1083 | // to use `hir_crate_items`. |
| 1084 | 1084 | tcx.ensure_done().hir_crate_items(()); |
| 1085 | 1085 | |
| 1086 | rustc_passes::delegation::check_glob_and_list_delegations_target_expr(tcx); | |
| 1087 | ||
| 1086 | 1088 | let sess = tcx.sess; |
| 1087 | 1089 | sess.time("misc_checking_1", || { |
| 1088 | 1090 | par_fns(&mut [ |
compiler/rustc_metadata/src/creader.rs+27-21| ... | ... | @@ -39,7 +39,7 @@ use rustc_span::{DUMMY_SP, Ident, Span, Symbol, sym}; |
| 39 | 39 | use rustc_target::spec::{PanicStrategy, Target}; |
| 40 | 40 | use tracing::{debug, info, trace}; |
| 41 | 41 | |
| 42 | use crate::errors; | |
| 42 | use crate::diagnostics; | |
| 43 | 43 | use crate::locator::{CrateError, CrateLocator, CratePaths, CrateRejections}; |
| 44 | 44 | use crate::rmeta::{ |
| 45 | 45 | CrateDep, CrateMetadata, CrateNumMap, CrateRoot, MetadataBlob, TargetModifiers, |
| ... | ... | @@ -365,7 +365,7 @@ impl CStore { |
| 365 | 365 | |
| 366 | 366 | match (flag_local_value, flag_extern_value) { |
| 367 | 367 | (Some(local_value), Some(extern_value)) => { |
| 368 | tcx.dcx().emit_err(errors::IncompatibleTargetModifiers { | |
| 368 | tcx.dcx().emit_err(diagnostics::IncompatibleTargetModifiers { | |
| 369 | 369 | span, |
| 370 | 370 | extern_crate, |
| 371 | 371 | local_crate, |
| ... | ... | @@ -376,7 +376,7 @@ impl CStore { |
| 376 | 376 | }) |
| 377 | 377 | } |
| 378 | 378 | (None, Some(extern_value)) => { |
| 379 | tcx.dcx().emit_err(errors::IncompatibleTargetModifiersLMissed { | |
| 379 | tcx.dcx().emit_err(diagnostics::IncompatibleTargetModifiersLMissed { | |
| 380 | 380 | span, |
| 381 | 381 | extern_crate, |
| 382 | 382 | local_crate, |
| ... | ... | @@ -386,7 +386,7 @@ impl CStore { |
| 386 | 386 | }) |
| 387 | 387 | } |
| 388 | 388 | (Some(local_value), None) => { |
| 389 | tcx.dcx().emit_err(errors::IncompatibleTargetModifiersRMissed { | |
| 389 | tcx.dcx().emit_err(diagnostics::IncompatibleTargetModifiersRMissed { | |
| 390 | 390 | span, |
| 391 | 391 | extern_crate, |
| 392 | 392 | local_crate, |
| ... | ... | @@ -458,7 +458,7 @@ impl CStore { |
| 458 | 458 | pub fn report_incompatible_target_modifiers(&self, tcx: TyCtxt<'_>, krate: &Crate) { |
| 459 | 459 | for flag_name in &tcx.sess.opts.cg.unsafe_allow_abi_mismatch { |
| 460 | 460 | if !OptionsTargetModifiers::is_target_modifier(flag_name) { |
| 461 | tcx.dcx().emit_err(errors::UnknownTargetModifierUnsafeAllowed { | |
| 461 | tcx.dcx().emit_err(diagnostics::UnknownTargetModifierUnsafeAllowed { | |
| 462 | 462 | span: krate.spans.inner_span.shrink_to_lo(), |
| 463 | 463 | flag_name: flag_name.clone(), |
| 464 | 464 | }); |
| ... | ... | @@ -502,7 +502,7 @@ impl CStore { |
| 502 | 502 | } |
| 503 | 503 | *errors += 1; |
| 504 | 504 | |
| 505 | tcx.dcx().emit_err(errors::MitigationLessStrictInDependency { | |
| 505 | tcx.dcx().emit_err(diagnostics::MitigationLessStrictInDependency { | |
| 506 | 506 | span: krate.spans.inner_span.shrink_to_lo(), |
| 507 | 507 | mitigation_name: my_mitigation.kind.to_string(), |
| 508 | 508 | mitigation_level: my_mitigation.level.level_str().to_string(), |
| ... | ... | @@ -525,7 +525,7 @@ impl CStore { |
| 525 | 525 | if data.has_async_drops() { |
| 526 | 526 | let extern_crate = data.name(); |
| 527 | 527 | let local_crate = tcx.crate_name(LOCAL_CRATE); |
| 528 | tcx.dcx().emit_warn(errors::AsyncDropTypesInDependency { | |
| 528 | tcx.dcx().emit_warn(diagnostics::AsyncDropTypesInDependency { | |
| 529 | 529 | span: krate.spans.inner_span.shrink_to_lo(), |
| 530 | 530 | extern_crate, |
| 531 | 531 | local_crate, |
| ... | ... | @@ -1034,11 +1034,13 @@ impl CStore { |
| 1034 | 1034 | // Sanity check the loaded crate to ensure it is indeed a panic runtime |
| 1035 | 1035 | // and the panic strategy is indeed what we thought it was. |
| 1036 | 1036 | if !cdata.is_panic_runtime() { |
| 1037 | tcx.dcx().emit_err(errors::CrateNotPanicRuntime { crate_name: name }); | |
| 1037 | tcx.dcx().emit_err(diagnostics::CrateNotPanicRuntime { crate_name: name }); | |
| 1038 | 1038 | } |
| 1039 | 1039 | if cdata.required_panic_strategy() != Some(desired_strategy) { |
| 1040 | tcx.dcx() | |
| 1041 | .emit_err(errors::NoPanicStrategy { crate_name: name, strategy: desired_strategy }); | |
| 1040 | tcx.dcx().emit_err(diagnostics::NoPanicStrategy { | |
| 1041 | crate_name: name, | |
| 1042 | strategy: desired_strategy, | |
| 1043 | }); | |
| 1042 | 1044 | } |
| 1043 | 1045 | |
| 1044 | 1046 | self.injected_panic_runtime = Some(cnum); |
| ... | ... | @@ -1074,7 +1076,7 @@ impl CStore { |
| 1074 | 1076 | |
| 1075 | 1077 | // Sanity check the loaded crate to ensure it is indeed a profiler runtime |
| 1076 | 1078 | if !cdata.is_profiler_runtime() { |
| 1077 | tcx.dcx().emit_err(errors::NotProfilerRuntime { crate_name: name }); | |
| 1079 | tcx.dcx().emit_err(diagnostics::NotProfilerRuntime { crate_name: name }); | |
| 1078 | 1080 | } |
| 1079 | 1081 | } |
| 1080 | 1082 | |
| ... | ... | @@ -1082,8 +1084,10 @@ impl CStore { |
| 1082 | 1084 | self.has_global_allocator = |
| 1083 | 1085 | match &*fn_spans(krate, Symbol::intern(&global_fn_name(sym::alloc))) { |
| 1084 | 1086 | [span1, span2, ..] => { |
| 1085 | tcx.dcx() | |
| 1086 | .emit_err(errors::NoMultipleGlobalAlloc { span2: *span2, span1: *span1 }); | |
| 1087 | tcx.dcx().emit_err(diagnostics::NoMultipleGlobalAlloc { | |
| 1088 | span2: *span2, | |
| 1089 | span1: *span1, | |
| 1090 | }); | |
| 1087 | 1091 | true |
| 1088 | 1092 | } |
| 1089 | 1093 | spans => !spans.is_empty(), |
| ... | ... | @@ -1091,8 +1095,10 @@ impl CStore { |
| 1091 | 1095 | let alloc_error_handler = Symbol::intern(&global_fn_name(ALLOC_ERROR_HANDLER)); |
| 1092 | 1096 | self.has_alloc_error_handler = match &*fn_spans(krate, alloc_error_handler) { |
| 1093 | 1097 | [span1, span2, ..] => { |
| 1094 | tcx.dcx() | |
| 1095 | .emit_err(errors::NoMultipleAllocErrorHandler { span2: *span2, span1: *span1 }); | |
| 1098 | tcx.dcx().emit_err(diagnostics::NoMultipleAllocErrorHandler { | |
| 1099 | span2: *span2, | |
| 1100 | span1: *span1, | |
| 1101 | }); | |
| 1096 | 1102 | true |
| 1097 | 1103 | } |
| 1098 | 1104 | spans => !spans.is_empty(), |
| ... | ... | @@ -1130,7 +1136,7 @@ impl CStore { |
| 1130 | 1136 | if data.has_global_allocator() { |
| 1131 | 1137 | match global_allocator { |
| 1132 | 1138 | Some(other_crate) => { |
| 1133 | tcx.dcx().emit_err(errors::ConflictingGlobalAlloc { | |
| 1139 | tcx.dcx().emit_err(diagnostics::ConflictingGlobalAlloc { | |
| 1134 | 1140 | crate_name: data.name(), |
| 1135 | 1141 | other_crate_name: other_crate, |
| 1136 | 1142 | }); |
| ... | ... | @@ -1144,7 +1150,7 @@ impl CStore { |
| 1144 | 1150 | if data.has_alloc_error_handler() { |
| 1145 | 1151 | match alloc_error_handler { |
| 1146 | 1152 | Some(other_crate) => { |
| 1147 | tcx.dcx().emit_err(errors::ConflictingAllocErrorHandler { | |
| 1153 | tcx.dcx().emit_err(diagnostics::ConflictingAllocErrorHandler { | |
| 1148 | 1154 | crate_name: data.name(), |
| 1149 | 1155 | other_crate_name: other_crate, |
| 1150 | 1156 | }); |
| ... | ... | @@ -1164,7 +1170,7 @@ impl CStore { |
| 1164 | 1170 | if !attr::contains_name(&krate.attrs, sym::default_lib_allocator) |
| 1165 | 1171 | && !self.iter_crate_data().any(|(_, data)| data.has_default_lib_allocator()) |
| 1166 | 1172 | { |
| 1167 | tcx.dcx().emit_err(errors::GlobalAllocRequired); | |
| 1173 | tcx.dcx().emit_err(diagnostics::GlobalAllocRequired); | |
| 1168 | 1174 | } |
| 1169 | 1175 | self.allocator_kind = Some(AllocatorKind::Default); |
| 1170 | 1176 | } |
| ... | ... | @@ -1229,7 +1235,7 @@ impl CStore { |
| 1229 | 1235 | // Sanity check that the loaded crate is `#![compiler_builtins]` |
| 1230 | 1236 | let cdata = self.get_crate_data(cnum); |
| 1231 | 1237 | if !cdata.is_compiler_builtins() { |
| 1232 | tcx.dcx().emit_err(errors::CrateNotCompilerBuiltins { crate_name: cdata.name() }); | |
| 1238 | tcx.dcx().emit_err(diagnostics::CrateNotCompilerBuiltins { crate_name: cdata.name() }); | |
| 1233 | 1239 | } |
| 1234 | 1240 | } |
| 1235 | 1241 | |
| ... | ... | @@ -1261,7 +1267,7 @@ impl CStore { |
| 1261 | 1267 | lint::builtin::UNUSED_CRATE_DEPENDENCIES, |
| 1262 | 1268 | span, |
| 1263 | 1269 | ast::CRATE_NODE_ID, |
| 1264 | errors::UnusedCrateDependency { | |
| 1270 | diagnostics::UnusedCrateDependency { | |
| 1265 | 1271 | extern_crate: name_interned, |
| 1266 | 1272 | local_crate: tcx.crate_name(LOCAL_CRATE), |
| 1267 | 1273 | }, |
| ... | ... | @@ -1298,7 +1304,7 @@ impl CStore { |
| 1298 | 1304 | // Make a point span rather than covering the whole file |
| 1299 | 1305 | let span = krate.spans.inner_span.shrink_to_lo(); |
| 1300 | 1306 | |
| 1301 | tcx.sess.dcx().emit_err(errors::WasmCAbi { span }); | |
| 1307 | tcx.sess.dcx().emit_err(diagnostics::WasmCAbi { span }); | |
| 1302 | 1308 | } |
| 1303 | 1309 | } |
| 1304 | 1310 |
compiler/rustc_metadata/src/dependency_format.rs+1-1| ... | ... | @@ -65,7 +65,7 @@ use rustc_target::spec::PanicStrategy; |
| 65 | 65 | use tracing::info; |
| 66 | 66 | |
| 67 | 67 | use crate::creader::CStore; |
| 68 | use crate::errors::{ | |
| 68 | use crate::diagnostics::{ | |
| 69 | 69 | BadPanicStrategy, CrateDepMultiple, IncompatiblePanicInDropStrategy, |
| 70 | 70 | IncompatibleWithImmediateAbort, IncompatibleWithImmediateAbortCore, LibRequired, |
| 71 | 71 | NonStaticCrateDep, RequiredPanicStrategy, RlibRequired, RustcLibRequired, TwoPanicRuntimes, |
compiler/rustc_metadata/src/diagnostics.rs created+706| ... | ... | @@ -0,0 +1,706 @@ |
| 1 | use std::io::Error; | |
| 2 | use std::path::{Path, PathBuf}; | |
| 3 | ||
| 4 | use rustc_errors::codes::*; | |
| 5 | use rustc_errors::{Diag, DiagCtxtHandle, Diagnostic, EmissionGuarantee, Level, msg}; | |
| 6 | use rustc_macros::{Diagnostic, Subdiagnostic}; | |
| 7 | use rustc_span::{Span, Symbol, sym}; | |
| 8 | use rustc_target::spec::{PanicStrategy, TargetTuple}; | |
| 9 | ||
| 10 | use crate::locator::CrateFlavor; | |
| 11 | ||
| 12 | #[derive(Diagnostic)] | |
| 13 | #[diag( | |
| 14 | "crate `{$crate_name}` required to be available in rlib format, but was not found in this form" | |
| 15 | )] | |
| 16 | pub(crate) struct RlibRequired { | |
| 17 | pub crate_name: Symbol, | |
| 18 | } | |
| 19 | ||
| 20 | #[derive(Diagnostic)] | |
| 21 | #[diag( | |
| 22 | "crate `{$crate_name}` required to be available in {$kind} format, but was not found in this form" | |
| 23 | )] | |
| 24 | pub(crate) struct LibRequired<'a> { | |
| 25 | pub crate_name: Symbol, | |
| 26 | pub kind: &'a str, | |
| 27 | } | |
| 28 | ||
| 29 | #[derive(Diagnostic)] | |
| 30 | #[diag( | |
| 31 | "crate `{$crate_name}` required to be available in {$kind} format, but was not found in this form" | |
| 32 | )] | |
| 33 | #[help("try adding `extern crate rustc_driver;` at the top level of this crate")] | |
| 34 | pub(crate) struct RustcLibRequired<'a> { | |
| 35 | pub crate_name: Symbol, | |
| 36 | pub kind: &'a str, | |
| 37 | } | |
| 38 | ||
| 39 | #[derive(Diagnostic)] | |
| 40 | #[diag("cannot satisfy dependencies so `{$crate_name}` only shows up once")] | |
| 41 | #[help("having upstream crates all available in one format will likely make this go away")] | |
| 42 | pub(crate) struct CrateDepMultiple { | |
| 43 | pub crate_name: Symbol, | |
| 44 | #[subdiagnostic] | |
| 45 | pub non_static_deps: Vec<NonStaticCrateDep>, | |
| 46 | #[help("`feature(rustc_private)` is needed to link to the compiler's `rustc_driver` library")] | |
| 47 | pub rustc_driver_help: bool, | |
| 48 | } | |
| 49 | ||
| 50 | #[derive(Subdiagnostic)] | |
| 51 | #[note("`{$sub_crate_name}` was unavailable as a static crate, preventing fully static linking")] | |
| 52 | pub(crate) struct NonStaticCrateDep { | |
| 53 | /// It's different from `crate_name` in main Diagnostic. | |
| 54 | pub sub_crate_name: Symbol, | |
| 55 | } | |
| 56 | ||
| 57 | #[derive(Diagnostic)] | |
| 58 | #[diag("cannot link together two panic runtimes: {$prev_name} and {$cur_name}")] | |
| 59 | pub(crate) struct TwoPanicRuntimes { | |
| 60 | pub prev_name: Symbol, | |
| 61 | pub cur_name: Symbol, | |
| 62 | } | |
| 63 | ||
| 64 | #[derive(Diagnostic)] | |
| 65 | #[diag( | |
| 66 | "the linked panic runtime `{$runtime}` is not compiled with this crate's panic strategy `{$strategy}`" | |
| 67 | )] | |
| 68 | pub(crate) struct BadPanicStrategy { | |
| 69 | pub runtime: Symbol, | |
| 70 | pub strategy: PanicStrategy, | |
| 71 | } | |
| 72 | ||
| 73 | #[derive(Diagnostic)] | |
| 74 | #[diag( | |
| 75 | "the crate `{$crate_name}` requires panic strategy `{$found_strategy}` which is incompatible with this crate's strategy of `{$desired_strategy}`" | |
| 76 | )] | |
| 77 | pub(crate) struct RequiredPanicStrategy { | |
| 78 | pub crate_name: Symbol, | |
| 79 | pub found_strategy: PanicStrategy, | |
| 80 | pub desired_strategy: PanicStrategy, | |
| 81 | } | |
| 82 | ||
| 83 | #[derive(Diagnostic)] | |
| 84 | #[diag( | |
| 85 | "the crate `{$crate_name}` was compiled with a panic strategy which is incompatible with `immediate-abort`" | |
| 86 | )] | |
| 87 | pub(crate) struct IncompatibleWithImmediateAbort { | |
| 88 | pub crate_name: Symbol, | |
| 89 | } | |
| 90 | ||
| 91 | #[derive(Diagnostic)] | |
| 92 | #[diag( | |
| 93 | "the crate `core` was compiled with a panic strategy which is incompatible with `immediate-abort`" | |
| 94 | )] | |
| 95 | pub(crate) struct IncompatibleWithImmediateAbortCore; | |
| 96 | ||
| 97 | #[derive(Diagnostic)] | |
| 98 | #[diag( | |
| 99 | "the crate `{$crate_name}` is compiled with the panic-in-drop strategy `{$found_strategy}` which is incompatible with this crate's strategy of `{$desired_strategy}`" | |
| 100 | )] | |
| 101 | pub(crate) struct IncompatiblePanicInDropStrategy { | |
| 102 | pub crate_name: Symbol, | |
| 103 | pub found_strategy: PanicStrategy, | |
| 104 | pub desired_strategy: PanicStrategy, | |
| 105 | } | |
| 106 | ||
| 107 | #[derive(Diagnostic)] | |
| 108 | #[diag("`#[link_ordinal]` is only supported if link kind is `raw-dylib`")] | |
| 109 | pub(crate) struct LinkOrdinalRawDylib { | |
| 110 | #[primary_span] | |
| 111 | pub span: Span, | |
| 112 | } | |
| 113 | ||
| 114 | #[derive(Diagnostic)] | |
| 115 | #[diag("library kind `framework` is only supported on Apple targets")] | |
| 116 | pub(crate) struct LibFrameworkApple; | |
| 117 | ||
| 118 | #[derive(Diagnostic)] | |
| 119 | #[diag("an empty renaming target was specified for library `{$lib_name}`")] | |
| 120 | pub(crate) struct EmptyRenamingTarget<'a> { | |
| 121 | pub lib_name: &'a str, | |
| 122 | } | |
| 123 | ||
| 124 | #[derive(Diagnostic)] | |
| 125 | #[diag( | |
| 126 | "renaming of the library `{$lib_name}` was specified, however this crate contains no `#[link(...)]` attributes referencing this library" | |
| 127 | )] | |
| 128 | pub(crate) struct RenamingNoLink<'a> { | |
| 129 | pub lib_name: &'a str, | |
| 130 | } | |
| 131 | ||
| 132 | #[derive(Diagnostic)] | |
| 133 | #[diag("multiple renamings were specified for library `{$lib_name}`")] | |
| 134 | pub(crate) struct MultipleRenamings<'a> { | |
| 135 | pub lib_name: &'a str, | |
| 136 | } | |
| 137 | ||
| 138 | #[derive(Diagnostic)] | |
| 139 | #[diag("overriding linking modifiers from command line is not supported")] | |
| 140 | pub(crate) struct NoLinkModOverride { | |
| 141 | #[primary_span] | |
| 142 | pub span: Option<Span>, | |
| 143 | } | |
| 144 | ||
| 145 | #[derive(Diagnostic)] | |
| 146 | #[diag("ABI not supported by `#[link(kind = \"raw-dylib\")]` on this architecture")] | |
| 147 | pub(crate) struct RawDylibUnsupportedAbi { | |
| 148 | #[primary_span] | |
| 149 | pub span: Span, | |
| 150 | } | |
| 151 | ||
| 152 | #[derive(Diagnostic)] | |
| 153 | #[diag("failed to create file encoder: {$err}")] | |
| 154 | pub(crate) struct FailCreateFileEncoder { | |
| 155 | pub err: Error, | |
| 156 | } | |
| 157 | ||
| 158 | #[derive(Diagnostic)] | |
| 159 | #[diag("failed to write to `{$path}`: {$err}")] | |
| 160 | pub(crate) struct FailWriteFile<'a> { | |
| 161 | pub path: &'a Path, | |
| 162 | pub err: Error, | |
| 163 | } | |
| 164 | ||
| 165 | #[derive(Diagnostic)] | |
| 166 | #[diag("the crate `{$crate_name}` is not a panic runtime")] | |
| 167 | pub(crate) struct CrateNotPanicRuntime { | |
| 168 | pub crate_name: Symbol, | |
| 169 | } | |
| 170 | ||
| 171 | #[derive(Diagnostic)] | |
| 172 | #[diag( | |
| 173 | "the crate `{$crate_name}` resolved as `compiler_builtins` but is not `#![compiler_builtins]`" | |
| 174 | )] | |
| 175 | pub(crate) struct CrateNotCompilerBuiltins { | |
| 176 | pub crate_name: Symbol, | |
| 177 | } | |
| 178 | ||
| 179 | #[derive(Diagnostic)] | |
| 180 | #[diag("the crate `{$crate_name}` does not have the panic strategy `{$strategy}`")] | |
| 181 | pub(crate) struct NoPanicStrategy { | |
| 182 | pub crate_name: Symbol, | |
| 183 | pub strategy: PanicStrategy, | |
| 184 | } | |
| 185 | ||
| 186 | #[derive(Diagnostic)] | |
| 187 | #[diag("the crate `{$crate_name}` is not a profiler runtime")] | |
| 188 | pub(crate) struct NotProfilerRuntime { | |
| 189 | pub crate_name: Symbol, | |
| 190 | } | |
| 191 | ||
| 192 | #[derive(Diagnostic)] | |
| 193 | #[diag("cannot define multiple global allocators")] | |
| 194 | pub(crate) struct NoMultipleGlobalAlloc { | |
| 195 | #[primary_span] | |
| 196 | #[label("cannot define a new global allocator")] | |
| 197 | pub span2: Span, | |
| 198 | #[label("previous global allocator defined here")] | |
| 199 | pub span1: Span, | |
| 200 | } | |
| 201 | ||
| 202 | #[derive(Diagnostic)] | |
| 203 | #[diag("cannot define multiple allocation error handlers")] | |
| 204 | pub(crate) struct NoMultipleAllocErrorHandler { | |
| 205 | #[primary_span] | |
| 206 | #[label("cannot define a new allocation error handler")] | |
| 207 | pub span2: Span, | |
| 208 | #[label("previous allocation error handler defined here")] | |
| 209 | pub span1: Span, | |
| 210 | } | |
| 211 | ||
| 212 | #[derive(Diagnostic)] | |
| 213 | #[diag( | |
| 214 | "the `#[global_allocator]` in {$other_crate_name} conflicts with global allocator in: {$crate_name}" | |
| 215 | )] | |
| 216 | pub(crate) struct ConflictingGlobalAlloc { | |
| 217 | pub crate_name: Symbol, | |
| 218 | pub other_crate_name: Symbol, | |
| 219 | } | |
| 220 | ||
| 221 | #[derive(Diagnostic)] | |
| 222 | #[diag( | |
| 223 | "the `#[alloc_error_handler]` in {$other_crate_name} conflicts with allocation error handler in: {$crate_name}" | |
| 224 | )] | |
| 225 | pub(crate) struct ConflictingAllocErrorHandler { | |
| 226 | pub crate_name: Symbol, | |
| 227 | pub other_crate_name: Symbol, | |
| 228 | } | |
| 229 | ||
| 230 | #[derive(Diagnostic)] | |
| 231 | #[diag( | |
| 232 | "no global memory allocator found but one is required; link to std or add `#[global_allocator]` to a static item that implements the GlobalAlloc trait" | |
| 233 | )] | |
| 234 | pub(crate) struct GlobalAllocRequired; | |
| 235 | ||
| 236 | #[derive(Diagnostic)] | |
| 237 | #[diag("failed to write {$filename}: {$err}")] | |
| 238 | pub(crate) struct FailedWriteError { | |
| 239 | pub filename: PathBuf, | |
| 240 | pub err: Error, | |
| 241 | } | |
| 242 | ||
| 243 | #[derive(Diagnostic)] | |
| 244 | #[diag("failed to copy {$filename} to stdout: {$err}")] | |
| 245 | pub(crate) struct FailedCopyToStdout { | |
| 246 | pub filename: PathBuf, | |
| 247 | pub err: Error, | |
| 248 | } | |
| 249 | ||
| 250 | #[derive(Diagnostic)] | |
| 251 | #[diag( | |
| 252 | "option `-o` or `--emit` is used to write binary output type `metadata` to stdout, but stdout is a tty" | |
| 253 | )] | |
| 254 | pub(crate) struct BinaryOutputToTty; | |
| 255 | ||
| 256 | #[derive(Diagnostic)] | |
| 257 | #[diag("could not find native static library `{$libname}`, perhaps an -L flag is missing?")] | |
| 258 | pub(crate) struct MissingNativeLibrary<'a> { | |
| 259 | libname: &'a str, | |
| 260 | #[subdiagnostic] | |
| 261 | suggest_name: Option<SuggestLibraryName<'a>>, | |
| 262 | } | |
| 263 | ||
| 264 | impl<'a> MissingNativeLibrary<'a> { | |
| 265 | pub(crate) fn new(libname: &'a str, verbatim: bool) -> Self { | |
| 266 | // if it looks like the user has provided a complete filename rather just the bare lib name, | |
| 267 | // then provide a note that they might want to try trimming the name | |
| 268 | let suggested_name = if !verbatim { | |
| 269 | if let Some(libname) = libname.strip_circumfix("lib", ".a") { | |
| 270 | // this is a unix style filename so trim prefix & suffix | |
| 271 | Some(libname) | |
| 272 | } else if let Some(libname) = libname.strip_suffix(".lib") { | |
| 273 | // this is a Windows style filename so just trim the suffix | |
| 274 | Some(libname) | |
| 275 | } else { | |
| 276 | None | |
| 277 | } | |
| 278 | } else { | |
| 279 | None | |
| 280 | }; | |
| 281 | ||
| 282 | Self { | |
| 283 | libname, | |
| 284 | suggest_name: suggested_name | |
| 285 | .map(|suggested_name| SuggestLibraryName { suggested_name }), | |
| 286 | } | |
| 287 | } | |
| 288 | } | |
| 289 | ||
| 290 | #[derive(Subdiagnostic)] | |
| 291 | #[help("only provide the library name `{$suggested_name}`, not the full filename")] | |
| 292 | pub(crate) struct SuggestLibraryName<'a> { | |
| 293 | suggested_name: &'a str, | |
| 294 | } | |
| 295 | ||
| 296 | #[derive(Diagnostic)] | |
| 297 | #[diag("couldn't create a temp dir: {$err}")] | |
| 298 | pub(crate) struct FailedCreateTempdir { | |
| 299 | pub err: Error, | |
| 300 | } | |
| 301 | ||
| 302 | #[derive(Diagnostic)] | |
| 303 | #[diag("failed to create the file {$filename}: {$err}")] | |
| 304 | pub(crate) struct FailedCreateFile<'a> { | |
| 305 | pub filename: &'a Path, | |
| 306 | pub err: Error, | |
| 307 | } | |
| 308 | ||
| 309 | #[derive(Diagnostic)] | |
| 310 | #[diag("failed to create encoded metadata from file: {$err}")] | |
| 311 | pub(crate) struct FailedCreateEncodedMetadata { | |
| 312 | pub err: Error, | |
| 313 | } | |
| 314 | ||
| 315 | #[derive(Diagnostic)] | |
| 316 | #[diag("cannot load a crate with a non-ascii name `{$crate_name}`")] | |
| 317 | pub(crate) struct NonAsciiName { | |
| 318 | #[primary_span] | |
| 319 | pub span: Span, | |
| 320 | pub crate_name: Symbol, | |
| 321 | } | |
| 322 | ||
| 323 | #[derive(Diagnostic)] | |
| 324 | #[diag("extern location for {$crate_name} does not exist: {$location}")] | |
| 325 | pub(crate) struct ExternLocationNotExist<'a> { | |
| 326 | #[primary_span] | |
| 327 | pub span: Span, | |
| 328 | pub crate_name: Symbol, | |
| 329 | pub location: &'a Path, | |
| 330 | } | |
| 331 | ||
| 332 | #[derive(Diagnostic)] | |
| 333 | #[diag("extern location for {$crate_name} is not a file: {$location}")] | |
| 334 | pub(crate) struct ExternLocationNotFile<'a> { | |
| 335 | #[primary_span] | |
| 336 | pub span: Span, | |
| 337 | pub crate_name: Symbol, | |
| 338 | pub location: &'a Path, | |
| 339 | } | |
| 340 | ||
| 341 | pub(crate) struct MultipleCandidates { | |
| 342 | pub span: Span, | |
| 343 | pub flavor: CrateFlavor, | |
| 344 | pub crate_name: Symbol, | |
| 345 | pub candidates: Vec<PathBuf>, | |
| 346 | } | |
| 347 | ||
| 348 | impl<G: EmissionGuarantee> Diagnostic<'_, G> for MultipleCandidates { | |
| 349 | fn into_diag(self, dcx: DiagCtxtHandle<'_>, level: Level) -> Diag<'_, G> { | |
| 350 | let mut diag = Diag::new( | |
| 351 | dcx, | |
| 352 | level, | |
| 353 | msg!("multiple candidates for `{$flavor}` dependency `{$crate_name}` found"), | |
| 354 | ); | |
| 355 | diag.arg("crate_name", self.crate_name); | |
| 356 | diag.arg("flavor", self.flavor); | |
| 357 | diag.code(E0464); | |
| 358 | diag.span(self.span); | |
| 359 | for (i, candidate) in self.candidates.iter().enumerate() { | |
| 360 | diag.note(format!("candidate #{}: {}", i + 1, candidate.display())); | |
| 361 | } | |
| 362 | diag | |
| 363 | } | |
| 364 | } | |
| 365 | ||
| 366 | #[derive(Diagnostic)] | |
| 367 | #[diag( | |
| 368 | "only metadata stub found for `{$flavor}` dependency `{$crate_name}` please provide path to the corresponding .rmeta file with full metadata" | |
| 369 | )] | |
| 370 | pub(crate) struct FullMetadataNotFound { | |
| 371 | #[primary_span] | |
| 372 | pub span: Span, | |
| 373 | pub flavor: CrateFlavor, | |
| 374 | pub crate_name: Symbol, | |
| 375 | } | |
| 376 | ||
| 377 | #[derive(Diagnostic)] | |
| 378 | #[diag("the current crate is indistinguishable from one of its dependencies: it has the same crate-name `{$crate_name}` and was compiled with the same `-C metadata` arguments, so this will result in symbol conflicts between the two", code = E0519)] | |
| 379 | pub(crate) struct SymbolConflictsCurrent { | |
| 380 | #[primary_span] | |
| 381 | pub span: Span, | |
| 382 | pub crate_name: Symbol, | |
| 383 | } | |
| 384 | ||
| 385 | #[derive(Diagnostic)] | |
| 386 | #[diag("found crates (`{$crate_name0}` and `{$crate_name1}`) with colliding StableCrateId values")] | |
| 387 | pub(crate) struct StableCrateIdCollision { | |
| 388 | #[primary_span] | |
| 389 | pub span: Span, | |
| 390 | pub crate_name0: Symbol, | |
| 391 | pub crate_name1: Symbol, | |
| 392 | } | |
| 393 | ||
| 394 | #[derive(Diagnostic)] | |
| 395 | #[diag("{$path}{$err}")] | |
| 396 | pub(crate) struct DlError { | |
| 397 | #[primary_span] | |
| 398 | pub span: Span, | |
| 399 | pub path: String, | |
| 400 | pub err: String, | |
| 401 | } | |
| 402 | ||
| 403 | #[derive(Diagnostic)] | |
| 404 | #[diag("found possibly newer version of crate `{$crate_name}`{$add_info}", code = E0460)] | |
| 405 | #[note("perhaps that crate needs to be recompiled?")] | |
| 406 | #[note("the following crate versions were found:{$found_crates}")] | |
| 407 | pub(crate) struct NewerCrateVersion { | |
| 408 | #[primary_span] | |
| 409 | pub span: Span, | |
| 410 | pub crate_name: Symbol, | |
| 411 | pub add_info: String, | |
| 412 | pub found_crates: String, | |
| 413 | } | |
| 414 | ||
| 415 | #[derive(Diagnostic)] | |
| 416 | #[diag("couldn't find crate `{$crate_name}` with expected target triple {$locator_triple}{$add_info}", code = E0461)] | |
| 417 | #[note("the following crate versions were found:{$found_crates}")] | |
| 418 | pub(crate) struct NoCrateWithTriple<'a> { | |
| 419 | #[primary_span] | |
| 420 | pub span: Span, | |
| 421 | pub crate_name: Symbol, | |
| 422 | pub locator_triple: &'a str, | |
| 423 | pub add_info: String, | |
| 424 | pub found_crates: String, | |
| 425 | } | |
| 426 | ||
| 427 | #[derive(Diagnostic)] | |
| 428 | #[diag("found staticlib `{$crate_name}` instead of rlib or dylib{$add_info}", code = E0462)] | |
| 429 | #[note("the following crate versions were found:{$found_crates}")] | |
| 430 | #[help("please recompile that crate using --crate-type lib")] | |
| 431 | pub(crate) struct FoundStaticlib { | |
| 432 | #[primary_span] | |
| 433 | pub span: Span, | |
| 434 | pub crate_name: Symbol, | |
| 435 | pub add_info: String, | |
| 436 | pub found_crates: String, | |
| 437 | } | |
| 438 | ||
| 439 | #[derive(Diagnostic)] | |
| 440 | #[diag("found crate `{$crate_name}` compiled by an incompatible version of rustc{$add_info}", code = E0514)] | |
| 441 | #[note("the following crate versions were found:{$found_crates}")] | |
| 442 | #[help( | |
| 443 | "please recompile that crate using this compiler ({$rustc_version}) (consider running `cargo clean` first)" | |
| 444 | )] | |
| 445 | pub(crate) struct IncompatibleRustc { | |
| 446 | #[primary_span] | |
| 447 | pub span: Span, | |
| 448 | pub crate_name: Symbol, | |
| 449 | pub add_info: String, | |
| 450 | pub found_crates: String, | |
| 451 | pub rustc_version: String, | |
| 452 | } | |
| 453 | ||
| 454 | pub(crate) struct InvalidMetadataFiles { | |
| 455 | pub span: Span, | |
| 456 | pub crate_name: Symbol, | |
| 457 | pub add_info: String, | |
| 458 | pub crate_rejections: Vec<String>, | |
| 459 | } | |
| 460 | ||
| 461 | impl<G: EmissionGuarantee> Diagnostic<'_, G> for InvalidMetadataFiles { | |
| 462 | #[track_caller] | |
| 463 | fn into_diag(self, dcx: DiagCtxtHandle<'_>, level: Level) -> Diag<'_, G> { | |
| 464 | let mut diag = Diag::new( | |
| 465 | dcx, | |
| 466 | level, | |
| 467 | msg!("found invalid metadata files for crate `{$crate_name}`{$add_info}"), | |
| 468 | ); | |
| 469 | diag.arg("crate_name", self.crate_name); | |
| 470 | diag.arg("add_info", self.add_info); | |
| 471 | diag.code(E0786); | |
| 472 | diag.span(self.span); | |
| 473 | for crate_rejection in self.crate_rejections { | |
| 474 | diag.note(crate_rejection); | |
| 475 | } | |
| 476 | diag | |
| 477 | } | |
| 478 | } | |
| 479 | ||
| 480 | pub(crate) struct CannotFindCrate { | |
| 481 | pub span: Span, | |
| 482 | pub crate_name: Symbol, | |
| 483 | pub add_info: String, | |
| 484 | pub missing_core: bool, | |
| 485 | pub current_crate: String, | |
| 486 | pub is_nightly_build: bool, | |
| 487 | pub profiler_runtime: Symbol, | |
| 488 | pub locator_triple: TargetTuple, | |
| 489 | pub is_ui_testing: bool, | |
| 490 | pub is_tier_3: bool, | |
| 491 | } | |
| 492 | ||
| 493 | impl<G: EmissionGuarantee> Diagnostic<'_, G> for CannotFindCrate { | |
| 494 | #[track_caller] | |
| 495 | fn into_diag(self, dcx: DiagCtxtHandle<'_>, level: Level) -> Diag<'_, G> { | |
| 496 | let mut diag = | |
| 497 | Diag::new(dcx, level, msg!("can't find crate for `{$crate_name}`{$add_info}")); | |
| 498 | diag.arg("crate_name", self.crate_name); | |
| 499 | diag.arg("current_crate", self.current_crate); | |
| 500 | diag.arg("add_info", self.add_info); | |
| 501 | diag.arg("locator_triple", self.locator_triple.tuple()); | |
| 502 | diag.code(E0463); | |
| 503 | diag.span(self.span); | |
| 504 | if self.crate_name == sym::std || self.crate_name == sym::core { | |
| 505 | if self.missing_core { | |
| 506 | diag.note(msg!("the `{$locator_triple}` target may not be installed")); | |
| 507 | } else { | |
| 508 | diag.note(msg!( | |
| 509 | "the `{$locator_triple}` target may not support the standard library" | |
| 510 | )); | |
| 511 | } | |
| 512 | ||
| 513 | let has_precompiled_std = !self.is_tier_3; | |
| 514 | ||
| 515 | if self.missing_core { | |
| 516 | if env!("CFG_RELEASE_CHANNEL") == "dev" && !self.is_ui_testing { | |
| 517 | // Note: Emits the nicer suggestion only for the dev channel. | |
| 518 | diag.help(msg!("consider adding the standard library to the sysroot with `x build library --target {$locator_triple}`")); | |
| 519 | } else if has_precompiled_std { | |
| 520 | // NOTE: this suggests using rustup, even though the user may not have it installed. | |
| 521 | // That's because they could choose to install it; or this may give them a hint which | |
| 522 | // target they need to install from their distro. | |
| 523 | diag.help(msg!( | |
| 524 | "consider downloading the target with `rustup target add {$locator_triple}`" | |
| 525 | )); | |
| 526 | } | |
| 527 | } | |
| 528 | ||
| 529 | // Suggest using #![no_std]. #[no_core] is unstable and not really supported anyway. | |
| 530 | // NOTE: this is a dummy span if `extern crate std` was injected by the compiler. | |
| 531 | // If it's not a dummy, that means someone added `extern crate std` explicitly and | |
| 532 | // `#![no_std]` won't help. | |
| 533 | if !self.missing_core && self.span.is_dummy() { | |
| 534 | diag.note(msg!("`std` is required by `{$current_crate}` because it does not declare `#![no_std]`")); | |
| 535 | } | |
| 536 | // Recommend -Zbuild-std even on stable builds for Tier 3 targets because | |
| 537 | // it's the recommended way to use the target, the user should switch to nightly. | |
| 538 | if self.is_nightly_build || !has_precompiled_std { | |
| 539 | diag.help(msg!("consider building the standard library from source with `cargo build -Zbuild-std`")); | |
| 540 | } | |
| 541 | } else if self.crate_name == self.profiler_runtime { | |
| 542 | diag.note(msg!("the compiler may have been built without the profiler runtime")); | |
| 543 | } else if self.crate_name.as_str().starts_with("rustc_") { | |
| 544 | diag.help(msg!("maybe you need to install the missing components with: `rustup component add rust-src rustc-dev llvm-tools-preview`")); | |
| 545 | } | |
| 546 | diag.span_label(self.span, msg!("can't find crate")); | |
| 547 | diag | |
| 548 | } | |
| 549 | } | |
| 550 | ||
| 551 | #[derive(Diagnostic)] | |
| 552 | #[diag("extern location for {$crate_name} is of an unknown type: {$path}")] | |
| 553 | pub(crate) struct CrateLocationUnknownType<'a> { | |
| 554 | #[primary_span] | |
| 555 | pub span: Span, | |
| 556 | pub path: &'a Path, | |
| 557 | pub crate_name: Symbol, | |
| 558 | } | |
| 559 | ||
| 560 | #[derive(Diagnostic)] | |
| 561 | #[diag("file name should be lib*.rlib or {$dll_prefix}*{$dll_suffix}")] | |
| 562 | pub(crate) struct LibFilenameForm<'a> { | |
| 563 | #[primary_span] | |
| 564 | pub span: Span, | |
| 565 | pub dll_prefix: &'a str, | |
| 566 | pub dll_suffix: &'a str, | |
| 567 | } | |
| 568 | ||
| 569 | #[derive(Diagnostic)] | |
| 570 | #[diag( | |
| 571 | "older versions of the `wasm-bindgen` crate are incompatible with current versions of Rust; please update to `wasm-bindgen` v0.2.88" | |
| 572 | )] | |
| 573 | pub(crate) struct WasmCAbi { | |
| 574 | #[primary_span] | |
| 575 | pub span: Span, | |
| 576 | } | |
| 577 | ||
| 578 | #[derive(Diagnostic)] | |
| 579 | #[diag("mixing `{$flag_name_prefixed}` will cause an ABI mismatch in crate `{$local_crate}`")] | |
| 580 | #[help( | |
| 581 | "the `{$flag_name_prefixed}` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely" | |
| 582 | )] | |
| 583 | #[note( | |
| 584 | "`{$flag_name_prefixed}={$local_value}` in this crate is incompatible with `{$flag_name_prefixed}={$extern_value}` in dependency `{$extern_crate}`" | |
| 585 | )] | |
| 586 | #[help( | |
| 587 | "set `{$flag_name_prefixed}={$extern_value}` in this crate or `{$flag_name_prefixed}={$local_value}` in `{$extern_crate}`" | |
| 588 | )] | |
| 589 | #[help( | |
| 590 | "if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch={$flag_name}` to silence this error" | |
| 591 | )] | |
| 592 | pub(crate) struct IncompatibleTargetModifiers { | |
| 593 | #[primary_span] | |
| 594 | pub span: Span, | |
| 595 | pub extern_crate: Symbol, | |
| 596 | pub local_crate: Symbol, | |
| 597 | pub flag_name: String, | |
| 598 | pub flag_name_prefixed: String, | |
| 599 | pub local_value: String, | |
| 600 | pub extern_value: String, | |
| 601 | } | |
| 602 | ||
| 603 | #[derive(Diagnostic)] | |
| 604 | #[diag("mixing `{$flag_name_prefixed}` will cause an ABI mismatch in crate `{$local_crate}`")] | |
| 605 | #[help( | |
| 606 | "the `{$flag_name_prefixed}` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely" | |
| 607 | )] | |
| 608 | #[note( | |
| 609 | "unset `{$flag_name_prefixed}` in this crate is incompatible with `{$flag_name_prefixed}={$extern_value}` in dependency `{$extern_crate}`" | |
| 610 | )] | |
| 611 | #[help( | |
| 612 | "set `{$flag_name_prefixed}={$extern_value}` in this crate or unset `{$flag_name_prefixed}` in `{$extern_crate}`" | |
| 613 | )] | |
| 614 | #[help( | |
| 615 | "if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch={$flag_name}` to silence this error" | |
| 616 | )] | |
| 617 | pub(crate) struct IncompatibleTargetModifiersLMissed { | |
| 618 | #[primary_span] | |
| 619 | pub span: Span, | |
| 620 | pub extern_crate: Symbol, | |
| 621 | pub local_crate: Symbol, | |
| 622 | pub flag_name: String, | |
| 623 | pub flag_name_prefixed: String, | |
| 624 | pub extern_value: String, | |
| 625 | } | |
| 626 | ||
| 627 | #[derive(Diagnostic)] | |
| 628 | #[diag("mixing `{$flag_name_prefixed}` will cause an ABI mismatch in crate `{$local_crate}`")] | |
| 629 | #[help( | |
| 630 | "the `{$flag_name_prefixed}` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely" | |
| 631 | )] | |
| 632 | #[note( | |
| 633 | "`{$flag_name_prefixed}={$local_value}` in this crate is incompatible with unset `{$flag_name_prefixed}` in dependency `{$extern_crate}`" | |
| 634 | )] | |
| 635 | #[help( | |
| 636 | "unset `{$flag_name_prefixed}` in this crate or set `{$flag_name_prefixed}={$local_value}` in `{$extern_crate}`" | |
| 637 | )] | |
| 638 | #[help( | |
| 639 | "if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch={$flag_name}` to silence this error" | |
| 640 | )] | |
| 641 | pub(crate) struct IncompatibleTargetModifiersRMissed { | |
| 642 | #[primary_span] | |
| 643 | pub span: Span, | |
| 644 | pub extern_crate: Symbol, | |
| 645 | pub local_crate: Symbol, | |
| 646 | pub flag_name: String, | |
| 647 | pub flag_name_prefixed: String, | |
| 648 | pub local_value: String, | |
| 649 | } | |
| 650 | ||
| 651 | #[derive(Diagnostic)] | |
| 652 | #[diag( | |
| 653 | "unknown target modifier `{$flag_name}`, requested by `-Cunsafe-allow-abi-mismatch={$flag_name}`" | |
| 654 | )] | |
| 655 | pub(crate) struct UnknownTargetModifierUnsafeAllowed { | |
| 656 | #[primary_span] | |
| 657 | pub span: Span, | |
| 658 | pub flag_name: String, | |
| 659 | } | |
| 660 | ||
| 661 | #[derive(Diagnostic)] | |
| 662 | #[diag( | |
| 663 | "found async drop types in dependency `{$extern_crate}`, but async_drop feature is disabled for `{$local_crate}`" | |
| 664 | )] | |
| 665 | #[help( | |
| 666 | "if async drop type will be dropped in a crate without `feature(async_drop)`, sync Drop will be used" | |
| 667 | )] | |
| 668 | pub(crate) struct AsyncDropTypesInDependency { | |
| 669 | #[primary_span] | |
| 670 | pub span: Span, | |
| 671 | pub extern_crate: Symbol, | |
| 672 | pub local_crate: Symbol, | |
| 673 | } | |
| 674 | ||
| 675 | #[derive(Diagnostic)] | |
| 676 | #[diag("link name must be well-formed if link kind is `raw-dylib`")] | |
| 677 | pub(crate) struct RawDylibMalformed { | |
| 678 | #[primary_span] | |
| 679 | pub span: Span, | |
| 680 | } | |
| 681 | ||
| 682 | #[derive(Diagnostic)] | |
| 683 | #[diag("extern crate `{$extern_crate}` is unused in crate `{$local_crate}`")] | |
| 684 | #[help("remove the dependency or add `use {$extern_crate} as _;` to the crate root")] | |
| 685 | pub(crate) struct UnusedCrateDependency { | |
| 686 | pub extern_crate: Symbol, | |
| 687 | pub local_crate: Symbol, | |
| 688 | } | |
| 689 | ||
| 690 | #[derive(Diagnostic)] | |
| 691 | #[diag( | |
| 692 | "your program uses the crate `{$extern_crate}`, that is not compiled with `{$mitigation_name}{$mitigation_level}` enabled" | |
| 693 | )] | |
| 694 | #[note( | |
| 695 | "recompile `{$extern_crate}` with `{$mitigation_name}{$mitigation_level}` enabled, or use `-Z allow-partial-mitigations={$mitigation_name}` to allow creating an artifact that has the mitigation partially enabled " | |
| 696 | )] | |
| 697 | #[help( | |
| 698 | "it is possible to disable `-Z allow-partial-mitigations={$mitigation_name}` via `-Z deny-partial-mitigations={$mitigation_name}`" | |
| 699 | )] | |
| 700 | pub(crate) struct MitigationLessStrictInDependency { | |
| 701 | #[primary_span] | |
| 702 | pub span: Span, | |
| 703 | pub mitigation_name: String, | |
| 704 | pub mitigation_level: String, | |
| 705 | pub extern_crate: Symbol, | |
| 706 | } |
compiler/rustc_metadata/src/errors.rs deleted-706| ... | ... | @@ -1,706 +0,0 @@ |
| 1 | use std::io::Error; | |
| 2 | use std::path::{Path, PathBuf}; | |
| 3 | ||
| 4 | use rustc_errors::codes::*; | |
| 5 | use rustc_errors::{Diag, DiagCtxtHandle, Diagnostic, EmissionGuarantee, Level, msg}; | |
| 6 | use rustc_macros::{Diagnostic, Subdiagnostic}; | |
| 7 | use rustc_span::{Span, Symbol, sym}; | |
| 8 | use rustc_target::spec::{PanicStrategy, TargetTuple}; | |
| 9 | ||
| 10 | use crate::locator::CrateFlavor; | |
| 11 | ||
| 12 | #[derive(Diagnostic)] | |
| 13 | #[diag( | |
| 14 | "crate `{$crate_name}` required to be available in rlib format, but was not found in this form" | |
| 15 | )] | |
| 16 | pub(crate) struct RlibRequired { | |
| 17 | pub crate_name: Symbol, | |
| 18 | } | |
| 19 | ||
| 20 | #[derive(Diagnostic)] | |
| 21 | #[diag( | |
| 22 | "crate `{$crate_name}` required to be available in {$kind} format, but was not found in this form" | |
| 23 | )] | |
| 24 | pub(crate) struct LibRequired<'a> { | |
| 25 | pub crate_name: Symbol, | |
| 26 | pub kind: &'a str, | |
| 27 | } | |
| 28 | ||
| 29 | #[derive(Diagnostic)] | |
| 30 | #[diag( | |
| 31 | "crate `{$crate_name}` required to be available in {$kind} format, but was not found in this form" | |
| 32 | )] | |
| 33 | #[help("try adding `extern crate rustc_driver;` at the top level of this crate")] | |
| 34 | pub(crate) struct RustcLibRequired<'a> { | |
| 35 | pub crate_name: Symbol, | |
| 36 | pub kind: &'a str, | |
| 37 | } | |
| 38 | ||
| 39 | #[derive(Diagnostic)] | |
| 40 | #[diag("cannot satisfy dependencies so `{$crate_name}` only shows up once")] | |
| 41 | #[help("having upstream crates all available in one format will likely make this go away")] | |
| 42 | pub(crate) struct CrateDepMultiple { | |
| 43 | pub crate_name: Symbol, | |
| 44 | #[subdiagnostic] | |
| 45 | pub non_static_deps: Vec<NonStaticCrateDep>, | |
| 46 | #[help("`feature(rustc_private)` is needed to link to the compiler's `rustc_driver` library")] | |
| 47 | pub rustc_driver_help: bool, | |
| 48 | } | |
| 49 | ||
| 50 | #[derive(Subdiagnostic)] | |
| 51 | #[note("`{$sub_crate_name}` was unavailable as a static crate, preventing fully static linking")] | |
| 52 | pub(crate) struct NonStaticCrateDep { | |
| 53 | /// It's different from `crate_name` in main Diagnostic. | |
| 54 | pub sub_crate_name: Symbol, | |
| 55 | } | |
| 56 | ||
| 57 | #[derive(Diagnostic)] | |
| 58 | #[diag("cannot link together two panic runtimes: {$prev_name} and {$cur_name}")] | |
| 59 | pub(crate) struct TwoPanicRuntimes { | |
| 60 | pub prev_name: Symbol, | |
| 61 | pub cur_name: Symbol, | |
| 62 | } | |
| 63 | ||
| 64 | #[derive(Diagnostic)] | |
| 65 | #[diag( | |
| 66 | "the linked panic runtime `{$runtime}` is not compiled with this crate's panic strategy `{$strategy}`" | |
| 67 | )] | |
| 68 | pub(crate) struct BadPanicStrategy { | |
| 69 | pub runtime: Symbol, | |
| 70 | pub strategy: PanicStrategy, | |
| 71 | } | |
| 72 | ||
| 73 | #[derive(Diagnostic)] | |
| 74 | #[diag( | |
| 75 | "the crate `{$crate_name}` requires panic strategy `{$found_strategy}` which is incompatible with this crate's strategy of `{$desired_strategy}`" | |
| 76 | )] | |
| 77 | pub(crate) struct RequiredPanicStrategy { | |
| 78 | pub crate_name: Symbol, | |
| 79 | pub found_strategy: PanicStrategy, | |
| 80 | pub desired_strategy: PanicStrategy, | |
| 81 | } | |
| 82 | ||
| 83 | #[derive(Diagnostic)] | |
| 84 | #[diag( | |
| 85 | "the crate `{$crate_name}` was compiled with a panic strategy which is incompatible with `immediate-abort`" | |
| 86 | )] | |
| 87 | pub(crate) struct IncompatibleWithImmediateAbort { | |
| 88 | pub crate_name: Symbol, | |
| 89 | } | |
| 90 | ||
| 91 | #[derive(Diagnostic)] | |
| 92 | #[diag( | |
| 93 | "the crate `core` was compiled with a panic strategy which is incompatible with `immediate-abort`" | |
| 94 | )] | |
| 95 | pub(crate) struct IncompatibleWithImmediateAbortCore; | |
| 96 | ||
| 97 | #[derive(Diagnostic)] | |
| 98 | #[diag( | |
| 99 | "the crate `{$crate_name}` is compiled with the panic-in-drop strategy `{$found_strategy}` which is incompatible with this crate's strategy of `{$desired_strategy}`" | |
| 100 | )] | |
| 101 | pub(crate) struct IncompatiblePanicInDropStrategy { | |
| 102 | pub crate_name: Symbol, | |
| 103 | pub found_strategy: PanicStrategy, | |
| 104 | pub desired_strategy: PanicStrategy, | |
| 105 | } | |
| 106 | ||
| 107 | #[derive(Diagnostic)] | |
| 108 | #[diag("`#[link_ordinal]` is only supported if link kind is `raw-dylib`")] | |
| 109 | pub(crate) struct LinkOrdinalRawDylib { | |
| 110 | #[primary_span] | |
| 111 | pub span: Span, | |
| 112 | } | |
| 113 | ||
| 114 | #[derive(Diagnostic)] | |
| 115 | #[diag("library kind `framework` is only supported on Apple targets")] | |
| 116 | pub(crate) struct LibFrameworkApple; | |
| 117 | ||
| 118 | #[derive(Diagnostic)] | |
| 119 | #[diag("an empty renaming target was specified for library `{$lib_name}`")] | |
| 120 | pub(crate) struct EmptyRenamingTarget<'a> { | |
| 121 | pub lib_name: &'a str, | |
| 122 | } | |
| 123 | ||
| 124 | #[derive(Diagnostic)] | |
| 125 | #[diag( | |
| 126 | "renaming of the library `{$lib_name}` was specified, however this crate contains no `#[link(...)]` attributes referencing this library" | |
| 127 | )] | |
| 128 | pub(crate) struct RenamingNoLink<'a> { | |
| 129 | pub lib_name: &'a str, | |
| 130 | } | |
| 131 | ||
| 132 | #[derive(Diagnostic)] | |
| 133 | #[diag("multiple renamings were specified for library `{$lib_name}`")] | |
| 134 | pub(crate) struct MultipleRenamings<'a> { | |
| 135 | pub lib_name: &'a str, | |
| 136 | } | |
| 137 | ||
| 138 | #[derive(Diagnostic)] | |
| 139 | #[diag("overriding linking modifiers from command line is not supported")] | |
| 140 | pub(crate) struct NoLinkModOverride { | |
| 141 | #[primary_span] | |
| 142 | pub span: Option<Span>, | |
| 143 | } | |
| 144 | ||
| 145 | #[derive(Diagnostic)] | |
| 146 | #[diag("ABI not supported by `#[link(kind = \"raw-dylib\")]` on this architecture")] | |
| 147 | pub(crate) struct RawDylibUnsupportedAbi { | |
| 148 | #[primary_span] | |
| 149 | pub span: Span, | |
| 150 | } | |
| 151 | ||
| 152 | #[derive(Diagnostic)] | |
| 153 | #[diag("failed to create file encoder: {$err}")] | |
| 154 | pub(crate) struct FailCreateFileEncoder { | |
| 155 | pub err: Error, | |
| 156 | } | |
| 157 | ||
| 158 | #[derive(Diagnostic)] | |
| 159 | #[diag("failed to write to `{$path}`: {$err}")] | |
| 160 | pub(crate) struct FailWriteFile<'a> { | |
| 161 | pub path: &'a Path, | |
| 162 | pub err: Error, | |
| 163 | } | |
| 164 | ||
| 165 | #[derive(Diagnostic)] | |
| 166 | #[diag("the crate `{$crate_name}` is not a panic runtime")] | |
| 167 | pub(crate) struct CrateNotPanicRuntime { | |
| 168 | pub crate_name: Symbol, | |
| 169 | } | |
| 170 | ||
| 171 | #[derive(Diagnostic)] | |
| 172 | #[diag( | |
| 173 | "the crate `{$crate_name}` resolved as `compiler_builtins` but is not `#![compiler_builtins]`" | |
| 174 | )] | |
| 175 | pub(crate) struct CrateNotCompilerBuiltins { | |
| 176 | pub crate_name: Symbol, | |
| 177 | } | |
| 178 | ||
| 179 | #[derive(Diagnostic)] | |
| 180 | #[diag("the crate `{$crate_name}` does not have the panic strategy `{$strategy}`")] | |
| 181 | pub(crate) struct NoPanicStrategy { | |
| 182 | pub crate_name: Symbol, | |
| 183 | pub strategy: PanicStrategy, | |
| 184 | } | |
| 185 | ||
| 186 | #[derive(Diagnostic)] | |
| 187 | #[diag("the crate `{$crate_name}` is not a profiler runtime")] | |
| 188 | pub(crate) struct NotProfilerRuntime { | |
| 189 | pub crate_name: Symbol, | |
| 190 | } | |
| 191 | ||
| 192 | #[derive(Diagnostic)] | |
| 193 | #[diag("cannot define multiple global allocators")] | |
| 194 | pub(crate) struct NoMultipleGlobalAlloc { | |
| 195 | #[primary_span] | |
| 196 | #[label("cannot define a new global allocator")] | |
| 197 | pub span2: Span, | |
| 198 | #[label("previous global allocator defined here")] | |
| 199 | pub span1: Span, | |
| 200 | } | |
| 201 | ||
| 202 | #[derive(Diagnostic)] | |
| 203 | #[diag("cannot define multiple allocation error handlers")] | |
| 204 | pub(crate) struct NoMultipleAllocErrorHandler { | |
| 205 | #[primary_span] | |
| 206 | #[label("cannot define a new allocation error handler")] | |
| 207 | pub span2: Span, | |
| 208 | #[label("previous allocation error handler defined here")] | |
| 209 | pub span1: Span, | |
| 210 | } | |
| 211 | ||
| 212 | #[derive(Diagnostic)] | |
| 213 | #[diag( | |
| 214 | "the `#[global_allocator]` in {$other_crate_name} conflicts with global allocator in: {$crate_name}" | |
| 215 | )] | |
| 216 | pub(crate) struct ConflictingGlobalAlloc { | |
| 217 | pub crate_name: Symbol, | |
| 218 | pub other_crate_name: Symbol, | |
| 219 | } | |
| 220 | ||
| 221 | #[derive(Diagnostic)] | |
| 222 | #[diag( | |
| 223 | "the `#[alloc_error_handler]` in {$other_crate_name} conflicts with allocation error handler in: {$crate_name}" | |
| 224 | )] | |
| 225 | pub(crate) struct ConflictingAllocErrorHandler { | |
| 226 | pub crate_name: Symbol, | |
| 227 | pub other_crate_name: Symbol, | |
| 228 | } | |
| 229 | ||
| 230 | #[derive(Diagnostic)] | |
| 231 | #[diag( | |
| 232 | "no global memory allocator found but one is required; link to std or add `#[global_allocator]` to a static item that implements the GlobalAlloc trait" | |
| 233 | )] | |
| 234 | pub(crate) struct GlobalAllocRequired; | |
| 235 | ||
| 236 | #[derive(Diagnostic)] | |
| 237 | #[diag("failed to write {$filename}: {$err}")] | |
| 238 | pub(crate) struct FailedWriteError { | |
| 239 | pub filename: PathBuf, | |
| 240 | pub err: Error, | |
| 241 | } | |
| 242 | ||
| 243 | #[derive(Diagnostic)] | |
| 244 | #[diag("failed to copy {$filename} to stdout: {$err}")] | |
| 245 | pub(crate) struct FailedCopyToStdout { | |
| 246 | pub filename: PathBuf, | |
| 247 | pub err: Error, | |
| 248 | } | |
| 249 | ||
| 250 | #[derive(Diagnostic)] | |
| 251 | #[diag( | |
| 252 | "option `-o` or `--emit` is used to write binary output type `metadata` to stdout, but stdout is a tty" | |
| 253 | )] | |
| 254 | pub(crate) struct BinaryOutputToTty; | |
| 255 | ||
| 256 | #[derive(Diagnostic)] | |
| 257 | #[diag("could not find native static library `{$libname}`, perhaps an -L flag is missing?")] | |
| 258 | pub(crate) struct MissingNativeLibrary<'a> { | |
| 259 | libname: &'a str, | |
| 260 | #[subdiagnostic] | |
| 261 | suggest_name: Option<SuggestLibraryName<'a>>, | |
| 262 | } | |
| 263 | ||
| 264 | impl<'a> MissingNativeLibrary<'a> { | |
| 265 | pub(crate) fn new(libname: &'a str, verbatim: bool) -> Self { | |
| 266 | // if it looks like the user has provided a complete filename rather just the bare lib name, | |
| 267 | // then provide a note that they might want to try trimming the name | |
| 268 | let suggested_name = if !verbatim { | |
| 269 | if let Some(libname) = libname.strip_circumfix("lib", ".a") { | |
| 270 | // this is a unix style filename so trim prefix & suffix | |
| 271 | Some(libname) | |
| 272 | } else if let Some(libname) = libname.strip_suffix(".lib") { | |
| 273 | // this is a Windows style filename so just trim the suffix | |
| 274 | Some(libname) | |
| 275 | } else { | |
| 276 | None | |
| 277 | } | |
| 278 | } else { | |
| 279 | None | |
| 280 | }; | |
| 281 | ||
| 282 | Self { | |
| 283 | libname, | |
| 284 | suggest_name: suggested_name | |
| 285 | .map(|suggested_name| SuggestLibraryName { suggested_name }), | |
| 286 | } | |
| 287 | } | |
| 288 | } | |
| 289 | ||
| 290 | #[derive(Subdiagnostic)] | |
| 291 | #[help("only provide the library name `{$suggested_name}`, not the full filename")] | |
| 292 | pub(crate) struct SuggestLibraryName<'a> { | |
| 293 | suggested_name: &'a str, | |
| 294 | } | |
| 295 | ||
| 296 | #[derive(Diagnostic)] | |
| 297 | #[diag("couldn't create a temp dir: {$err}")] | |
| 298 | pub(crate) struct FailedCreateTempdir { | |
| 299 | pub err: Error, | |
| 300 | } | |
| 301 | ||
| 302 | #[derive(Diagnostic)] | |
| 303 | #[diag("failed to create the file {$filename}: {$err}")] | |
| 304 | pub(crate) struct FailedCreateFile<'a> { | |
| 305 | pub filename: &'a Path, | |
| 306 | pub err: Error, | |
| 307 | } | |
| 308 | ||
| 309 | #[derive(Diagnostic)] | |
| 310 | #[diag("failed to create encoded metadata from file: {$err}")] | |
| 311 | pub(crate) struct FailedCreateEncodedMetadata { | |
| 312 | pub err: Error, | |
| 313 | } | |
| 314 | ||
| 315 | #[derive(Diagnostic)] | |
| 316 | #[diag("cannot load a crate with a non-ascii name `{$crate_name}`")] | |
| 317 | pub(crate) struct NonAsciiName { | |
| 318 | #[primary_span] | |
| 319 | pub span: Span, | |
| 320 | pub crate_name: Symbol, | |
| 321 | } | |
| 322 | ||
| 323 | #[derive(Diagnostic)] | |
| 324 | #[diag("extern location for {$crate_name} does not exist: {$location}")] | |
| 325 | pub(crate) struct ExternLocationNotExist<'a> { | |
| 326 | #[primary_span] | |
| 327 | pub span: Span, | |
| 328 | pub crate_name: Symbol, | |
| 329 | pub location: &'a Path, | |
| 330 | } | |
| 331 | ||
| 332 | #[derive(Diagnostic)] | |
| 333 | #[diag("extern location for {$crate_name} is not a file: {$location}")] | |
| 334 | pub(crate) struct ExternLocationNotFile<'a> { | |
| 335 | #[primary_span] | |
| 336 | pub span: Span, | |
| 337 | pub crate_name: Symbol, | |
| 338 | pub location: &'a Path, | |
| 339 | } | |
| 340 | ||
| 341 | pub(crate) struct MultipleCandidates { | |
| 342 | pub span: Span, | |
| 343 | pub flavor: CrateFlavor, | |
| 344 | pub crate_name: Symbol, | |
| 345 | pub candidates: Vec<PathBuf>, | |
| 346 | } | |
| 347 | ||
| 348 | impl<G: EmissionGuarantee> Diagnostic<'_, G> for MultipleCandidates { | |
| 349 | fn into_diag(self, dcx: DiagCtxtHandle<'_>, level: Level) -> Diag<'_, G> { | |
| 350 | let mut diag = Diag::new( | |
| 351 | dcx, | |
| 352 | level, | |
| 353 | msg!("multiple candidates for `{$flavor}` dependency `{$crate_name}` found"), | |
| 354 | ); | |
| 355 | diag.arg("crate_name", self.crate_name); | |
| 356 | diag.arg("flavor", self.flavor); | |
| 357 | diag.code(E0464); | |
| 358 | diag.span(self.span); | |
| 359 | for (i, candidate) in self.candidates.iter().enumerate() { | |
| 360 | diag.note(format!("candidate #{}: {}", i + 1, candidate.display())); | |
| 361 | } | |
| 362 | diag | |
| 363 | } | |
| 364 | } | |
| 365 | ||
| 366 | #[derive(Diagnostic)] | |
| 367 | #[diag( | |
| 368 | "only metadata stub found for `{$flavor}` dependency `{$crate_name}` please provide path to the corresponding .rmeta file with full metadata" | |
| 369 | )] | |
| 370 | pub(crate) struct FullMetadataNotFound { | |
| 371 | #[primary_span] | |
| 372 | pub span: Span, | |
| 373 | pub flavor: CrateFlavor, | |
| 374 | pub crate_name: Symbol, | |
| 375 | } | |
| 376 | ||
| 377 | #[derive(Diagnostic)] | |
| 378 | #[diag("the current crate is indistinguishable from one of its dependencies: it has the same crate-name `{$crate_name}` and was compiled with the same `-C metadata` arguments, so this will result in symbol conflicts between the two", code = E0519)] | |
| 379 | pub(crate) struct SymbolConflictsCurrent { | |
| 380 | #[primary_span] | |
| 381 | pub span: Span, | |
| 382 | pub crate_name: Symbol, | |
| 383 | } | |
| 384 | ||
| 385 | #[derive(Diagnostic)] | |
| 386 | #[diag("found crates (`{$crate_name0}` and `{$crate_name1}`) with colliding StableCrateId values")] | |
| 387 | pub(crate) struct StableCrateIdCollision { | |
| 388 | #[primary_span] | |
| 389 | pub span: Span, | |
| 390 | pub crate_name0: Symbol, | |
| 391 | pub crate_name1: Symbol, | |
| 392 | } | |
| 393 | ||
| 394 | #[derive(Diagnostic)] | |
| 395 | #[diag("{$path}{$err}")] | |
| 396 | pub(crate) struct DlError { | |
| 397 | #[primary_span] | |
| 398 | pub span: Span, | |
| 399 | pub path: String, | |
| 400 | pub err: String, | |
| 401 | } | |
| 402 | ||
| 403 | #[derive(Diagnostic)] | |
| 404 | #[diag("found possibly newer version of crate `{$crate_name}`{$add_info}", code = E0460)] | |
| 405 | #[note("perhaps that crate needs to be recompiled?")] | |
| 406 | #[note("the following crate versions were found:{$found_crates}")] | |
| 407 | pub(crate) struct NewerCrateVersion { | |
| 408 | #[primary_span] | |
| 409 | pub span: Span, | |
| 410 | pub crate_name: Symbol, | |
| 411 | pub add_info: String, | |
| 412 | pub found_crates: String, | |
| 413 | } | |
| 414 | ||
| 415 | #[derive(Diagnostic)] | |
| 416 | #[diag("couldn't find crate `{$crate_name}` with expected target triple {$locator_triple}{$add_info}", code = E0461)] | |
| 417 | #[note("the following crate versions were found:{$found_crates}")] | |
| 418 | pub(crate) struct NoCrateWithTriple<'a> { | |
| 419 | #[primary_span] | |
| 420 | pub span: Span, | |
| 421 | pub crate_name: Symbol, | |
| 422 | pub locator_triple: &'a str, | |
| 423 | pub add_info: String, | |
| 424 | pub found_crates: String, | |
| 425 | } | |
| 426 | ||
| 427 | #[derive(Diagnostic)] | |
| 428 | #[diag("found staticlib `{$crate_name}` instead of rlib or dylib{$add_info}", code = E0462)] | |
| 429 | #[note("the following crate versions were found:{$found_crates}")] | |
| 430 | #[help("please recompile that crate using --crate-type lib")] | |
| 431 | pub(crate) struct FoundStaticlib { | |
| 432 | #[primary_span] | |
| 433 | pub span: Span, | |
| 434 | pub crate_name: Symbol, | |
| 435 | pub add_info: String, | |
| 436 | pub found_crates: String, | |
| 437 | } | |
| 438 | ||
| 439 | #[derive(Diagnostic)] | |
| 440 | #[diag("found crate `{$crate_name}` compiled by an incompatible version of rustc{$add_info}", code = E0514)] | |
| 441 | #[note("the following crate versions were found:{$found_crates}")] | |
| 442 | #[help( | |
| 443 | "please recompile that crate using this compiler ({$rustc_version}) (consider running `cargo clean` first)" | |
| 444 | )] | |
| 445 | pub(crate) struct IncompatibleRustc { | |
| 446 | #[primary_span] | |
| 447 | pub span: Span, | |
| 448 | pub crate_name: Symbol, | |
| 449 | pub add_info: String, | |
| 450 | pub found_crates: String, | |
| 451 | pub rustc_version: String, | |
| 452 | } | |
| 453 | ||
| 454 | pub(crate) struct InvalidMetadataFiles { | |
| 455 | pub span: Span, | |
| 456 | pub crate_name: Symbol, | |
| 457 | pub add_info: String, | |
| 458 | pub crate_rejections: Vec<String>, | |
| 459 | } | |
| 460 | ||
| 461 | impl<G: EmissionGuarantee> Diagnostic<'_, G> for InvalidMetadataFiles { | |
| 462 | #[track_caller] | |
| 463 | fn into_diag(self, dcx: DiagCtxtHandle<'_>, level: Level) -> Diag<'_, G> { | |
| 464 | let mut diag = Diag::new( | |
| 465 | dcx, | |
| 466 | level, | |
| 467 | msg!("found invalid metadata files for crate `{$crate_name}`{$add_info}"), | |
| 468 | ); | |
| 469 | diag.arg("crate_name", self.crate_name); | |
| 470 | diag.arg("add_info", self.add_info); | |
| 471 | diag.code(E0786); | |
| 472 | diag.span(self.span); | |
| 473 | for crate_rejection in self.crate_rejections { | |
| 474 | diag.note(crate_rejection); | |
| 475 | } | |
| 476 | diag | |
| 477 | } | |
| 478 | } | |
| 479 | ||
| 480 | pub(crate) struct CannotFindCrate { | |
| 481 | pub span: Span, | |
| 482 | pub crate_name: Symbol, | |
| 483 | pub add_info: String, | |
| 484 | pub missing_core: bool, | |
| 485 | pub current_crate: String, | |
| 486 | pub is_nightly_build: bool, | |
| 487 | pub profiler_runtime: Symbol, | |
| 488 | pub locator_triple: TargetTuple, | |
| 489 | pub is_ui_testing: bool, | |
| 490 | pub is_tier_3: bool, | |
| 491 | } | |
| 492 | ||
| 493 | impl<G: EmissionGuarantee> Diagnostic<'_, G> for CannotFindCrate { | |
| 494 | #[track_caller] | |
| 495 | fn into_diag(self, dcx: DiagCtxtHandle<'_>, level: Level) -> Diag<'_, G> { | |
| 496 | let mut diag = | |
| 497 | Diag::new(dcx, level, msg!("can't find crate for `{$crate_name}`{$add_info}")); | |
| 498 | diag.arg("crate_name", self.crate_name); | |
| 499 | diag.arg("current_crate", self.current_crate); | |
| 500 | diag.arg("add_info", self.add_info); | |
| 501 | diag.arg("locator_triple", self.locator_triple.tuple()); | |
| 502 | diag.code(E0463); | |
| 503 | diag.span(self.span); | |
| 504 | if self.crate_name == sym::std || self.crate_name == sym::core { | |
| 505 | if self.missing_core { | |
| 506 | diag.note(msg!("the `{$locator_triple}` target may not be installed")); | |
| 507 | } else { | |
| 508 | diag.note(msg!( | |
| 509 | "the `{$locator_triple}` target may not support the standard library" | |
| 510 | )); | |
| 511 | } | |
| 512 | ||
| 513 | let has_precompiled_std = !self.is_tier_3; | |
| 514 | ||
| 515 | if self.missing_core { | |
| 516 | if env!("CFG_RELEASE_CHANNEL") == "dev" && !self.is_ui_testing { | |
| 517 | // Note: Emits the nicer suggestion only for the dev channel. | |
| 518 | diag.help(msg!("consider adding the standard library to the sysroot with `x build library --target {$locator_triple}`")); | |
| 519 | } else if has_precompiled_std { | |
| 520 | // NOTE: this suggests using rustup, even though the user may not have it installed. | |
| 521 | // That's because they could choose to install it; or this may give them a hint which | |
| 522 | // target they need to install from their distro. | |
| 523 | diag.help(msg!( | |
| 524 | "consider downloading the target with `rustup target add {$locator_triple}`" | |
| 525 | )); | |
| 526 | } | |
| 527 | } | |
| 528 | ||
| 529 | // Suggest using #![no_std]. #[no_core] is unstable and not really supported anyway. | |
| 530 | // NOTE: this is a dummy span if `extern crate std` was injected by the compiler. | |
| 531 | // If it's not a dummy, that means someone added `extern crate std` explicitly and | |
| 532 | // `#![no_std]` won't help. | |
| 533 | if !self.missing_core && self.span.is_dummy() { | |
| 534 | diag.note(msg!("`std` is required by `{$current_crate}` because it does not declare `#![no_std]`")); | |
| 535 | } | |
| 536 | // Recommend -Zbuild-std even on stable builds for Tier 3 targets because | |
| 537 | // it's the recommended way to use the target, the user should switch to nightly. | |
| 538 | if self.is_nightly_build || !has_precompiled_std { | |
| 539 | diag.help(msg!("consider building the standard library from source with `cargo build -Zbuild-std`")); | |
| 540 | } | |
| 541 | } else if self.crate_name == self.profiler_runtime { | |
| 542 | diag.note(msg!("the compiler may have been built without the profiler runtime")); | |
| 543 | } else if self.crate_name.as_str().starts_with("rustc_") { | |
| 544 | diag.help(msg!("maybe you need to install the missing components with: `rustup component add rust-src rustc-dev llvm-tools-preview`")); | |
| 545 | } | |
| 546 | diag.span_label(self.span, msg!("can't find crate")); | |
| 547 | diag | |
| 548 | } | |
| 549 | } | |
| 550 | ||
| 551 | #[derive(Diagnostic)] | |
| 552 | #[diag("extern location for {$crate_name} is of an unknown type: {$path}")] | |
| 553 | pub(crate) struct CrateLocationUnknownType<'a> { | |
| 554 | #[primary_span] | |
| 555 | pub span: Span, | |
| 556 | pub path: &'a Path, | |
| 557 | pub crate_name: Symbol, | |
| 558 | } | |
| 559 | ||
| 560 | #[derive(Diagnostic)] | |
| 561 | #[diag("file name should be lib*.rlib or {$dll_prefix}*{$dll_suffix}")] | |
| 562 | pub(crate) struct LibFilenameForm<'a> { | |
| 563 | #[primary_span] | |
| 564 | pub span: Span, | |
| 565 | pub dll_prefix: &'a str, | |
| 566 | pub dll_suffix: &'a str, | |
| 567 | } | |
| 568 | ||
| 569 | #[derive(Diagnostic)] | |
| 570 | #[diag( | |
| 571 | "older versions of the `wasm-bindgen` crate are incompatible with current versions of Rust; please update to `wasm-bindgen` v0.2.88" | |
| 572 | )] | |
| 573 | pub(crate) struct WasmCAbi { | |
| 574 | #[primary_span] | |
| 575 | pub span: Span, | |
| 576 | } | |
| 577 | ||
| 578 | #[derive(Diagnostic)] | |
| 579 | #[diag("mixing `{$flag_name_prefixed}` will cause an ABI mismatch in crate `{$local_crate}`")] | |
| 580 | #[help( | |
| 581 | "the `{$flag_name_prefixed}` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely" | |
| 582 | )] | |
| 583 | #[note( | |
| 584 | "`{$flag_name_prefixed}={$local_value}` in this crate is incompatible with `{$flag_name_prefixed}={$extern_value}` in dependency `{$extern_crate}`" | |
| 585 | )] | |
| 586 | #[help( | |
| 587 | "set `{$flag_name_prefixed}={$extern_value}` in this crate or `{$flag_name_prefixed}={$local_value}` in `{$extern_crate}`" | |
| 588 | )] | |
| 589 | #[help( | |
| 590 | "if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch={$flag_name}` to silence this error" | |
| 591 | )] | |
| 592 | pub(crate) struct IncompatibleTargetModifiers { | |
| 593 | #[primary_span] | |
| 594 | pub span: Span, | |
| 595 | pub extern_crate: Symbol, | |
| 596 | pub local_crate: Symbol, | |
| 597 | pub flag_name: String, | |
| 598 | pub flag_name_prefixed: String, | |
| 599 | pub local_value: String, | |
| 600 | pub extern_value: String, | |
| 601 | } | |
| 602 | ||
| 603 | #[derive(Diagnostic)] | |
| 604 | #[diag("mixing `{$flag_name_prefixed}` will cause an ABI mismatch in crate `{$local_crate}`")] | |
| 605 | #[help( | |
| 606 | "the `{$flag_name_prefixed}` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely" | |
| 607 | )] | |
| 608 | #[note( | |
| 609 | "unset `{$flag_name_prefixed}` in this crate is incompatible with `{$flag_name_prefixed}={$extern_value}` in dependency `{$extern_crate}`" | |
| 610 | )] | |
| 611 | #[help( | |
| 612 | "set `{$flag_name_prefixed}={$extern_value}` in this crate or unset `{$flag_name_prefixed}` in `{$extern_crate}`" | |
| 613 | )] | |
| 614 | #[help( | |
| 615 | "if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch={$flag_name}` to silence this error" | |
| 616 | )] | |
| 617 | pub(crate) struct IncompatibleTargetModifiersLMissed { | |
| 618 | #[primary_span] | |
| 619 | pub span: Span, | |
| 620 | pub extern_crate: Symbol, | |
| 621 | pub local_crate: Symbol, | |
| 622 | pub flag_name: String, | |
| 623 | pub flag_name_prefixed: String, | |
| 624 | pub extern_value: String, | |
| 625 | } | |
| 626 | ||
| 627 | #[derive(Diagnostic)] | |
| 628 | #[diag("mixing `{$flag_name_prefixed}` will cause an ABI mismatch in crate `{$local_crate}`")] | |
| 629 | #[help( | |
| 630 | "the `{$flag_name_prefixed}` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely" | |
| 631 | )] | |
| 632 | #[note( | |
| 633 | "`{$flag_name_prefixed}={$local_value}` in this crate is incompatible with unset `{$flag_name_prefixed}` in dependency `{$extern_crate}`" | |
| 634 | )] | |
| 635 | #[help( | |
| 636 | "unset `{$flag_name_prefixed}` in this crate or set `{$flag_name_prefixed}={$local_value}` in `{$extern_crate}`" | |
| 637 | )] | |
| 638 | #[help( | |
| 639 | "if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch={$flag_name}` to silence this error" | |
| 640 | )] | |
| 641 | pub(crate) struct IncompatibleTargetModifiersRMissed { | |
| 642 | #[primary_span] | |
| 643 | pub span: Span, | |
| 644 | pub extern_crate: Symbol, | |
| 645 | pub local_crate: Symbol, | |
| 646 | pub flag_name: String, | |
| 647 | pub flag_name_prefixed: String, | |
| 648 | pub local_value: String, | |
| 649 | } | |
| 650 | ||
| 651 | #[derive(Diagnostic)] | |
| 652 | #[diag( | |
| 653 | "unknown target modifier `{$flag_name}`, requested by `-Cunsafe-allow-abi-mismatch={$flag_name}`" | |
| 654 | )] | |
| 655 | pub(crate) struct UnknownTargetModifierUnsafeAllowed { | |
| 656 | #[primary_span] | |
| 657 | pub span: Span, | |
| 658 | pub flag_name: String, | |
| 659 | } | |
| 660 | ||
| 661 | #[derive(Diagnostic)] | |
| 662 | #[diag( | |
| 663 | "found async drop types in dependency `{$extern_crate}`, but async_drop feature is disabled for `{$local_crate}`" | |
| 664 | )] | |
| 665 | #[help( | |
| 666 | "if async drop type will be dropped in a crate without `feature(async_drop)`, sync Drop will be used" | |
| 667 | )] | |
| 668 | pub(crate) struct AsyncDropTypesInDependency { | |
| 669 | #[primary_span] | |
| 670 | pub span: Span, | |
| 671 | pub extern_crate: Symbol, | |
| 672 | pub local_crate: Symbol, | |
| 673 | } | |
| 674 | ||
| 675 | #[derive(Diagnostic)] | |
| 676 | #[diag("link name must be well-formed if link kind is `raw-dylib`")] | |
| 677 | pub(crate) struct RawDylibMalformed { | |
| 678 | #[primary_span] | |
| 679 | pub span: Span, | |
| 680 | } | |
| 681 | ||
| 682 | #[derive(Diagnostic)] | |
| 683 | #[diag("extern crate `{$extern_crate}` is unused in crate `{$local_crate}`")] | |
| 684 | #[help("remove the dependency or add `use {$extern_crate} as _;` to the crate root")] | |
| 685 | pub(crate) struct UnusedCrateDependency { | |
| 686 | pub extern_crate: Symbol, | |
| 687 | pub local_crate: Symbol, | |
| 688 | } | |
| 689 | ||
| 690 | #[derive(Diagnostic)] | |
| 691 | #[diag( | |
| 692 | "your program uses the crate `{$extern_crate}`, that is not compiled with `{$mitigation_name}{$mitigation_level}` enabled" | |
| 693 | )] | |
| 694 | #[note( | |
| 695 | "recompile `{$extern_crate}` with `{$mitigation_name}{$mitigation_level}` enabled, or use `-Z allow-partial-mitigations={$mitigation_name}` to allow creating an artifact that has the mitigation partially enabled " | |
| 696 | )] | |
| 697 | #[help( | |
| 698 | "it is possible to disable `-Z allow-partial-mitigations={$mitigation_name}` via `-Z deny-partial-mitigations={$mitigation_name}`" | |
| 699 | )] | |
| 700 | pub(crate) struct MitigationLessStrictInDependency { | |
| 701 | #[primary_span] | |
| 702 | pub span: Span, | |
| 703 | pub mitigation_name: String, | |
| 704 | pub mitigation_level: String, | |
| 705 | pub extern_crate: Symbol, | |
| 706 | } |
compiler/rustc_metadata/src/fs.rs+1-1| ... | ... | @@ -8,7 +8,7 @@ use rustc_session::Session; |
| 8 | 8 | use rustc_session::config::{CrateType, OutFileName, OutputType}; |
| 9 | 9 | use rustc_session::output::filename_for_metadata; |
| 10 | 10 | |
| 11 | use crate::errors::{ | |
| 11 | use crate::diagnostics::{ | |
| 12 | 12 | BinaryOutputToTty, FailedCopyToStdout, FailedCreateEncodedMetadata, FailedCreateFile, |
| 13 | 13 | FailedCreateTempdir, FailedWriteError, |
| 14 | 14 | }; |
compiler/rustc_metadata/src/lib.rs+1-1| ... | ... | @@ -21,7 +21,7 @@ mod native_libs; |
| 21 | 21 | mod rmeta; |
| 22 | 22 | |
| 23 | 23 | pub mod creader; |
| 24 | pub mod errors; | |
| 24 | pub mod diagnostics; | |
| 25 | 25 | pub mod fs; |
| 26 | 26 | pub mod locator; |
| 27 | 27 |
compiler/rustc_metadata/src/locator.rs+39-18| ... | ... | @@ -235,7 +235,7 @@ use tempfile::Builder as TempFileBuilder; |
| 235 | 235 | use tracing::{debug, info}; |
| 236 | 236 | |
| 237 | 237 | use crate::creader::{Library, MetadataLoader}; |
| 238 | use crate::errors; | |
| 238 | use crate::diagnostics; | |
| 239 | 239 | use crate::rmeta::{METADATA_HEADER, MetadataBlob, ProcMacroKind, rustc_version}; |
| 240 | 240 | |
| 241 | 241 | #[derive(Clone)] |
| ... | ... | @@ -1070,28 +1070,45 @@ impl CrateError { |
| 1070 | 1070 | let dcx = sess.dcx(); |
| 1071 | 1071 | match self { |
| 1072 | 1072 | CrateError::NonAsciiName(crate_name) => { |
| 1073 | dcx.emit_err(errors::NonAsciiName { span, crate_name }); | |
| 1073 | dcx.emit_err(diagnostics::NonAsciiName { span, crate_name }); | |
| 1074 | 1074 | } |
| 1075 | 1075 | CrateError::ExternLocationNotExist(crate_name, loc) => { |
| 1076 | dcx.emit_err(errors::ExternLocationNotExist { span, crate_name, location: &loc }); | |
| 1076 | dcx.emit_err(diagnostics::ExternLocationNotExist { | |
| 1077 | span, | |
| 1078 | crate_name, | |
| 1079 | location: &loc, | |
| 1080 | }); | |
| 1077 | 1081 | } |
| 1078 | 1082 | CrateError::ExternLocationNotFile(crate_name, loc) => { |
| 1079 | dcx.emit_err(errors::ExternLocationNotFile { span, crate_name, location: &loc }); | |
| 1083 | dcx.emit_err(diagnostics::ExternLocationNotFile { | |
| 1084 | span, | |
| 1085 | crate_name, | |
| 1086 | location: &loc, | |
| 1087 | }); | |
| 1080 | 1088 | } |
| 1081 | 1089 | CrateError::MultipleCandidates(crate_name, flavor, candidates) => { |
| 1082 | dcx.emit_err(errors::MultipleCandidates { span, crate_name, flavor, candidates }); | |
| 1090 | dcx.emit_err(diagnostics::MultipleCandidates { | |
| 1091 | span, | |
| 1092 | crate_name, | |
| 1093 | flavor, | |
| 1094 | candidates, | |
| 1095 | }); | |
| 1083 | 1096 | } |
| 1084 | 1097 | CrateError::FullMetadataNotFound(crate_name, flavor) => { |
| 1085 | dcx.emit_err(errors::FullMetadataNotFound { span, crate_name, flavor }); | |
| 1098 | dcx.emit_err(diagnostics::FullMetadataNotFound { span, crate_name, flavor }); | |
| 1086 | 1099 | } |
| 1087 | 1100 | CrateError::SymbolConflictsCurrent(root_name) => { |
| 1088 | dcx.emit_err(errors::SymbolConflictsCurrent { span, crate_name: root_name }); | |
| 1101 | dcx.emit_err(diagnostics::SymbolConflictsCurrent { span, crate_name: root_name }); | |
| 1089 | 1102 | } |
| 1090 | 1103 | CrateError::StableCrateIdCollision(crate_name0, crate_name1) => { |
| 1091 | dcx.emit_err(errors::StableCrateIdCollision { span, crate_name0, crate_name1 }); | |
| 1104 | dcx.emit_err(diagnostics::StableCrateIdCollision { | |
| 1105 | span, | |
| 1106 | crate_name0, | |
| 1107 | crate_name1, | |
| 1108 | }); | |
| 1092 | 1109 | } |
| 1093 | 1110 | CrateError::DlOpen(path, err) | CrateError::DlSym(path, err) => { |
| 1094 | dcx.emit_err(errors::DlError { span, path, err }); | |
| 1111 | dcx.emit_err(diagnostics::DlError { span, path, err }); | |
| 1095 | 1112 | } |
| 1096 | 1113 | CrateError::LocatorCombined(locator) => { |
| 1097 | 1114 | let crate_name = locator.crate_name; |
| ... | ... | @@ -1102,8 +1119,12 @@ impl CrateError { |
| 1102 | 1119 | if !locator.crate_rejections.via_filename.is_empty() { |
| 1103 | 1120 | let mismatches = locator.crate_rejections.via_filename.iter(); |
| 1104 | 1121 | for CrateMismatch { path, .. } in mismatches { |
| 1105 | dcx.emit_err(errors::CrateLocationUnknownType { span, path, crate_name }); | |
| 1106 | dcx.emit_err(errors::LibFilenameForm { | |
| 1122 | dcx.emit_err(diagnostics::CrateLocationUnknownType { | |
| 1123 | span, | |
| 1124 | path, | |
| 1125 | crate_name, | |
| 1126 | }); | |
| 1127 | dcx.emit_err(diagnostics::LibFilenameForm { | |
| 1107 | 1128 | span, |
| 1108 | 1129 | dll_prefix: &locator.dll_prefix, |
| 1109 | 1130 | dll_suffix: &locator.dll_suffix, |
| ... | ... | @@ -1129,7 +1150,7 @@ impl CrateError { |
| 1129 | 1150 | )); |
| 1130 | 1151 | } |
| 1131 | 1152 | } |
| 1132 | dcx.emit_err(errors::NewerCrateVersion { | |
| 1153 | dcx.emit_err(diagnostics::NewerCrateVersion { | |
| 1133 | 1154 | span, |
| 1134 | 1155 | crate_name, |
| 1135 | 1156 | add_info, |
| ... | ... | @@ -1145,7 +1166,7 @@ impl CrateError { |
| 1145 | 1166 | path.display(), |
| 1146 | 1167 | )); |
| 1147 | 1168 | } |
| 1148 | dcx.emit_err(errors::NoCrateWithTriple { | |
| 1169 | dcx.emit_err(diagnostics::NoCrateWithTriple { | |
| 1149 | 1170 | span, |
| 1150 | 1171 | crate_name, |
| 1151 | 1172 | locator_triple: locator.triple.tuple(), |
| ... | ... | @@ -1161,7 +1182,7 @@ impl CrateError { |
| 1161 | 1182 | path.display() |
| 1162 | 1183 | )); |
| 1163 | 1184 | } |
| 1164 | dcx.emit_err(errors::FoundStaticlib { | |
| 1185 | dcx.emit_err(diagnostics::FoundStaticlib { | |
| 1165 | 1186 | span, |
| 1166 | 1187 | crate_name, |
| 1167 | 1188 | add_info, |
| ... | ... | @@ -1177,7 +1198,7 @@ impl CrateError { |
| 1177 | 1198 | path.display(), |
| 1178 | 1199 | )); |
| 1179 | 1200 | } |
| 1180 | dcx.emit_err(errors::IncompatibleRustc { | |
| 1201 | dcx.emit_err(diagnostics::IncompatibleRustc { | |
| 1181 | 1202 | span, |
| 1182 | 1203 | crate_name, |
| 1183 | 1204 | add_info, |
| ... | ... | @@ -1189,14 +1210,14 @@ impl CrateError { |
| 1189 | 1210 | for CrateMismatch { path: _, got } in locator.crate_rejections.via_invalid { |
| 1190 | 1211 | crate_rejections.push(got); |
| 1191 | 1212 | } |
| 1192 | dcx.emit_err(errors::InvalidMetadataFiles { | |
| 1213 | dcx.emit_err(diagnostics::InvalidMetadataFiles { | |
| 1193 | 1214 | span, |
| 1194 | 1215 | crate_name, |
| 1195 | 1216 | add_info, |
| 1196 | 1217 | crate_rejections, |
| 1197 | 1218 | }); |
| 1198 | 1219 | } else { |
| 1199 | let error = errors::CannotFindCrate { | |
| 1220 | let error = diagnostics::CannotFindCrate { | |
| 1200 | 1221 | span, |
| 1201 | 1222 | crate_name, |
| 1202 | 1223 | add_info, |
| ... | ... | @@ -1222,7 +1243,7 @@ impl CrateError { |
| 1222 | 1243 | } |
| 1223 | 1244 | } |
| 1224 | 1245 | CrateError::NotFound(crate_name) => { |
| 1225 | let error = errors::CannotFindCrate { | |
| 1246 | let error = diagnostics::CannotFindCrate { | |
| 1226 | 1247 | span, |
| 1227 | 1248 | crate_name, |
| 1228 | 1249 | add_info: String::new(), |
compiler/rustc_metadata/src/native_libs.rs+17-14| ... | ... | @@ -21,7 +21,7 @@ use rustc_span::Symbol; |
| 21 | 21 | use rustc_span::def_id::{DefId, LOCAL_CRATE}; |
| 22 | 22 | use rustc_target::spec::{Arch, BinaryFormat, CfgAbi, Env, LinkSelfContainedComponents, Os}; |
| 23 | 23 | |
| 24 | use crate::errors; | |
| 24 | use crate::diagnostics; | |
| 25 | 25 | |
| 26 | 26 | /// The fallback directories are passed to linker, but not used when rustc does the search, |
| 27 | 27 | /// because in the latter case the set of fallback directories cannot always be determined |
| ... | ... | @@ -163,8 +163,9 @@ pub fn try_find_native_dynamic_library( |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | pub fn find_native_static_library(name: &str, verbatim: bool, sess: &Session) -> PathBuf { |
| 166 | try_find_native_static_library(sess, name, verbatim) | |
| 167 | .unwrap_or_else(|| sess.dcx().emit_fatal(errors::MissingNativeLibrary::new(name, verbatim))) | |
| 166 | try_find_native_static_library(sess, name, verbatim).unwrap_or_else(|| { | |
| 167 | sess.dcx().emit_fatal(diagnostics::MissingNativeLibrary::new(name, verbatim)) | |
| 168 | }) | |
| 168 | 169 | } |
| 169 | 170 | |
| 170 | 171 | fn find_bundled_library( |
| ... | ... | @@ -241,7 +242,7 @@ impl<'tcx> Collector<'tcx> { |
| 241 | 242 | if let Some(span) = |
| 242 | 243 | find_attr!(self.tcx, child_item, LinkOrdinal {span, ..} => *span) |
| 243 | 244 | { |
| 244 | sess.dcx().emit_err(errors::LinkOrdinalRawDylib { span }); | |
| 245 | sess.dcx().emit_err(diagnostics::LinkOrdinalRawDylib { span }); | |
| 245 | 246 | } |
| 246 | 247 | } |
| 247 | 248 | |
| ... | ... | @@ -277,16 +278,18 @@ impl<'tcx> Collector<'tcx> { |
| 277 | 278 | && !self.tcx.sess.target.is_like_darwin |
| 278 | 279 | { |
| 279 | 280 | // Cannot check this when parsing options because the target is not yet available. |
| 280 | self.tcx.dcx().emit_err(errors::LibFrameworkApple); | |
| 281 | self.tcx.dcx().emit_err(diagnostics::LibFrameworkApple); | |
| 281 | 282 | } |
| 282 | 283 | if let Some(ref new_name) = lib.new_name { |
| 283 | 284 | let any_duplicate = self.libs.iter().any(|n| n.name.as_str() == lib.name); |
| 284 | 285 | if new_name.is_empty() { |
| 285 | self.tcx.dcx().emit_err(errors::EmptyRenamingTarget { lib_name: &lib.name }); | |
| 286 | self.tcx | |
| 287 | .dcx() | |
| 288 | .emit_err(diagnostics::EmptyRenamingTarget { lib_name: &lib.name }); | |
| 286 | 289 | } else if !any_duplicate { |
| 287 | self.tcx.dcx().emit_err(errors::RenamingNoLink { lib_name: &lib.name }); | |
| 290 | self.tcx.dcx().emit_err(diagnostics::RenamingNoLink { lib_name: &lib.name }); | |
| 288 | 291 | } else if !renames.insert(&lib.name) { |
| 289 | self.tcx.dcx().emit_err(errors::MultipleRenamings { lib_name: &lib.name }); | |
| 292 | self.tcx.dcx().emit_err(diagnostics::MultipleRenamings { lib_name: &lib.name }); | |
| 290 | 293 | } |
| 291 | 294 | } |
| 292 | 295 | } |
| ... | ... | @@ -312,14 +315,14 @@ impl<'tcx> Collector<'tcx> { |
| 312 | 315 | if lib.has_modifiers() || passed_lib.has_modifiers() { |
| 313 | 316 | match lib.foreign_module { |
| 314 | 317 | Some(def_id) => { |
| 315 | self.tcx.dcx().emit_err(errors::NoLinkModOverride { | |
| 318 | self.tcx.dcx().emit_err(diagnostics::NoLinkModOverride { | |
| 316 | 319 | span: Some(self.tcx.def_span(def_id)), |
| 317 | 320 | }) |
| 318 | 321 | } |
| 319 | 322 | None => self |
| 320 | 323 | .tcx |
| 321 | 324 | .dcx() |
| 322 | .emit_err(errors::NoLinkModOverride { span: None }), | |
| 325 | .emit_err(diagnostics::NoLinkModOverride { span: None }), | |
| 323 | 326 | }; |
| 324 | 327 | } |
| 325 | 328 | if passed_lib.kind != NativeLibKind::Unspecified { |
| ... | ... | @@ -434,7 +437,7 @@ impl<'tcx> Collector<'tcx> { |
| 434 | 437 | DllCallingConvention::Vectorcall(self.i686_arg_list_size(item)) |
| 435 | 438 | } |
| 436 | 439 | _ => { |
| 437 | self.tcx.dcx().emit_fatal(errors::RawDylibUnsupportedAbi { span }); | |
| 440 | self.tcx.dcx().emit_fatal(diagnostics::RawDylibUnsupportedAbi { span }); | |
| 438 | 441 | } |
| 439 | 442 | } |
| 440 | 443 | } else { |
| ... | ... | @@ -443,7 +446,7 @@ impl<'tcx> Collector<'tcx> { |
| 443 | 446 | DllCallingConvention::C |
| 444 | 447 | } |
| 445 | 448 | _ => { |
| 446 | self.tcx.dcx().emit_fatal(errors::RawDylibUnsupportedAbi { span }); | |
| 449 | self.tcx.dcx().emit_fatal(diagnostics::RawDylibUnsupportedAbi { span }); | |
| 447 | 450 | } |
| 448 | 451 | } |
| 449 | 452 | }; |
| ... | ... | @@ -458,11 +461,11 @@ impl<'tcx> Collector<'tcx> { |
| 458 | 461 | if self.tcx.sess.target.binary_format == BinaryFormat::Elf { |
| 459 | 462 | let name = name.as_str(); |
| 460 | 463 | if name.contains('\0') { |
| 461 | self.tcx.dcx().emit_err(errors::RawDylibMalformed { span }); | |
| 464 | self.tcx.dcx().emit_err(diagnostics::RawDylibMalformed { span }); | |
| 462 | 465 | } else if let Some((left, right)) = name.split_once('@') |
| 463 | 466 | && (left.is_empty() || right.is_empty() || right.contains('@')) |
| 464 | 467 | { |
| 465 | self.tcx.dcx().emit_err(errors::RawDylibMalformed { span }); | |
| 468 | self.tcx.dcx().emit_err(diagnostics::RawDylibMalformed { span }); | |
| 466 | 469 | } |
| 467 | 470 | } |
| 468 | 471 |
compiler/rustc_metadata/src/rmeta/encoder.rs+6-3| ... | ... | @@ -35,12 +35,12 @@ use rustc_span::{ |
| 35 | 35 | }; |
| 36 | 36 | use tracing::{debug, instrument, trace}; |
| 37 | 37 | |
| 38 | use crate::diagnostics::{FailCreateFileEncoder, FailWriteFile}; | |
| 38 | 39 | use crate::eii::EiiMapEncodedKeyValue; |
| 39 | use crate::errors::{FailCreateFileEncoder, FailWriteFile}; | |
| 40 | 40 | use crate::rmeta::*; |
| 41 | 41 | |
| 42 | 42 | pub(super) struct EncodeContext<'a, 'tcx> { |
| 43 | opaque: opaque::FileEncoder, | |
| 43 | opaque: opaque::FileEncoder<'a>, | |
| 44 | 44 | tcx: TyCtxt<'tcx>, |
| 45 | 45 | feat: &'tcx rustc_feature::Features, |
| 46 | 46 | tables: TableBuilders, |
| ... | ... | @@ -1122,6 +1122,9 @@ fn should_encode_mir( |
| 1122 | 1122 | && reachable_set.contains(&def_id) |
| 1123 | 1123 | && (tcx.generics_of(def_id).requires_monomorphization(tcx) |
| 1124 | 1124 | || tcx.cross_crate_inlinable(def_id))); |
| 1125 | // Comptime fns do not have optimized MIR at all. | |
| 1126 | let opt = | |
| 1127 | opt && !matches!(tcx.constness(def_id), hir::Constness::Const { always: true }); | |
| 1125 | 1128 | // The function has a `const` modifier or is in a `const trait`. |
| 1126 | 1129 | let is_const_fn = tcx.is_const_fn(def_id.to_def_id()); |
| 1127 | 1130 | (is_const_fn, opt) |
| ... | ... | @@ -1153,6 +1156,7 @@ fn should_encode_variances<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId, def_kind: Def |
| 1153 | 1156 | | DefKind::Static { .. } |
| 1154 | 1157 | | DefKind::Const { .. } |
| 1155 | 1158 | | DefKind::ForeignMod |
| 1159 | | DefKind::TyAlias | |
| 1156 | 1160 | | DefKind::Impl { .. } |
| 1157 | 1161 | | DefKind::Trait |
| 1158 | 1162 | | DefKind::TraitAlias |
| ... | ... | @@ -1166,7 +1170,6 @@ fn should_encode_variances<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId, def_kind: Def |
| 1166 | 1170 | | DefKind::Closure |
| 1167 | 1171 | | DefKind::ExternCrate |
| 1168 | 1172 | | DefKind::SyntheticCoroutineBody => false, |
| 1169 | DefKind::TyAlias => tcx.type_alias_is_lazy(def_id), | |
| 1170 | 1173 | } |
| 1171 | 1174 | } |
| 1172 | 1175 |
compiler/rustc_metadata/src/rmeta/mod.rs+1-1| ... | ... | @@ -371,7 +371,7 @@ macro_rules! define_tables { |
| 371 | 371 | } |
| 372 | 372 | |
| 373 | 373 | impl TableBuilders { |
| 374 | fn encode(&self, buf: &mut FileEncoder) -> LazyTables { | |
| 374 | fn encode(&self, buf: &mut FileEncoder<'_>) -> LazyTables { | |
| 375 | 375 | LazyTables { |
| 376 | 376 | $($name1: self.$name1.encode(buf),)+ |
| 377 | 377 | $($name2: self.$name2.encode(buf),)+ |
compiler/rustc_metadata/src/rmeta/table.rs+1-1| ... | ... | @@ -487,7 +487,7 @@ impl<I: Idx, const N: usize, T: FixedSizeEncoding<ByteArray = [u8; N]>> TableBui |
| 487 | 487 | } |
| 488 | 488 | } |
| 489 | 489 | |
| 490 | pub(crate) fn encode(&self, buf: &mut FileEncoder) -> LazyTable<I, T> { | |
| 490 | pub(crate) fn encode(&self, buf: &mut FileEncoder<'_>) -> LazyTable<I, T> { | |
| 491 | 491 | let pos = buf.position(); |
| 492 | 492 | |
| 493 | 493 | let width = self.width; |
compiler/rustc_middle/src/dep_graph/graph.rs+8-6| ... | ... | @@ -135,7 +135,7 @@ impl DepGraph { |
| 135 | 135 | session: &Session, |
| 136 | 136 | prev_graph: Arc<SerializedDepGraph>, |
| 137 | 137 | prev_work_products: WorkProductMap, |
| 138 | encoder: FileEncoder, | |
| 138 | encoder: FileEncoder<'static>, | |
| 139 | 139 | ) -> DepGraph { |
| 140 | 140 | let prev_graph_node_count = prev_graph.node_count(); |
| 141 | 141 | |
| ... | ... | @@ -195,10 +195,12 @@ impl DepGraph { |
| 195 | 195 | self.data.is_some() |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | pub fn with_retained_dep_graph(&self, f: impl Fn(&RetainedDepGraph)) { | |
| 199 | if let Some(data) = &self.data { | |
| 200 | data.current.encoder.with_retained_dep_graph(f) | |
| 201 | } | |
| 198 | /// Returns a clone of the in-memory retained dep graph, if it is being built | |
| 199 | /// (i.e. `-Zquery-dep-graph` is set). Cloning rather than exposing the lock keeps | |
| 200 | /// callers from holding it while forcing queries, which would deadlock against a | |
| 201 | /// reentrant `record` under the parallel frontend. | |
| 202 | pub fn retained_dep_graph(&self) -> Option<RetainedDepGraph> { | |
| 203 | self.data.as_ref().and_then(|data| data.current.encoder.retained_dep_graph()) | |
| 202 | 204 | } |
| 203 | 205 | |
| 204 | 206 | pub fn assert_ignored(&self) { |
| ... | ... | @@ -1135,7 +1137,7 @@ impl CurrentDepGraph { |
| 1135 | 1137 | fn new( |
| 1136 | 1138 | session: &Session, |
| 1137 | 1139 | prev_graph_node_count: usize, |
| 1138 | encoder: FileEncoder, | |
| 1140 | encoder: FileEncoder<'static>, | |
| 1139 | 1141 | previous: Arc<SerializedDepGraph>, |
| 1140 | 1142 | ) -> Self { |
| 1141 | 1143 | let mut stable_hasher = StableHasher::new(); |
compiler/rustc_middle/src/dep_graph/retained.rs+1| ... | ... | @@ -9,6 +9,7 @@ use super::{DepNode, DepNodeIndex}; |
| 9 | 9 | /// Normally, dependencies recorded during the current session are written to |
| 10 | 10 | /// disk and then forgotten, to avoid wasting memory on information that is |
| 11 | 11 | /// not needed when the compiler is working correctly. |
| 12 | #[derive(Clone)] | |
| 12 | 13 | pub struct RetainedDepGraph { |
| 13 | 14 | pub inner: LinkedGraph<DepNode, ()>, |
| 14 | 15 | pub indices: FxHashMap<DepNode, NodeIndex>, |
compiler/rustc_middle/src/dep_graph/serialized.rs+15-11| ... | ... | @@ -564,13 +564,17 @@ struct LocalEncoderResult { |
| 564 | 564 | struct EncoderState { |
| 565 | 565 | next_node_index: AtomicU64, |
| 566 | 566 | previous: Arc<SerializedDepGraph>, |
| 567 | file: Lock<Option<FileEncoder>>, | |
| 567 | file: Lock<Option<FileEncoder<'static>>>, | |
| 568 | 568 | local: WorkerLocal<RefCell<LocalEncoderState>>, |
| 569 | 569 | stats: Option<Lock<FxHashMap<DepKind, Stat>>>, |
| 570 | 570 | } |
| 571 | 571 | |
| 572 | 572 | impl EncoderState { |
| 573 | fn new(encoder: FileEncoder, record_stats: bool, previous: Arc<SerializedDepGraph>) -> Self { | |
| 573 | fn new( | |
| 574 | encoder: FileEncoder<'static>, | |
| 575 | record_stats: bool, | |
| 576 | previous: Arc<SerializedDepGraph>, | |
| 577 | ) -> Self { | |
| 574 | 578 | Self { |
| 575 | 579 | previous, |
| 576 | 580 | next_node_index: AtomicU64::new(0), |
| ... | ... | @@ -636,10 +640,12 @@ impl EncoderState { |
| 636 | 640 | |
| 637 | 641 | // Outline the build of the full dep graph as it's typically disabled and cold. |
| 638 | 642 | outline(move || { |
| 639 | // Do not ICE when a query is called from within `with_query`. | |
| 640 | if let Some(retained_graph) = &mut retained_graph.try_lock() { | |
| 641 | retained_graph.push(index, *node, &edges); | |
| 642 | } | |
| 643 | // Block on the lock rather than using `try_lock`: under the parallel frontend | |
| 644 | // several threads record nodes concurrently, and dropping a node on lock | |
| 645 | // contention would make the retained graph nondeterministic. Readers take a | |
| 646 | // clone of the graph (`retained_dep_graph`) rather than holding the lock, so | |
| 647 | // this never deadlocks against a reentrant `record`. | |
| 648 | retained_graph.lock().push(index, *node, &edges); | |
| 643 | 649 | }); |
| 644 | 650 | } |
| 645 | 651 | |
| ... | ... | @@ -861,7 +867,7 @@ pub(crate) struct GraphEncoder { |
| 861 | 867 | impl GraphEncoder { |
| 862 | 868 | pub(crate) fn new( |
| 863 | 869 | sess: &Session, |
| 864 | encoder: FileEncoder, | |
| 870 | encoder: FileEncoder<'static>, | |
| 865 | 871 | prev_node_count: usize, |
| 866 | 872 | previous: Arc<SerializedDepGraph>, |
| 867 | 873 | ) -> Self { |
| ... | ... | @@ -874,10 +880,8 @@ impl GraphEncoder { |
| 874 | 880 | GraphEncoder { status, retained_graph, profiler: sess.prof.clone() } |
| 875 | 881 | } |
| 876 | 882 | |
| 877 | pub(crate) fn with_retained_dep_graph(&self, f: impl Fn(&RetainedDepGraph)) { | |
| 878 | if let Some(retained_graph) = &self.retained_graph { | |
| 879 | f(&retained_graph.lock()) | |
| 880 | } | |
| 883 | pub(crate) fn retained_dep_graph(&self) -> Option<RetainedDepGraph> { | |
| 884 | self.retained_graph.as_ref().map(|retained_graph| retained_graph.lock().clone()) | |
| 881 | 885 | } |
| 882 | 886 | |
| 883 | 887 | /// Encodes a node that does not exists in the previous graph. |
compiler/rustc_middle/src/hir/map.rs+8| ... | ... | @@ -871,6 +871,14 @@ impl<'tcx> TyCtxt<'tcx> { |
| 871 | 871 | self.opt_hir_owner_node(def_id)?.fn_decl()?.opt_delegation_sig_id() |
| 872 | 872 | } |
| 873 | 873 | |
| 874 | pub fn hir_opt_delegation_info(self, def_id: LocalDefId) -> Option<&'tcx DelegationInfo> { | |
| 875 | self.opt_hir_owner_node(def_id)?.fn_decl()?.opt_delegation_info() | |
| 876 | } | |
| 877 | ||
| 878 | pub fn hir_delegation_info(self, delegation_id: LocalDefId) -> &'tcx DelegationInfo { | |
| 879 | self.hir_opt_delegation_info(delegation_id).expect("processing delegation") | |
| 880 | } | |
| 881 | ||
| 874 | 882 | #[inline] |
| 875 | 883 | fn hir_opt_ident(self, id: HirId) -> Option<Ident> { |
| 876 | 884 | match self.hir_node(id) { |
compiler/rustc_middle/src/query/on_disk_cache.rs+2-2| ... | ... | @@ -201,7 +201,7 @@ impl OnDiskCache { |
| 201 | 201 | |
| 202 | 202 | /// Serialize the current-session data that will be loaded by [`OnDiskCache`] |
| 203 | 203 | /// in a subsequent incremental compilation session. |
| 204 | pub fn serialize(tcx: TyCtxt<'_>, encoder: FileEncoder) -> FileEncodeResult { | |
| 204 | pub fn serialize(tcx: TyCtxt<'_>, encoder: FileEncoder<'static>) -> FileEncodeResult { | |
| 205 | 205 | // Serializing the `DepGraph` should not modify it. |
| 206 | 206 | tcx.dep_graph.with_ignore(|| { |
| 207 | 207 | // Allocate `SourceFileIndex`es. |
| ... | ... | @@ -779,7 +779,7 @@ impl_ref_decoder! {<'tcx> |
| 779 | 779 | /// An encoder that can write to the incremental compilation cache. |
| 780 | 780 | pub struct CacheEncoder<'a, 'tcx> { |
| 781 | 781 | tcx: TyCtxt<'tcx>, |
| 782 | encoder: FileEncoder, | |
| 782 | encoder: FileEncoder<'static>, | |
| 783 | 783 | type_shorthands: FxHashMap<Ty<'tcx>, usize>, |
| 784 | 784 | predicate_shorthands: FxHashMap<ty::PredicateKind<'tcx>, usize>, |
| 785 | 785 | interpret_allocs: FxIndexSet<interpret::AllocId>, |
compiler/rustc_middle/src/ty/context/impl_interner.rs-15| ... | ... | @@ -208,21 +208,6 @@ impl<'tcx> Interner for TyCtxt<'tcx> { |
| 208 | 208 | self.adt_def(adt_def_id) |
| 209 | 209 | } |
| 210 | 210 | |
| 211 | fn alias_ty_kind_from_def_id(self, def_id: DefId) -> ty::AliasTyKind<'tcx> { | |
| 212 | match self.def_kind(def_id) { | |
| 213 | DefKind::AssocTy | |
| 214 | if let DefKind::Impl { of_trait: false } = self.def_kind(self.parent(def_id)) => | |
| 215 | { | |
| 216 | ty::Inherent { def_id } | |
| 217 | } | |
| 218 | DefKind::AssocTy => ty::Projection { def_id }, | |
| 219 | ||
| 220 | DefKind::OpaqueTy => ty::Opaque { def_id }, | |
| 221 | DefKind::TyAlias => ty::Free { def_id }, | |
| 222 | kind => bug!("unexpected DefKind in AliasTy: {kind:?}"), | |
| 223 | } | |
| 224 | } | |
| 225 | ||
| 226 | 211 | fn unevaluated_const_kind_from_def_id( |
| 227 | 212 | self, |
| 228 | 213 | def_id: Self::DefId, |
compiler/rustc_middle/src/ty/mod.rs+12-4| ... | ... | @@ -201,6 +201,9 @@ pub struct ResolverGlobalCtxt { |
| 201 | 201 | pub doc_link_traits_in_scope: FxIndexMap<LocalDefId, Vec<DefId>>, |
| 202 | 202 | pub all_macro_rules: UnordSet<Symbol>, |
| 203 | 203 | pub stripped_cfg_items: Vec<StrippedCfgItem>, |
| 204 | // Information about delegations which is used when handling recursive delegations | |
| 205 | // and ensures easy access to delegation-only `LocalDefId`s. | |
| 206 | pub delegation_infos: FxIndexMap<LocalDefId, DelegationInfo>, | |
| 204 | 207 | } |
| 205 | 208 | |
| 206 | 209 | #[derive(Debug)] |
| ... | ... | @@ -257,13 +260,10 @@ pub struct ResolverAstLowering<'tcx> { |
| 257 | 260 | /// Lints that were emitted by the resolver and early lints. |
| 258 | 261 | pub lint_buffer: Steal<LintBuffer>, |
| 259 | 262 | |
| 260 | // Information about delegations which is used when handling recursive delegations | |
| 261 | pub delegation_infos: LocalDefIdMap<DelegationInfo>, | |
| 262 | ||
| 263 | 263 | pub disambiguators: LocalDefIdMap<Steal<PerParentDisambiguatorState>>, |
| 264 | 264 | } |
| 265 | 265 | |
| 266 | #[derive(Debug)] | |
| 266 | #[derive(Debug, StableHash)] | |
| 267 | 267 | pub struct DelegationInfo { |
| 268 | 268 | // `DefId` (either the resolution at delegation.id or item_id in case of a trait impl) for signature resolution, |
| 269 | 269 | // for details see https://github.com/rust-lang/rust/issues/118212#issuecomment-2160686914 |
| ... | ... | @@ -1789,6 +1789,14 @@ impl<'tcx> TyCtxt<'tcx> { |
| 1789 | 1789 | | DefKind::Ctor(..) |
| 1790 | 1790 | | DefKind::AnonConst |
| 1791 | 1791 | | DefKind::InlineConst => self.mir_for_ctfe(def), |
| 1792 | DefKind::Fn | DefKind::AssocFn | |
| 1793 | if matches!( | |
| 1794 | self.constness(def), | |
| 1795 | hir::Constness::Const { always: true } | |
| 1796 | ) => | |
| 1797 | { | |
| 1798 | self.mir_for_ctfe(def) | |
| 1799 | } | |
| 1792 | 1800 | // If the caller wants `mir_for_ctfe` of a function they should not be using |
| 1793 | 1801 | // `instance_mir`, so we'll assume const fn also wants the optimized version. |
| 1794 | 1802 | _ => self.optimized_mir(def), |
compiler/rustc_middle/src/ty/util.rs+7-3| ... | ... | @@ -905,7 +905,7 @@ impl<'tcx> TyCtxt<'tcx> { |
| 905 | 905 | return Ty::new_error(self, guar); |
| 906 | 906 | } |
| 907 | 907 | |
| 908 | ty = self.type_of(def_id).instantiate(self, args).skip_norm_wip(); | |
| 908 | ty = self.type_of(def_id).instantiate(self, args).skip_normalization(); | |
| 909 | 909 | depth += 1; |
| 910 | 910 | } |
| 911 | 911 | |
| ... | ... | @@ -967,7 +967,7 @@ impl<'tcx> OpaqueTypeExpander<'tcx> { |
| 967 | 967 | Some(expanded_ty) => *expanded_ty, |
| 968 | 968 | None => { |
| 969 | 969 | let generic_ty = self.tcx.type_of(def_id); |
| 970 | let concrete_ty = generic_ty.instantiate(self.tcx, args).skip_norm_wip(); | |
| 970 | let concrete_ty = generic_ty.instantiate(self.tcx, args).skip_normalization(); | |
| 971 | 971 | let expanded_ty = self.fold_ty(concrete_ty); |
| 972 | 972 | self.expanded_cache.insert((def_id, args), expanded_ty); |
| 973 | 973 | expanded_ty |
| ... | ... | @@ -1047,7 +1047,11 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for FreeAliasTypeExpander<'tcx> { |
| 1047 | 1047 | |
| 1048 | 1048 | self.depth += 1; |
| 1049 | 1049 | let ty = ensure_sufficient_stack(|| { |
| 1050 | self.tcx.type_of(def_id).instantiate(self.tcx, args).skip_norm_wip().fold_with(self) | |
| 1050 | self.tcx | |
| 1051 | .type_of(def_id) | |
| 1052 | .instantiate(self.tcx, args) | |
| 1053 | .skip_normalization() | |
| 1054 | .fold_with(self) | |
| 1051 | 1055 | }); |
| 1052 | 1056 | self.depth -= 1; |
| 1053 | 1057 | ty |
compiler/rustc_mir_build/src/builder/expr/into.rs+1-1| ... | ... | @@ -18,7 +18,7 @@ use crate::builder::expr::category::{Category, RvalueFunc}; |
| 18 | 18 | use crate::builder::matches::{DeclareLetBindings, Exhaustive, HasMatchGuard}; |
| 19 | 19 | use crate::builder::scope::LintLevel; |
| 20 | 20 | use crate::builder::{BlockAnd, BlockAndExtension, BlockFrame, Builder, NeedsTemporary}; |
| 21 | use crate::errors::{LoopMatchArmWithGuard, LoopMatchUnsupportedType}; | |
| 21 | use crate::diagnostics::{LoopMatchArmWithGuard, LoopMatchUnsupportedType}; | |
| 22 | 22 | |
| 23 | 23 | impl<'a, 'tcx> Builder<'a, 'tcx> { |
| 24 | 24 | /// Compile `expr`, storing the result into `destination`, which |
compiler/rustc_mir_build/src/builder/mod.rs+3-3| ... | ... | @@ -44,7 +44,7 @@ use rustc_span::{Span, Symbol}; |
| 44 | 44 | |
| 45 | 45 | use crate::builder::expr::as_place::PlaceBuilder; |
| 46 | 46 | use crate::builder::scope::{DropKind, LintLevel}; |
| 47 | use crate::errors; | |
| 47 | use crate::diagnostics; | |
| 48 | 48 | |
| 49 | 49 | pub(crate) fn closure_saved_names_of_captured_variables<'tcx>( |
| 50 | 50 | tcx: TyCtxt<'tcx>, |
| ... | ... | @@ -577,7 +577,7 @@ fn construct_const<'a, 'tcx>( |
| 577 | 577 | }) |
| 578 | 578 | | Node::ImplItem(hir::ImplItem { kind: hir::ImplItemKind::Const(ty, _), span, .. }) |
| 579 | 579 | | Node::TraitItem(hir::TraitItem { |
| 580 | kind: hir::TraitItemKind::Const(ty, Some(_), _), | |
| 580 | kind: hir::TraitItemKind::Const(ty, Some(_)), | |
| 581 | 581 | span, |
| 582 | 582 | .. |
| 583 | 583 | }) => (*span, ty.span), |
| ... | ... | @@ -931,7 +931,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { |
| 931 | 931 | lint::builtin::UNREACHABLE_CODE, |
| 932 | 932 | lint_root, |
| 933 | 933 | target_loc.span, |
| 934 | errors::UnreachableDueToUninhabited { | |
| 934 | diagnostics::UnreachableDueToUninhabited { | |
| 935 | 935 | expr: target_loc.span, |
| 936 | 936 | orig: orig_span, |
| 937 | 937 | descr, |
compiler/rustc_mir_build/src/builder/scope.rs+2-2| ... | ... | @@ -99,7 +99,7 @@ use tracing::{debug, instrument}; |
| 99 | 99 | |
| 100 | 100 | use super::matches::BuiltMatchTree; |
| 101 | 101 | use crate::builder::{BlockAnd, BlockAndExtension, BlockFrame, Builder, CFG}; |
| 102 | use crate::errors::{ | |
| 102 | use crate::diagnostics::{ | |
| 103 | 103 | ConstContinueBadConst, ConstContinueNotMonomorphicConst, ConstContinueUnknownJumpTarget, |
| 104 | 104 | }; |
| 105 | 105 | |
| ... | ... | @@ -924,7 +924,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { |
| 924 | 924 | | ExprKind::NamedConst { .. } => self.as_constant(&self.thir[value]), |
| 925 | 925 | |
| 926 | 926 | other => { |
| 927 | use crate::errors::ConstContinueNotMonomorphicConstReason as Reason; | |
| 927 | use crate::diagnostics::ConstContinueNotMonomorphicConstReason as Reason; | |
| 928 | 928 | |
| 929 | 929 | let span = expr.span; |
| 930 | 930 | let reason = match other { |
compiler/rustc_mir_build/src/check_unsafety.rs+1-1| ... | ... | @@ -16,7 +16,7 @@ use rustc_session::lint::builtin::{DEPRECATED_SAFE_2024, UNSAFE_OP_IN_UNSAFE_FN, |
| 16 | 16 | use rustc_span::def_id::{DefId, LocalDefId}; |
| 17 | 17 | use rustc_span::{Span, Symbol}; |
| 18 | 18 | |
| 19 | use crate::errors::*; | |
| 19 | use crate::diagnostics::*; | |
| 20 | 20 | |
| 21 | 21 | struct UnsafetyVisitor<'a, 'tcx> { |
| 22 | 22 | tcx: TyCtxt<'tcx>, |
compiler/rustc_mir_build/src/diagnostics.rs created+1449| ... | ... | @@ -0,0 +1,1449 @@ |
| 1 | use rustc_errors::codes::*; | |
| 2 | use rustc_errors::{ | |
| 3 | Applicability, Diag, DiagArgValue, DiagCtxtHandle, Diagnostic, EmissionGuarantee, Level, | |
| 4 | MultiSpan, Subdiagnostic, msg, | |
| 5 | }; | |
| 6 | use rustc_macros::{Diagnostic, Subdiagnostic}; | |
| 7 | use rustc_middle::ty::{self, Ty}; | |
| 8 | use rustc_pattern_analysis::errors::Uncovered; | |
| 9 | use rustc_pattern_analysis::rustc::RustcPatCtxt; | |
| 10 | use rustc_span::{Ident, Span, Symbol}; | |
| 11 | ||
| 12 | #[derive(Diagnostic)] | |
| 13 | #[diag("call to deprecated safe function `{$function}` is unsafe and requires unsafe block")] | |
| 14 | pub(crate) struct CallToDeprecatedSafeFnRequiresUnsafe { | |
| 15 | #[label("call to unsafe function")] | |
| 16 | pub(crate) span: Span, | |
| 17 | pub(crate) function: String, | |
| 18 | #[subdiagnostic] | |
| 19 | pub(crate) sub: CallToDeprecatedSafeFnRequiresUnsafeSub, | |
| 20 | } | |
| 21 | ||
| 22 | #[derive(Subdiagnostic)] | |
| 23 | #[multipart_suggestion( | |
| 24 | "you can wrap the call in an `unsafe` block if you can guarantee {$guarantee}", | |
| 25 | applicability = "machine-applicable" | |
| 26 | )] | |
| 27 | pub(crate) struct CallToDeprecatedSafeFnRequiresUnsafeSub { | |
| 28 | pub(crate) start_of_line_suggestion: String, | |
| 29 | #[suggestion_part(code = "{start_of_line_suggestion}")] | |
| 30 | pub(crate) start_of_line: Span, | |
| 31 | #[suggestion_part(code = "unsafe {{ ")] | |
| 32 | pub(crate) left: Span, | |
| 33 | #[suggestion_part(code = " }}")] | |
| 34 | pub(crate) right: Span, | |
| 35 | pub(crate) guarantee: String, | |
| 36 | } | |
| 37 | ||
| 38 | #[derive(Diagnostic)] | |
| 39 | #[diag("call to unsafe function `{$function}` is unsafe and requires unsafe block", code = E0133)] | |
| 40 | #[note("consult the function's documentation for information on how to avoid undefined behavior")] | |
| 41 | pub(crate) struct UnsafeOpInUnsafeFnCallToUnsafeFunctionRequiresUnsafe { | |
| 42 | #[label("call to unsafe function")] | |
| 43 | pub(crate) span: Span, | |
| 44 | pub(crate) function: String, | |
| 45 | #[subdiagnostic] | |
| 46 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedLintNote>, | |
| 47 | } | |
| 48 | ||
| 49 | #[derive(Diagnostic)] | |
| 50 | #[diag("call to unsafe function is unsafe and requires unsafe block", code = E0133)] | |
| 51 | #[note("consult the function's documentation for information on how to avoid undefined behavior")] | |
| 52 | pub(crate) struct UnsafeOpInUnsafeFnCallToUnsafeFunctionRequiresUnsafeNameless { | |
| 53 | #[label("call to unsafe function")] | |
| 54 | pub(crate) span: Span, | |
| 55 | #[subdiagnostic] | |
| 56 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedLintNote>, | |
| 57 | } | |
| 58 | ||
| 59 | #[derive(Diagnostic)] | |
| 60 | #[diag("use of inline assembly is unsafe and requires unsafe block", code = E0133)] | |
| 61 | #[note("inline assembly is entirely unchecked and can cause undefined behavior")] | |
| 62 | pub(crate) struct UnsafeOpInUnsafeFnUseOfInlineAssemblyRequiresUnsafe { | |
| 63 | #[label("use of inline assembly")] | |
| 64 | pub(crate) span: Span, | |
| 65 | #[subdiagnostic] | |
| 66 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedLintNote>, | |
| 67 | } | |
| 68 | ||
| 69 | #[derive(Diagnostic)] | |
| 70 | #[diag("initializing type with an unsafe field is unsafe and requires unsafe block", code = E0133)] | |
| 71 | #[note("unsafe fields may carry library invariants")] | |
| 72 | pub(crate) struct UnsafeOpInUnsafeFnInitializingTypeWithUnsafeFieldRequiresUnsafe { | |
| 73 | #[label("initialization of struct with unsafe field")] | |
| 74 | pub(crate) span: Span, | |
| 75 | #[subdiagnostic] | |
| 76 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedLintNote>, | |
| 77 | } | |
| 78 | ||
| 79 | #[derive(Diagnostic)] | |
| 80 | #[diag("use of mutable static is unsafe and requires unsafe block", code = E0133)] | |
| 81 | #[note( | |
| 82 | "mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior" | |
| 83 | )] | |
| 84 | pub(crate) struct UnsafeOpInUnsafeFnUseOfMutableStaticRequiresUnsafe { | |
| 85 | #[label("use of mutable static")] | |
| 86 | pub(crate) span: Span, | |
| 87 | #[subdiagnostic] | |
| 88 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedLintNote>, | |
| 89 | } | |
| 90 | ||
| 91 | #[derive(Diagnostic)] | |
| 92 | #[diag("use of extern static is unsafe and requires unsafe block", code = E0133)] | |
| 93 | #[note( | |
| 94 | "extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior" | |
| 95 | )] | |
| 96 | pub(crate) struct UnsafeOpInUnsafeFnUseOfExternStaticRequiresUnsafe { | |
| 97 | #[label("use of extern static")] | |
| 98 | pub(crate) span: Span, | |
| 99 | #[subdiagnostic] | |
| 100 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedLintNote>, | |
| 101 | } | |
| 102 | ||
| 103 | #[derive(Diagnostic)] | |
| 104 | #[diag("use of unsafe field is unsafe and requires unsafe block", code = E0133)] | |
| 105 | #[note("unsafe fields may carry library invariants")] | |
| 106 | pub(crate) struct UnsafeOpInUnsafeFnUseOfUnsafeFieldRequiresUnsafe { | |
| 107 | #[label("use of unsafe field")] | |
| 108 | pub(crate) span: Span, | |
| 109 | #[subdiagnostic] | |
| 110 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedLintNote>, | |
| 111 | } | |
| 112 | ||
| 113 | #[derive(Diagnostic)] | |
| 114 | #[diag("dereference of raw pointer is unsafe and requires unsafe block", code = E0133)] | |
| 115 | #[note( | |
| 116 | "raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior" | |
| 117 | )] | |
| 118 | pub(crate) struct UnsafeOpInUnsafeFnDerefOfRawPointerRequiresUnsafe { | |
| 119 | #[label("dereference of raw pointer")] | |
| 120 | pub(crate) span: Span, | |
| 121 | #[subdiagnostic] | |
| 122 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedLintNote>, | |
| 123 | } | |
| 124 | ||
| 125 | #[derive(Diagnostic)] | |
| 126 | #[diag("access to union field is unsafe and requires unsafe block", code = E0133)] | |
| 127 | #[note( | |
| 128 | "the field may not be properly initialized: using uninitialized data will cause undefined behavior" | |
| 129 | )] | |
| 130 | pub(crate) struct UnsafeOpInUnsafeFnAccessToUnionFieldRequiresUnsafe { | |
| 131 | #[label("access to union field")] | |
| 132 | pub(crate) span: Span, | |
| 133 | #[subdiagnostic] | |
| 134 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedLintNote>, | |
| 135 | } | |
| 136 | ||
| 137 | #[derive(Diagnostic)] | |
| 138 | #[diag( | |
| 139 | "mutation of layout constrained field is unsafe and requires unsafe block", | |
| 140 | code = E0133 | |
| 141 | )] | |
| 142 | #[note("mutating layout constrained fields cannot statically be checked for valid values")] | |
| 143 | pub(crate) struct UnsafeOpInUnsafeFnMutationOfLayoutConstrainedFieldRequiresUnsafe { | |
| 144 | #[label("mutation of layout constrained field")] | |
| 145 | pub(crate) span: Span, | |
| 146 | #[subdiagnostic] | |
| 147 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedLintNote>, | |
| 148 | } | |
| 149 | ||
| 150 | #[derive(Diagnostic)] | |
| 151 | #[diag( | |
| 152 | "borrow of layout constrained field with interior mutability is unsafe and requires unsafe block", | |
| 153 | code = E0133, | |
| 154 | )] | |
| 155 | pub(crate) struct UnsafeOpInUnsafeFnBorrowOfLayoutConstrainedFieldRequiresUnsafe { | |
| 156 | #[label("borrow of layout constrained field with interior mutability")] | |
| 157 | pub(crate) span: Span, | |
| 158 | #[subdiagnostic] | |
| 159 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedLintNote>, | |
| 160 | } | |
| 161 | ||
| 162 | #[derive(Diagnostic)] | |
| 163 | #[diag( | |
| 164 | "unsafe binder cast is unsafe and requires unsafe block information that may be required to uphold safety guarantees of a type", | |
| 165 | code = E0133, | |
| 166 | )] | |
| 167 | pub(crate) struct UnsafeOpInUnsafeFnUnsafeBinderCastRequiresUnsafe { | |
| 168 | #[label("unsafe binder cast")] | |
| 169 | pub(crate) span: Span, | |
| 170 | #[subdiagnostic] | |
| 171 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedLintNote>, | |
| 172 | } | |
| 173 | ||
| 174 | #[derive(Diagnostic)] | |
| 175 | #[diag("call to function `{$function}` with `#[target_feature]` is unsafe and requires unsafe block", code = E0133)] | |
| 176 | #[help( | |
| 177 | "in order for the call to be safe, the context requires the following additional target {$missing_target_features_count -> | |
| 178 | [1] feature | |
| 179 | *[count] features | |
| 180 | }: {$missing_target_features}" | |
| 181 | )] | |
| 182 | pub(crate) struct UnsafeOpInUnsafeFnCallToFunctionWithRequiresUnsafe { | |
| 183 | #[label("call to function with `#[target_feature]`")] | |
| 184 | pub(crate) span: Span, | |
| 185 | pub(crate) function: String, | |
| 186 | pub(crate) missing_target_features: DiagArgValue, | |
| 187 | pub(crate) missing_target_features_count: usize, | |
| 188 | #[note("the {$build_target_features} target {$build_target_features_count -> | |
| 189 | [1] feature | |
| 190 | *[count] features | |
| 191 | } being enabled in the build configuration does not remove the requirement to list {$build_target_features_count -> | |
| 192 | [1] it | |
| 193 | *[count] them | |
| 194 | } in `#[target_feature]`")] | |
| 195 | pub(crate) note: bool, | |
| 196 | pub(crate) build_target_features: DiagArgValue, | |
| 197 | pub(crate) build_target_features_count: usize, | |
| 198 | #[subdiagnostic] | |
| 199 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedLintNote>, | |
| 200 | } | |
| 201 | ||
| 202 | #[derive(Diagnostic)] | |
| 203 | #[diag("call to unsafe function `{$function}` is unsafe and requires unsafe block", code = E0133)] | |
| 204 | #[note("consult the function's documentation for information on how to avoid undefined behavior")] | |
| 205 | pub(crate) struct CallToUnsafeFunctionRequiresUnsafe { | |
| 206 | #[primary_span] | |
| 207 | #[label("call to unsafe function")] | |
| 208 | pub(crate) span: Span, | |
| 209 | pub(crate) function: String, | |
| 210 | #[subdiagnostic] | |
| 211 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>, | |
| 212 | } | |
| 213 | ||
| 214 | #[derive(Diagnostic)] | |
| 215 | #[diag("call to unsafe function is unsafe and requires unsafe block", code = E0133)] | |
| 216 | #[note("consult the function's documentation for information on how to avoid undefined behavior")] | |
| 217 | pub(crate) struct CallToUnsafeFunctionRequiresUnsafeNameless { | |
| 218 | #[primary_span] | |
| 219 | #[label("call to unsafe function")] | |
| 220 | pub(crate) span: Span, | |
| 221 | #[subdiagnostic] | |
| 222 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>, | |
| 223 | } | |
| 224 | ||
| 225 | #[derive(Diagnostic)] | |
| 226 | #[diag("call to unsafe function `{$function}` is unsafe and requires unsafe function or block", code = E0133)] | |
| 227 | #[note("consult the function's documentation for information on how to avoid undefined behavior")] | |
| 228 | pub(crate) struct CallToUnsafeFunctionRequiresUnsafeUnsafeOpInUnsafeFnAllowed { | |
| 229 | #[primary_span] | |
| 230 | #[label("call to unsafe function")] | |
| 231 | pub(crate) span: Span, | |
| 232 | pub(crate) function: String, | |
| 233 | #[subdiagnostic] | |
| 234 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>, | |
| 235 | } | |
| 236 | ||
| 237 | #[derive(Diagnostic)] | |
| 238 | #[diag( | |
| 239 | "call to unsafe function is unsafe and requires unsafe function or block", | |
| 240 | code = E0133 | |
| 241 | )] | |
| 242 | #[note("consult the function's documentation for information on how to avoid undefined behavior")] | |
| 243 | pub(crate) struct CallToUnsafeFunctionRequiresUnsafeNamelessUnsafeOpInUnsafeFnAllowed { | |
| 244 | #[primary_span] | |
| 245 | #[label("call to unsafe function")] | |
| 246 | pub(crate) span: Span, | |
| 247 | #[subdiagnostic] | |
| 248 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>, | |
| 249 | } | |
| 250 | ||
| 251 | #[derive(Diagnostic)] | |
| 252 | #[diag("use of inline assembly is unsafe and requires unsafe block", code = E0133)] | |
| 253 | #[note("inline assembly is entirely unchecked and can cause undefined behavior")] | |
| 254 | pub(crate) struct UseOfInlineAssemblyRequiresUnsafe { | |
| 255 | #[primary_span] | |
| 256 | #[label("use of inline assembly")] | |
| 257 | pub(crate) span: Span, | |
| 258 | #[subdiagnostic] | |
| 259 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>, | |
| 260 | } | |
| 261 | ||
| 262 | #[derive(Diagnostic)] | |
| 263 | #[diag("use of inline assembly is unsafe and requires unsafe function or block", code = E0133)] | |
| 264 | #[note("inline assembly is entirely unchecked and can cause undefined behavior")] | |
| 265 | pub(crate) struct UseOfInlineAssemblyRequiresUnsafeUnsafeOpInUnsafeFnAllowed { | |
| 266 | #[primary_span] | |
| 267 | #[label("use of inline assembly")] | |
| 268 | pub(crate) span: Span, | |
| 269 | #[subdiagnostic] | |
| 270 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>, | |
| 271 | } | |
| 272 | ||
| 273 | #[derive(Diagnostic)] | |
| 274 | #[diag("initializing type with an unsafe field is unsafe and requires unsafe block", code = E0133)] | |
| 275 | #[note("unsafe fields may carry library invariants")] | |
| 276 | pub(crate) struct InitializingTypeWithUnsafeFieldRequiresUnsafe { | |
| 277 | #[primary_span] | |
| 278 | #[label("initialization of struct with unsafe field")] | |
| 279 | pub(crate) span: Span, | |
| 280 | #[subdiagnostic] | |
| 281 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>, | |
| 282 | } | |
| 283 | ||
| 284 | #[derive(Diagnostic)] | |
| 285 | #[diag( | |
| 286 | "initializing type with an unsafe field is unsafe and requires unsafe block", | |
| 287 | code = E0133 | |
| 288 | )] | |
| 289 | #[note("unsafe fields may carry library invariants")] | |
| 290 | pub(crate) struct InitializingTypeWithUnsafeFieldRequiresUnsafeUnsafeOpInUnsafeFnAllowed { | |
| 291 | #[primary_span] | |
| 292 | #[label("initialization of struct with unsafe field")] | |
| 293 | pub(crate) span: Span, | |
| 294 | #[subdiagnostic] | |
| 295 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>, | |
| 296 | } | |
| 297 | ||
| 298 | #[derive(Diagnostic)] | |
| 299 | #[diag("use of mutable static is unsafe and requires unsafe block", code = E0133)] | |
| 300 | #[note( | |
| 301 | "mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior" | |
| 302 | )] | |
| 303 | pub(crate) struct UseOfMutableStaticRequiresUnsafe { | |
| 304 | #[primary_span] | |
| 305 | #[label("use of mutable static")] | |
| 306 | pub(crate) span: Span, | |
| 307 | #[subdiagnostic] | |
| 308 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>, | |
| 309 | } | |
| 310 | ||
| 311 | #[derive(Diagnostic)] | |
| 312 | #[diag("use of mutable static is unsafe and requires unsafe function or block", code = E0133)] | |
| 313 | #[note( | |
| 314 | "mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior" | |
| 315 | )] | |
| 316 | pub(crate) struct UseOfMutableStaticRequiresUnsafeUnsafeOpInUnsafeFnAllowed { | |
| 317 | #[primary_span] | |
| 318 | #[label("use of mutable static")] | |
| 319 | pub(crate) span: Span, | |
| 320 | #[subdiagnostic] | |
| 321 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>, | |
| 322 | } | |
| 323 | ||
| 324 | #[derive(Diagnostic)] | |
| 325 | #[diag("use of extern static is unsafe and requires unsafe block", code = E0133)] | |
| 326 | #[note( | |
| 327 | "extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior" | |
| 328 | )] | |
| 329 | pub(crate) struct UseOfExternStaticRequiresUnsafe { | |
| 330 | #[primary_span] | |
| 331 | #[label("use of extern static")] | |
| 332 | pub(crate) span: Span, | |
| 333 | #[subdiagnostic] | |
| 334 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>, | |
| 335 | } | |
| 336 | ||
| 337 | #[derive(Diagnostic)] | |
| 338 | #[diag("use of extern static is unsafe and requires unsafe function or block", code = E0133)] | |
| 339 | #[note( | |
| 340 | "extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior" | |
| 341 | )] | |
| 342 | pub(crate) struct UseOfExternStaticRequiresUnsafeUnsafeOpInUnsafeFnAllowed { | |
| 343 | #[primary_span] | |
| 344 | #[label("use of extern static")] | |
| 345 | pub(crate) span: Span, | |
| 346 | #[subdiagnostic] | |
| 347 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>, | |
| 348 | } | |
| 349 | ||
| 350 | #[derive(Diagnostic)] | |
| 351 | #[diag("use of unsafe field is unsafe and requires unsafe block", code = E0133)] | |
| 352 | #[note("unsafe fields may carry library invariants")] | |
| 353 | pub(crate) struct UseOfUnsafeFieldRequiresUnsafe { | |
| 354 | #[primary_span] | |
| 355 | #[label("use of unsafe field")] | |
| 356 | pub(crate) span: Span, | |
| 357 | #[subdiagnostic] | |
| 358 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>, | |
| 359 | } | |
| 360 | ||
| 361 | #[derive(Diagnostic)] | |
| 362 | #[diag("use of unsafe field is unsafe and requires unsafe block", code = E0133)] | |
| 363 | #[note("unsafe fields may carry library invariants")] | |
| 364 | pub(crate) struct UseOfUnsafeFieldRequiresUnsafeUnsafeOpInUnsafeFnAllowed { | |
| 365 | #[primary_span] | |
| 366 | #[label("use of unsafe field")] | |
| 367 | pub(crate) span: Span, | |
| 368 | #[subdiagnostic] | |
| 369 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>, | |
| 370 | } | |
| 371 | ||
| 372 | #[derive(Diagnostic)] | |
| 373 | #[diag("dereference of raw pointer is unsafe and requires unsafe block", code = E0133)] | |
| 374 | #[note( | |
| 375 | "raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior" | |
| 376 | )] | |
| 377 | pub(crate) struct DerefOfRawPointerRequiresUnsafe { | |
| 378 | #[primary_span] | |
| 379 | #[label("dereference of raw pointer")] | |
| 380 | pub(crate) span: Span, | |
| 381 | #[subdiagnostic] | |
| 382 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>, | |
| 383 | } | |
| 384 | ||
| 385 | #[derive(Diagnostic)] | |
| 386 | #[diag("dereference of raw pointer is unsafe and requires unsafe function or block", code = E0133)] | |
| 387 | #[note( | |
| 388 | "raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior" | |
| 389 | )] | |
| 390 | pub(crate) struct DerefOfRawPointerRequiresUnsafeUnsafeOpInUnsafeFnAllowed { | |
| 391 | #[primary_span] | |
| 392 | #[label("dereference of raw pointer")] | |
| 393 | pub(crate) span: Span, | |
| 394 | #[subdiagnostic] | |
| 395 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>, | |
| 396 | } | |
| 397 | ||
| 398 | #[derive(Diagnostic)] | |
| 399 | #[diag("access to union field is unsafe and requires unsafe block", code = E0133)] | |
| 400 | #[note( | |
| 401 | "the field may not be properly initialized: using uninitialized data will cause undefined behavior" | |
| 402 | )] | |
| 403 | pub(crate) struct AccessToUnionFieldRequiresUnsafe { | |
| 404 | #[primary_span] | |
| 405 | #[label("access to union field")] | |
| 406 | pub(crate) span: Span, | |
| 407 | #[subdiagnostic] | |
| 408 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>, | |
| 409 | } | |
| 410 | ||
| 411 | #[derive(Diagnostic)] | |
| 412 | #[diag("access to union field is unsafe and requires unsafe function or block", code = E0133)] | |
| 413 | #[note( | |
| 414 | "the field may not be properly initialized: using uninitialized data will cause undefined behavior" | |
| 415 | )] | |
| 416 | pub(crate) struct AccessToUnionFieldRequiresUnsafeUnsafeOpInUnsafeFnAllowed { | |
| 417 | #[primary_span] | |
| 418 | #[label("access to union field")] | |
| 419 | pub(crate) span: Span, | |
| 420 | #[subdiagnostic] | |
| 421 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>, | |
| 422 | } | |
| 423 | ||
| 424 | #[derive(Diagnostic)] | |
| 425 | #[diag("mutation of layout constrained field is unsafe and requires unsafe block", code = E0133)] | |
| 426 | #[note("mutating layout constrained fields cannot statically be checked for valid values")] | |
| 427 | pub(crate) struct MutationOfLayoutConstrainedFieldRequiresUnsafe { | |
| 428 | #[primary_span] | |
| 429 | #[label("mutation of layout constrained field")] | |
| 430 | pub(crate) span: Span, | |
| 431 | #[subdiagnostic] | |
| 432 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>, | |
| 433 | } | |
| 434 | ||
| 435 | #[derive(Diagnostic)] | |
| 436 | #[diag( | |
| 437 | "mutation of layout constrained field is unsafe and requires unsafe function or block", | |
| 438 | code = E0133 | |
| 439 | )] | |
| 440 | #[note("mutating layout constrained fields cannot statically be checked for valid values")] | |
| 441 | pub(crate) struct MutationOfLayoutConstrainedFieldRequiresUnsafeUnsafeOpInUnsafeFnAllowed { | |
| 442 | #[primary_span] | |
| 443 | #[label("mutation of layout constrained field")] | |
| 444 | pub(crate) span: Span, | |
| 445 | #[subdiagnostic] | |
| 446 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>, | |
| 447 | } | |
| 448 | ||
| 449 | #[derive(Diagnostic)] | |
| 450 | #[diag("borrow of layout constrained field with interior mutability is unsafe and requires unsafe block", code = E0133)] | |
| 451 | #[note( | |
| 452 | "references to fields of layout constrained fields lose the constraints. Coupled with interior mutability, the field can be changed to invalid values" | |
| 453 | )] | |
| 454 | pub(crate) struct BorrowOfLayoutConstrainedFieldRequiresUnsafe { | |
| 455 | #[primary_span] | |
| 456 | #[label("borrow of layout constrained field with interior mutability")] | |
| 457 | pub(crate) span: Span, | |
| 458 | #[subdiagnostic] | |
| 459 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>, | |
| 460 | } | |
| 461 | ||
| 462 | #[derive(Diagnostic)] | |
| 463 | #[diag( | |
| 464 | "borrow of layout constrained field with interior mutability is unsafe and requires unsafe function or block", | |
| 465 | code = E0133 | |
| 466 | )] | |
| 467 | #[note( | |
| 468 | "references to fields of layout constrained fields lose the constraints. Coupled with interior mutability, the field can be changed to invalid values" | |
| 469 | )] | |
| 470 | pub(crate) struct BorrowOfLayoutConstrainedFieldRequiresUnsafeUnsafeOpInUnsafeFnAllowed { | |
| 471 | #[primary_span] | |
| 472 | #[label("borrow of layout constrained field with interior mutability")] | |
| 473 | pub(crate) span: Span, | |
| 474 | #[subdiagnostic] | |
| 475 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>, | |
| 476 | } | |
| 477 | ||
| 478 | #[derive(Diagnostic)] | |
| 479 | #[diag("call to function `{$function}` with `#[target_feature]` is unsafe and requires unsafe block", code = E0133)] | |
| 480 | #[help( | |
| 481 | "in order for the call to be safe, the context requires the following additional target {$missing_target_features_count -> | |
| 482 | [1] feature | |
| 483 | *[count] features | |
| 484 | }: {$missing_target_features}" | |
| 485 | )] | |
| 486 | pub(crate) struct CallToFunctionWithRequiresUnsafe { | |
| 487 | #[primary_span] | |
| 488 | #[label("call to function with `#[target_feature]`")] | |
| 489 | pub(crate) span: Span, | |
| 490 | pub(crate) function: String, | |
| 491 | pub(crate) missing_target_features: DiagArgValue, | |
| 492 | pub(crate) missing_target_features_count: usize, | |
| 493 | #[note("the {$build_target_features} target {$build_target_features_count -> | |
| 494 | [1] feature | |
| 495 | *[count] features | |
| 496 | } being enabled in the build configuration does not remove the requirement to list {$build_target_features_count -> | |
| 497 | [1] it | |
| 498 | *[count] them | |
| 499 | } in `#[target_feature]`")] | |
| 500 | pub(crate) note: bool, | |
| 501 | pub(crate) build_target_features: DiagArgValue, | |
| 502 | pub(crate) build_target_features_count: usize, | |
| 503 | #[subdiagnostic] | |
| 504 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>, | |
| 505 | } | |
| 506 | ||
| 507 | #[derive(Diagnostic)] | |
| 508 | #[diag( | |
| 509 | "call to function `{$function}` with `#[target_feature]` is unsafe and requires unsafe function or block", | |
| 510 | code = E0133, | |
| 511 | )] | |
| 512 | #[help( | |
| 513 | "in order for the call to be safe, the context requires the following additional target {$missing_target_features_count -> | |
| 514 | [1] feature | |
| 515 | *[count] features | |
| 516 | }: {$missing_target_features}" | |
| 517 | )] | |
| 518 | pub(crate) struct CallToFunctionWithRequiresUnsafeUnsafeOpInUnsafeFnAllowed { | |
| 519 | #[primary_span] | |
| 520 | #[label("call to function with `#[target_feature]`")] | |
| 521 | pub(crate) span: Span, | |
| 522 | pub(crate) function: String, | |
| 523 | pub(crate) missing_target_features: DiagArgValue, | |
| 524 | pub(crate) missing_target_features_count: usize, | |
| 525 | #[note("the {$build_target_features} target {$build_target_features_count -> | |
| 526 | [1] feature | |
| 527 | *[count] features | |
| 528 | } being enabled in the build configuration does not remove the requirement to list {$build_target_features_count -> | |
| 529 | [1] it | |
| 530 | *[count] them | |
| 531 | } in `#[target_feature]`")] | |
| 532 | pub(crate) note: bool, | |
| 533 | pub(crate) build_target_features: DiagArgValue, | |
| 534 | pub(crate) build_target_features_count: usize, | |
| 535 | #[subdiagnostic] | |
| 536 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>, | |
| 537 | } | |
| 538 | ||
| 539 | #[derive(Diagnostic)] | |
| 540 | #[diag( | |
| 541 | "unsafe binder cast is unsafe and requires unsafe block information that may be required to uphold safety guarantees of a type", | |
| 542 | code = E0133, | |
| 543 | )] | |
| 544 | pub(crate) struct UnsafeBinderCastRequiresUnsafe { | |
| 545 | #[primary_span] | |
| 546 | #[label("unsafe binder cast")] | |
| 547 | pub(crate) span: Span, | |
| 548 | #[subdiagnostic] | |
| 549 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>, | |
| 550 | } | |
| 551 | ||
| 552 | #[derive(Diagnostic)] | |
| 553 | #[diag( | |
| 554 | "unsafe binder cast is unsafe and requires unsafe block or unsafe fn information that may be required to uphold safety guarantees of a type", | |
| 555 | code = E0133, | |
| 556 | )] | |
| 557 | pub(crate) struct UnsafeBinderCastRequiresUnsafeUnsafeOpInUnsafeFnAllowed { | |
| 558 | #[primary_span] | |
| 559 | #[label("unsafe binder cast")] | |
| 560 | pub(crate) span: Span, | |
| 561 | #[subdiagnostic] | |
| 562 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>, | |
| 563 | } | |
| 564 | ||
| 565 | #[derive(Diagnostic)] | |
| 566 | #[diag("call `{$function}` explicitly is unsafe and requires unsafe block", code = E0133)] | |
| 567 | pub(crate) struct CallDropExplicitlyRequiresUnsafe { | |
| 568 | #[primary_span] | |
| 569 | pub(crate) span: Span, | |
| 570 | pub(crate) function: String, | |
| 571 | #[subdiagnostic] | |
| 572 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>, | |
| 573 | } | |
| 574 | ||
| 575 | #[derive(Subdiagnostic)] | |
| 576 | #[label("items do not inherit unsafety from separate enclosing items")] | |
| 577 | pub(crate) struct UnsafeNotInheritedNote { | |
| 578 | #[primary_span] | |
| 579 | pub(crate) span: Span, | |
| 580 | } | |
| 581 | ||
| 582 | pub(crate) struct UnsafeNotInheritedLintNote { | |
| 583 | pub(crate) signature_span: Span, | |
| 584 | pub(crate) body_span: Span, | |
| 585 | } | |
| 586 | ||
| 587 | impl Subdiagnostic for UnsafeNotInheritedLintNote { | |
| 588 | fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) { | |
| 589 | diag.span_note( | |
| 590 | self.signature_span, | |
| 591 | msg!("an unsafe function restricts its caller, but its body is safe by default"), | |
| 592 | ); | |
| 593 | let body_start = self.body_span.shrink_to_lo(); | |
| 594 | let body_end = self.body_span.shrink_to_hi(); | |
| 595 | diag.tool_only_multipart_suggestion( | |
| 596 | msg!("consider wrapping the function body in an unsafe block"), | |
| 597 | vec![(body_start, "{ unsafe ".into()), (body_end, "}".into())], | |
| 598 | Applicability::MachineApplicable, | |
| 599 | ); | |
| 600 | } | |
| 601 | } | |
| 602 | ||
| 603 | #[derive(Diagnostic)] | |
| 604 | #[diag("unnecessary `unsafe` block")] | |
| 605 | pub(crate) struct UnusedUnsafe { | |
| 606 | #[label("unnecessary `unsafe` block")] | |
| 607 | pub(crate) span: Span, | |
| 608 | #[subdiagnostic] | |
| 609 | pub(crate) enclosing: Option<UnusedUnsafeEnclosing>, | |
| 610 | } | |
| 611 | ||
| 612 | #[derive(Subdiagnostic)] | |
| 613 | pub(crate) enum UnusedUnsafeEnclosing { | |
| 614 | #[label("because it's nested under this `unsafe` block")] | |
| 615 | Block { | |
| 616 | #[primary_span] | |
| 617 | span: Span, | |
| 618 | }, | |
| 619 | } | |
| 620 | ||
| 621 | pub(crate) struct NonExhaustivePatternsTypeNotEmpty<'a, 'tcx> { | |
| 622 | pub(crate) cx: &'a RustcPatCtxt<'a, 'tcx>, | |
| 623 | pub(crate) scrut_span: Span, | |
| 624 | pub(crate) braces_span: Option<Span>, | |
| 625 | pub(crate) ty: Ty<'tcx>, | |
| 626 | } | |
| 627 | ||
| 628 | impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for NonExhaustivePatternsTypeNotEmpty<'_, '_> { | |
| 629 | fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, G> { | |
| 630 | let mut diag = | |
| 631 | Diag::new(dcx, level, msg!("non-exhaustive patterns: type `{$ty}` is non-empty")); | |
| 632 | diag.span(self.scrut_span); | |
| 633 | diag.code(E0004); | |
| 634 | let peeled_ty = self.ty.peel_refs(); | |
| 635 | diag.arg("ty", self.ty); | |
| 636 | diag.arg("peeled_ty", peeled_ty); | |
| 637 | ||
| 638 | if let ty::Adt(def, _) = peeled_ty.kind() { | |
| 639 | let def_span = self | |
| 640 | .cx | |
| 641 | .tcx | |
| 642 | .hir_get_if_local(def.did()) | |
| 643 | .and_then(|node| node.ident()) | |
| 644 | .map(|ident| ident.span) | |
| 645 | .unwrap_or_else(|| self.cx.tcx.def_span(def.did())); | |
| 646 | ||
| 647 | // workaround to make test pass | |
| 648 | let mut span: MultiSpan = def_span.into(); | |
| 649 | span.push_span_label(def_span, ""); | |
| 650 | ||
| 651 | diag.span_note(span, msg!("`{$peeled_ty}` defined here")); | |
| 652 | } | |
| 653 | ||
| 654 | let is_non_exhaustive = matches!(self.ty.kind(), | |
| 655 | ty::Adt(def, _) if def.variant_list_has_applicable_non_exhaustive()); | |
| 656 | if is_non_exhaustive { | |
| 657 | diag.note(msg!( | |
| 658 | "the matched value is of type `{$ty}`, which is marked as non-exhaustive" | |
| 659 | )); | |
| 660 | } else { | |
| 661 | diag.note(msg!("the matched value is of type `{$ty}`")); | |
| 662 | } | |
| 663 | ||
| 664 | if let ty::Ref(_, sub_ty, _) = self.ty.kind() { | |
| 665 | if !sub_ty.is_inhabited_from(self.cx.tcx, self.cx.module, self.cx.typing_env) { | |
| 666 | diag.note(msg!("references are always considered inhabited")); | |
| 667 | } | |
| 668 | } | |
| 669 | ||
| 670 | let sm = self.cx.tcx.sess.source_map(); | |
| 671 | if let Some(braces_span) = self.braces_span { | |
| 672 | // Get the span for the empty match body `{}`. | |
| 673 | let (indentation, more) = if let Some(snippet) = sm.indentation_before(self.scrut_span) | |
| 674 | { | |
| 675 | (format!("\n{snippet}"), " ") | |
| 676 | } else { | |
| 677 | (" ".to_string(), "") | |
| 678 | }; | |
| 679 | diag.span_suggestion_verbose( | |
| 680 | braces_span, | |
| 681 | msg!("ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown"), | |
| 682 | format!(" {{{indentation}{more}_ => todo!(),{indentation}}}"), | |
| 683 | Applicability::HasPlaceholders, | |
| 684 | ); | |
| 685 | } else { | |
| 686 | diag.help(msg!( | |
| 687 | "ensure that all possible cases are being handled by adding a match arm with a wildcard pattern" | |
| 688 | )); | |
| 689 | } | |
| 690 | ||
| 691 | diag | |
| 692 | } | |
| 693 | } | |
| 694 | ||
| 695 | #[derive(Subdiagnostic)] | |
| 696 | #[note("match arms with guards don't count towards exhaustivity")] | |
| 697 | pub(crate) struct NonExhaustiveMatchAllArmsGuarded; | |
| 698 | ||
| 699 | #[derive(Diagnostic)] | |
| 700 | #[diag("statics cannot be referenced in patterns", code = E0158)] | |
| 701 | pub(crate) struct StaticInPattern { | |
| 702 | #[primary_span] | |
| 703 | #[label("can't be used in patterns")] | |
| 704 | pub(crate) span: Span, | |
| 705 | #[label("`static` defined here")] | |
| 706 | pub(crate) static_span: Span, | |
| 707 | } | |
| 708 | ||
| 709 | #[derive(Diagnostic)] | |
| 710 | #[diag("constant parameters cannot be referenced in patterns", code = E0158)] | |
| 711 | pub(crate) struct ConstParamInPattern { | |
| 712 | #[primary_span] | |
| 713 | #[label("can't be used in patterns")] | |
| 714 | pub(crate) span: Span, | |
| 715 | #[label("constant defined here")] | |
| 716 | pub(crate) const_span: Span, | |
| 717 | } | |
| 718 | ||
| 719 | #[derive(Diagnostic)] | |
| 720 | #[diag("runtime values cannot be referenced in patterns", code = E0080)] | |
| 721 | pub(crate) struct NonConstPath { | |
| 722 | #[primary_span] | |
| 723 | #[label("references a runtime value")] | |
| 724 | pub(crate) span: Span, | |
| 725 | } | |
| 726 | ||
| 727 | pub(crate) struct UnreachablePattern<'tcx> { | |
| 728 | pub(crate) covered_by_many_n_more_count: Option<usize>, | |
| 729 | pub(crate) inner: UnreachablePatternInner<'tcx>, | |
| 730 | } | |
| 731 | ||
| 732 | impl<'a, 'tcx, G: EmissionGuarantee> Diagnostic<'a, G> for UnreachablePattern<'tcx> { | |
| 733 | #[track_caller] | |
| 734 | fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, G> { | |
| 735 | let mut diag = self.inner.into_diag(dcx, level); | |
| 736 | if let Some(covered_by_many_n_more_count) = self.covered_by_many_n_more_count { | |
| 737 | diag.arg("covered_by_many_n_more_count", covered_by_many_n_more_count); | |
| 738 | } | |
| 739 | diag | |
| 740 | } | |
| 741 | } | |
| 742 | ||
| 743 | #[derive(Diagnostic)] | |
| 744 | #[diag("unreachable pattern")] | |
| 745 | pub(crate) struct UnreachablePatternInner<'tcx> { | |
| 746 | #[label("no value can reach this")] | |
| 747 | pub(crate) span: Option<Span>, | |
| 748 | #[label("matches no values because `{$matches_no_values_ty}` is uninhabited")] | |
| 749 | pub(crate) matches_no_values: Option<Span>, | |
| 750 | pub(crate) matches_no_values_ty: Ty<'tcx>, | |
| 751 | #[note( | |
| 752 | "to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types" | |
| 753 | )] | |
| 754 | pub(crate) uninhabited_note: Option<()>, | |
| 755 | #[label("matches any value")] | |
| 756 | pub(crate) covered_by_catchall: Option<Span>, | |
| 757 | #[subdiagnostic] | |
| 758 | pub(crate) wanted_constant: Option<WantedConstant>, | |
| 759 | #[note( | |
| 760 | "there is a constant of the same name imported in another scope, which could have been used to pattern match against its value instead of introducing a new catch-all binding, but it needs to be imported in the pattern's scope" | |
| 761 | )] | |
| 762 | pub(crate) accessible_constant: Option<Span>, | |
| 763 | #[note( | |
| 764 | "there is a constant of the same name, which could have been used to pattern match against its value instead of introducing a new catch-all binding, but it is not accessible from this scope" | |
| 765 | )] | |
| 766 | pub(crate) inaccessible_constant: Option<Span>, | |
| 767 | #[note( | |
| 768 | "there is a binding of the same name; if you meant to pattern match against the value of that binding, that is a feature of constants that is not available for `let` bindings" | |
| 769 | )] | |
| 770 | pub(crate) pattern_let_binding: Option<Span>, | |
| 771 | #[label("matches all the relevant values")] | |
| 772 | pub(crate) covered_by_one: Option<Span>, | |
| 773 | #[note("multiple earlier patterns match some of the same values")] | |
| 774 | pub(crate) covered_by_many: Option<MultiSpan>, | |
| 775 | #[suggestion("remove the match arm", code = "", applicability = "machine-applicable")] | |
| 776 | pub(crate) suggest_remove: Option<Span>, | |
| 777 | } | |
| 778 | ||
| 779 | #[derive(Subdiagnostic)] | |
| 780 | #[suggestion( | |
| 781 | "you might have meant to pattern match against the value of {$is_typo -> | |
| 782 | [true] similarly named constant | |
| 783 | *[false] constant | |
| 784 | } `{$const_name}` instead of introducing a new catch-all binding", | |
| 785 | code = "{const_path}", | |
| 786 | applicability = "machine-applicable" | |
| 787 | )] | |
| 788 | pub(crate) struct WantedConstant { | |
| 789 | #[primary_span] | |
| 790 | pub(crate) span: Span, | |
| 791 | pub(crate) is_typo: bool, | |
| 792 | pub(crate) const_name: String, | |
| 793 | pub(crate) const_path: String, | |
| 794 | } | |
| 795 | ||
| 796 | #[derive(Diagnostic)] | |
| 797 | #[diag("unreachable {$descr}")] | |
| 798 | pub(crate) struct UnreachableDueToUninhabited<'desc, 'tcx> { | |
| 799 | pub descr: &'desc str, | |
| 800 | #[label("unreachable {$descr}")] | |
| 801 | pub expr: Span, | |
| 802 | #[label("any code following this expression is unreachable")] | |
| 803 | #[note("this expression has type `{$ty}`, which is uninhabited")] | |
| 804 | pub orig: Span, | |
| 805 | pub ty: Ty<'tcx>, | |
| 806 | } | |
| 807 | ||
| 808 | #[derive(Diagnostic)] | |
| 809 | #[diag("constant pattern cannot depend on generic parameters", code = E0158)] | |
| 810 | pub(crate) struct ConstPatternDependsOnGenericParameter { | |
| 811 | #[primary_span] | |
| 812 | #[label("`const` depends on a generic parameter")] | |
| 813 | pub(crate) span: Span, | |
| 814 | } | |
| 815 | ||
| 816 | #[derive(Diagnostic)] | |
| 817 | #[diag("could not evaluate constant pattern")] | |
| 818 | pub(crate) struct CouldNotEvalConstPattern { | |
| 819 | #[primary_span] | |
| 820 | #[label("could not evaluate constant")] | |
| 821 | pub(crate) span: Span, | |
| 822 | } | |
| 823 | ||
| 824 | #[derive(Diagnostic)] | |
| 825 | #[diag("lower bound for range pattern must be less than or equal to upper bound", code = E0030)] | |
| 826 | pub(crate) struct LowerRangeBoundMustBeLessThanOrEqualToUpper { | |
| 827 | #[primary_span] | |
| 828 | #[label("lower bound larger than upper bound")] | |
| 829 | pub(crate) span: Span, | |
| 830 | #[note( | |
| 831 | "when matching against a range, the compiler verifies that the range is non-empty. Range patterns include both end-points, so this is equivalent to requiring the start of the range to be less than or equal to the end of the range" | |
| 832 | )] | |
| 833 | pub(crate) teach: bool, | |
| 834 | } | |
| 835 | ||
| 836 | #[derive(Diagnostic)] | |
| 837 | #[diag("literal out of range for `{$ty}`")] | |
| 838 | pub(crate) struct LiteralOutOfRange<'tcx> { | |
| 839 | #[primary_span] | |
| 840 | #[label("this value does not fit into the type `{$ty}` whose range is `{$min}..={$max}`")] | |
| 841 | pub(crate) span: Span, | |
| 842 | pub(crate) ty: Ty<'tcx>, | |
| 843 | pub(crate) min: i128, | |
| 844 | pub(crate) max: u128, | |
| 845 | } | |
| 846 | ||
| 847 | #[derive(Diagnostic)] | |
| 848 | #[diag("lower bound for range pattern must be less than upper bound", code = E0579)] | |
| 849 | pub(crate) struct LowerRangeBoundMustBeLessThanUpper { | |
| 850 | #[primary_span] | |
| 851 | pub(crate) span: Span, | |
| 852 | } | |
| 853 | ||
| 854 | #[derive(Diagnostic)] | |
| 855 | #[diag("exclusive upper bound for a range bound cannot be the minimum", code = E0579)] | |
| 856 | pub(crate) struct UpperRangeBoundCannotBeMin { | |
| 857 | #[primary_span] | |
| 858 | pub(crate) span: Span, | |
| 859 | } | |
| 860 | ||
| 861 | #[derive(Diagnostic)] | |
| 862 | #[diag("pattern binding `{$name}` is named the same as one of the variants of the type `{$ty_path}`", code = E0170)] | |
| 863 | pub(crate) struct BindingsWithVariantName { | |
| 864 | #[suggestion( | |
| 865 | "to match on the variant, qualify the path", | |
| 866 | code = "{ty_path}::{name}", | |
| 867 | applicability = "machine-applicable" | |
| 868 | )] | |
| 869 | pub(crate) suggestion: Option<Span>, | |
| 870 | pub(crate) ty_path: String, | |
| 871 | pub(crate) name: Ident, | |
| 872 | } | |
| 873 | ||
| 874 | #[derive(Diagnostic)] | |
| 875 | #[diag( | |
| 876 | "irrefutable `if let` {$count -> | |
| 877 | [one] pattern | |
| 878 | *[other] patterns | |
| 879 | }" | |
| 880 | )] | |
| 881 | #[note( | |
| 882 | "{$count -> | |
| 883 | [one] this pattern | |
| 884 | *[other] these patterns | |
| 885 | } will always match, so the `if let` is useless" | |
| 886 | )] | |
| 887 | #[help("consider replacing the `if let` with a `let`")] | |
| 888 | pub(crate) struct IrrefutableLetPatternsIfLet { | |
| 889 | pub(crate) count: usize, | |
| 890 | } | |
| 891 | ||
| 892 | #[derive(Diagnostic)] | |
| 893 | #[diag( | |
| 894 | "irrefutable `if let` guard {$count -> | |
| 895 | [one] pattern | |
| 896 | *[other] patterns | |
| 897 | }" | |
| 898 | )] | |
| 899 | #[note( | |
| 900 | "{$count -> | |
| 901 | [one] this pattern | |
| 902 | *[other] these patterns | |
| 903 | } will always match, so the guard is useless" | |
| 904 | )] | |
| 905 | #[help("consider removing the guard and adding a `let` inside the match arm")] | |
| 906 | pub(crate) struct IrrefutableLetPatternsIfLetGuard { | |
| 907 | pub(crate) count: usize, | |
| 908 | } | |
| 909 | ||
| 910 | #[derive(Diagnostic)] | |
| 911 | #[diag("unreachable `else` clause")] | |
| 912 | #[note("this pattern always matches, so the else clause is unreachable")] | |
| 913 | pub(crate) struct IrrefutableLetPatternsLetElse { | |
| 914 | #[subdiagnostic] | |
| 915 | pub(crate) be_replaced: Option<LetElseReplacementSuggestion>, | |
| 916 | } | |
| 917 | ||
| 918 | #[derive(Subdiagnostic, Debug)] | |
| 919 | #[suggestion( | |
| 920 | "consider using `let {$lhs} = {$rhs}` to match on a specific variant", | |
| 921 | code = "let {lhs} = {rhs}", | |
| 922 | applicability = "machine-applicable" | |
| 923 | )] | |
| 924 | pub(crate) struct LetElseReplacementSuggestion { | |
| 925 | #[primary_span] | |
| 926 | pub(crate) span: Span, | |
| 927 | pub(crate) lhs: String, | |
| 928 | pub(crate) rhs: String, | |
| 929 | } | |
| 930 | ||
| 931 | #[derive(Diagnostic)] | |
| 932 | #[diag( | |
| 933 | "irrefutable `while let` {$count -> | |
| 934 | [one] pattern | |
| 935 | *[other] patterns | |
| 936 | }" | |
| 937 | )] | |
| 938 | #[note( | |
| 939 | "{$count -> | |
| 940 | [one] this pattern | |
| 941 | *[other] these patterns | |
| 942 | } will always match, so the loop will never exit" | |
| 943 | )] | |
| 944 | #[help("consider instead using a `loop {\"{\"} ... {\"}\"}` with a `let` inside it")] | |
| 945 | pub(crate) struct IrrefutableLetPatternsWhileLet { | |
| 946 | pub(crate) count: usize, | |
| 947 | } | |
| 948 | ||
| 949 | #[derive(Diagnostic)] | |
| 950 | #[diag("borrow of moved value")] | |
| 951 | pub(crate) struct BorrowOfMovedValue<'tcx> { | |
| 952 | #[primary_span] | |
| 953 | #[label("value moved into `{$name}` here")] | |
| 954 | #[label( | |
| 955 | "move occurs because `{$name}` has type `{$ty}`, which does not implement the `Copy` trait" | |
| 956 | )] | |
| 957 | pub(crate) binding_span: Span, | |
| 958 | #[label("value borrowed here after move")] | |
| 959 | pub(crate) conflicts_ref: Vec<Span>, | |
| 960 | pub(crate) name: Ident, | |
| 961 | pub(crate) ty: Ty<'tcx>, | |
| 962 | #[suggestion( | |
| 963 | "borrow this binding in the pattern to avoid moving the value", | |
| 964 | code = "ref ", | |
| 965 | applicability = "machine-applicable" | |
| 966 | )] | |
| 967 | pub(crate) suggest_borrowing: Option<Span>, | |
| 968 | } | |
| 969 | ||
| 970 | #[derive(Diagnostic)] | |
| 971 | #[diag("cannot borrow value as mutable more than once at a time")] | |
| 972 | pub(crate) struct MultipleMutBorrows { | |
| 973 | #[primary_span] | |
| 974 | pub(crate) span: Span, | |
| 975 | #[subdiagnostic] | |
| 976 | pub(crate) occurrences: Vec<Conflict>, | |
| 977 | } | |
| 978 | ||
| 979 | #[derive(Diagnostic)] | |
| 980 | #[diag("cannot borrow value as mutable because it is also borrowed as immutable")] | |
| 981 | pub(crate) struct AlreadyBorrowed { | |
| 982 | #[primary_span] | |
| 983 | pub(crate) span: Span, | |
| 984 | #[subdiagnostic] | |
| 985 | pub(crate) occurrences: Vec<Conflict>, | |
| 986 | } | |
| 987 | ||
| 988 | #[derive(Diagnostic)] | |
| 989 | #[diag("cannot borrow value as immutable because it is also borrowed as mutable")] | |
| 990 | pub(crate) struct AlreadyMutBorrowed { | |
| 991 | #[primary_span] | |
| 992 | pub(crate) span: Span, | |
| 993 | #[subdiagnostic] | |
| 994 | pub(crate) occurrences: Vec<Conflict>, | |
| 995 | } | |
| 996 | ||
| 997 | #[derive(Diagnostic)] | |
| 998 | #[diag("cannot move out of value because it is borrowed")] | |
| 999 | pub(crate) struct MovedWhileBorrowed { | |
| 1000 | #[primary_span] | |
| 1001 | pub(crate) span: Span, | |
| 1002 | #[subdiagnostic] | |
| 1003 | pub(crate) occurrences: Vec<Conflict>, | |
| 1004 | } | |
| 1005 | ||
| 1006 | #[derive(Subdiagnostic)] | |
| 1007 | pub(crate) enum Conflict { | |
| 1008 | #[label("value is mutably borrowed by `{$name}` here")] | |
| 1009 | Mut { | |
| 1010 | #[primary_span] | |
| 1011 | span: Span, | |
| 1012 | name: Symbol, | |
| 1013 | }, | |
| 1014 | #[label("value is borrowed by `{$name}` here")] | |
| 1015 | Ref { | |
| 1016 | #[primary_span] | |
| 1017 | span: Span, | |
| 1018 | name: Symbol, | |
| 1019 | }, | |
| 1020 | #[label("value is moved into `{$name}` here")] | |
| 1021 | Moved { | |
| 1022 | #[primary_span] | |
| 1023 | span: Span, | |
| 1024 | name: Symbol, | |
| 1025 | }, | |
| 1026 | } | |
| 1027 | ||
| 1028 | #[derive(Diagnostic)] | |
| 1029 | #[diag("cannot use unions in constant patterns")] | |
| 1030 | pub(crate) struct UnionPattern { | |
| 1031 | #[primary_span] | |
| 1032 | #[label("can't use a `union` here")] | |
| 1033 | pub(crate) span: Span, | |
| 1034 | } | |
| 1035 | ||
| 1036 | #[derive(Diagnostic)] | |
| 1037 | #[diag("constant of non-structural type `{$ty}` in a pattern")] | |
| 1038 | pub(crate) struct TypeNotStructural<'tcx> { | |
| 1039 | #[primary_span] | |
| 1040 | #[label("constant of non-structural type")] | |
| 1041 | pub(crate) span: Span, | |
| 1042 | #[label( | |
| 1043 | "{$is_local -> | |
| 1044 | *[true] `{$ty}` must be annotated with `#[derive(PartialEq)]` to be usable in patterns | |
| 1045 | [false] `{$ty}` is not usable in patterns | |
| 1046 | }" | |
| 1047 | )] | |
| 1048 | pub(crate) ty_def_span: Span, | |
| 1049 | pub(crate) ty: Ty<'tcx>, | |
| 1050 | #[note( | |
| 1051 | "the `PartialEq` trait must be derived, manual `impl`s are not sufficient; see \ | |
| 1052 | https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details" | |
| 1053 | )] | |
| 1054 | pub(crate) manual_partialeq_impl_span: Option<Span>, | |
| 1055 | #[note( | |
| 1056 | "see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details" | |
| 1057 | )] | |
| 1058 | pub(crate) manual_partialeq_impl_note: bool, | |
| 1059 | #[subdiagnostic] | |
| 1060 | pub(crate) suggestion: Option<SuggestEq<'tcx>>, | |
| 1061 | pub(crate) is_local: bool, | |
| 1062 | } | |
| 1063 | ||
| 1064 | #[derive(Subdiagnostic)] | |
| 1065 | pub(crate) enum SuggestEq<'tcx> { | |
| 1066 | #[multipart_suggestion( | |
| 1067 | "{$manual_partialeq_impl -> | |
| 1068 | [false] if `{$ty}` manually implemented `PartialEq`, you could add | |
| 1069 | *[true] add | |
| 1070 | } a condition to the match arm checking for equality", | |
| 1071 | applicability = "maybe-incorrect", | |
| 1072 | style = "verbose" | |
| 1073 | )] | |
| 1074 | AddIf { | |
| 1075 | #[suggestion_part(code = "binding")] | |
| 1076 | pat_span: Span, | |
| 1077 | #[suggestion_part(code = " if binding == {name}")] | |
| 1078 | if_span: Span, | |
| 1079 | name: String, | |
| 1080 | ty: Ty<'tcx>, | |
| 1081 | manual_partialeq_impl: bool, | |
| 1082 | }, | |
| 1083 | #[multipart_suggestion( | |
| 1084 | "{$manual_partialeq_impl -> | |
| 1085 | [false] if `{$ty}` manually implemented `PartialEq`, you could add | |
| 1086 | *[true] add | |
| 1087 | } a check for equality to the condition of the match arm", | |
| 1088 | applicability = "maybe-incorrect", | |
| 1089 | style = "verbose" | |
| 1090 | )] | |
| 1091 | AddToIf { | |
| 1092 | #[suggestion_part(code = "binding")] | |
| 1093 | pat_span: Span, | |
| 1094 | #[suggestion_part(code = " && binding == {name}")] | |
| 1095 | span: Span, | |
| 1096 | name: String, | |
| 1097 | ty: Ty<'tcx>, | |
| 1098 | manual_partialeq_impl: bool, | |
| 1099 | }, | |
| 1100 | #[multipart_suggestion( | |
| 1101 | "{$manual_partialeq_impl -> | |
| 1102 | [false] if `{$ty}` manually implemented `PartialEq`, you could check | |
| 1103 | *[true] check | |
| 1104 | } for equality instead of pattern matching", | |
| 1105 | applicability = "maybe-incorrect", | |
| 1106 | style = "verbose" | |
| 1107 | )] | |
| 1108 | AddToLetChain { | |
| 1109 | #[suggestion_part(code = "binding")] | |
| 1110 | pat_span: Span, | |
| 1111 | #[suggestion_part(code = " && binding == {name}")] | |
| 1112 | span: Span, | |
| 1113 | name: String, | |
| 1114 | ty: Ty<'tcx>, | |
| 1115 | manual_partialeq_impl: bool, | |
| 1116 | }, | |
| 1117 | #[multipart_suggestion( | |
| 1118 | "{$manual_partialeq_impl -> | |
| 1119 | [false] if `{$ty}` manually implemented `PartialEq`, you could check | |
| 1120 | *[true] check | |
| 1121 | } for equality instead of pattern matching", | |
| 1122 | applicability = "maybe-incorrect", | |
| 1123 | style = "verbose" | |
| 1124 | )] | |
| 1125 | ReplaceWithEq { | |
| 1126 | #[suggestion_part(code = "")] | |
| 1127 | removal: Span, | |
| 1128 | #[suggestion_part(code = " == ")] | |
| 1129 | eq: Span, | |
| 1130 | ty: Ty<'tcx>, | |
| 1131 | manual_partialeq_impl: bool, | |
| 1132 | }, | |
| 1133 | #[multipart_suggestion( | |
| 1134 | "{$manual_partialeq_impl -> | |
| 1135 | [false] if `{$ty}` manually implemented `PartialEq`, you could check | |
| 1136 | *[true] check | |
| 1137 | } for equality instead of pattern matching", | |
| 1138 | applicability = "maybe-incorrect", | |
| 1139 | style = "verbose" | |
| 1140 | )] | |
| 1141 | ReplaceLetElseWithIf { | |
| 1142 | #[suggestion_part(code = "if ")] | |
| 1143 | if_span: Span, | |
| 1144 | #[suggestion_part(code = " == ")] | |
| 1145 | eq: Span, | |
| 1146 | #[suggestion_part(code = " ")] | |
| 1147 | else_span: Span, | |
| 1148 | ty: Ty<'tcx>, | |
| 1149 | manual_partialeq_impl: bool, | |
| 1150 | }, | |
| 1151 | } | |
| 1152 | ||
| 1153 | #[derive(Diagnostic)] | |
| 1154 | #[diag("constant of non-structural type `{$ty}` in a pattern")] | |
| 1155 | #[note( | |
| 1156 | "see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details" | |
| 1157 | )] | |
| 1158 | pub(crate) struct TypeNotPartialEq<'tcx> { | |
| 1159 | #[primary_span] | |
| 1160 | #[label("constant of non-structural type")] | |
| 1161 | pub(crate) span: Span, | |
| 1162 | pub(crate) ty: Ty<'tcx>, | |
| 1163 | } | |
| 1164 | ||
| 1165 | #[derive(Diagnostic)] | |
| 1166 | #[diag("{$prefix} `{$non_sm_ty}` cannot be used in patterns")] | |
| 1167 | pub(crate) struct InvalidPattern<'tcx> { | |
| 1168 | #[primary_span] | |
| 1169 | #[label("{$prefix} can't be used in patterns")] | |
| 1170 | pub(crate) span: Span, | |
| 1171 | pub(crate) non_sm_ty: Ty<'tcx>, | |
| 1172 | pub(crate) prefix: String, | |
| 1173 | } | |
| 1174 | ||
| 1175 | #[derive(Diagnostic)] | |
| 1176 | #[diag("cannot use unsized non-slice type `{$non_sm_ty}` in constant patterns")] | |
| 1177 | pub(crate) struct UnsizedPattern<'tcx> { | |
| 1178 | #[primary_span] | |
| 1179 | pub(crate) span: Span, | |
| 1180 | pub(crate) non_sm_ty: Ty<'tcx>, | |
| 1181 | } | |
| 1182 | ||
| 1183 | #[derive(Diagnostic)] | |
| 1184 | #[diag("cannot use NaN in patterns")] | |
| 1185 | #[note("NaNs compare inequal to everything, even themselves, so this pattern would never match")] | |
| 1186 | #[help("try using the `is_nan` method instead")] | |
| 1187 | pub(crate) struct NaNPattern { | |
| 1188 | #[primary_span] | |
| 1189 | #[label("evaluates to `NaN`, which is not allowed in patterns")] | |
| 1190 | pub(crate) span: Span, | |
| 1191 | } | |
| 1192 | ||
| 1193 | #[derive(Diagnostic)] | |
| 1194 | #[diag( | |
| 1195 | "function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon" | |
| 1196 | )] | |
| 1197 | #[note("see https://github.com/rust-lang/rust/issues/70861 for details")] | |
| 1198 | pub(crate) struct PointerPattern { | |
| 1199 | #[primary_span] | |
| 1200 | #[label("can't be used in patterns")] | |
| 1201 | pub(crate) span: Span, | |
| 1202 | } | |
| 1203 | ||
| 1204 | #[derive(Diagnostic)] | |
| 1205 | #[diag("mismatched types")] | |
| 1206 | #[note("the matched value is of type `{$ty}`")] | |
| 1207 | pub(crate) struct NonEmptyNeverPattern<'tcx> { | |
| 1208 | #[primary_span] | |
| 1209 | #[label("a never pattern must be used on an uninhabited type")] | |
| 1210 | pub(crate) span: Span, | |
| 1211 | pub(crate) ty: Ty<'tcx>, | |
| 1212 | } | |
| 1213 | ||
| 1214 | #[derive(Diagnostic)] | |
| 1215 | #[diag("refutable pattern in {$origin}", code = E0005)] | |
| 1216 | pub(crate) struct PatternNotCovered<'s, 'tcx> { | |
| 1217 | #[primary_span] | |
| 1218 | pub(crate) span: Span, | |
| 1219 | pub(crate) origin: &'s str, | |
| 1220 | #[subdiagnostic] | |
| 1221 | pub(crate) uncovered: Uncovered, | |
| 1222 | #[subdiagnostic] | |
| 1223 | pub(crate) inform: Option<Inform>, | |
| 1224 | #[subdiagnostic] | |
| 1225 | pub(crate) interpreted_as_const: Option<InterpretedAsConst>, | |
| 1226 | #[subdiagnostic] | |
| 1227 | pub(crate) interpreted_as_const_sugg: Option<InterpretedAsConstSugg>, | |
| 1228 | #[subdiagnostic] | |
| 1229 | pub(crate) adt_defined_here: Option<AdtDefinedHere<'tcx>>, | |
| 1230 | #[note( | |
| 1231 | "pattern `{$witness_1}` is currently uninhabited, but this variant contains private fields which may become inhabited in the future" | |
| 1232 | )] | |
| 1233 | pub(crate) witness_1_is_privately_uninhabited: bool, | |
| 1234 | pub(crate) witness_1: String, | |
| 1235 | #[note("the matched value is of type `{$pattern_ty}`")] | |
| 1236 | pub(crate) _p: (), | |
| 1237 | pub(crate) pattern_ty: Ty<'tcx>, | |
| 1238 | #[subdiagnostic] | |
| 1239 | pub(crate) let_suggestion: Option<SuggestLet>, | |
| 1240 | #[subdiagnostic] | |
| 1241 | pub(crate) misc_suggestion: Option<MiscPatternSuggestion>, | |
| 1242 | } | |
| 1243 | ||
| 1244 | #[derive(Subdiagnostic, Debug)] | |
| 1245 | #[note( | |
| 1246 | "{$descr} require an \"irrefutable pattern\", like a `struct` or an `enum` with only one variant" | |
| 1247 | )] | |
| 1248 | #[note("for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html")] | |
| 1249 | pub(crate) struct Inform { | |
| 1250 | pub(crate) descr: &'static str, | |
| 1251 | } | |
| 1252 | ||
| 1253 | #[derive(Subdiagnostic)] | |
| 1254 | #[label( | |
| 1255 | "missing patterns are not covered because `{$variable}` is interpreted as a constant pattern, not a new variable" | |
| 1256 | )] | |
| 1257 | pub(crate) struct InterpretedAsConst { | |
| 1258 | #[primary_span] | |
| 1259 | pub(crate) span: Span, | |
| 1260 | pub(crate) variable: String, | |
| 1261 | } | |
| 1262 | ||
| 1263 | pub(crate) struct AdtDefinedHere<'tcx> { | |
| 1264 | pub(crate) adt_def_span: Span, | |
| 1265 | pub(crate) ty: Ty<'tcx>, | |
| 1266 | pub(crate) variants: Vec<Variant>, | |
| 1267 | } | |
| 1268 | ||
| 1269 | pub(crate) struct Variant { | |
| 1270 | pub(crate) span: Span, | |
| 1271 | } | |
| 1272 | ||
| 1273 | impl<'tcx> Subdiagnostic for AdtDefinedHere<'tcx> { | |
| 1274 | fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) { | |
| 1275 | diag.arg("ty", self.ty); | |
| 1276 | let mut spans = MultiSpan::from(self.adt_def_span); | |
| 1277 | ||
| 1278 | for Variant { span } in self.variants { | |
| 1279 | spans.push_span_label(span, msg!("not covered")); | |
| 1280 | } | |
| 1281 | ||
| 1282 | diag.span_note(spans, msg!("`{$ty}` defined here")); | |
| 1283 | } | |
| 1284 | } | |
| 1285 | ||
| 1286 | #[derive(Subdiagnostic)] | |
| 1287 | #[suggestion( | |
| 1288 | "introduce a variable instead", | |
| 1289 | code = "{variable}_var", | |
| 1290 | applicability = "maybe-incorrect", | |
| 1291 | style = "verbose" | |
| 1292 | )] | |
| 1293 | pub(crate) struct InterpretedAsConstSugg { | |
| 1294 | #[primary_span] | |
| 1295 | pub(crate) span: Span, | |
| 1296 | pub(crate) variable: String, | |
| 1297 | } | |
| 1298 | ||
| 1299 | #[derive(Subdiagnostic)] | |
| 1300 | pub(crate) enum SuggestLet { | |
| 1301 | #[multipart_suggestion( | |
| 1302 | "you might want to use `if let` to ignore the {$count -> | |
| 1303 | [one] variant that isn't | |
| 1304 | *[other] variants that aren't | |
| 1305 | } matched", | |
| 1306 | applicability = "has-placeholders" | |
| 1307 | )] | |
| 1308 | If { | |
| 1309 | #[suggestion_part(code = "if ")] | |
| 1310 | start_span: Span, | |
| 1311 | #[suggestion_part(code = " {{ todo!() }}")] | |
| 1312 | semi_span: Span, | |
| 1313 | count: usize, | |
| 1314 | }, | |
| 1315 | #[suggestion( | |
| 1316 | "you might want to use `let...else` to handle the {$count -> | |
| 1317 | [one] variant that isn't | |
| 1318 | *[other] variants that aren't | |
| 1319 | } matched", | |
| 1320 | code = " else {{ todo!() }}", | |
| 1321 | applicability = "has-placeholders" | |
| 1322 | )] | |
| 1323 | Else { | |
| 1324 | #[primary_span] | |
| 1325 | end_span: Span, | |
| 1326 | count: usize, | |
| 1327 | }, | |
| 1328 | } | |
| 1329 | ||
| 1330 | #[derive(Subdiagnostic)] | |
| 1331 | pub(crate) enum MiscPatternSuggestion { | |
| 1332 | #[suggestion( | |
| 1333 | "alternatively, you could prepend the pattern with an underscore to define a new named variable; identifiers cannot begin with digits", | |
| 1334 | code = "_", | |
| 1335 | applicability = "maybe-incorrect" | |
| 1336 | )] | |
| 1337 | AttemptedIntegerLiteral { | |
| 1338 | #[primary_span] | |
| 1339 | start_span: Span, | |
| 1340 | }, | |
| 1341 | } | |
| 1342 | ||
| 1343 | #[derive(Diagnostic)] | |
| 1344 | #[diag("invalid update of the `#[loop_match]` state")] | |
| 1345 | pub(crate) struct LoopMatchInvalidUpdate { | |
| 1346 | #[primary_span] | |
| 1347 | pub lhs: Span, | |
| 1348 | #[label("the assignment must update this variable")] | |
| 1349 | pub scrutinee: Span, | |
| 1350 | } | |
| 1351 | ||
| 1352 | #[derive(Diagnostic)] | |
| 1353 | #[diag("invalid match on `#[loop_match]` state")] | |
| 1354 | #[note("a local variable must be the scrutinee within a `#[loop_match]`")] | |
| 1355 | pub(crate) struct LoopMatchInvalidMatch { | |
| 1356 | #[primary_span] | |
| 1357 | pub span: Span, | |
| 1358 | } | |
| 1359 | ||
| 1360 | #[derive(Diagnostic)] | |
| 1361 | #[diag("this `#[loop_match]` state value has type `{$ty}`, which is not supported")] | |
| 1362 | #[note("only integers, floats, bool, char, and enums without fields are supported")] | |
| 1363 | pub(crate) struct LoopMatchUnsupportedType<'tcx> { | |
| 1364 | #[primary_span] | |
| 1365 | pub span: Span, | |
| 1366 | pub ty: Ty<'tcx>, | |
| 1367 | } | |
| 1368 | ||
| 1369 | #[derive(Diagnostic)] | |
| 1370 | #[diag("statements are not allowed in this position within a `#[loop_match]`")] | |
| 1371 | pub(crate) struct LoopMatchBadStatements { | |
| 1372 | #[primary_span] | |
| 1373 | pub span: Span, | |
| 1374 | } | |
| 1375 | ||
| 1376 | #[derive(Diagnostic)] | |
| 1377 | #[diag("this expression must be a single `match` wrapped in a labeled block")] | |
| 1378 | pub(crate) struct LoopMatchBadRhs { | |
| 1379 | #[primary_span] | |
| 1380 | pub span: Span, | |
| 1381 | } | |
| 1382 | ||
| 1383 | #[derive(Diagnostic)] | |
| 1384 | #[diag("expected a single assignment expression")] | |
| 1385 | pub(crate) struct LoopMatchMissingAssignment { | |
| 1386 | #[primary_span] | |
| 1387 | pub span: Span, | |
| 1388 | } | |
| 1389 | ||
| 1390 | #[derive(Diagnostic)] | |
| 1391 | #[diag("match arms that are part of a `#[loop_match]` cannot have guards")] | |
| 1392 | pub(crate) struct LoopMatchArmWithGuard { | |
| 1393 | #[primary_span] | |
| 1394 | pub span: Span, | |
| 1395 | } | |
| 1396 | ||
| 1397 | #[derive(Diagnostic)] | |
| 1398 | #[diag("could not determine the target branch for this `#[const_continue]`")] | |
| 1399 | #[help("try extracting the expression into a `const` item")] | |
| 1400 | pub(crate) struct ConstContinueNotMonomorphicConst { | |
| 1401 | #[primary_span] | |
| 1402 | pub span: Span, | |
| 1403 | ||
| 1404 | #[subdiagnostic] | |
| 1405 | pub reason: ConstContinueNotMonomorphicConstReason, | |
| 1406 | } | |
| 1407 | ||
| 1408 | #[derive(Subdiagnostic)] | |
| 1409 | pub(crate) enum ConstContinueNotMonomorphicConstReason { | |
| 1410 | #[label("constant parameters may use generics, and are not evaluated early enough")] | |
| 1411 | ConstantParameter { | |
| 1412 | #[primary_span] | |
| 1413 | span: Span, | |
| 1414 | }, | |
| 1415 | ||
| 1416 | #[label("`const` blocks may use generics, and are not evaluated early enough")] | |
| 1417 | ConstBlock { | |
| 1418 | #[primary_span] | |
| 1419 | span: Span, | |
| 1420 | }, | |
| 1421 | ||
| 1422 | #[label("this value must be a literal or a monomorphic const")] | |
| 1423 | Other { | |
| 1424 | #[primary_span] | |
| 1425 | span: Span, | |
| 1426 | }, | |
| 1427 | } | |
| 1428 | ||
| 1429 | #[derive(Diagnostic)] | |
| 1430 | #[diag("could not determine the target branch for this `#[const_continue]`")] | |
| 1431 | pub(crate) struct ConstContinueBadConst { | |
| 1432 | #[primary_span] | |
| 1433 | #[label("this value is too generic")] | |
| 1434 | pub span: Span, | |
| 1435 | } | |
| 1436 | ||
| 1437 | #[derive(Diagnostic)] | |
| 1438 | #[diag("a `#[const_continue]` must break to a label with a value")] | |
| 1439 | pub(crate) struct ConstContinueMissingLabelOrValue { | |
| 1440 | #[primary_span] | |
| 1441 | pub span: Span, | |
| 1442 | } | |
| 1443 | ||
| 1444 | #[derive(Diagnostic)] | |
| 1445 | #[diag("the target of this `#[const_continue]` is not statically known")] | |
| 1446 | pub(crate) struct ConstContinueUnknownJumpTarget { | |
| 1447 | #[primary_span] | |
| 1448 | pub span: Span, | |
| 1449 | } |
compiler/rustc_mir_build/src/errors.rs deleted-1449| ... | ... | @@ -1,1449 +0,0 @@ |
| 1 | use rustc_errors::codes::*; | |
| 2 | use rustc_errors::{ | |
| 3 | Applicability, Diag, DiagArgValue, DiagCtxtHandle, Diagnostic, EmissionGuarantee, Level, | |
| 4 | MultiSpan, Subdiagnostic, msg, | |
| 5 | }; | |
| 6 | use rustc_macros::{Diagnostic, Subdiagnostic}; | |
| 7 | use rustc_middle::ty::{self, Ty}; | |
| 8 | use rustc_pattern_analysis::errors::Uncovered; | |
| 9 | use rustc_pattern_analysis::rustc::RustcPatCtxt; | |
| 10 | use rustc_span::{Ident, Span, Symbol}; | |
| 11 | ||
| 12 | #[derive(Diagnostic)] | |
| 13 | #[diag("call to deprecated safe function `{$function}` is unsafe and requires unsafe block")] | |
| 14 | pub(crate) struct CallToDeprecatedSafeFnRequiresUnsafe { | |
| 15 | #[label("call to unsafe function")] | |
| 16 | pub(crate) span: Span, | |
| 17 | pub(crate) function: String, | |
| 18 | #[subdiagnostic] | |
| 19 | pub(crate) sub: CallToDeprecatedSafeFnRequiresUnsafeSub, | |
| 20 | } | |
| 21 | ||
| 22 | #[derive(Subdiagnostic)] | |
| 23 | #[multipart_suggestion( | |
| 24 | "you can wrap the call in an `unsafe` block if you can guarantee {$guarantee}", | |
| 25 | applicability = "machine-applicable" | |
| 26 | )] | |
| 27 | pub(crate) struct CallToDeprecatedSafeFnRequiresUnsafeSub { | |
| 28 | pub(crate) start_of_line_suggestion: String, | |
| 29 | #[suggestion_part(code = "{start_of_line_suggestion}")] | |
| 30 | pub(crate) start_of_line: Span, | |
| 31 | #[suggestion_part(code = "unsafe {{ ")] | |
| 32 | pub(crate) left: Span, | |
| 33 | #[suggestion_part(code = " }}")] | |
| 34 | pub(crate) right: Span, | |
| 35 | pub(crate) guarantee: String, | |
| 36 | } | |
| 37 | ||
| 38 | #[derive(Diagnostic)] | |
| 39 | #[diag("call to unsafe function `{$function}` is unsafe and requires unsafe block", code = E0133)] | |
| 40 | #[note("consult the function's documentation for information on how to avoid undefined behavior")] | |
| 41 | pub(crate) struct UnsafeOpInUnsafeFnCallToUnsafeFunctionRequiresUnsafe { | |
| 42 | #[label("call to unsafe function")] | |
| 43 | pub(crate) span: Span, | |
| 44 | pub(crate) function: String, | |
| 45 | #[subdiagnostic] | |
| 46 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedLintNote>, | |
| 47 | } | |
| 48 | ||
| 49 | #[derive(Diagnostic)] | |
| 50 | #[diag("call to unsafe function is unsafe and requires unsafe block", code = E0133)] | |
| 51 | #[note("consult the function's documentation for information on how to avoid undefined behavior")] | |
| 52 | pub(crate) struct UnsafeOpInUnsafeFnCallToUnsafeFunctionRequiresUnsafeNameless { | |
| 53 | #[label("call to unsafe function")] | |
| 54 | pub(crate) span: Span, | |
| 55 | #[subdiagnostic] | |
| 56 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedLintNote>, | |
| 57 | } | |
| 58 | ||
| 59 | #[derive(Diagnostic)] | |
| 60 | #[diag("use of inline assembly is unsafe and requires unsafe block", code = E0133)] | |
| 61 | #[note("inline assembly is entirely unchecked and can cause undefined behavior")] | |
| 62 | pub(crate) struct UnsafeOpInUnsafeFnUseOfInlineAssemblyRequiresUnsafe { | |
| 63 | #[label("use of inline assembly")] | |
| 64 | pub(crate) span: Span, | |
| 65 | #[subdiagnostic] | |
| 66 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedLintNote>, | |
| 67 | } | |
| 68 | ||
| 69 | #[derive(Diagnostic)] | |
| 70 | #[diag("initializing type with an unsafe field is unsafe and requires unsafe block", code = E0133)] | |
| 71 | #[note("unsafe fields may carry library invariants")] | |
| 72 | pub(crate) struct UnsafeOpInUnsafeFnInitializingTypeWithUnsafeFieldRequiresUnsafe { | |
| 73 | #[label("initialization of struct with unsafe field")] | |
| 74 | pub(crate) span: Span, | |
| 75 | #[subdiagnostic] | |
| 76 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedLintNote>, | |
| 77 | } | |
| 78 | ||
| 79 | #[derive(Diagnostic)] | |
| 80 | #[diag("use of mutable static is unsafe and requires unsafe block", code = E0133)] | |
| 81 | #[note( | |
| 82 | "mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior" | |
| 83 | )] | |
| 84 | pub(crate) struct UnsafeOpInUnsafeFnUseOfMutableStaticRequiresUnsafe { | |
| 85 | #[label("use of mutable static")] | |
| 86 | pub(crate) span: Span, | |
| 87 | #[subdiagnostic] | |
| 88 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedLintNote>, | |
| 89 | } | |
| 90 | ||
| 91 | #[derive(Diagnostic)] | |
| 92 | #[diag("use of extern static is unsafe and requires unsafe block", code = E0133)] | |
| 93 | #[note( | |
| 94 | "extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior" | |
| 95 | )] | |
| 96 | pub(crate) struct UnsafeOpInUnsafeFnUseOfExternStaticRequiresUnsafe { | |
| 97 | #[label("use of extern static")] | |
| 98 | pub(crate) span: Span, | |
| 99 | #[subdiagnostic] | |
| 100 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedLintNote>, | |
| 101 | } | |
| 102 | ||
| 103 | #[derive(Diagnostic)] | |
| 104 | #[diag("use of unsafe field is unsafe and requires unsafe block", code = E0133)] | |
| 105 | #[note("unsafe fields may carry library invariants")] | |
| 106 | pub(crate) struct UnsafeOpInUnsafeFnUseOfUnsafeFieldRequiresUnsafe { | |
| 107 | #[label("use of unsafe field")] | |
| 108 | pub(crate) span: Span, | |
| 109 | #[subdiagnostic] | |
| 110 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedLintNote>, | |
| 111 | } | |
| 112 | ||
| 113 | #[derive(Diagnostic)] | |
| 114 | #[diag("dereference of raw pointer is unsafe and requires unsafe block", code = E0133)] | |
| 115 | #[note( | |
| 116 | "raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior" | |
| 117 | )] | |
| 118 | pub(crate) struct UnsafeOpInUnsafeFnDerefOfRawPointerRequiresUnsafe { | |
| 119 | #[label("dereference of raw pointer")] | |
| 120 | pub(crate) span: Span, | |
| 121 | #[subdiagnostic] | |
| 122 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedLintNote>, | |
| 123 | } | |
| 124 | ||
| 125 | #[derive(Diagnostic)] | |
| 126 | #[diag("access to union field is unsafe and requires unsafe block", code = E0133)] | |
| 127 | #[note( | |
| 128 | "the field may not be properly initialized: using uninitialized data will cause undefined behavior" | |
| 129 | )] | |
| 130 | pub(crate) struct UnsafeOpInUnsafeFnAccessToUnionFieldRequiresUnsafe { | |
| 131 | #[label("access to union field")] | |
| 132 | pub(crate) span: Span, | |
| 133 | #[subdiagnostic] | |
| 134 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedLintNote>, | |
| 135 | } | |
| 136 | ||
| 137 | #[derive(Diagnostic)] | |
| 138 | #[diag( | |
| 139 | "mutation of layout constrained field is unsafe and requires unsafe block", | |
| 140 | code = E0133 | |
| 141 | )] | |
| 142 | #[note("mutating layout constrained fields cannot statically be checked for valid values")] | |
| 143 | pub(crate) struct UnsafeOpInUnsafeFnMutationOfLayoutConstrainedFieldRequiresUnsafe { | |
| 144 | #[label("mutation of layout constrained field")] | |
| 145 | pub(crate) span: Span, | |
| 146 | #[subdiagnostic] | |
| 147 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedLintNote>, | |
| 148 | } | |
| 149 | ||
| 150 | #[derive(Diagnostic)] | |
| 151 | #[diag( | |
| 152 | "borrow of layout constrained field with interior mutability is unsafe and requires unsafe block", | |
| 153 | code = E0133, | |
| 154 | )] | |
| 155 | pub(crate) struct UnsafeOpInUnsafeFnBorrowOfLayoutConstrainedFieldRequiresUnsafe { | |
| 156 | #[label("borrow of layout constrained field with interior mutability")] | |
| 157 | pub(crate) span: Span, | |
| 158 | #[subdiagnostic] | |
| 159 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedLintNote>, | |
| 160 | } | |
| 161 | ||
| 162 | #[derive(Diagnostic)] | |
| 163 | #[diag( | |
| 164 | "unsafe binder cast is unsafe and requires unsafe block information that may be required to uphold safety guarantees of a type", | |
| 165 | code = E0133, | |
| 166 | )] | |
| 167 | pub(crate) struct UnsafeOpInUnsafeFnUnsafeBinderCastRequiresUnsafe { | |
| 168 | #[label("unsafe binder cast")] | |
| 169 | pub(crate) span: Span, | |
| 170 | #[subdiagnostic] | |
| 171 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedLintNote>, | |
| 172 | } | |
| 173 | ||
| 174 | #[derive(Diagnostic)] | |
| 175 | #[diag("call to function `{$function}` with `#[target_feature]` is unsafe and requires unsafe block", code = E0133)] | |
| 176 | #[help( | |
| 177 | "in order for the call to be safe, the context requires the following additional target {$missing_target_features_count -> | |
| 178 | [1] feature | |
| 179 | *[count] features | |
| 180 | }: {$missing_target_features}" | |
| 181 | )] | |
| 182 | pub(crate) struct UnsafeOpInUnsafeFnCallToFunctionWithRequiresUnsafe { | |
| 183 | #[label("call to function with `#[target_feature]`")] | |
| 184 | pub(crate) span: Span, | |
| 185 | pub(crate) function: String, | |
| 186 | pub(crate) missing_target_features: DiagArgValue, | |
| 187 | pub(crate) missing_target_features_count: usize, | |
| 188 | #[note("the {$build_target_features} target {$build_target_features_count -> | |
| 189 | [1] feature | |
| 190 | *[count] features | |
| 191 | } being enabled in the build configuration does not remove the requirement to list {$build_target_features_count -> | |
| 192 | [1] it | |
| 193 | *[count] them | |
| 194 | } in `#[target_feature]`")] | |
| 195 | pub(crate) note: bool, | |
| 196 | pub(crate) build_target_features: DiagArgValue, | |
| 197 | pub(crate) build_target_features_count: usize, | |
| 198 | #[subdiagnostic] | |
| 199 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedLintNote>, | |
| 200 | } | |
| 201 | ||
| 202 | #[derive(Diagnostic)] | |
| 203 | #[diag("call to unsafe function `{$function}` is unsafe and requires unsafe block", code = E0133)] | |
| 204 | #[note("consult the function's documentation for information on how to avoid undefined behavior")] | |
| 205 | pub(crate) struct CallToUnsafeFunctionRequiresUnsafe { | |
| 206 | #[primary_span] | |
| 207 | #[label("call to unsafe function")] | |
| 208 | pub(crate) span: Span, | |
| 209 | pub(crate) function: String, | |
| 210 | #[subdiagnostic] | |
| 211 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>, | |
| 212 | } | |
| 213 | ||
| 214 | #[derive(Diagnostic)] | |
| 215 | #[diag("call to unsafe function is unsafe and requires unsafe block", code = E0133)] | |
| 216 | #[note("consult the function's documentation for information on how to avoid undefined behavior")] | |
| 217 | pub(crate) struct CallToUnsafeFunctionRequiresUnsafeNameless { | |
| 218 | #[primary_span] | |
| 219 | #[label("call to unsafe function")] | |
| 220 | pub(crate) span: Span, | |
| 221 | #[subdiagnostic] | |
| 222 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>, | |
| 223 | } | |
| 224 | ||
| 225 | #[derive(Diagnostic)] | |
| 226 | #[diag("call to unsafe function `{$function}` is unsafe and requires unsafe function or block", code = E0133)] | |
| 227 | #[note("consult the function's documentation for information on how to avoid undefined behavior")] | |
| 228 | pub(crate) struct CallToUnsafeFunctionRequiresUnsafeUnsafeOpInUnsafeFnAllowed { | |
| 229 | #[primary_span] | |
| 230 | #[label("call to unsafe function")] | |
| 231 | pub(crate) span: Span, | |
| 232 | pub(crate) function: String, | |
| 233 | #[subdiagnostic] | |
| 234 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>, | |
| 235 | } | |
| 236 | ||
| 237 | #[derive(Diagnostic)] | |
| 238 | #[diag( | |
| 239 | "call to unsafe function is unsafe and requires unsafe function or block", | |
| 240 | code = E0133 | |
| 241 | )] | |
| 242 | #[note("consult the function's documentation for information on how to avoid undefined behavior")] | |
| 243 | pub(crate) struct CallToUnsafeFunctionRequiresUnsafeNamelessUnsafeOpInUnsafeFnAllowed { | |
| 244 | #[primary_span] | |
| 245 | #[label("call to unsafe function")] | |
| 246 | pub(crate) span: Span, | |
| 247 | #[subdiagnostic] | |
| 248 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>, | |
| 249 | } | |
| 250 | ||
| 251 | #[derive(Diagnostic)] | |
| 252 | #[diag("use of inline assembly is unsafe and requires unsafe block", code = E0133)] | |
| 253 | #[note("inline assembly is entirely unchecked and can cause undefined behavior")] | |
| 254 | pub(crate) struct UseOfInlineAssemblyRequiresUnsafe { | |
| 255 | #[primary_span] | |
| 256 | #[label("use of inline assembly")] | |
| 257 | pub(crate) span: Span, | |
| 258 | #[subdiagnostic] | |
| 259 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>, | |
| 260 | } | |
| 261 | ||
| 262 | #[derive(Diagnostic)] | |
| 263 | #[diag("use of inline assembly is unsafe and requires unsafe function or block", code = E0133)] | |
| 264 | #[note("inline assembly is entirely unchecked and can cause undefined behavior")] | |
| 265 | pub(crate) struct UseOfInlineAssemblyRequiresUnsafeUnsafeOpInUnsafeFnAllowed { | |
| 266 | #[primary_span] | |
| 267 | #[label("use of inline assembly")] | |
| 268 | pub(crate) span: Span, | |
| 269 | #[subdiagnostic] | |
| 270 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>, | |
| 271 | } | |
| 272 | ||
| 273 | #[derive(Diagnostic)] | |
| 274 | #[diag("initializing type with an unsafe field is unsafe and requires unsafe block", code = E0133)] | |
| 275 | #[note("unsafe fields may carry library invariants")] | |
| 276 | pub(crate) struct InitializingTypeWithUnsafeFieldRequiresUnsafe { | |
| 277 | #[primary_span] | |
| 278 | #[label("initialization of struct with unsafe field")] | |
| 279 | pub(crate) span: Span, | |
| 280 | #[subdiagnostic] | |
| 281 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>, | |
| 282 | } | |
| 283 | ||
| 284 | #[derive(Diagnostic)] | |
| 285 | #[diag( | |
| 286 | "initializing type with an unsafe field is unsafe and requires unsafe block", | |
| 287 | code = E0133 | |
| 288 | )] | |
| 289 | #[note("unsafe fields may carry library invariants")] | |
| 290 | pub(crate) struct InitializingTypeWithUnsafeFieldRequiresUnsafeUnsafeOpInUnsafeFnAllowed { | |
| 291 | #[primary_span] | |
| 292 | #[label("initialization of struct with unsafe field")] | |
| 293 | pub(crate) span: Span, | |
| 294 | #[subdiagnostic] | |
| 295 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>, | |
| 296 | } | |
| 297 | ||
| 298 | #[derive(Diagnostic)] | |
| 299 | #[diag("use of mutable static is unsafe and requires unsafe block", code = E0133)] | |
| 300 | #[note( | |
| 301 | "mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior" | |
| 302 | )] | |
| 303 | pub(crate) struct UseOfMutableStaticRequiresUnsafe { | |
| 304 | #[primary_span] | |
| 305 | #[label("use of mutable static")] | |
| 306 | pub(crate) span: Span, | |
| 307 | #[subdiagnostic] | |
| 308 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>, | |
| 309 | } | |
| 310 | ||
| 311 | #[derive(Diagnostic)] | |
| 312 | #[diag("use of mutable static is unsafe and requires unsafe function or block", code = E0133)] | |
| 313 | #[note( | |
| 314 | "mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior" | |
| 315 | )] | |
| 316 | pub(crate) struct UseOfMutableStaticRequiresUnsafeUnsafeOpInUnsafeFnAllowed { | |
| 317 | #[primary_span] | |
| 318 | #[label("use of mutable static")] | |
| 319 | pub(crate) span: Span, | |
| 320 | #[subdiagnostic] | |
| 321 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>, | |
| 322 | } | |
| 323 | ||
| 324 | #[derive(Diagnostic)] | |
| 325 | #[diag("use of extern static is unsafe and requires unsafe block", code = E0133)] | |
| 326 | #[note( | |
| 327 | "extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior" | |
| 328 | )] | |
| 329 | pub(crate) struct UseOfExternStaticRequiresUnsafe { | |
| 330 | #[primary_span] | |
| 331 | #[label("use of extern static")] | |
| 332 | pub(crate) span: Span, | |
| 333 | #[subdiagnostic] | |
| 334 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>, | |
| 335 | } | |
| 336 | ||
| 337 | #[derive(Diagnostic)] | |
| 338 | #[diag("use of extern static is unsafe and requires unsafe function or block", code = E0133)] | |
| 339 | #[note( | |
| 340 | "extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior" | |
| 341 | )] | |
| 342 | pub(crate) struct UseOfExternStaticRequiresUnsafeUnsafeOpInUnsafeFnAllowed { | |
| 343 | #[primary_span] | |
| 344 | #[label("use of extern static")] | |
| 345 | pub(crate) span: Span, | |
| 346 | #[subdiagnostic] | |
| 347 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>, | |
| 348 | } | |
| 349 | ||
| 350 | #[derive(Diagnostic)] | |
| 351 | #[diag("use of unsafe field is unsafe and requires unsafe block", code = E0133)] | |
| 352 | #[note("unsafe fields may carry library invariants")] | |
| 353 | pub(crate) struct UseOfUnsafeFieldRequiresUnsafe { | |
| 354 | #[primary_span] | |
| 355 | #[label("use of unsafe field")] | |
| 356 | pub(crate) span: Span, | |
| 357 | #[subdiagnostic] | |
| 358 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>, | |
| 359 | } | |
| 360 | ||
| 361 | #[derive(Diagnostic)] | |
| 362 | #[diag("use of unsafe field is unsafe and requires unsafe block", code = E0133)] | |
| 363 | #[note("unsafe fields may carry library invariants")] | |
| 364 | pub(crate) struct UseOfUnsafeFieldRequiresUnsafeUnsafeOpInUnsafeFnAllowed { | |
| 365 | #[primary_span] | |
| 366 | #[label("use of unsafe field")] | |
| 367 | pub(crate) span: Span, | |
| 368 | #[subdiagnostic] | |
| 369 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>, | |
| 370 | } | |
| 371 | ||
| 372 | #[derive(Diagnostic)] | |
| 373 | #[diag("dereference of raw pointer is unsafe and requires unsafe block", code = E0133)] | |
| 374 | #[note( | |
| 375 | "raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior" | |
| 376 | )] | |
| 377 | pub(crate) struct DerefOfRawPointerRequiresUnsafe { | |
| 378 | #[primary_span] | |
| 379 | #[label("dereference of raw pointer")] | |
| 380 | pub(crate) span: Span, | |
| 381 | #[subdiagnostic] | |
| 382 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>, | |
| 383 | } | |
| 384 | ||
| 385 | #[derive(Diagnostic)] | |
| 386 | #[diag("dereference of raw pointer is unsafe and requires unsafe function or block", code = E0133)] | |
| 387 | #[note( | |
| 388 | "raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior" | |
| 389 | )] | |
| 390 | pub(crate) struct DerefOfRawPointerRequiresUnsafeUnsafeOpInUnsafeFnAllowed { | |
| 391 | #[primary_span] | |
| 392 | #[label("dereference of raw pointer")] | |
| 393 | pub(crate) span: Span, | |
| 394 | #[subdiagnostic] | |
| 395 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>, | |
| 396 | } | |
| 397 | ||
| 398 | #[derive(Diagnostic)] | |
| 399 | #[diag("access to union field is unsafe and requires unsafe block", code = E0133)] | |
| 400 | #[note( | |
| 401 | "the field may not be properly initialized: using uninitialized data will cause undefined behavior" | |
| 402 | )] | |
| 403 | pub(crate) struct AccessToUnionFieldRequiresUnsafe { | |
| 404 | #[primary_span] | |
| 405 | #[label("access to union field")] | |
| 406 | pub(crate) span: Span, | |
| 407 | #[subdiagnostic] | |
| 408 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>, | |
| 409 | } | |
| 410 | ||
| 411 | #[derive(Diagnostic)] | |
| 412 | #[diag("access to union field is unsafe and requires unsafe function or block", code = E0133)] | |
| 413 | #[note( | |
| 414 | "the field may not be properly initialized: using uninitialized data will cause undefined behavior" | |
| 415 | )] | |
| 416 | pub(crate) struct AccessToUnionFieldRequiresUnsafeUnsafeOpInUnsafeFnAllowed { | |
| 417 | #[primary_span] | |
| 418 | #[label("access to union field")] | |
| 419 | pub(crate) span: Span, | |
| 420 | #[subdiagnostic] | |
| 421 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>, | |
| 422 | } | |
| 423 | ||
| 424 | #[derive(Diagnostic)] | |
| 425 | #[diag("mutation of layout constrained field is unsafe and requires unsafe block", code = E0133)] | |
| 426 | #[note("mutating layout constrained fields cannot statically be checked for valid values")] | |
| 427 | pub(crate) struct MutationOfLayoutConstrainedFieldRequiresUnsafe { | |
| 428 | #[primary_span] | |
| 429 | #[label("mutation of layout constrained field")] | |
| 430 | pub(crate) span: Span, | |
| 431 | #[subdiagnostic] | |
| 432 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>, | |
| 433 | } | |
| 434 | ||
| 435 | #[derive(Diagnostic)] | |
| 436 | #[diag( | |
| 437 | "mutation of layout constrained field is unsafe and requires unsafe function or block", | |
| 438 | code = E0133 | |
| 439 | )] | |
| 440 | #[note("mutating layout constrained fields cannot statically be checked for valid values")] | |
| 441 | pub(crate) struct MutationOfLayoutConstrainedFieldRequiresUnsafeUnsafeOpInUnsafeFnAllowed { | |
| 442 | #[primary_span] | |
| 443 | #[label("mutation of layout constrained field")] | |
| 444 | pub(crate) span: Span, | |
| 445 | #[subdiagnostic] | |
| 446 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>, | |
| 447 | } | |
| 448 | ||
| 449 | #[derive(Diagnostic)] | |
| 450 | #[diag("borrow of layout constrained field with interior mutability is unsafe and requires unsafe block", code = E0133)] | |
| 451 | #[note( | |
| 452 | "references to fields of layout constrained fields lose the constraints. Coupled with interior mutability, the field can be changed to invalid values" | |
| 453 | )] | |
| 454 | pub(crate) struct BorrowOfLayoutConstrainedFieldRequiresUnsafe { | |
| 455 | #[primary_span] | |
| 456 | #[label("borrow of layout constrained field with interior mutability")] | |
| 457 | pub(crate) span: Span, | |
| 458 | #[subdiagnostic] | |
| 459 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>, | |
| 460 | } | |
| 461 | ||
| 462 | #[derive(Diagnostic)] | |
| 463 | #[diag( | |
| 464 | "borrow of layout constrained field with interior mutability is unsafe and requires unsafe function or block", | |
| 465 | code = E0133 | |
| 466 | )] | |
| 467 | #[note( | |
| 468 | "references to fields of layout constrained fields lose the constraints. Coupled with interior mutability, the field can be changed to invalid values" | |
| 469 | )] | |
| 470 | pub(crate) struct BorrowOfLayoutConstrainedFieldRequiresUnsafeUnsafeOpInUnsafeFnAllowed { | |
| 471 | #[primary_span] | |
| 472 | #[label("borrow of layout constrained field with interior mutability")] | |
| 473 | pub(crate) span: Span, | |
| 474 | #[subdiagnostic] | |
| 475 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>, | |
| 476 | } | |
| 477 | ||
| 478 | #[derive(Diagnostic)] | |
| 479 | #[diag("call to function `{$function}` with `#[target_feature]` is unsafe and requires unsafe block", code = E0133)] | |
| 480 | #[help( | |
| 481 | "in order for the call to be safe, the context requires the following additional target {$missing_target_features_count -> | |
| 482 | [1] feature | |
| 483 | *[count] features | |
| 484 | }: {$missing_target_features}" | |
| 485 | )] | |
| 486 | pub(crate) struct CallToFunctionWithRequiresUnsafe { | |
| 487 | #[primary_span] | |
| 488 | #[label("call to function with `#[target_feature]`")] | |
| 489 | pub(crate) span: Span, | |
| 490 | pub(crate) function: String, | |
| 491 | pub(crate) missing_target_features: DiagArgValue, | |
| 492 | pub(crate) missing_target_features_count: usize, | |
| 493 | #[note("the {$build_target_features} target {$build_target_features_count -> | |
| 494 | [1] feature | |
| 495 | *[count] features | |
| 496 | } being enabled in the build configuration does not remove the requirement to list {$build_target_features_count -> | |
| 497 | [1] it | |
| 498 | *[count] them | |
| 499 | } in `#[target_feature]`")] | |
| 500 | pub(crate) note: bool, | |
| 501 | pub(crate) build_target_features: DiagArgValue, | |
| 502 | pub(crate) build_target_features_count: usize, | |
| 503 | #[subdiagnostic] | |
| 504 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>, | |
| 505 | } | |
| 506 | ||
| 507 | #[derive(Diagnostic)] | |
| 508 | #[diag( | |
| 509 | "call to function `{$function}` with `#[target_feature]` is unsafe and requires unsafe function or block", | |
| 510 | code = E0133, | |
| 511 | )] | |
| 512 | #[help( | |
| 513 | "in order for the call to be safe, the context requires the following additional target {$missing_target_features_count -> | |
| 514 | [1] feature | |
| 515 | *[count] features | |
| 516 | }: {$missing_target_features}" | |
| 517 | )] | |
| 518 | pub(crate) struct CallToFunctionWithRequiresUnsafeUnsafeOpInUnsafeFnAllowed { | |
| 519 | #[primary_span] | |
| 520 | #[label("call to function with `#[target_feature]`")] | |
| 521 | pub(crate) span: Span, | |
| 522 | pub(crate) function: String, | |
| 523 | pub(crate) missing_target_features: DiagArgValue, | |
| 524 | pub(crate) missing_target_features_count: usize, | |
| 525 | #[note("the {$build_target_features} target {$build_target_features_count -> | |
| 526 | [1] feature | |
| 527 | *[count] features | |
| 528 | } being enabled in the build configuration does not remove the requirement to list {$build_target_features_count -> | |
| 529 | [1] it | |
| 530 | *[count] them | |
| 531 | } in `#[target_feature]`")] | |
| 532 | pub(crate) note: bool, | |
| 533 | pub(crate) build_target_features: DiagArgValue, | |
| 534 | pub(crate) build_target_features_count: usize, | |
| 535 | #[subdiagnostic] | |
| 536 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>, | |
| 537 | } | |
| 538 | ||
| 539 | #[derive(Diagnostic)] | |
| 540 | #[diag( | |
| 541 | "unsafe binder cast is unsafe and requires unsafe block information that may be required to uphold safety guarantees of a type", | |
| 542 | code = E0133, | |
| 543 | )] | |
| 544 | pub(crate) struct UnsafeBinderCastRequiresUnsafe { | |
| 545 | #[primary_span] | |
| 546 | #[label("unsafe binder cast")] | |
| 547 | pub(crate) span: Span, | |
| 548 | #[subdiagnostic] | |
| 549 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>, | |
| 550 | } | |
| 551 | ||
| 552 | #[derive(Diagnostic)] | |
| 553 | #[diag( | |
| 554 | "unsafe binder cast is unsafe and requires unsafe block or unsafe fn information that may be required to uphold safety guarantees of a type", | |
| 555 | code = E0133, | |
| 556 | )] | |
| 557 | pub(crate) struct UnsafeBinderCastRequiresUnsafeUnsafeOpInUnsafeFnAllowed { | |
| 558 | #[primary_span] | |
| 559 | #[label("unsafe binder cast")] | |
| 560 | pub(crate) span: Span, | |
| 561 | #[subdiagnostic] | |
| 562 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>, | |
| 563 | } | |
| 564 | ||
| 565 | #[derive(Diagnostic)] | |
| 566 | #[diag("call `{$function}` explicitly is unsafe and requires unsafe block", code = E0133)] | |
| 567 | pub(crate) struct CallDropExplicitlyRequiresUnsafe { | |
| 568 | #[primary_span] | |
| 569 | pub(crate) span: Span, | |
| 570 | pub(crate) function: String, | |
| 571 | #[subdiagnostic] | |
| 572 | pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>, | |
| 573 | } | |
| 574 | ||
| 575 | #[derive(Subdiagnostic)] | |
| 576 | #[label("items do not inherit unsafety from separate enclosing items")] | |
| 577 | pub(crate) struct UnsafeNotInheritedNote { | |
| 578 | #[primary_span] | |
| 579 | pub(crate) span: Span, | |
| 580 | } | |
| 581 | ||
| 582 | pub(crate) struct UnsafeNotInheritedLintNote { | |
| 583 | pub(crate) signature_span: Span, | |
| 584 | pub(crate) body_span: Span, | |
| 585 | } | |
| 586 | ||
| 587 | impl Subdiagnostic for UnsafeNotInheritedLintNote { | |
| 588 | fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) { | |
| 589 | diag.span_note( | |
| 590 | self.signature_span, | |
| 591 | msg!("an unsafe function restricts its caller, but its body is safe by default"), | |
| 592 | ); | |
| 593 | let body_start = self.body_span.shrink_to_lo(); | |
| 594 | let body_end = self.body_span.shrink_to_hi(); | |
| 595 | diag.tool_only_multipart_suggestion( | |
| 596 | msg!("consider wrapping the function body in an unsafe block"), | |
| 597 | vec![(body_start, "{ unsafe ".into()), (body_end, "}".into())], | |
| 598 | Applicability::MachineApplicable, | |
| 599 | ); | |
| 600 | } | |
| 601 | } | |
| 602 | ||
| 603 | #[derive(Diagnostic)] | |
| 604 | #[diag("unnecessary `unsafe` block")] | |
| 605 | pub(crate) struct UnusedUnsafe { | |
| 606 | #[label("unnecessary `unsafe` block")] | |
| 607 | pub(crate) span: Span, | |
| 608 | #[subdiagnostic] | |
| 609 | pub(crate) enclosing: Option<UnusedUnsafeEnclosing>, | |
| 610 | } | |
| 611 | ||
| 612 | #[derive(Subdiagnostic)] | |
| 613 | pub(crate) enum UnusedUnsafeEnclosing { | |
| 614 | #[label("because it's nested under this `unsafe` block")] | |
| 615 | Block { | |
| 616 | #[primary_span] | |
| 617 | span: Span, | |
| 618 | }, | |
| 619 | } | |
| 620 | ||
| 621 | pub(crate) struct NonExhaustivePatternsTypeNotEmpty<'a, 'tcx> { | |
| 622 | pub(crate) cx: &'a RustcPatCtxt<'a, 'tcx>, | |
| 623 | pub(crate) scrut_span: Span, | |
| 624 | pub(crate) braces_span: Option<Span>, | |
| 625 | pub(crate) ty: Ty<'tcx>, | |
| 626 | } | |
| 627 | ||
| 628 | impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for NonExhaustivePatternsTypeNotEmpty<'_, '_> { | |
| 629 | fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, G> { | |
| 630 | let mut diag = | |
| 631 | Diag::new(dcx, level, msg!("non-exhaustive patterns: type `{$ty}` is non-empty")); | |
| 632 | diag.span(self.scrut_span); | |
| 633 | diag.code(E0004); | |
| 634 | let peeled_ty = self.ty.peel_refs(); | |
| 635 | diag.arg("ty", self.ty); | |
| 636 | diag.arg("peeled_ty", peeled_ty); | |
| 637 | ||
| 638 | if let ty::Adt(def, _) = peeled_ty.kind() { | |
| 639 | let def_span = self | |
| 640 | .cx | |
| 641 | .tcx | |
| 642 | .hir_get_if_local(def.did()) | |
| 643 | .and_then(|node| node.ident()) | |
| 644 | .map(|ident| ident.span) | |
| 645 | .unwrap_or_else(|| self.cx.tcx.def_span(def.did())); | |
| 646 | ||
| 647 | // workaround to make test pass | |
| 648 | let mut span: MultiSpan = def_span.into(); | |
| 649 | span.push_span_label(def_span, ""); | |
| 650 | ||
| 651 | diag.span_note(span, msg!("`{$peeled_ty}` defined here")); | |
| 652 | } | |
| 653 | ||
| 654 | let is_non_exhaustive = matches!(self.ty.kind(), | |
| 655 | ty::Adt(def, _) if def.variant_list_has_applicable_non_exhaustive()); | |
| 656 | if is_non_exhaustive { | |
| 657 | diag.note(msg!( | |
| 658 | "the matched value is of type `{$ty}`, which is marked as non-exhaustive" | |
| 659 | )); | |
| 660 | } else { | |
| 661 | diag.note(msg!("the matched value is of type `{$ty}`")); | |
| 662 | } | |
| 663 | ||
| 664 | if let ty::Ref(_, sub_ty, _) = self.ty.kind() { | |
| 665 | if !sub_ty.is_inhabited_from(self.cx.tcx, self.cx.module, self.cx.typing_env) { | |
| 666 | diag.note(msg!("references are always considered inhabited")); | |
| 667 | } | |
| 668 | } | |
| 669 | ||
| 670 | let sm = self.cx.tcx.sess.source_map(); | |
| 671 | if let Some(braces_span) = self.braces_span { | |
| 672 | // Get the span for the empty match body `{}`. | |
| 673 | let (indentation, more) = if let Some(snippet) = sm.indentation_before(self.scrut_span) | |
| 674 | { | |
| 675 | (format!("\n{snippet}"), " ") | |
| 676 | } else { | |
| 677 | (" ".to_string(), "") | |
| 678 | }; | |
| 679 | diag.span_suggestion_verbose( | |
| 680 | braces_span, | |
| 681 | msg!("ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown"), | |
| 682 | format!(" {{{indentation}{more}_ => todo!(),{indentation}}}"), | |
| 683 | Applicability::HasPlaceholders, | |
| 684 | ); | |
| 685 | } else { | |
| 686 | diag.help(msg!( | |
| 687 | "ensure that all possible cases are being handled by adding a match arm with a wildcard pattern" | |
| 688 | )); | |
| 689 | } | |
| 690 | ||
| 691 | diag | |
| 692 | } | |
| 693 | } | |
| 694 | ||
| 695 | #[derive(Subdiagnostic)] | |
| 696 | #[note("match arms with guards don't count towards exhaustivity")] | |
| 697 | pub(crate) struct NonExhaustiveMatchAllArmsGuarded; | |
| 698 | ||
| 699 | #[derive(Diagnostic)] | |
| 700 | #[diag("statics cannot be referenced in patterns", code = E0158)] | |
| 701 | pub(crate) struct StaticInPattern { | |
| 702 | #[primary_span] | |
| 703 | #[label("can't be used in patterns")] | |
| 704 | pub(crate) span: Span, | |
| 705 | #[label("`static` defined here")] | |
| 706 | pub(crate) static_span: Span, | |
| 707 | } | |
| 708 | ||
| 709 | #[derive(Diagnostic)] | |
| 710 | #[diag("constant parameters cannot be referenced in patterns", code = E0158)] | |
| 711 | pub(crate) struct ConstParamInPattern { | |
| 712 | #[primary_span] | |
| 713 | #[label("can't be used in patterns")] | |
| 714 | pub(crate) span: Span, | |
| 715 | #[label("constant defined here")] | |
| 716 | pub(crate) const_span: Span, | |
| 717 | } | |
| 718 | ||
| 719 | #[derive(Diagnostic)] | |
| 720 | #[diag("runtime values cannot be referenced in patterns", code = E0080)] | |
| 721 | pub(crate) struct NonConstPath { | |
| 722 | #[primary_span] | |
| 723 | #[label("references a runtime value")] | |
| 724 | pub(crate) span: Span, | |
| 725 | } | |
| 726 | ||
| 727 | pub(crate) struct UnreachablePattern<'tcx> { | |
| 728 | pub(crate) covered_by_many_n_more_count: Option<usize>, | |
| 729 | pub(crate) inner: UnreachablePatternInner<'tcx>, | |
| 730 | } | |
| 731 | ||
| 732 | impl<'a, 'tcx, G: EmissionGuarantee> Diagnostic<'a, G> for UnreachablePattern<'tcx> { | |
| 733 | #[track_caller] | |
| 734 | fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, G> { | |
| 735 | let mut diag = self.inner.into_diag(dcx, level); | |
| 736 | if let Some(covered_by_many_n_more_count) = self.covered_by_many_n_more_count { | |
| 737 | diag.arg("covered_by_many_n_more_count", covered_by_many_n_more_count); | |
| 738 | } | |
| 739 | diag | |
| 740 | } | |
| 741 | } | |
| 742 | ||
| 743 | #[derive(Diagnostic)] | |
| 744 | #[diag("unreachable pattern")] | |
| 745 | pub(crate) struct UnreachablePatternInner<'tcx> { | |
| 746 | #[label("no value can reach this")] | |
| 747 | pub(crate) span: Option<Span>, | |
| 748 | #[label("matches no values because `{$matches_no_values_ty}` is uninhabited")] | |
| 749 | pub(crate) matches_no_values: Option<Span>, | |
| 750 | pub(crate) matches_no_values_ty: Ty<'tcx>, | |
| 751 | #[note( | |
| 752 | "to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types" | |
| 753 | )] | |
| 754 | pub(crate) uninhabited_note: Option<()>, | |
| 755 | #[label("matches any value")] | |
| 756 | pub(crate) covered_by_catchall: Option<Span>, | |
| 757 | #[subdiagnostic] | |
| 758 | pub(crate) wanted_constant: Option<WantedConstant>, | |
| 759 | #[note( | |
| 760 | "there is a constant of the same name imported in another scope, which could have been used to pattern match against its value instead of introducing a new catch-all binding, but it needs to be imported in the pattern's scope" | |
| 761 | )] | |
| 762 | pub(crate) accessible_constant: Option<Span>, | |
| 763 | #[note( | |
| 764 | "there is a constant of the same name, which could have been used to pattern match against its value instead of introducing a new catch-all binding, but it is not accessible from this scope" | |
| 765 | )] | |
| 766 | pub(crate) inaccessible_constant: Option<Span>, | |
| 767 | #[note( | |
| 768 | "there is a binding of the same name; if you meant to pattern match against the value of that binding, that is a feature of constants that is not available for `let` bindings" | |
| 769 | )] | |
| 770 | pub(crate) pattern_let_binding: Option<Span>, | |
| 771 | #[label("matches all the relevant values")] | |
| 772 | pub(crate) covered_by_one: Option<Span>, | |
| 773 | #[note("multiple earlier patterns match some of the same values")] | |
| 774 | pub(crate) covered_by_many: Option<MultiSpan>, | |
| 775 | #[suggestion("remove the match arm", code = "", applicability = "machine-applicable")] | |
| 776 | pub(crate) suggest_remove: Option<Span>, | |
| 777 | } | |
| 778 | ||
| 779 | #[derive(Subdiagnostic)] | |
| 780 | #[suggestion( | |
| 781 | "you might have meant to pattern match against the value of {$is_typo -> | |
| 782 | [true] similarly named constant | |
| 783 | *[false] constant | |
| 784 | } `{$const_name}` instead of introducing a new catch-all binding", | |
| 785 | code = "{const_path}", | |
| 786 | applicability = "machine-applicable" | |
| 787 | )] | |
| 788 | pub(crate) struct WantedConstant { | |
| 789 | #[primary_span] | |
| 790 | pub(crate) span: Span, | |
| 791 | pub(crate) is_typo: bool, | |
| 792 | pub(crate) const_name: String, | |
| 793 | pub(crate) const_path: String, | |
| 794 | } | |
| 795 | ||
| 796 | #[derive(Diagnostic)] | |
| 797 | #[diag("unreachable {$descr}")] | |
| 798 | pub(crate) struct UnreachableDueToUninhabited<'desc, 'tcx> { | |
| 799 | pub descr: &'desc str, | |
| 800 | #[label("unreachable {$descr}")] | |
| 801 | pub expr: Span, | |
| 802 | #[label("any code following this expression is unreachable")] | |
| 803 | #[note("this expression has type `{$ty}`, which is uninhabited")] | |
| 804 | pub orig: Span, | |
| 805 | pub ty: Ty<'tcx>, | |
| 806 | } | |
| 807 | ||
| 808 | #[derive(Diagnostic)] | |
| 809 | #[diag("constant pattern cannot depend on generic parameters", code = E0158)] | |
| 810 | pub(crate) struct ConstPatternDependsOnGenericParameter { | |
| 811 | #[primary_span] | |
| 812 | #[label("`const` depends on a generic parameter")] | |
| 813 | pub(crate) span: Span, | |
| 814 | } | |
| 815 | ||
| 816 | #[derive(Diagnostic)] | |
| 817 | #[diag("could not evaluate constant pattern")] | |
| 818 | pub(crate) struct CouldNotEvalConstPattern { | |
| 819 | #[primary_span] | |
| 820 | #[label("could not evaluate constant")] | |
| 821 | pub(crate) span: Span, | |
| 822 | } | |
| 823 | ||
| 824 | #[derive(Diagnostic)] | |
| 825 | #[diag("lower bound for range pattern must be less than or equal to upper bound", code = E0030)] | |
| 826 | pub(crate) struct LowerRangeBoundMustBeLessThanOrEqualToUpper { | |
| 827 | #[primary_span] | |
| 828 | #[label("lower bound larger than upper bound")] | |
| 829 | pub(crate) span: Span, | |
| 830 | #[note( | |
| 831 | "when matching against a range, the compiler verifies that the range is non-empty. Range patterns include both end-points, so this is equivalent to requiring the start of the range to be less than or equal to the end of the range" | |
| 832 | )] | |
| 833 | pub(crate) teach: bool, | |
| 834 | } | |
| 835 | ||
| 836 | #[derive(Diagnostic)] | |
| 837 | #[diag("literal out of range for `{$ty}`")] | |
| 838 | pub(crate) struct LiteralOutOfRange<'tcx> { | |
| 839 | #[primary_span] | |
| 840 | #[label("this value does not fit into the type `{$ty}` whose range is `{$min}..={$max}`")] | |
| 841 | pub(crate) span: Span, | |
| 842 | pub(crate) ty: Ty<'tcx>, | |
| 843 | pub(crate) min: i128, | |
| 844 | pub(crate) max: u128, | |
| 845 | } | |
| 846 | ||
| 847 | #[derive(Diagnostic)] | |
| 848 | #[diag("lower bound for range pattern must be less than upper bound", code = E0579)] | |
| 849 | pub(crate) struct LowerRangeBoundMustBeLessThanUpper { | |
| 850 | #[primary_span] | |
| 851 | pub(crate) span: Span, | |
| 852 | } | |
| 853 | ||
| 854 | #[derive(Diagnostic)] | |
| 855 | #[diag("exclusive upper bound for a range bound cannot be the minimum", code = E0579)] | |
| 856 | pub(crate) struct UpperRangeBoundCannotBeMin { | |
| 857 | #[primary_span] | |
| 858 | pub(crate) span: Span, | |
| 859 | } | |
| 860 | ||
| 861 | #[derive(Diagnostic)] | |
| 862 | #[diag("pattern binding `{$name}` is named the same as one of the variants of the type `{$ty_path}`", code = E0170)] | |
| 863 | pub(crate) struct BindingsWithVariantName { | |
| 864 | #[suggestion( | |
| 865 | "to match on the variant, qualify the path", | |
| 866 | code = "{ty_path}::{name}", | |
| 867 | applicability = "machine-applicable" | |
| 868 | )] | |
| 869 | pub(crate) suggestion: Option<Span>, | |
| 870 | pub(crate) ty_path: String, | |
| 871 | pub(crate) name: Ident, | |
| 872 | } | |
| 873 | ||
| 874 | #[derive(Diagnostic)] | |
| 875 | #[diag( | |
| 876 | "irrefutable `if let` {$count -> | |
| 877 | [one] pattern | |
| 878 | *[other] patterns | |
| 879 | }" | |
| 880 | )] | |
| 881 | #[note( | |
| 882 | "{$count -> | |
| 883 | [one] this pattern | |
| 884 | *[other] these patterns | |
| 885 | } will always match, so the `if let` is useless" | |
| 886 | )] | |
| 887 | #[help("consider replacing the `if let` with a `let`")] | |
| 888 | pub(crate) struct IrrefutableLetPatternsIfLet { | |
| 889 | pub(crate) count: usize, | |
| 890 | } | |
| 891 | ||
| 892 | #[derive(Diagnostic)] | |
| 893 | #[diag( | |
| 894 | "irrefutable `if let` guard {$count -> | |
| 895 | [one] pattern | |
| 896 | *[other] patterns | |
| 897 | }" | |
| 898 | )] | |
| 899 | #[note( | |
| 900 | "{$count -> | |
| 901 | [one] this pattern | |
| 902 | *[other] these patterns | |
| 903 | } will always match, so the guard is useless" | |
| 904 | )] | |
| 905 | #[help("consider removing the guard and adding a `let` inside the match arm")] | |
| 906 | pub(crate) struct IrrefutableLetPatternsIfLetGuard { | |
| 907 | pub(crate) count: usize, | |
| 908 | } | |
| 909 | ||
| 910 | #[derive(Diagnostic)] | |
| 911 | #[diag("unreachable `else` clause")] | |
| 912 | #[note("this pattern always matches, so the else clause is unreachable")] | |
| 913 | pub(crate) struct IrrefutableLetPatternsLetElse { | |
| 914 | #[subdiagnostic] | |
| 915 | pub(crate) be_replaced: Option<LetElseReplacementSuggestion>, | |
| 916 | } | |
| 917 | ||
| 918 | #[derive(Subdiagnostic, Debug)] | |
| 919 | #[suggestion( | |
| 920 | "consider using `let {$lhs} = {$rhs}` to match on a specific variant", | |
| 921 | code = "let {lhs} = {rhs}", | |
| 922 | applicability = "machine-applicable" | |
| 923 | )] | |
| 924 | pub(crate) struct LetElseReplacementSuggestion { | |
| 925 | #[primary_span] | |
| 926 | pub(crate) span: Span, | |
| 927 | pub(crate) lhs: String, | |
| 928 | pub(crate) rhs: String, | |
| 929 | } | |
| 930 | ||
| 931 | #[derive(Diagnostic)] | |
| 932 | #[diag( | |
| 933 | "irrefutable `while let` {$count -> | |
| 934 | [one] pattern | |
| 935 | *[other] patterns | |
| 936 | }" | |
| 937 | )] | |
| 938 | #[note( | |
| 939 | "{$count -> | |
| 940 | [one] this pattern | |
| 941 | *[other] these patterns | |
| 942 | } will always match, so the loop will never exit" | |
| 943 | )] | |
| 944 | #[help("consider instead using a `loop {\"{\"} ... {\"}\"}` with a `let` inside it")] | |
| 945 | pub(crate) struct IrrefutableLetPatternsWhileLet { | |
| 946 | pub(crate) count: usize, | |
| 947 | } | |
| 948 | ||
| 949 | #[derive(Diagnostic)] | |
| 950 | #[diag("borrow of moved value")] | |
| 951 | pub(crate) struct BorrowOfMovedValue<'tcx> { | |
| 952 | #[primary_span] | |
| 953 | #[label("value moved into `{$name}` here")] | |
| 954 | #[label( | |
| 955 | "move occurs because `{$name}` has type `{$ty}`, which does not implement the `Copy` trait" | |
| 956 | )] | |
| 957 | pub(crate) binding_span: Span, | |
| 958 | #[label("value borrowed here after move")] | |
| 959 | pub(crate) conflicts_ref: Vec<Span>, | |
| 960 | pub(crate) name: Ident, | |
| 961 | pub(crate) ty: Ty<'tcx>, | |
| 962 | #[suggestion( | |
| 963 | "borrow this binding in the pattern to avoid moving the value", | |
| 964 | code = "ref ", | |
| 965 | applicability = "machine-applicable" | |
| 966 | )] | |
| 967 | pub(crate) suggest_borrowing: Option<Span>, | |
| 968 | } | |
| 969 | ||
| 970 | #[derive(Diagnostic)] | |
| 971 | #[diag("cannot borrow value as mutable more than once at a time")] | |
| 972 | pub(crate) struct MultipleMutBorrows { | |
| 973 | #[primary_span] | |
| 974 | pub(crate) span: Span, | |
| 975 | #[subdiagnostic] | |
| 976 | pub(crate) occurrences: Vec<Conflict>, | |
| 977 | } | |
| 978 | ||
| 979 | #[derive(Diagnostic)] | |
| 980 | #[diag("cannot borrow value as mutable because it is also borrowed as immutable")] | |
| 981 | pub(crate) struct AlreadyBorrowed { | |
| 982 | #[primary_span] | |
| 983 | pub(crate) span: Span, | |
| 984 | #[subdiagnostic] | |
| 985 | pub(crate) occurrences: Vec<Conflict>, | |
| 986 | } | |
| 987 | ||
| 988 | #[derive(Diagnostic)] | |
| 989 | #[diag("cannot borrow value as immutable because it is also borrowed as mutable")] | |
| 990 | pub(crate) struct AlreadyMutBorrowed { | |
| 991 | #[primary_span] | |
| 992 | pub(crate) span: Span, | |
| 993 | #[subdiagnostic] | |
| 994 | pub(crate) occurrences: Vec<Conflict>, | |
| 995 | } | |
| 996 | ||
| 997 | #[derive(Diagnostic)] | |
| 998 | #[diag("cannot move out of value because it is borrowed")] | |
| 999 | pub(crate) struct MovedWhileBorrowed { | |
| 1000 | #[primary_span] | |
| 1001 | pub(crate) span: Span, | |
| 1002 | #[subdiagnostic] | |
| 1003 | pub(crate) occurrences: Vec<Conflict>, | |
| 1004 | } | |
| 1005 | ||
| 1006 | #[derive(Subdiagnostic)] | |
| 1007 | pub(crate) enum Conflict { | |
| 1008 | #[label("value is mutably borrowed by `{$name}` here")] | |
| 1009 | Mut { | |
| 1010 | #[primary_span] | |
| 1011 | span: Span, | |
| 1012 | name: Symbol, | |
| 1013 | }, | |
| 1014 | #[label("value is borrowed by `{$name}` here")] | |
| 1015 | Ref { | |
| 1016 | #[primary_span] | |
| 1017 | span: Span, | |
| 1018 | name: Symbol, | |
| 1019 | }, | |
| 1020 | #[label("value is moved into `{$name}` here")] | |
| 1021 | Moved { | |
| 1022 | #[primary_span] | |
| 1023 | span: Span, | |
| 1024 | name: Symbol, | |
| 1025 | }, | |
| 1026 | } | |
| 1027 | ||
| 1028 | #[derive(Diagnostic)] | |
| 1029 | #[diag("cannot use unions in constant patterns")] | |
| 1030 | pub(crate) struct UnionPattern { | |
| 1031 | #[primary_span] | |
| 1032 | #[label("can't use a `union` here")] | |
| 1033 | pub(crate) span: Span, | |
| 1034 | } | |
| 1035 | ||
| 1036 | #[derive(Diagnostic)] | |
| 1037 | #[diag("constant of non-structural type `{$ty}` in a pattern")] | |
| 1038 | pub(crate) struct TypeNotStructural<'tcx> { | |
| 1039 | #[primary_span] | |
| 1040 | #[label("constant of non-structural type")] | |
| 1041 | pub(crate) span: Span, | |
| 1042 | #[label( | |
| 1043 | "{$is_local -> | |
| 1044 | *[true] `{$ty}` must be annotated with `#[derive(PartialEq)]` to be usable in patterns | |
| 1045 | [false] `{$ty}` is not usable in patterns | |
| 1046 | }" | |
| 1047 | )] | |
| 1048 | pub(crate) ty_def_span: Span, | |
| 1049 | pub(crate) ty: Ty<'tcx>, | |
| 1050 | #[note( | |
| 1051 | "the `PartialEq` trait must be derived, manual `impl`s are not sufficient; see \ | |
| 1052 | https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details" | |
| 1053 | )] | |
| 1054 | pub(crate) manual_partialeq_impl_span: Option<Span>, | |
| 1055 | #[note( | |
| 1056 | "see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details" | |
| 1057 | )] | |
| 1058 | pub(crate) manual_partialeq_impl_note: bool, | |
| 1059 | #[subdiagnostic] | |
| 1060 | pub(crate) suggestion: Option<SuggestEq<'tcx>>, | |
| 1061 | pub(crate) is_local: bool, | |
| 1062 | } | |
| 1063 | ||
| 1064 | #[derive(Subdiagnostic)] | |
| 1065 | pub(crate) enum SuggestEq<'tcx> { | |
| 1066 | #[multipart_suggestion( | |
| 1067 | "{$manual_partialeq_impl -> | |
| 1068 | [false] if `{$ty}` manually implemented `PartialEq`, you could add | |
| 1069 | *[true] add | |
| 1070 | } a condition to the match arm checking for equality", | |
| 1071 | applicability = "maybe-incorrect", | |
| 1072 | style = "verbose" | |
| 1073 | )] | |
| 1074 | AddIf { | |
| 1075 | #[suggestion_part(code = "binding")] | |
| 1076 | pat_span: Span, | |
| 1077 | #[suggestion_part(code = " if binding == {name}")] | |
| 1078 | if_span: Span, | |
| 1079 | name: String, | |
| 1080 | ty: Ty<'tcx>, | |
| 1081 | manual_partialeq_impl: bool, | |
| 1082 | }, | |
| 1083 | #[multipart_suggestion( | |
| 1084 | "{$manual_partialeq_impl -> | |
| 1085 | [false] if `{$ty}` manually implemented `PartialEq`, you could add | |
| 1086 | *[true] add | |
| 1087 | } a check for equality to the condition of the match arm", | |
| 1088 | applicability = "maybe-incorrect", | |
| 1089 | style = "verbose" | |
| 1090 | )] | |
| 1091 | AddToIf { | |
| 1092 | #[suggestion_part(code = "binding")] | |
| 1093 | pat_span: Span, | |
| 1094 | #[suggestion_part(code = " && binding == {name}")] | |
| 1095 | span: Span, | |
| 1096 | name: String, | |
| 1097 | ty: Ty<'tcx>, | |
| 1098 | manual_partialeq_impl: bool, | |
| 1099 | }, | |
| 1100 | #[multipart_suggestion( | |
| 1101 | "{$manual_partialeq_impl -> | |
| 1102 | [false] if `{$ty}` manually implemented `PartialEq`, you could check | |
| 1103 | *[true] check | |
| 1104 | } for equality instead of pattern matching", | |
| 1105 | applicability = "maybe-incorrect", | |
| 1106 | style = "verbose" | |
| 1107 | )] | |
| 1108 | AddToLetChain { | |
| 1109 | #[suggestion_part(code = "binding")] | |
| 1110 | pat_span: Span, | |
| 1111 | #[suggestion_part(code = " && binding == {name}")] | |
| 1112 | span: Span, | |
| 1113 | name: String, | |
| 1114 | ty: Ty<'tcx>, | |
| 1115 | manual_partialeq_impl: bool, | |
| 1116 | }, | |
| 1117 | #[multipart_suggestion( | |
| 1118 | "{$manual_partialeq_impl -> | |
| 1119 | [false] if `{$ty}` manually implemented `PartialEq`, you could check | |
| 1120 | *[true] check | |
| 1121 | } for equality instead of pattern matching", | |
| 1122 | applicability = "maybe-incorrect", | |
| 1123 | style = "verbose" | |
| 1124 | )] | |
| 1125 | ReplaceWithEq { | |
| 1126 | #[suggestion_part(code = "")] | |
| 1127 | removal: Span, | |
| 1128 | #[suggestion_part(code = " == ")] | |
| 1129 | eq: Span, | |
| 1130 | ty: Ty<'tcx>, | |
| 1131 | manual_partialeq_impl: bool, | |
| 1132 | }, | |
| 1133 | #[multipart_suggestion( | |
| 1134 | "{$manual_partialeq_impl -> | |
| 1135 | [false] if `{$ty}` manually implemented `PartialEq`, you could check | |
| 1136 | *[true] check | |
| 1137 | } for equality instead of pattern matching", | |
| 1138 | applicability = "maybe-incorrect", | |
| 1139 | style = "verbose" | |
| 1140 | )] | |
| 1141 | ReplaceLetElseWithIf { | |
| 1142 | #[suggestion_part(code = "if ")] | |
| 1143 | if_span: Span, | |
| 1144 | #[suggestion_part(code = " == ")] | |
| 1145 | eq: Span, | |
| 1146 | #[suggestion_part(code = " ")] | |
| 1147 | else_span: Span, | |
| 1148 | ty: Ty<'tcx>, | |
| 1149 | manual_partialeq_impl: bool, | |
| 1150 | }, | |
| 1151 | } | |
| 1152 | ||
| 1153 | #[derive(Diagnostic)] | |
| 1154 | #[diag("constant of non-structural type `{$ty}` in a pattern")] | |
| 1155 | #[note( | |
| 1156 | "see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details" | |
| 1157 | )] | |
| 1158 | pub(crate) struct TypeNotPartialEq<'tcx> { | |
| 1159 | #[primary_span] | |
| 1160 | #[label("constant of non-structural type")] | |
| 1161 | pub(crate) span: Span, | |
| 1162 | pub(crate) ty: Ty<'tcx>, | |
| 1163 | } | |
| 1164 | ||
| 1165 | #[derive(Diagnostic)] | |
| 1166 | #[diag("{$prefix} `{$non_sm_ty}` cannot be used in patterns")] | |
| 1167 | pub(crate) struct InvalidPattern<'tcx> { | |
| 1168 | #[primary_span] | |
| 1169 | #[label("{$prefix} can't be used in patterns")] | |
| 1170 | pub(crate) span: Span, | |
| 1171 | pub(crate) non_sm_ty: Ty<'tcx>, | |
| 1172 | pub(crate) prefix: String, | |
| 1173 | } | |
| 1174 | ||
| 1175 | #[derive(Diagnostic)] | |
| 1176 | #[diag("cannot use unsized non-slice type `{$non_sm_ty}` in constant patterns")] | |
| 1177 | pub(crate) struct UnsizedPattern<'tcx> { | |
| 1178 | #[primary_span] | |
| 1179 | pub(crate) span: Span, | |
| 1180 | pub(crate) non_sm_ty: Ty<'tcx>, | |
| 1181 | } | |
| 1182 | ||
| 1183 | #[derive(Diagnostic)] | |
| 1184 | #[diag("cannot use NaN in patterns")] | |
| 1185 | #[note("NaNs compare inequal to everything, even themselves, so this pattern would never match")] | |
| 1186 | #[help("try using the `is_nan` method instead")] | |
| 1187 | pub(crate) struct NaNPattern { | |
| 1188 | #[primary_span] | |
| 1189 | #[label("evaluates to `NaN`, which is not allowed in patterns")] | |
| 1190 | pub(crate) span: Span, | |
| 1191 | } | |
| 1192 | ||
| 1193 | #[derive(Diagnostic)] | |
| 1194 | #[diag( | |
| 1195 | "function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon" | |
| 1196 | )] | |
| 1197 | #[note("see https://github.com/rust-lang/rust/issues/70861 for details")] | |
| 1198 | pub(crate) struct PointerPattern { | |
| 1199 | #[primary_span] | |
| 1200 | #[label("can't be used in patterns")] | |
| 1201 | pub(crate) span: Span, | |
| 1202 | } | |
| 1203 | ||
| 1204 | #[derive(Diagnostic)] | |
| 1205 | #[diag("mismatched types")] | |
| 1206 | #[note("the matched value is of type `{$ty}`")] | |
| 1207 | pub(crate) struct NonEmptyNeverPattern<'tcx> { | |
| 1208 | #[primary_span] | |
| 1209 | #[label("a never pattern must be used on an uninhabited type")] | |
| 1210 | pub(crate) span: Span, | |
| 1211 | pub(crate) ty: Ty<'tcx>, | |
| 1212 | } | |
| 1213 | ||
| 1214 | #[derive(Diagnostic)] | |
| 1215 | #[diag("refutable pattern in {$origin}", code = E0005)] | |
| 1216 | pub(crate) struct PatternNotCovered<'s, 'tcx> { | |
| 1217 | #[primary_span] | |
| 1218 | pub(crate) span: Span, | |
| 1219 | pub(crate) origin: &'s str, | |
| 1220 | #[subdiagnostic] | |
| 1221 | pub(crate) uncovered: Uncovered, | |
| 1222 | #[subdiagnostic] | |
| 1223 | pub(crate) inform: Option<Inform>, | |
| 1224 | #[subdiagnostic] | |
| 1225 | pub(crate) interpreted_as_const: Option<InterpretedAsConst>, | |
| 1226 | #[subdiagnostic] | |
| 1227 | pub(crate) interpreted_as_const_sugg: Option<InterpretedAsConstSugg>, | |
| 1228 | #[subdiagnostic] | |
| 1229 | pub(crate) adt_defined_here: Option<AdtDefinedHere<'tcx>>, | |
| 1230 | #[note( | |
| 1231 | "pattern `{$witness_1}` is currently uninhabited, but this variant contains private fields which may become inhabited in the future" | |
| 1232 | )] | |
| 1233 | pub(crate) witness_1_is_privately_uninhabited: bool, | |
| 1234 | pub(crate) witness_1: String, | |
| 1235 | #[note("the matched value is of type `{$pattern_ty}`")] | |
| 1236 | pub(crate) _p: (), | |
| 1237 | pub(crate) pattern_ty: Ty<'tcx>, | |
| 1238 | #[subdiagnostic] | |
| 1239 | pub(crate) let_suggestion: Option<SuggestLet>, | |
| 1240 | #[subdiagnostic] | |
| 1241 | pub(crate) misc_suggestion: Option<MiscPatternSuggestion>, | |
| 1242 | } | |
| 1243 | ||
| 1244 | #[derive(Subdiagnostic, Debug)] | |
| 1245 | #[note( | |
| 1246 | "{$descr} require an \"irrefutable pattern\", like a `struct` or an `enum` with only one variant" | |
| 1247 | )] | |
| 1248 | #[note("for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html")] | |
| 1249 | pub(crate) struct Inform { | |
| 1250 | pub(crate) descr: &'static str, | |
| 1251 | } | |
| 1252 | ||
| 1253 | #[derive(Subdiagnostic)] | |
| 1254 | #[label( | |
| 1255 | "missing patterns are not covered because `{$variable}` is interpreted as a constant pattern, not a new variable" | |
| 1256 | )] | |
| 1257 | pub(crate) struct InterpretedAsConst { | |
| 1258 | #[primary_span] | |
| 1259 | pub(crate) span: Span, | |
| 1260 | pub(crate) variable: String, | |
| 1261 | } | |
| 1262 | ||
| 1263 | pub(crate) struct AdtDefinedHere<'tcx> { | |
| 1264 | pub(crate) adt_def_span: Span, | |
| 1265 | pub(crate) ty: Ty<'tcx>, | |
| 1266 | pub(crate) variants: Vec<Variant>, | |
| 1267 | } | |
| 1268 | ||
| 1269 | pub(crate) struct Variant { | |
| 1270 | pub(crate) span: Span, | |
| 1271 | } | |
| 1272 | ||
| 1273 | impl<'tcx> Subdiagnostic for AdtDefinedHere<'tcx> { | |
| 1274 | fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) { | |
| 1275 | diag.arg("ty", self.ty); | |
| 1276 | let mut spans = MultiSpan::from(self.adt_def_span); | |
| 1277 | ||
| 1278 | for Variant { span } in self.variants { | |
| 1279 | spans.push_span_label(span, msg!("not covered")); | |
| 1280 | } | |
| 1281 | ||
| 1282 | diag.span_note(spans, msg!("`{$ty}` defined here")); | |
| 1283 | } | |
| 1284 | } | |
| 1285 | ||
| 1286 | #[derive(Subdiagnostic)] | |
| 1287 | #[suggestion( | |
| 1288 | "introduce a variable instead", | |
| 1289 | code = "{variable}_var", | |
| 1290 | applicability = "maybe-incorrect", | |
| 1291 | style = "verbose" | |
| 1292 | )] | |
| 1293 | pub(crate) struct InterpretedAsConstSugg { | |
| 1294 | #[primary_span] | |
| 1295 | pub(crate) span: Span, | |
| 1296 | pub(crate) variable: String, | |
| 1297 | } | |
| 1298 | ||
| 1299 | #[derive(Subdiagnostic)] | |
| 1300 | pub(crate) enum SuggestLet { | |
| 1301 | #[multipart_suggestion( | |
| 1302 | "you might want to use `if let` to ignore the {$count -> | |
| 1303 | [one] variant that isn't | |
| 1304 | *[other] variants that aren't | |
| 1305 | } matched", | |
| 1306 | applicability = "has-placeholders" | |
| 1307 | )] | |
| 1308 | If { | |
| 1309 | #[suggestion_part(code = "if ")] | |
| 1310 | start_span: Span, | |
| 1311 | #[suggestion_part(code = " {{ todo!() }}")] | |
| 1312 | semi_span: Span, | |
| 1313 | count: usize, | |
| 1314 | }, | |
| 1315 | #[suggestion( | |
| 1316 | "you might want to use `let...else` to handle the {$count -> | |
| 1317 | [one] variant that isn't | |
| 1318 | *[other] variants that aren't | |
| 1319 | } matched", | |
| 1320 | code = " else {{ todo!() }}", | |
| 1321 | applicability = "has-placeholders" | |
| 1322 | )] | |
| 1323 | Else { | |
| 1324 | #[primary_span] | |
| 1325 | end_span: Span, | |
| 1326 | count: usize, | |
| 1327 | }, | |
| 1328 | } | |
| 1329 | ||
| 1330 | #[derive(Subdiagnostic)] | |
| 1331 | pub(crate) enum MiscPatternSuggestion { | |
| 1332 | #[suggestion( | |
| 1333 | "alternatively, you could prepend the pattern with an underscore to define a new named variable; identifiers cannot begin with digits", | |
| 1334 | code = "_", | |
| 1335 | applicability = "maybe-incorrect" | |
| 1336 | )] | |
| 1337 | AttemptedIntegerLiteral { | |
| 1338 | #[primary_span] | |
| 1339 | start_span: Span, | |
| 1340 | }, | |
| 1341 | } | |
| 1342 | ||
| 1343 | #[derive(Diagnostic)] | |
| 1344 | #[diag("invalid update of the `#[loop_match]` state")] | |
| 1345 | pub(crate) struct LoopMatchInvalidUpdate { | |
| 1346 | #[primary_span] | |
| 1347 | pub lhs: Span, | |
| 1348 | #[label("the assignment must update this variable")] | |
| 1349 | pub scrutinee: Span, | |
| 1350 | } | |
| 1351 | ||
| 1352 | #[derive(Diagnostic)] | |
| 1353 | #[diag("invalid match on `#[loop_match]` state")] | |
| 1354 | #[note("a local variable must be the scrutinee within a `#[loop_match]`")] | |
| 1355 | pub(crate) struct LoopMatchInvalidMatch { | |
| 1356 | #[primary_span] | |
| 1357 | pub span: Span, | |
| 1358 | } | |
| 1359 | ||
| 1360 | #[derive(Diagnostic)] | |
| 1361 | #[diag("this `#[loop_match]` state value has type `{$ty}`, which is not supported")] | |
| 1362 | #[note("only integers, floats, bool, char, and enums without fields are supported")] | |
| 1363 | pub(crate) struct LoopMatchUnsupportedType<'tcx> { | |
| 1364 | #[primary_span] | |
| 1365 | pub span: Span, | |
| 1366 | pub ty: Ty<'tcx>, | |
| 1367 | } | |
| 1368 | ||
| 1369 | #[derive(Diagnostic)] | |
| 1370 | #[diag("statements are not allowed in this position within a `#[loop_match]`")] | |
| 1371 | pub(crate) struct LoopMatchBadStatements { | |
| 1372 | #[primary_span] | |
| 1373 | pub span: Span, | |
| 1374 | } | |
| 1375 | ||
| 1376 | #[derive(Diagnostic)] | |
| 1377 | #[diag("this expression must be a single `match` wrapped in a labeled block")] | |
| 1378 | pub(crate) struct LoopMatchBadRhs { | |
| 1379 | #[primary_span] | |
| 1380 | pub span: Span, | |
| 1381 | } | |
| 1382 | ||
| 1383 | #[derive(Diagnostic)] | |
| 1384 | #[diag("expected a single assignment expression")] | |
| 1385 | pub(crate) struct LoopMatchMissingAssignment { | |
| 1386 | #[primary_span] | |
| 1387 | pub span: Span, | |
| 1388 | } | |
| 1389 | ||
| 1390 | #[derive(Diagnostic)] | |
| 1391 | #[diag("match arms that are part of a `#[loop_match]` cannot have guards")] | |
| 1392 | pub(crate) struct LoopMatchArmWithGuard { | |
| 1393 | #[primary_span] | |
| 1394 | pub span: Span, | |
| 1395 | } | |
| 1396 | ||
| 1397 | #[derive(Diagnostic)] | |
| 1398 | #[diag("could not determine the target branch for this `#[const_continue]`")] | |
| 1399 | #[help("try extracting the expression into a `const` item")] | |
| 1400 | pub(crate) struct ConstContinueNotMonomorphicConst { | |
| 1401 | #[primary_span] | |
| 1402 | pub span: Span, | |
| 1403 | ||
| 1404 | #[subdiagnostic] | |
| 1405 | pub reason: ConstContinueNotMonomorphicConstReason, | |
| 1406 | } | |
| 1407 | ||
| 1408 | #[derive(Subdiagnostic)] | |
| 1409 | pub(crate) enum ConstContinueNotMonomorphicConstReason { | |
| 1410 | #[label("constant parameters may use generics, and are not evaluated early enough")] | |
| 1411 | ConstantParameter { | |
| 1412 | #[primary_span] | |
| 1413 | span: Span, | |
| 1414 | }, | |
| 1415 | ||
| 1416 | #[label("`const` blocks may use generics, and are not evaluated early enough")] | |
| 1417 | ConstBlock { | |
| 1418 | #[primary_span] | |
| 1419 | span: Span, | |
| 1420 | }, | |
| 1421 | ||
| 1422 | #[label("this value must be a literal or a monomorphic const")] | |
| 1423 | Other { | |
| 1424 | #[primary_span] | |
| 1425 | span: Span, | |
| 1426 | }, | |
| 1427 | } | |
| 1428 | ||
| 1429 | #[derive(Diagnostic)] | |
| 1430 | #[diag("could not determine the target branch for this `#[const_continue]`")] | |
| 1431 | pub(crate) struct ConstContinueBadConst { | |
| 1432 | #[primary_span] | |
| 1433 | #[label("this value is too generic")] | |
| 1434 | pub span: Span, | |
| 1435 | } | |
| 1436 | ||
| 1437 | #[derive(Diagnostic)] | |
| 1438 | #[diag("a `#[const_continue]` must break to a label with a value")] | |
| 1439 | pub(crate) struct ConstContinueMissingLabelOrValue { | |
| 1440 | #[primary_span] | |
| 1441 | pub span: Span, | |
| 1442 | } | |
| 1443 | ||
| 1444 | #[derive(Diagnostic)] | |
| 1445 | #[diag("the target of this `#[const_continue]` is not statically known")] | |
| 1446 | pub(crate) struct ConstContinueUnknownJumpTarget { | |
| 1447 | #[primary_span] | |
| 1448 | pub span: Span, | |
| 1449 | } |
compiler/rustc_mir_build/src/lib.rs+1-1| ... | ... | @@ -11,7 +11,7 @@ |
| 11 | 11 | mod builder; |
| 12 | 12 | mod check_tail_calls; |
| 13 | 13 | mod check_unsafety; |
| 14 | mod errors; | |
| 14 | mod diagnostics; | |
| 15 | 15 | pub mod thir; |
| 16 | 16 | |
| 17 | 17 | use rustc_middle::util::Providers; |
compiler/rustc_mir_build/src/thir/cx/expr.rs+1-1| ... | ... | @@ -22,7 +22,7 @@ use rustc_middle::{bug, span_bug}; |
| 22 | 22 | use rustc_span::Span; |
| 23 | 23 | use tracing::{debug, info, instrument, trace}; |
| 24 | 24 | |
| 25 | use crate::errors::*; | |
| 25 | use crate::diagnostics::*; | |
| 26 | 26 | use crate::thir::cx::ThirBuildCx; |
| 27 | 27 | |
| 28 | 28 | impl<'tcx> ThirBuildCx<'tcx> { |
compiler/rustc_mir_build/src/thir/pattern/check_match.rs+1-1| ... | ... | @@ -27,7 +27,7 @@ use rustc_span::{Ident, Span}; |
| 27 | 27 | use rustc_trait_selection::infer::InferCtxtExt; |
| 28 | 28 | use tracing::instrument; |
| 29 | 29 | |
| 30 | use crate::errors::*; | |
| 30 | use crate::diagnostics::*; | |
| 31 | 31 | |
| 32 | 32 | pub(crate) fn check_match(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Result<(), ErrorGuaranteed> { |
| 33 | 33 | let typeck_results = tcx.typeck(def_id); |
compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs+1-1| ... | ... | @@ -20,7 +20,7 @@ use rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt; |
| 20 | 20 | use tracing::{debug, instrument, trace}; |
| 21 | 21 | |
| 22 | 22 | use super::PatCtxt; |
| 23 | use crate::errors::{ | |
| 23 | use crate::diagnostics::{ | |
| 24 | 24 | ConstPatternDependsOnGenericParameter, CouldNotEvalConstPattern, InvalidPattern, NaNPattern, |
| 25 | 25 | PointerPattern, SuggestEq, TypeNotPartialEq, TypeNotStructural, UnionPattern, UnsizedPattern, |
| 26 | 26 | }; |
compiler/rustc_mir_build/src/thir/pattern/mod.rs+1-1| ... | ... | @@ -29,7 +29,7 @@ use tracing::{debug, instrument}; |
| 29 | 29 | |
| 30 | 30 | pub(crate) use self::check_match::check_match; |
| 31 | 31 | use self::migration::PatMigration; |
| 32 | use crate::errors::*; | |
| 32 | use crate::diagnostics::*; | |
| 33 | 33 | use crate::thir::cx::ThirBuildCx; |
| 34 | 34 | |
| 35 | 35 | /// Context for lowering HIR patterns to THIR patterns. |
compiler/rustc_mir_dataflow/src/diagnostics.rs created+41| ... | ... | @@ -0,0 +1,41 @@ |
| 1 | use rustc_macros::Diagnostic; | |
| 2 | use rustc_span::Span; | |
| 3 | ||
| 4 | #[derive(Diagnostic)] | |
| 5 | #[diag("stop_after_dataflow ended compilation")] | |
| 6 | pub(crate) struct StopAfterDataFlowEndedCompilation; | |
| 7 | ||
| 8 | #[derive(Diagnostic)] | |
| 9 | #[diag("rustc_peek: argument expression must be either `place` or `&place`")] | |
| 10 | pub(crate) struct PeekMustBePlaceOrRefPlace { | |
| 11 | #[primary_span] | |
| 12 | pub span: Span, | |
| 13 | } | |
| 14 | ||
| 15 | #[derive(Diagnostic)] | |
| 16 | #[diag("dataflow::sanity_check cannot feed a non-temp to rustc_peek")] | |
| 17 | pub(crate) struct PeekMustBeNotTemporary { | |
| 18 | #[primary_span] | |
| 19 | pub span: Span, | |
| 20 | } | |
| 21 | ||
| 22 | #[derive(Diagnostic)] | |
| 23 | #[diag("rustc_peek: bit not set")] | |
| 24 | pub(crate) struct PeekBitNotSet { | |
| 25 | #[primary_span] | |
| 26 | pub span: Span, | |
| 27 | } | |
| 28 | ||
| 29 | #[derive(Diagnostic)] | |
| 30 | #[diag("rustc_peek: argument was not a local")] | |
| 31 | pub(crate) struct PeekArgumentNotALocal { | |
| 32 | #[primary_span] | |
| 33 | pub span: Span, | |
| 34 | } | |
| 35 | ||
| 36 | #[derive(Diagnostic)] | |
| 37 | #[diag("rustc_peek: argument untracked")] | |
| 38 | pub(crate) struct PeekArgumentUntracked { | |
| 39 | #[primary_span] | |
| 40 | pub span: Span, | |
| 41 | } |
compiler/rustc_mir_dataflow/src/errors.rs deleted-41| ... | ... | @@ -1,41 +0,0 @@ |
| 1 | use rustc_macros::Diagnostic; | |
| 2 | use rustc_span::Span; | |
| 3 | ||
| 4 | #[derive(Diagnostic)] | |
| 5 | #[diag("stop_after_dataflow ended compilation")] | |
| 6 | pub(crate) struct StopAfterDataFlowEndedCompilation; | |
| 7 | ||
| 8 | #[derive(Diagnostic)] | |
| 9 | #[diag("rustc_peek: argument expression must be either `place` or `&place`")] | |
| 10 | pub(crate) struct PeekMustBePlaceOrRefPlace { | |
| 11 | #[primary_span] | |
| 12 | pub span: Span, | |
| 13 | } | |
| 14 | ||
| 15 | #[derive(Diagnostic)] | |
| 16 | #[diag("dataflow::sanity_check cannot feed a non-temp to rustc_peek")] | |
| 17 | pub(crate) struct PeekMustBeNotTemporary { | |
| 18 | #[primary_span] | |
| 19 | pub span: Span, | |
| 20 | } | |
| 21 | ||
| 22 | #[derive(Diagnostic)] | |
| 23 | #[diag("rustc_peek: bit not set")] | |
| 24 | pub(crate) struct PeekBitNotSet { | |
| 25 | #[primary_span] | |
| 26 | pub span: Span, | |
| 27 | } | |
| 28 | ||
| 29 | #[derive(Diagnostic)] | |
| 30 | #[diag("rustc_peek: argument was not a local")] | |
| 31 | pub(crate) struct PeekArgumentNotALocal { | |
| 32 | #[primary_span] | |
| 33 | pub span: Span, | |
| 34 | } | |
| 35 | ||
| 36 | #[derive(Diagnostic)] | |
| 37 | #[diag("rustc_peek: argument untracked")] | |
| 38 | pub(crate) struct PeekArgumentUntracked { | |
| 39 | #[primary_span] | |
| 40 | pub span: Span, | |
| 41 | } |
compiler/rustc_mir_dataflow/src/lib.rs+1-1| ... | ... | @@ -23,8 +23,8 @@ pub use self::framework::{ |
| 23 | 23 | use self::move_paths::MoveData; |
| 24 | 24 | |
| 25 | 25 | pub mod debuginfo; |
| 26 | mod diagnostics; | |
| 26 | 27 | mod drop_flag_effects; |
| 27 | mod errors; | |
| 28 | 28 | mod framework; |
| 29 | 29 | pub mod impls; |
| 30 | 30 | pub mod move_paths; |
compiler/rustc_mir_dataflow/src/rustc_peek.rs+1-1| ... | ... | @@ -5,7 +5,7 @@ use rustc_middle::ty::{self, Ty, TyCtxt}; |
| 5 | 5 | use rustc_span::{Span, sym}; |
| 6 | 6 | use tracing::{debug, info}; |
| 7 | 7 | |
| 8 | use crate::errors::{ | |
| 8 | use crate::diagnostics::{ | |
| 9 | 9 | PeekArgumentNotALocal, PeekArgumentUntracked, PeekBitNotSet, PeekMustBeNotTemporary, |
| 10 | 10 | PeekMustBePlaceOrRefPlace, StopAfterDataFlowEndedCompilation, |
| 11 | 11 | }; |
compiler/rustc_mir_transform/src/cross_crate_inline.rs+7-1| ... | ... | @@ -1,7 +1,7 @@ |
| 1 | 1 | use rustc_hir::attrs::InlineAttr; |
| 2 | 2 | use rustc_hir::def::DefKind; |
| 3 | 3 | use rustc_hir::def_id::LocalDefId; |
| 4 | use rustc_hir::find_attr; | |
| 4 | use rustc_hir::{self as hir, find_attr}; | |
| 5 | 5 | use rustc_middle::bug; |
| 6 | 6 | use rustc_middle::mir::visit::Visitor; |
| 7 | 7 | use rustc_middle::mir::*; |
| ... | ... | @@ -43,6 +43,12 @@ fn cross_crate_inlinable(tcx: TyCtxt<'_>, def_id: LocalDefId) -> bool { |
| 43 | 43 | return true; |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | if let hir::Constness::Const { always: true } = tcx.constness(def_id) { | |
| 47 | // Comptime functions only exist during const eval and can never be passed | |
| 48 | // to codegen. The const eval MIR pipeline also doesn't inline anything at all. | |
| 49 | return false; | |
| 50 | } | |
| 51 | ||
| 46 | 52 | // Obey source annotations first; this is important because it means we can use |
| 47 | 53 | // #[inline(never)] to force code generation. |
| 48 | 54 | match codegen_fn_attrs.inline { |
compiler/rustc_mir_transform/src/deduce_param_attrs.rs+7| ... | ... | @@ -9,6 +9,7 @@ |
| 9 | 9 | //! after `optimized_mir`! We check for things that are *not* guaranteed to be preserved by MIR |
| 10 | 10 | //! transforms, such as which local variables happen to be mutated. |
| 11 | 11 | |
| 12 | use rustc_hir as hir; | |
| 12 | 13 | use rustc_hir::def_id::LocalDefId; |
| 13 | 14 | use rustc_index::IndexVec; |
| 14 | 15 | use rustc_middle::middle::deduced_param_attrs::{DeducedParamAttrs, UsageSummary}; |
| ... | ... | @@ -205,6 +206,12 @@ pub(super) fn deduced_param_attrs<'tcx>( |
| 205 | 206 | return &[]; |
| 206 | 207 | } |
| 207 | 208 | |
| 209 | if let hir::Constness::Const { always: true } = tcx.constness(def_id) { | |
| 210 | // Comptime functions only exist during const eval and can never be passed | |
| 211 | // to codegen. | |
| 212 | return &[]; | |
| 213 | } | |
| 214 | ||
| 208 | 215 | // Grab the optimized MIR. Analyze it to determine which arguments have been mutated. |
| 209 | 216 | let body: &Body<'tcx> = tcx.optimized_mir(def_id); |
| 210 | 217 | // Arguments spread at ABI level are currently unsupported. |
compiler/rustc_mir_transform/src/lib.rs+12-1| ... | ... | @@ -511,7 +511,18 @@ fn inner_mir_for_ctfe(tcx: TyCtxt<'_>, def: LocalDefId) -> Body<'_> { |
| 511 | 511 | }; |
| 512 | 512 | |
| 513 | 513 | let mut body = remap_mir_for_const_eval_select(tcx, body, hir::Constness::Const { always }); |
| 514 | pm::run_passes(tcx, &mut body, &[&ctfe_limit::CtfeLimit], None, pm::Optimizations::Allowed); | |
| 514 | // FIXME(reflection): probably need to look at this for comptime closures | |
| 515 | let passes: &[&dyn MirPass<'_>] = if matches!(tcx.def_kind(def), DefKind::Fn | DefKind::AssocFn) | |
| 516 | && matches!(tcx.constness(def), hir::Constness::Const { always: true }) | |
| 517 | { | |
| 518 | // Need to generate mentioned items, as all functions are expected to have them, but for const | |
| 519 | // fns we just look at the optimized MIR, which generates it. For comptime fns, there is no | |
| 520 | // optimized MIR. | |
| 521 | &[&ctfe_limit::CtfeLimit, &mentioned_items::MentionedItems] | |
| 522 | } else { | |
| 523 | &[&ctfe_limit::CtfeLimit] | |
| 524 | }; | |
| 525 | pm::run_passes(tcx, &mut body, passes, None, pm::Optimizations::Allowed); | |
| 515 | 526 | |
| 516 | 527 | body |
| 517 | 528 | } |
compiler/rustc_monomorphize/src/collector.rs+2-2| ... | ... | @@ -413,7 +413,7 @@ fn collect_items_rec<'tcx>( |
| 413 | 413 | // current step of mono items collection. |
| 414 | 414 | // |
| 415 | 415 | // FIXME: don't rely on global state, instead bubble up errors. Note: this is very hard to do. |
| 416 | let error_count = tcx.dcx().err_count(); | |
| 416 | let error_count = tcx.dcx().err_count_on_current_thread(); | |
| 417 | 417 | |
| 418 | 418 | // In `mentioned_items` we collect items that were mentioned in this MIR but possibly do not |
| 419 | 419 | // need to be monomorphized. This is done to ensure that optimizing away function calls does not |
| ... | ... | @@ -538,7 +538,7 @@ fn collect_items_rec<'tcx>( |
| 538 | 538 | |
| 539 | 539 | // Check for PMEs and emit a diagnostic if one happened. To try to show relevant edges of the |
| 540 | 540 | // mono item graph. |
| 541 | if tcx.dcx().err_count() > error_count | |
| 541 | if tcx.dcx().err_count_on_current_thread() > error_count | |
| 542 | 542 | && starting_item.node.is_generic_fn() |
| 543 | 543 | && starting_item.node.is_user_defined() |
| 544 | 544 | { |
compiler/rustc_next_trait_solver/src/solve/normalizes_to/inherent.rs+2-1| ... | ... | @@ -54,7 +54,7 @@ where |
| 54 | 54 | .map(|pred| goal.with(cx, pred)), |
| 55 | 55 | ); |
| 56 | 56 | |
| 57 | let normalized = match inherent.kind { | |
| 57 | let normalized: I::Term = match inherent.kind { | |
| 58 | 58 | ty::AliasTermKind::InherentTy { def_id } => { |
| 59 | 59 | cx.type_of(def_id.into()).instantiate(cx, inherent_args).skip_norm_wip().into() |
| 60 | 60 | } |
| ... | ... | @@ -74,6 +74,7 @@ where |
| 74 | 74 | } |
| 75 | 75 | kind => panic!("expected inherent alias, found {kind:?}"), |
| 76 | 76 | }; |
| 77 | ||
| 77 | 78 | self.instantiate_normalizes_to_term(goal, normalized); |
| 78 | 79 | self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes) |
| 79 | 80 | } |
compiler/rustc_next_trait_solver/src/solve/normalizes_to/mod.rs+31| ... | ... | @@ -121,11 +121,42 @@ where |
| 121 | 121 | /// We know `term` to always be a fully unconstrained inference variable, so |
| 122 | 122 | /// `eq` should never fail here. However, in case `term` contains aliases, we |
| 123 | 123 | /// emit nested `AliasRelate` goals to structurally normalize the alias. |
| 124 | /// | |
| 125 | /// Additionally, when `term` is a const, this registers a `ConstArgHasType` | |
| 126 | /// goal to ensure that the const value's type matches the declared type of | |
| 127 | /// the alias it was normalized from. | |
| 128 | /// | |
| 129 | /// You may reasonably wonder: shouldn't `wfcheck::check_type_const` already | |
| 130 | /// catch any such type mismatch at the definition site, so that the | |
| 131 | /// definition is tainted and we never even attempt to normalize a reference | |
| 132 | /// to it? In principle that's exactly what should happen. However, we cannot | |
| 133 | /// simply force the defining item's wfcheck to run before all uses are | |
| 134 | /// normalized: wfcheck itself may depend on typeck, trait solving, and | |
| 135 | /// normalization, so enforcing such a strict ordering would easily create | |
| 136 | /// query cycles. | |
| 137 | /// | |
| 138 | /// However, when CTFE runs on a MIR body, normalizing a type const within | |
| 139 | /// that body can change the type of the resulting value, causing the MIR | |
| 140 | /// to become ill-formed. If `check_type_const` for that alias has not yet | |
| 141 | /// reported its error, no prior error has been recorded and MIR validation | |
| 142 | /// fires a `span_bug!`. Registering the obligation here ensures the type | |
| 143 | /// mismatch is reported during normalization itself, tainting the MIR | |
| 144 | /// before validation runs. | |
| 124 | 145 | pub fn instantiate_normalizes_to_term( |
| 125 | 146 | &mut self, |
| 126 | 147 | goal: Goal<I, NormalizesTo<I>>, |
| 127 | 148 | term: I::Term, |
| 128 | 149 | ) { |
| 150 | if let Some(ct) = term.as_const() { | |
| 151 | let cx = self.cx(); | |
| 152 | let alias = goal.predicate.alias; | |
| 153 | let expected_ty = | |
| 154 | cx.type_of(alias.def_id()).instantiate(cx, alias.args).skip_norm_wip(); | |
| 155 | self.add_goal( | |
| 156 | GoalSource::Misc, | |
| 157 | goal.with(cx, ty::ClauseKind::ConstArgHasType(ct, expected_ty)), | |
| 158 | ); | |
| 159 | } | |
| 129 | 160 | self.eq(goal.param_env, goal.predicate.term, term) |
| 130 | 161 | .expect("expected goal term to be fully unconstrained"); |
| 131 | 162 | } |
compiler/rustc_parse/src/parser/ty.rs+1-1| ... | ... | @@ -1092,7 +1092,7 @@ impl<'a> Parser<'a> { |
| 1092 | 1092 | && (self.token.can_begin_type() |
| 1093 | 1093 | || (self.token.is_reserved_ident() && !self.token.is_keyword(kw::Where)))) |
| 1094 | 1094 | { |
| 1095 | if self.token.is_keyword(kw::Dyn) { | |
| 1095 | if self.token.is_keyword(kw::Dyn) && self.token.span.edition().at_least_rust_2018() { | |
| 1096 | 1096 | // Account for `&dyn Trait + dyn Other`. |
| 1097 | 1097 | self.bump(); |
| 1098 | 1098 | self.dcx().emit_err(InvalidDynKeyword { |
compiler/rustc_passes/src/dead.rs+16| ... | ... | @@ -5,6 +5,7 @@ |
| 5 | 5 | |
| 6 | 6 | use std::mem; |
| 7 | 7 | use std::ops::ControlFlow; |
| 8 | use std::sync::atomic::Ordering; | |
| 8 | 9 | |
| 9 | 10 | use hir::def_id::{LocalDefIdMap, LocalDefIdSet}; |
| 10 | 11 | use rustc_abi::FieldIdx; |
| ... | ... | @@ -930,6 +931,21 @@ fn create_and_seed_worklist(tcx: TyCtxt<'_>) -> SeedWorklists { |
| 930 | 931 | }); |
| 931 | 932 | } |
| 932 | 933 | |
| 934 | // Under `--test`, what `main` resolves to is the would-be entry point of a normal build, | |
| 935 | // so keep it live, unless a stripped user `#[rustc_main]` would have been the entry instead. | |
| 936 | if tcx.sess.is_test_crate() | |
| 937 | && !tcx.sess.removed_rustc_main_attr.load(Ordering::Relaxed) | |
| 938 | && let Some(main_def) = tcx.resolutions(()).main_def | |
| 939 | && let Some(def_id) = main_def.opt_fn_def_id() | |
| 940 | && let Some(local_def_id) = def_id.as_local() | |
| 941 | { | |
| 942 | worklist.push(WorkItem { | |
| 943 | id: local_def_id, | |
| 944 | propagated: ComesFromAllowExpect::No, | |
| 945 | own: ComesFromAllowExpect::No, | |
| 946 | }); | |
| 947 | } | |
| 948 | ||
| 933 | 949 | for (id, effective_vis) in tcx.effective_visibilities(()).iter() { |
| 934 | 950 | if effective_vis.is_public_at_level(Level::Reachable) { |
| 935 | 951 | deferred_seeds.push(WorkItem { |
compiler/rustc_passes/src/delegation.rs created+32| ... | ... | @@ -0,0 +1,32 @@ |
| 1 | use rustc_data_structures::fx::FxIndexMap; | |
| 2 | use rustc_macros::Diagnostic; | |
| 3 | use rustc_middle::ty::TyCtxt; | |
| 4 | use rustc_span::Span; | |
| 5 | ||
| 6 | pub fn check_glob_and_list_delegations_target_expr(tcx: TyCtxt<'_>) { | |
| 7 | let mut delegations_by_group_id = FxIndexMap::default(); | |
| 8 | ||
| 9 | for &id in tcx.resolutions(()).delegation_infos.keys() { | |
| 10 | if let Some(info) = tcx.hir_opt_delegation_info(id) | |
| 11 | && let Some((group_id, unused_target_expr)) = info.group_id | |
| 12 | { | |
| 13 | delegations_by_group_id | |
| 14 | .entry(group_id) | |
| 15 | .or_insert_with(|| (true, tcx.def_span(id))) | |
| 16 | .0 &= unused_target_expr; | |
| 17 | } | |
| 18 | } | |
| 19 | ||
| 20 | for (_, (unused_target_expr, span)) in delegations_by_group_id { | |
| 21 | if unused_target_expr { | |
| 22 | tcx.dcx().emit_err(DelegationTargetExprDeletedEverywhere { span }); | |
| 23 | } | |
| 24 | } | |
| 25 | } | |
| 26 | ||
| 27 | #[derive(Diagnostic)] | |
| 28 | #[diag("unused target expression is specified for glob or list delegation")] | |
| 29 | struct DelegationTargetExprDeletedEverywhere { | |
| 30 | #[primary_span] | |
| 31 | pub span: Span, | |
| 32 | } |
compiler/rustc_passes/src/lib.rs+1| ... | ... | @@ -11,6 +11,7 @@ mod check_attr; |
| 11 | 11 | mod check_export; |
| 12 | 12 | pub mod dead; |
| 13 | 13 | mod debugger_visualizer; |
| 14 | pub mod delegation; | |
| 14 | 15 | mod diagnostic_items; |
| 15 | 16 | mod eii; |
| 16 | 17 | pub mod entry; |
compiler/rustc_passes/src/reachable.rs+3-3| ... | ... | @@ -145,7 +145,7 @@ impl<'tcx> ReachableContext<'tcx> { |
| 145 | 145 | _ => false, |
| 146 | 146 | }, |
| 147 | 147 | Node::TraitItem(trait_method) => match trait_method.kind { |
| 148 | hir::TraitItemKind::Const(_, ref default, _) => default.is_some(), | |
| 148 | hir::TraitItemKind::Const(_, ref default) => default.is_some(), | |
| 149 | 149 | hir::TraitItemKind::Fn(_, hir::TraitFn::Provided(_)) => true, |
| 150 | 150 | hir::TraitItemKind::Fn(_, hir::TraitFn::Required(_)) |
| 151 | 151 | | hir::TraitItemKind::Type(..) => false, |
| ... | ... | @@ -266,11 +266,11 @@ impl<'tcx> ReachableContext<'tcx> { |
| 266 | 266 | } |
| 267 | 267 | Node::TraitItem(trait_method) => { |
| 268 | 268 | match trait_method.kind { |
| 269 | hir::TraitItemKind::Const(_, None, _) | |
| 269 | hir::TraitItemKind::Const(_, None) | |
| 270 | 270 | | hir::TraitItemKind::Fn(_, hir::TraitFn::Required(_)) => { |
| 271 | 271 | // Keep going, nothing to get exported |
| 272 | 272 | } |
| 273 | hir::TraitItemKind::Const(_, Some(rhs), _) => self.visit_const_item_rhs(rhs), | |
| 273 | hir::TraitItemKind::Const(_, Some(rhs)) => self.visit_const_item_rhs(rhs), | |
| 274 | 274 | hir::TraitItemKind::Fn(_, hir::TraitFn::Provided(body_id)) => { |
| 275 | 275 | self.visit_nested_body(body_id); |
| 276 | 276 | } |
compiler/rustc_resolve/src/imports.rs+9| ... | ... | @@ -628,6 +628,15 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { |
| 628 | 628 | module.underscore_disambiguator.get() |
| 629 | 629 | }); |
| 630 | 630 | self.update_local_resolution(module, key, orig_ident_span, |this, resolution| { |
| 631 | if res == Res::Err | |
| 632 | && let Some(old_decl) = resolution.best_decl() | |
| 633 | && old_decl.res() != Res::Err | |
| 634 | { | |
| 635 | // Do not override real declarations with `Res::Err`s from error recovery. | |
| 636 | // FIXME: this special case shouldn't be necessary, but removing it triggers an ICE | |
| 637 | // due to some other issues (#157406, tests/ui/imports/dummy-import-ice.rs). | |
| 638 | return Ok(()); | |
| 639 | } | |
| 631 | 640 | if decl.is_glob_import() { |
| 632 | 641 | resolution.glob_decl = Some(match resolution.glob_decl { |
| 633 | 642 | Some(old_decl) => this.select_glob_decl(old_decl, decl), |
compiler/rustc_resolve/src/lib.rs+3-2| ... | ... | @@ -1506,7 +1506,7 @@ pub struct Resolver<'ra, 'tcx> { |
| 1506 | 1506 | /// Generic args to suggest for required params (e.g. `<'_>`, `<_, _>`), if any. |
| 1507 | 1507 | item_required_generic_args_suggestions: FxHashMap<LocalDefId, String> = default::fx_hash_map(), |
| 1508 | 1508 | delegation_fn_sigs: LocalDefIdMap<DelegationFnSig> = Default::default(), |
| 1509 | delegation_infos: LocalDefIdMap<DelegationInfo> = Default::default(), | |
| 1509 | delegation_infos: FxIndexMap<LocalDefId, DelegationInfo>, | |
| 1510 | 1510 | |
| 1511 | 1511 | main_def: Option<MainDefinition> = None, |
| 1512 | 1512 | trait_impls: FxIndexMap<DefId, Vec<LocalDefId>>, |
| ... | ... | @@ -1871,6 +1871,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { |
| 1871 | 1871 | doc_link_traits_in_scope: Default::default(), |
| 1872 | 1872 | current_crate_outer_attr_insert_span, |
| 1873 | 1873 | disambiguators: Default::default(), |
| 1874 | delegation_infos: Default::default(), | |
| 1874 | 1875 | .. |
| 1875 | 1876 | }; |
| 1876 | 1877 | |
| ... | ... | @@ -1991,6 +1992,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { |
| 1991 | 1992 | doc_link_traits_in_scope: self.doc_link_traits_in_scope, |
| 1992 | 1993 | all_macro_rules: self.all_macro_rules, |
| 1993 | 1994 | stripped_cfg_items, |
| 1995 | delegation_infos: self.delegation_infos, | |
| 1994 | 1996 | }; |
| 1995 | 1997 | let ast_lowering = ty::ResolverAstLowering { |
| 1996 | 1998 | partial_res_map: self.partial_res_map, |
| ... | ... | @@ -1998,7 +2000,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { |
| 1998 | 2000 | next_node_id: self.next_node_id, |
| 1999 | 2001 | owners: self.owners, |
| 2000 | 2002 | lint_buffer: Steal::new(self.lint_buffer), |
| 2001 | delegation_infos: self.delegation_infos, | |
| 2002 | 2003 | disambiguators, |
| 2003 | 2004 | }; |
| 2004 | 2005 | ResolverOutputs { global_ctxt, ast_lowering } |
compiler/rustc_serialize/src/opaque.rs+28-8| ... | ... | @@ -29,7 +29,10 @@ const BUF_SIZE: usize = 64 * 1024; |
| 29 | 29 | /// `Vec`. `FileEncoder` is better because its memory use is determined by the |
| 30 | 30 | /// size of the buffer, rather than the full length of the encoded data, and |
| 31 | 31 | /// because it doesn't need to reallocate memory along the way. |
| 32 | pub struct FileEncoder { | |
| 32 | /// | |
| 33 | /// The `'a` lifetime is the borrow of the optional flush strategy (see | |
| 34 | /// `flush_strategy`); it is unused (`'static`) for encoders created without one. | |
| 35 | pub struct FileEncoder<'a> { | |
| 33 | 36 | // The input buffer. For adequate performance, we need to be able to write |
| 34 | 37 | // directly to the unwritten region of the buffer, without calling copy_from_slice. |
| 35 | 38 | // Note that our buffer is always initialized so that we can do that direct access |
| ... | ... | @@ -43,11 +46,12 @@ pub struct FileEncoder { |
| 43 | 46 | // comment on `trait Encoder`. |
| 44 | 47 | res: Result<(), io::Error>, |
| 45 | 48 | path: PathBuf, |
| 49 | flush_strategy: Option<&'a mut (dyn FnMut(&[u8]) + Send)>, | |
| 46 | 50 | #[cfg(debug_assertions)] |
| 47 | 51 | finished: bool, |
| 48 | 52 | } |
| 49 | 53 | |
| 50 | impl FileEncoder { | |
| 54 | impl<'a> FileEncoder<'a> { | |
| 51 | 55 | pub fn new<P: AsRef<Path>>(path: P) -> io::Result<Self> { |
| 52 | 56 | // File::create opens the file for writing only. When -Zmeta-stats is enabled, the metadata |
| 53 | 57 | // encoder rewinds the file to inspect what was written. So we need to always open the file |
| ... | ... | @@ -62,11 +66,21 @@ impl FileEncoder { |
| 62 | 66 | flushed: 0, |
| 63 | 67 | file, |
| 64 | 68 | res: Ok(()), |
| 69 | flush_strategy: None, | |
| 65 | 70 | #[cfg(debug_assertions)] |
| 66 | 71 | finished: false, |
| 67 | 72 | }) |
| 68 | 73 | } |
| 69 | 74 | |
| 75 | pub fn with_flush_strategy<P: AsRef<Path>>( | |
| 76 | path: P, | |
| 77 | strategy: &'a mut (dyn FnMut(&[u8]) + Send), | |
| 78 | ) -> io::Result<Self> { | |
| 79 | let mut encoder = Self::new(path)?; | |
| 80 | encoder.flush_strategy = Some(strategy); | |
| 81 | Ok(encoder) | |
| 82 | } | |
| 83 | ||
| 70 | 84 | #[inline] |
| 71 | 85 | pub fn position(&self) -> usize { |
| 72 | 86 | // Tracking position this way instead of having a `self.position` field |
| ... | ... | @@ -86,6 +100,9 @@ impl FileEncoder { |
| 86 | 100 | self.res = self.file.write_all(&self.buf[..self.buffered]); |
| 87 | 101 | } |
| 88 | 102 | self.flushed += self.buffered; |
| 103 | if let Some(f) = &mut self.flush_strategy { | |
| 104 | f(&self.buf[..self.buffered]); | |
| 105 | } | |
| 89 | 106 | self.buffered = 0; |
| 90 | 107 | } |
| 91 | 108 | |
| ... | ... | @@ -115,6 +132,9 @@ impl FileEncoder { |
| 115 | 132 | } else { |
| 116 | 133 | if self.res.is_ok() { |
| 117 | 134 | self.res = self.file.write_all(buf); |
| 135 | if let Some(f) = &mut self.flush_strategy { | |
| 136 | f(buf); | |
| 137 | } | |
| 118 | 138 | } |
| 119 | 139 | self.flushed += buf.len(); |
| 120 | 140 | } |
| ... | ... | @@ -200,7 +220,7 @@ impl FileEncoder { |
| 200 | 220 | } |
| 201 | 221 | |
| 202 | 222 | #[cfg(debug_assertions)] |
| 203 | impl Drop for FileEncoder { | |
| 223 | impl Drop for FileEncoder<'_> { | |
| 204 | 224 | fn drop(&mut self) { |
| 205 | 225 | if !std::thread::panicking() { |
| 206 | 226 | assert!(self.finished); |
| ... | ... | @@ -217,7 +237,7 @@ macro_rules! write_leb128 { |
| 217 | 237 | }; |
| 218 | 238 | } |
| 219 | 239 | |
| 220 | impl Encoder for FileEncoder { | |
| 240 | impl Encoder for FileEncoder<'_> { | |
| 221 | 241 | write_leb128!(emit_usize, usize, write_usize_leb128); |
| 222 | 242 | write_leb128!(emit_u128, u128, write_u128_leb128); |
| 223 | 243 | write_leb128!(emit_u64, u64, write_u64_leb128); |
| ... | ... | @@ -415,8 +435,8 @@ impl<'a> Decoder for MemDecoder<'a> { |
| 415 | 435 | |
| 416 | 436 | // Specialize encoding byte slices. This specialization also applies to encoding `Vec<u8>`s, etc., |
| 417 | 437 | // since the default implementations call `encode` on their slices internally. |
| 418 | impl Encodable<FileEncoder> for [u8] { | |
| 419 | fn encode(&self, e: &mut FileEncoder) { | |
| 438 | impl Encodable<FileEncoder<'_>> for [u8] { | |
| 439 | fn encode(&self, e: &mut FileEncoder<'_>) { | |
| 420 | 440 | Encoder::emit_usize(e, self.len()); |
| 421 | 441 | e.emit_raw_bytes(self); |
| 422 | 442 | } |
| ... | ... | @@ -438,9 +458,9 @@ impl IntEncodedWithFixedSize { |
| 438 | 458 | pub const ENCODED_SIZE: usize = 8; |
| 439 | 459 | } |
| 440 | 460 | |
| 441 | impl Encodable<FileEncoder> for IntEncodedWithFixedSize { | |
| 461 | impl Encodable<FileEncoder<'_>> for IntEncodedWithFixedSize { | |
| 442 | 462 | #[inline] |
| 443 | fn encode(&self, e: &mut FileEncoder) { | |
| 463 | fn encode(&self, e: &mut FileEncoder<'_>) { | |
| 444 | 464 | let start_pos = e.position(); |
| 445 | 465 | e.write_array(self.0.to_le_bytes()); |
| 446 | 466 | let end_pos = e.position(); |
compiler/rustc_serialize/src/opaque/tests.rs+34-2| ... | ... | @@ -3,7 +3,7 @@ use std::fs; |
| 3 | 3 | |
| 4 | 4 | use rustc_macros::{Decodable_NoContext, Encodable_NoContext}; |
| 5 | 5 | |
| 6 | use crate::opaque::{FileEncoder, MemDecoder}; | |
| 6 | use crate::opaque::{FileEncoder, MAGIC_END_BYTES, MemDecoder}; | |
| 7 | 7 | use crate::{Decodable, Encodable}; |
| 8 | 8 | |
| 9 | 9 | #[derive(PartialEq, Clone, Debug, Encodable_NoContext, Decodable_NoContext)] |
| ... | ... | @@ -28,7 +28,7 @@ struct Struct { |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | fn check_round_trip< |
| 31 | T: Encodable<FileEncoder> + for<'a> Decodable<MemDecoder<'a>> + PartialEq + Debug, | |
| 31 | T: for<'a> Encodable<FileEncoder<'a>> + for<'a> Decodable<MemDecoder<'a>> + PartialEq + Debug, | |
| 32 | 32 | >( |
| 33 | 33 | values: Vec<T>, |
| 34 | 34 | ) { |
| ... | ... | @@ -293,3 +293,35 @@ fn test_cell() { |
| 293 | 293 | let obj = B { foo: Cell::new(true), bar: RefCell::new(A { baz: 2 }) }; |
| 294 | 294 | check_round_trip(vec![obj]); |
| 295 | 295 | } |
| 296 | ||
| 297 | #[test] | |
| 298 | fn test_flush_strategy() { | |
| 299 | let tmpfile = tempfile::NamedTempFile::new().unwrap(); | |
| 300 | let tmpfile = tmpfile.path(); | |
| 301 | ||
| 302 | // Small write that is explicitly flushed, and then a chunk larger than BUF_SIZE (64 KiB). | |
| 303 | // to hit `write_all_cold_path`. | |
| 304 | let small: Vec<u8> = (0..100u32).map(|i| i as u8).collect(); | |
| 305 | let big: Vec<u8> = (0..100_000u32).map(|i| i as u8).collect(); | |
| 306 | ||
| 307 | let mut expected: Vec<u8> = Vec::new(); | |
| 308 | expected.extend(&small); | |
| 309 | expected.extend(&big); | |
| 310 | expected.extend(MAGIC_END_BYTES); | |
| 311 | ||
| 312 | let mut flushed: Vec<u8> = Vec::new(); | |
| 313 | let mut strategy = |buf: &[u8]| { | |
| 314 | flushed.extend(buf); | |
| 315 | }; | |
| 316 | let mut encoder = FileEncoder::with_flush_strategy(&tmpfile, &mut strategy).unwrap(); | |
| 317 | ||
| 318 | encoder.write_all(&small); | |
| 319 | encoder.flush(); | |
| 320 | encoder.write_all(&big); | |
| 321 | encoder.finish().unwrap(); | |
| 322 | ||
| 323 | drop(encoder); | |
| 324 | ||
| 325 | assert_eq!(flushed, expected); | |
| 326 | assert_eq!(flushed, fs::read(&tmpfile).unwrap()); | |
| 327 | } |
compiler/rustc_session/src/session.rs+5| ... | ... | @@ -181,6 +181,10 @@ pub struct Session { |
| 181 | 181 | /// |
| 182 | 182 | /// The value is the `DepNodeIndex` of the node encodes the used feature. |
| 183 | 183 | pub used_features: Lock<FxHashMap<Symbol, u32>>, |
| 184 | ||
| 185 | /// Whether the test harness removed a user-written `#[rustc_main]` attribute | |
| 186 | /// while generating the synthetic test entry point. | |
| 187 | pub removed_rustc_main_attr: AtomicBool, | |
| 184 | 188 | } |
| 185 | 189 | |
| 186 | 190 | #[derive(Clone, Copy)] |
| ... | ... | @@ -1133,6 +1137,7 @@ pub fn build_session( |
| 1133 | 1137 | thin_lto_supported: true, // filled by `run_compiler` |
| 1134 | 1138 | mir_opt_bisect_eval_count: AtomicUsize::new(0), |
| 1135 | 1139 | used_features: Lock::default(), |
| 1140 | removed_rustc_main_attr: AtomicBool::new(false), | |
| 1136 | 1141 | }; |
| 1137 | 1142 | |
| 1138 | 1143 | validate_commandline_args_with_session_available(&sess); |
compiler/rustc_span/src/lib.rs+1-1| ... | ... | @@ -1362,7 +1362,7 @@ pub trait SpanEncoder: Encoder { |
| 1362 | 1362 | fn encode_def_id(&mut self, def_id: DefId); |
| 1363 | 1363 | } |
| 1364 | 1364 | |
| 1365 | impl SpanEncoder for FileEncoder { | |
| 1365 | impl SpanEncoder for FileEncoder<'_> { | |
| 1366 | 1366 | fn encode_span(&mut self, span: Span) { |
| 1367 | 1367 | let span = span.data(); |
| 1368 | 1368 | span.lo.encode(self); |
compiler/rustc_trait_selection/src/traits/normalize.rs+14-1| ... | ... | @@ -339,7 +339,7 @@ impl<'a, 'b, 'tcx> AssocTypeNormalizer<'a, 'b, 'tcx> { |
| 339 | 339 | }), |
| 340 | 340 | ); |
| 341 | 341 | self.depth += 1; |
| 342 | let res = if free.kind.is_type() { | |
| 342 | let res: ty::Term<'tcx> = if free.kind.is_type() { | |
| 343 | 343 | infcx |
| 344 | 344 | .tcx |
| 345 | 345 | .type_of(free.def_id()) |
| ... | ... | @@ -356,6 +356,19 @@ impl<'a, 'b, 'tcx> AssocTypeNormalizer<'a, 'b, 'tcx> { |
| 356 | 356 | .fold_with(self) |
| 357 | 357 | .into() |
| 358 | 358 | }; |
| 359 | // When normalizing a free const alias, register a `ConstArgHasType` | |
| 360 | // obligation to ensure the const value's type matches the declared type. | |
| 361 | if let Some(ct) = res.as_const() { | |
| 362 | let expected_ty = | |
| 363 | infcx.tcx.type_of(free.def_id()).instantiate(infcx.tcx, free.args).skip_norm_wip(); | |
| 364 | self.obligations.push(Obligation::with_depth( | |
| 365 | infcx.tcx, | |
| 366 | self.cause.clone(), | |
| 367 | self.depth, | |
| 368 | self.param_env, | |
| 369 | ty::ClauseKind::ConstArgHasType(ct, expected_ty), | |
| 370 | )); | |
| 371 | } | |
| 359 | 372 | self.depth -= 1; |
| 360 | 373 | res |
| 361 | 374 | } |
compiler/rustc_trait_selection/src/traits/project.rs+48-1| ... | ... | @@ -5,6 +5,7 @@ use std::ops::ControlFlow; |
| 5 | 5 | use rustc_data_structures::sso::SsoHashSet; |
| 6 | 6 | use rustc_data_structures::stack::ensure_sufficient_stack; |
| 7 | 7 | use rustc_errors::ErrorGuaranteed; |
| 8 | use rustc_hir::def_id::DefId; | |
| 8 | 9 | use rustc_hir::lang_items::LangItem; |
| 9 | 10 | use rustc_infer::infer::DefineOpaqueTypes; |
| 10 | 11 | use rustc_infer::infer::resolve::OpportunisticRegionResolver; |
| ... | ... | @@ -487,6 +488,30 @@ fn normalize_to_error<'a, 'tcx>( |
| 487 | 488 | Normalized { value: new_value, obligations } |
| 488 | 489 | } |
| 489 | 490 | |
| 491 | /// When normalizing a const alias, register a `ConstArgHasType` obligation | |
| 492 | /// to ensure the const value's type matches the declared type. | |
| 493 | fn push_const_arg_has_type_obligation<'tcx>( | |
| 494 | tcx: TyCtxt<'tcx>, | |
| 495 | obligations: &mut PredicateObligations<'tcx>, | |
| 496 | cause: &ObligationCause<'tcx>, | |
| 497 | depth: usize, | |
| 498 | param_env: ty::ParamEnv<'tcx>, | |
| 499 | term: Term<'tcx>, | |
| 500 | def_id: DefId, | |
| 501 | args: ty::GenericArgsRef<'tcx>, | |
| 502 | ) { | |
| 503 | if let Some(ct) = term.as_const() { | |
| 504 | let expected_ty = tcx.type_of(def_id).instantiate(tcx, args).skip_norm_wip(); | |
| 505 | obligations.push(Obligation::with_depth( | |
| 506 | tcx, | |
| 507 | cause.clone(), | |
| 508 | depth, | |
| 509 | param_env, | |
| 510 | ty::ClauseKind::ConstArgHasType(ct, expected_ty), | |
| 511 | )); | |
| 512 | } | |
| 513 | } | |
| 514 | ||
| 490 | 515 | /// Confirm and normalize the given inherent projection. |
| 491 | 516 | // FIXME(mgca): While this supports constants, it is only used for types by default right now |
| 492 | 517 | #[instrument(level = "debug", skip(selcx, param_env, cause, obligations))] |
| ... | ... | @@ -554,6 +579,17 @@ pub fn normalize_inherent_projection<'a, 'b, 'tcx>( |
| 554 | 579 | tcx.const_of_item(alias_term.def_id()).instantiate(tcx, args).skip_norm_wip().into() |
| 555 | 580 | }; |
| 556 | 581 | |
| 582 | push_const_arg_has_type_obligation( | |
| 583 | tcx, | |
| 584 | obligations, | |
| 585 | &cause, | |
| 586 | depth + 1, | |
| 587 | param_env, | |
| 588 | term, | |
| 589 | alias_term.def_id(), | |
| 590 | args, | |
| 591 | ); | |
| 592 | ||
| 557 | 593 | let mut term = selcx.infcx.resolve_vars_if_possible(term); |
| 558 | 594 | if term.has_aliases() { |
| 559 | 595 | term = |
| ... | ... | @@ -2049,7 +2085,18 @@ fn confirm_impl_candidate<'cx, 'tcx>( |
| 2049 | 2085 | Progress { term: err, obligations: nested } |
| 2050 | 2086 | } else { |
| 2051 | 2087 | assoc_term_own_obligations(selcx, obligation, &mut nested); |
| 2052 | Progress { term: term.instantiate(tcx, args).skip_norm_wip(), obligations: nested } | |
| 2088 | let instantiated_term: Term<'tcx> = term.instantiate(tcx, args).skip_norm_wip(); | |
| 2089 | push_const_arg_has_type_obligation( | |
| 2090 | tcx, | |
| 2091 | &mut nested, | |
| 2092 | &obligation.cause, | |
| 2093 | obligation.recursion_depth + 1, | |
| 2094 | obligation.param_env, | |
| 2095 | instantiated_term, | |
| 2096 | assoc_term.item.def_id, | |
| 2097 | args, | |
| 2098 | ); | |
| 2099 | Progress { term: instantiated_term, obligations: nested } | |
| 2053 | 2100 | }; |
| 2054 | 2101 | Ok(Projected::Progress(progress)) |
| 2055 | 2102 | } |
compiler/rustc_traits/src/normalize_projection_ty.rs+39-2| ... | ... | @@ -2,7 +2,7 @@ use rustc_infer::infer::TyCtxtInferExt; |
| 2 | 2 | use rustc_infer::infer::canonical::{Canonical, QueryResponse}; |
| 3 | 3 | use rustc_infer::traits::PredicateObligations; |
| 4 | 4 | use rustc_middle::query::Providers; |
| 5 | use rustc_middle::ty::{ParamEnvAnd, TyCtxt}; | |
| 5 | use rustc_middle::ty::{self, ParamEnvAnd, TyCtxt}; | |
| 6 | 6 | use rustc_trait_selection::error_reporting::InferCtxtErrorExt; |
| 7 | 7 | use rustc_trait_selection::infer::InferCtxtBuilderExt; |
| 8 | 8 | use rustc_trait_selection::traits::query::normalize::NormalizationResult; |
| ... | ... | @@ -19,6 +19,25 @@ pub(crate) fn provide(p: &mut Providers) { |
| 19 | 19 | }; |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | /// If `normalized_term` is a const, returns a `ConstArgHasType` obligation | |
| 23 | /// to verify that the const value's type matches the alias's declared type. | |
| 24 | /// Returns `None` if the term is a type rather than a const. | |
| 25 | fn const_arg_has_type_obligation<'tcx>( | |
| 26 | tcx: TyCtxt<'tcx>, | |
| 27 | param_env: ty::ParamEnv<'tcx>, | |
| 28 | normalized_term: ty::Term<'tcx>, | |
| 29 | goal: ty::AliasTerm<'tcx>, | |
| 30 | ) -> Option<traits::PredicateObligation<'tcx>> { | |
| 31 | let ct = normalized_term.as_const()?; | |
| 32 | let expected_ty = tcx.type_of(goal.def_id()).instantiate(tcx, goal.args).skip_norm_wip(); | |
| 33 | Some(traits::Obligation::new( | |
| 34 | tcx, | |
| 35 | ObligationCause::dummy(), | |
| 36 | param_env, | |
| 37 | ty::ClauseKind::ConstArgHasType(ct, expected_ty), | |
| 38 | )) | |
| 39 | } | |
| 40 | ||
| 22 | 41 | fn normalize_canonicalized_projection<'tcx>( |
| 23 | 42 | tcx: TyCtxt<'tcx>, |
| 24 | 43 | goal: CanonicalAliasGoal<'tcx>, |
| ... | ... | @@ -40,6 +59,12 @@ fn normalize_canonicalized_projection<'tcx>( |
| 40 | 59 | 0, |
| 41 | 60 | &mut obligations, |
| 42 | 61 | ); |
| 62 | obligations.extend(const_arg_has_type_obligation( | |
| 63 | tcx, | |
| 64 | param_env, | |
| 65 | normalized_term, | |
| 66 | goal.into(), | |
| 67 | )); | |
| 43 | 68 | ocx.register_obligations(obligations); |
| 44 | 69 | // #112047: With projections and opaques, we are able to create opaques that |
| 45 | 70 | // are recursive (given some generic parameters of the opaque's type variables). |
| ... | ... | @@ -86,11 +111,17 @@ fn normalize_canonicalized_free_alias<'tcx>( |
| 86 | 111 | }, |
| 87 | 112 | ); |
| 88 | 113 | ocx.register_obligations(obligations); |
| 89 | let normalized_term = if goal.kind.is_type() { | |
| 114 | let normalized_term: ty::Term<'tcx> = if goal.kind.is_type() { | |
| 90 | 115 | tcx.type_of(goal.def_id()).instantiate(tcx, goal.args).skip_norm_wip().into() |
| 91 | 116 | } else { |
| 92 | 117 | tcx.const_of_item(goal.def_id()).instantiate(tcx, goal.args).skip_norm_wip().into() |
| 93 | 118 | }; |
| 119 | ocx.register_obligations(const_arg_has_type_obligation( | |
| 120 | tcx, | |
| 121 | param_env, | |
| 122 | normalized_term, | |
| 123 | goal.into(), | |
| 124 | )); | |
| 94 | 125 | Ok(NormalizationResult { normalized_term }) |
| 95 | 126 | }, |
| 96 | 127 | ) |
| ... | ... | @@ -116,6 +147,12 @@ fn normalize_canonicalized_inherent_projection<'tcx>( |
| 116 | 147 | 0, |
| 117 | 148 | &mut obligations, |
| 118 | 149 | ); |
| 150 | obligations.extend(const_arg_has_type_obligation( | |
| 151 | tcx, | |
| 152 | param_env, | |
| 153 | normalized_term, | |
| 154 | goal.into(), | |
| 155 | )); | |
| 119 | 156 | ocx.register_obligations(obligations); |
| 120 | 157 | |
| 121 | 158 | Ok(NormalizationResult { normalized_term }) |
compiler/rustc_ty_utils/src/assoc.rs+2-2| ... | ... | @@ -88,8 +88,8 @@ fn associated_item_from_trait_item( |
| 88 | 88 | let owner_id = trait_item.owner_id; |
| 89 | 89 | let name = trait_item.ident.name; |
| 90 | 90 | let kind = match trait_item.kind { |
| 91 | hir::TraitItemKind::Const(_, _, is_type_const) => { | |
| 92 | ty::AssocKind::Const { name, is_type_const: is_type_const.into() } | |
| 91 | hir::TraitItemKind::Const(_, _) => { | |
| 92 | ty::AssocKind::Const { name, is_type_const: tcx.is_type_const(owner_id.def_id) } | |
| 93 | 93 | } |
| 94 | 94 | hir::TraitItemKind::Fn { .. } => { |
| 95 | 95 | ty::AssocKind::Fn { name, has_self: fn_has_self_parameter(tcx, owner_id) } |
compiler/rustc_type_ir/src/interner.rs-2| ... | ... | @@ -244,8 +244,6 @@ pub trait Interner: |
| 244 | 244 | type AdtDef: AdtDef<Self>; |
| 245 | 245 | fn adt_def(self, adt_def_id: Self::AdtId) -> Self::AdtDef; |
| 246 | 246 | |
| 247 | fn alias_ty_kind_from_def_id(self, def_id: Self::DefId) -> ty::AliasTyKind<Self>; | |
| 248 | ||
| 249 | 247 | fn unevaluated_const_kind_from_def_id( |
| 250 | 248 | self, |
| 251 | 249 | def_id: Self::DefId, |
compiler/rustc_type_ir/src/predicate.rs-7| ... | ... | @@ -429,13 +429,6 @@ impl<I: Interner> ExistentialTraitRef<I> { |
| 429 | 429 | /// Therefore, you must specify *some* self type to perform the conversion. |
| 430 | 430 | /// A common choice is the trait object type itself or some kind of dummy type. |
| 431 | 431 | pub fn with_self_ty(self, interner: I, self_ty: I::Ty) -> TraitRef<I> { |
| 432 | // FIXME(#157122): This assertion was accidentally commented out in refactoring PR #53816 | |
| 433 | // back in 2018 but nowadays it can actually trigger. Either remove this | |
| 434 | // comment entirely if the assertion is incorrect or uncomment it and fix | |
| 435 | // the fallout! | |
| 436 | // otherwise the escaping vars would be captured by the binder | |
| 437 | //debug_assert!(!self_ty.has_escaping_bound_vars()); | |
| 438 | ||
| 439 | 432 | TraitRef::new(interner, self.def_id, [self_ty.into()].into_iter().chain(self.args.iter())) |
| 440 | 433 | } |
| 441 | 434 | } |
compiler/rustc_type_ir/src/ty_kind.rs-4| ... | ... | @@ -65,10 +65,6 @@ pub enum AliasTyKind<I: Interner> { |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | impl<I: Interner> AliasTyKind<I> { |
| 68 | pub fn new_from_def_id(interner: I, def_id: I::DefId) -> Self { | |
| 69 | interner.alias_ty_kind_from_def_id(def_id) | |
| 70 | } | |
| 71 | ||
| 72 | 68 | pub fn descr(self) -> &'static str { |
| 73 | 69 | match self { |
| 74 | 70 | AliasTyKind::Projection { .. } => "associated type", |
library/alloc/src/collections/btree/map/entry.rs+71-5| ... | ... | @@ -165,9 +165,42 @@ impl<'a, K: Ord, V, A: Allocator + Clone> Entry<'a, K, V, A> { |
| 165 | 165 | /// ``` |
| 166 | 166 | #[stable(feature = "rust1", since = "1.0.0")] |
| 167 | 167 | pub fn or_insert_with<F: FnOnce() -> V>(self, default: F) -> &'a mut V { |
| 168 | self.or_try_insert_with(|| Result::<_, !>::Ok(default())).unwrap() | |
| 169 | } | |
| 170 | ||
| 171 | /// Ensures a value is in the entry by inserting the result of a fallible default function | |
| 172 | /// if empty, and returns a mutable reference to the value in the entry. | |
| 173 | /// | |
| 174 | /// This method works identically to [`or_insert_with`] except that the default function | |
| 175 | /// should return a `Result` and, in the case of an error, the error is propagated. | |
| 176 | /// | |
| 177 | /// [`or_insert_with`]: Self::or_insert_with | |
| 178 | /// | |
| 179 | /// # Examples | |
| 180 | /// | |
| 181 | /// ``` | |
| 182 | /// #![feature(try_entry)] | |
| 183 | /// # fn main() -> Result<(), std::num::ParseIntError> { | |
| 184 | /// use std::collections::BTreeMap; | |
| 185 | /// | |
| 186 | /// let mut map: BTreeMap<&str, usize> = BTreeMap::new(); | |
| 187 | /// let value = "42"; | |
| 188 | /// | |
| 189 | /// map.entry("poneyland").or_try_insert_with(|| value.parse())?; | |
| 190 | /// | |
| 191 | /// assert_eq!(map["poneyland"], 42); | |
| 192 | /// # Ok(()) | |
| 193 | /// # } | |
| 194 | /// ``` | |
| 195 | #[inline] | |
| 196 | #[unstable(feature = "try_entry", issue = "157354")] | |
| 197 | pub fn or_try_insert_with<F: FnOnce() -> Result<V, E>, E>( | |
| 198 | self, | |
| 199 | default: F, | |
| 200 | ) -> Result<&'a mut V, E> { | |
| 168 | 201 | match self { |
| 169 | Occupied(entry) => entry.into_mut(), | |
| 170 | Vacant(entry) => entry.insert(default()), | |
| 202 | Occupied(entry) => Ok(entry.into_mut()), | |
| 203 | Vacant(entry) => Ok(entry.insert(default()?)), | |
| 171 | 204 | } |
| 172 | 205 | } |
| 173 | 206 | |
| ... | ... | @@ -193,11 +226,44 @@ impl<'a, K: Ord, V, A: Allocator + Clone> Entry<'a, K, V, A> { |
| 193 | 226 | #[inline] |
| 194 | 227 | #[stable(feature = "or_insert_with_key", since = "1.50.0")] |
| 195 | 228 | pub fn or_insert_with_key<F: FnOnce(&K) -> V>(self, default: F) -> &'a mut V { |
| 229 | self.or_try_insert_with_key(|k| Result::<_, !>::Ok(default(k))).into_ok() | |
| 230 | } | |
| 231 | ||
| 232 | /// Ensures a value is in the entry by inserting, if empty, the result of the default function. | |
| 233 | /// This method allows for generating key-derived values for insertion by providing the default | |
| 234 | /// function a reference to the key that was moved during the `entry(key)` method call. | |
| 235 | /// | |
| 236 | /// This method works identically to [`or_insert_with_key`] except that the default function | |
| 237 | /// should return a `Result` and, in the case of an error, the error is propagated. | |
| 238 | /// | |
| 239 | /// [`or_insert_with_key`]: Self::or_insert_with_key | |
| 240 | /// | |
| 241 | /// # Examples | |
| 242 | /// | |
| 243 | /// ``` | |
| 244 | /// #![feature(try_entry)] | |
| 245 | /// # fn main() -> Result<(), std::num::ParseIntError> { | |
| 246 | /// use std::collections::BTreeMap; | |
| 247 | /// | |
| 248 | /// let mut map: BTreeMap<&str, usize> = BTreeMap::new(); | |
| 249 | /// | |
| 250 | /// map.entry("42").or_try_insert_with_key(|key| key.parse())?; | |
| 251 | /// | |
| 252 | /// assert_eq!(map["42"], 42); | |
| 253 | /// # Ok(()) | |
| 254 | /// # } | |
| 255 | /// ``` | |
| 256 | #[inline] | |
| 257 | #[unstable(feature = "try_entry", issue = "157354")] | |
| 258 | pub fn or_try_insert_with_key<F: FnOnce(&K) -> Result<V, E>, E>( | |
| 259 | self, | |
| 260 | default: F, | |
| 261 | ) -> Result<&'a mut V, E> { | |
| 196 | 262 | match self { |
| 197 | Occupied(entry) => entry.into_mut(), | |
| 263 | Occupied(entry) => Ok(entry.into_mut()), | |
| 198 | 264 | Vacant(entry) => { |
| 199 | let value = default(entry.key()); | |
| 200 | entry.insert(value) | |
| 265 | let value = default(entry.key())?; | |
| 266 | Ok(entry.insert(value)) | |
| 201 | 267 | } |
| 202 | 268 | } |
| 203 | 269 | } |
library/alloctests/lib.rs+1| ... | ... | @@ -51,6 +51,7 @@ |
| 51 | 51 | #![feature(trusted_random_access)] |
| 52 | 52 | #![feature(try_reserve_kind)] |
| 53 | 53 | #![feature(try_trait_v2)] |
| 54 | #![feature(unwrap_infallible)] | |
| 54 | 55 | #![feature(wtf8_internals)] |
| 55 | 56 | // tidy-alphabetical-end |
| 56 | 57 | // |
library/core/src/any.rs+4-4| ... | ... | @@ -785,9 +785,8 @@ impl TypeId { |
| 785 | 785 | /// ``` |
| 786 | 786 | #[unstable(feature = "type_info", issue = "146922")] |
| 787 | 787 | #[rustc_const_unstable(feature = "type_info", issue = "146922")] |
| 788 | pub const fn trait_info_of< | |
| 789 | T: ptr::Pointee<Metadata = ptr::DynMetadata<T>> + ?Sized + 'static, | |
| 790 | >( | |
| 788 | #[rustc_comptime] | |
| 789 | pub fn trait_info_of<T: ptr::Pointee<Metadata = ptr::DynMetadata<T>> + ?Sized + 'static>( | |
| 791 | 790 | self, |
| 792 | 791 | ) -> Option<TraitImpl<T>> { |
| 793 | 792 | // SAFETY: The vtable was obtained for `T`, so it is guaranteed to be `DynMetadata<T>`. |
| ... | ... | @@ -812,7 +811,8 @@ impl TypeId { |
| 812 | 811 | /// ``` |
| 813 | 812 | #[unstable(feature = "type_info", issue = "146922")] |
| 814 | 813 | #[rustc_const_unstable(feature = "type_info", issue = "146922")] |
| 815 | pub const fn trait_info_of_trait_type_id( | |
| 814 | #[rustc_comptime] | |
| 815 | pub fn trait_info_of_trait_type_id( | |
| 816 | 816 | self, |
| 817 | 817 | trait_represented_by_type_id: TypeId, |
| 818 | 818 | ) -> Option<TraitImpl<*const ()>> { |
library/core/src/char/methods.rs+272-119| ... | ... | @@ -5,7 +5,6 @@ use crate::panic::const_panic; |
| 5 | 5 | use crate::slice; |
| 6 | 6 | use crate::str::from_utf8_unchecked_mut; |
| 7 | 7 | use crate::ub_checks::assert_unsafe_precondition; |
| 8 | use crate::unicode::printable::is_printable; | |
| 9 | 8 | use crate::unicode::{self, conversions}; |
| 10 | 9 | |
| 11 | 10 | impl char { |
| ... | ... | @@ -93,13 +92,18 @@ impl char { |
| 93 | 92 | /// The version of [Unicode](https://www.unicode.org/) that the Unicode parts of |
| 94 | 93 | /// `char` and `str` methods are based on. |
| 95 | 94 | /// |
| 96 | /// New versions of Unicode are released regularly and subsequently all methods | |
| 97 | /// in the standard library depending on Unicode are updated. Therefore the | |
| 98 | /// behavior of some `char` and `str` methods and the value of this constant | |
| 99 | /// changes over time. This is *not* considered to be a breaking change. | |
| 95 | /// New versions of Unicode are released regularly, and subsequently all methods | |
| 96 | /// in the standard library depending on Unicode are updated. Therefore, the | |
| 97 | /// behavior of some `char` and `str` methods, and the value of this constant, | |
| 98 | /// change over time (within the boundaries of Unicode's [stability policies]). | |
| 99 | /// This is *not* considered to be a breaking change. | |
| 100 | /// | |
| 101 | /// [stability policies]: https://www.unicode.org/policies/stability_policy.html | |
| 100 | 102 | /// |
| 101 | 103 | /// The version numbering scheme is explained in |
| 102 | /// [Unicode 11.0 or later, Section 3.1 Versions of the Unicode Standard](https://www.unicode.org/versions/Unicode11.0.0/ch03.pdf#page=4). | |
| 104 | /// [Section 3.1 (Version Numbering)] of the Unicode Standard. | |
| 105 | /// | |
| 106 | /// [Section 3.1 (Version Numbering)]: https://www.unicode.org/versions/latest/core-spec/chapter-3/#G49512 | |
| 103 | 107 | #[stable(feature = "assoc_char_consts", since = "1.52.0")] |
| 104 | 108 | pub const UNICODE_VERSION: (u8, u8, u8) = crate::unicode::UNICODE_VERSION; |
| 105 | 109 | |
| ... | ... | @@ -473,18 +477,30 @@ impl char { |
| 473 | 477 | #[inline] |
| 474 | 478 | pub(crate) fn escape_debug_ext(self, args: EscapeDebugExtArgs) -> EscapeDebug { |
| 475 | 479 | match self { |
| 476 | '\0' => EscapeDebug::backslash(ascii::Char::Digit0), | |
| 477 | '\t' => EscapeDebug::backslash(ascii::Char::SmallT), | |
| 478 | '\r' => EscapeDebug::backslash(ascii::Char::SmallR), | |
| 479 | '\n' => EscapeDebug::backslash(ascii::Char::SmallN), | |
| 480 | '\\' => EscapeDebug::backslash(ascii::Char::ReverseSolidus), | |
| 480 | // Special escapes | |
| 481 | 481 | '\"' if args.escape_double_quote => EscapeDebug::backslash(ascii::Char::QuotationMark), |
| 482 | 482 | '\'' if args.escape_single_quote => EscapeDebug::backslash(ascii::Char::Apostrophe), |
| 483 | _ if args.escape_grapheme_extended && self.is_grapheme_extended() => { | |
| 483 | '\\' => EscapeDebug::backslash(ascii::Char::ReverseSolidus), | |
| 484 | '\n' => EscapeDebug::backslash(ascii::Char::SmallN), | |
| 485 | '\t' => EscapeDebug::backslash(ascii::Char::SmallT), | |
| 486 | '\r' => EscapeDebug::backslash(ascii::Char::SmallR), | |
| 487 | '\0' => EscapeDebug::backslash(ascii::Char::Digit0), | |
| 488 | ||
| 489 | // ASCII fast path | |
| 490 | '\x20'..='\x7E' => EscapeDebug::printable(self), | |
| 491 | ||
| 492 | _ if self.is_control() | |
| 493 | || self.is_private_use() | |
| 494 | || self.is_whitespace() | |
| 495 | || args.escape_grapheme_extender && self.is_grapheme_extender() | |
| 496 | || self.is_default_ignorable() | |
| 497 | || self.is_format_control() | |
| 498 | || self.is_unassigned() => | |
| 499 | { | |
| 484 | 500 | EscapeDebug::unicode(self) |
| 485 | 501 | } |
| 486 | _ if is_printable(self) => EscapeDebug::printable(self), | |
| 487 | _ => EscapeDebug::unicode(self), | |
| 502 | ||
| 503 | _ => EscapeDebug::printable(self), | |
| 488 | 504 | } |
| 489 | 505 | } |
| 490 | 506 | |
| ... | ... | @@ -753,11 +769,11 @@ impl char { |
| 753 | 769 | |
| 754 | 770 | /// Returns `true` if this `char` has the `Alphabetic` property. |
| 755 | 771 | /// |
| 756 | /// `Alphabetic` is described in Chapter 4 (Character Properties) of the [Unicode Standard] and | |
| 757 | /// specified in the [Unicode Character Database][ucd] [`DerivedCoreProperties.txt`]. | |
| 772 | /// `Alphabetic` is [described] in Chapter 4 (Character Properties) of the Unicode Standard, and | |
| 773 | /// [specified] in the Unicode Character Database [`DerivedCoreProperties.txt`]. | |
| 758 | 774 | /// |
| 759 | /// [Unicode Standard]: https://www.unicode.org/versions/latest/ | |
| 760 | /// [ucd]: https://www.unicode.org/reports/tr44/ | |
| 775 | /// [described]: https://www.unicode.org/versions/latest/core-spec/chapter-4/#G32524 | |
| 776 | /// [specified]: https://www.unicode.org/reports/tr44/#Alphabetic | |
| 761 | 777 | /// [`DerivedCoreProperties.txt`]: https://www.unicode.org/Public/UCD/latest/ucd/DerivedCoreProperties.txt |
| 762 | 778 | /// |
| 763 | 779 | /// # Examples |
| ... | ... | @@ -786,11 +802,11 @@ impl char { |
| 786 | 802 | /// Returns `true` if this `char` has the `Cased` property. |
| 787 | 803 | /// A character is cased if and only if it is uppercase, lowercase, or titlecase. |
| 788 | 804 | /// |
| 789 | /// `Cased` is described in Chapter 4 (Character Properties) of the [Unicode Standard] and | |
| 790 | /// specified in the [Unicode Character Database][ucd] [`DerivedCoreProperties.txt`]. | |
| 805 | /// `Cased` is [described] in Chapter 3 (Character Properties) of the Unicode Standard and | |
| 806 | /// [specified] in the Unicode Character Database [`DerivedCoreProperties.txt`]. | |
| 791 | 807 | /// |
| 792 | /// [Unicode Standard]: https://www.unicode.org/versions/latest/ | |
| 793 | /// [ucd]: https://www.unicode.org/reports/tr44/ | |
| 808 | /// [described]: https://www.unicode.org/versions/latest/core-spec/chapter-3/#G44595 | |
| 809 | /// [specified]: https://www.unicode.org/reports/tr44/#Cased | |
| 794 | 810 | /// [`DerivedCoreProperties.txt`]: https://www.unicode.org/Public/UCD/latest/ucd/DerivedCoreProperties.txt |
| 795 | 811 | /// |
| 796 | 812 | /// # Examples |
| ... | ... | @@ -849,11 +865,11 @@ impl char { |
| 849 | 865 | |
| 850 | 866 | /// Returns `true` if this `char` has the `Lowercase` property. |
| 851 | 867 | /// |
| 852 | /// `Lowercase` is described in Chapter 4 (Character Properties) of the [Unicode Standard] and | |
| 853 | /// specified in the [Unicode Character Database][ucd] [`DerivedCoreProperties.txt`]. | |
| 868 | /// `Lowercase` is [described] in Chapter 4 (Character Properties) of the Unicode Standard, and | |
| 869 | /// [specified] in the Unicode Character Database [`DerivedCoreProperties.txt`]. | |
| 854 | 870 | /// |
| 855 | /// [Unicode Standard]: https://www.unicode.org/versions/latest/ | |
| 856 | /// [ucd]: https://www.unicode.org/reports/tr44/ | |
| 871 | /// [described]: https://www.unicode.org/versions/latest/core-spec/chapter-4/#G136255 | |
| 872 | /// [specified]: https://www.unicode.org/reports/tr44/#Lowercase | |
| 857 | 873 | /// [`DerivedCoreProperties.txt`]: https://www.unicode.org/Public/UCD/latest/ucd/DerivedCoreProperties.txt |
| 858 | 874 | /// |
| 859 | 875 | /// # Examples |
| ... | ... | @@ -889,15 +905,15 @@ impl char { |
| 889 | 905 | } |
| 890 | 906 | } |
| 891 | 907 | |
| 892 | /// Returns `true` if this `char` has the general category for titlecase letters. | |
| 908 | /// Returns `true` if this `char` is in the general category for titlecase letters. | |
| 893 | 909 | /// Conceptually, these characters consist of an uppercase portion followed by a lowercase portion. |
| 894 | 910 | /// |
| 895 | /// Titlecase letters (code points with the general category of `Lt`) are described in Chapter 4 | |
| 896 | /// (Character Properties) of the [Unicode Standard] and specified in the [Unicode Character | |
| 897 | /// Database][ucd] [`UnicodeData.txt`]. | |
| 911 | /// Titlecase letters (code points with the general category of `Lt`) are [described] in Chapter 4 | |
| 912 | /// (Character Properties) of the Unicode Standard, and [specified] in the Unicode Character | |
| 913 | /// Database [`UnicodeData.txt`]. | |
| 898 | 914 | /// |
| 899 | /// [Unicode Standard]: https://www.unicode.org/versions/latest/ | |
| 900 | /// [ucd]: https://www.unicode.org/reports/tr44/ | |
| 915 | /// [described]: https://www.unicode.org/versions/latest/core-spec/chapter-4/#G124722 | |
| 916 | /// [specified]: https://www.unicode.org/reports/tr44/#GC_Values_Table | |
| 901 | 917 | /// [`UnicodeData.txt`]: https://www.unicode.org/Public/UCD/latest/ucd/UnicodeData.txt |
| 902 | 918 | /// |
| 903 | 919 | /// # Examples |
| ... | ... | @@ -925,11 +941,11 @@ impl char { |
| 925 | 941 | |
| 926 | 942 | /// Returns `true` if this `char` has the `Uppercase` property. |
| 927 | 943 | /// |
| 928 | /// `Uppercase` is described in Chapter 4 (Character Properties) of the [Unicode Standard] and | |
| 929 | /// specified in the [Unicode Character Database][ucd] [`DerivedCoreProperties.txt`]. | |
| 944 | /// `Uppercase` is [described] in Chapter 4 (Character Properties) of the Unicode Standard, and | |
| 945 | /// [specified] in the Unicode Character Database [`DerivedCoreProperties.txt`]. | |
| 930 | 946 | /// |
| 931 | /// [Unicode Standard]: https://www.unicode.org/versions/latest/ | |
| 932 | /// [ucd]: https://www.unicode.org/reports/tr44/ | |
| 947 | /// [described]: https://www.unicode.org/versions/latest/core-spec/chapter-4/#G136255 | |
| 948 | /// [specified]: https://www.unicode.org/reports/tr44/#Uppercase | |
| 933 | 949 | /// [`DerivedCoreProperties.txt`]: https://www.unicode.org/Public/UCD/latest/ucd/DerivedCoreProperties.txt |
| 934 | 950 | /// |
| 935 | 951 | /// # Examples |
| ... | ... | @@ -965,44 +981,54 @@ impl char { |
| 965 | 981 | } |
| 966 | 982 | } |
| 967 | 983 | |
| 968 | /// Returns `true` if this `char` has the `White_Space` property. | |
| 984 | /// Returns `true` if this `char` has one of the general categories for numbers. | |
| 969 | 985 | /// |
| 970 | /// `White_Space` is specified in the [Unicode Character Database][ucd] [`PropList.txt`]. | |
| 986 | /// The general categories for numbers (`Nd` for decimal digits, `Nl` for letter-like numeric | |
| 987 | /// characters, and `No` for other numeric characters) are [specified] in the Unicode Character | |
| 988 | /// Database [`UnicodeData.txt`]. | |
| 971 | 989 | /// |
| 972 | /// [ucd]: https://www.unicode.org/reports/tr44/ | |
| 973 | /// [`PropList.txt`]: https://www.unicode.org/Public/UCD/latest/ucd/PropList.txt | |
| 990 | /// This method doesn't cover everything that could be considered a number, e.g. ideographic numbers like '三'. | |
| 991 | /// If you want everything including characters with overlapping purposes, then you might want to use | |
| 992 | /// a Unicode or language-processing library that exposes the appropriate character properties | |
| 993 | /// (e.g. [`Numeric_Type`]) instead of looking at the Unicode categories. | |
| 994 | /// | |
| 995 | /// If you want to parse ASCII decimal digits (0-9) or ASCII base-N, use | |
| 996 | /// `is_ascii_digit` or `is_digit` instead. | |
| 997 | /// | |
| 998 | /// [specified]: https://www.unicode.org/reports/tr44/#GC_Values_Table | |
| 999 | /// [`UnicodeData.txt`]: https://www.unicode.org/Public/UCD/latest/ucd/UnicodeData.txt | |
| 1000 | /// [`Numeric_Type`]: https://www.unicode.org/reports/tr44/#Numeric_Type | |
| 974 | 1001 | /// |
| 975 | 1002 | /// # Examples |
| 976 | 1003 | /// |
| 977 | 1004 | /// Basic usage: |
| 978 | 1005 | /// |
| 979 | 1006 | /// ``` |
| 980 | /// assert!(' '.is_whitespace()); | |
| 981 | /// | |
| 982 | /// // line break | |
| 983 | /// assert!('\n'.is_whitespace()); | |
| 984 | /// | |
| 985 | /// // a non-breaking space | |
| 986 | /// assert!('\u{A0}'.is_whitespace()); | |
| 987 | /// | |
| 988 | /// assert!(!'越'.is_whitespace()); | |
| 1007 | /// assert!('٣'.is_numeric()); | |
| 1008 | /// assert!('7'.is_numeric()); | |
| 1009 | /// assert!('৬'.is_numeric()); | |
| 1010 | /// assert!('¾'.is_numeric()); | |
| 1011 | /// assert!('①'.is_numeric()); | |
| 1012 | /// assert!(!'K'.is_numeric()); | |
| 1013 | /// assert!(!'و'.is_numeric()); | |
| 1014 | /// assert!(!'藏'.is_numeric()); | |
| 1015 | /// assert!(!'三'.is_numeric()); | |
| 989 | 1016 | /// ``` |
| 990 | 1017 | #[must_use] |
| 991 | 1018 | #[stable(feature = "rust1", since = "1.0.0")] |
| 992 | #[rustc_const_stable(feature = "const_char_classify", since = "1.87.0")] | |
| 993 | 1019 | #[inline] |
| 994 | pub const fn is_whitespace(self) -> bool { | |
| 1020 | pub fn is_numeric(self) -> bool { | |
| 995 | 1021 | match self { |
| 996 | ' ' | '\x09'..='\x0d' => true, | |
| 997 | '\0'..='\u{84}' => false, | |
| 998 | _ => unicode::White_Space(self), | |
| 1022 | '0'..='9' => true, | |
| 1023 | '\0'..='\u{B1}' => false, | |
| 1024 | _ => unicode::N(self), | |
| 999 | 1025 | } |
| 1000 | 1026 | } |
| 1001 | 1027 | |
| 1002 | 1028 | /// Returns `true` if this `char` satisfies either [`is_alphabetic()`] or [`is_numeric()`]. |
| 1003 | 1029 | /// |
| 1004 | /// [`is_alphabetic()`]: #method.is_alphabetic | |
| 1005 | /// [`is_numeric()`]: #method.is_numeric | |
| 1030 | /// [`is_alphabetic()`]: Self::is_alphabetic | |
| 1031 | /// [`is_numeric()`]: Self::is_numeric | |
| 1006 | 1032 | /// |
| 1007 | 1033 | /// # Examples |
| 1008 | 1034 | /// |
| ... | ... | @@ -1029,14 +1055,49 @@ impl char { |
| 1029 | 1055 | } |
| 1030 | 1056 | } |
| 1031 | 1057 | |
| 1058 | /// Returns `true` if this `char` has the `White_Space` property. | |
| 1059 | /// | |
| 1060 | /// `White_Space` is [specified] in the Unicode Character Database [`PropList.txt`]. | |
| 1061 | /// | |
| 1062 | /// [specified]: https://www.unicode.org/reports/tr44/#White_Space | |
| 1063 | /// [`PropList.txt`]: https://www.unicode.org/Public/UCD/latest/ucd/PropList.txt | |
| 1064 | /// | |
| 1065 | /// # Examples | |
| 1066 | /// | |
| 1067 | /// Basic usage: | |
| 1068 | /// | |
| 1069 | /// ``` | |
| 1070 | /// assert!(' '.is_whitespace()); | |
| 1071 | /// | |
| 1072 | /// // line break | |
| 1073 | /// assert!('\n'.is_whitespace()); | |
| 1074 | /// | |
| 1075 | /// // a non-breaking space | |
| 1076 | /// assert!('\u{A0}'.is_whitespace()); | |
| 1077 | /// | |
| 1078 | /// assert!(!'越'.is_whitespace()); | |
| 1079 | /// ``` | |
| 1080 | #[must_use] | |
| 1081 | #[stable(feature = "rust1", since = "1.0.0")] | |
| 1082 | #[rustc_const_stable(feature = "const_char_classify", since = "1.87.0")] | |
| 1083 | #[inline] | |
| 1084 | pub const fn is_whitespace(self) -> bool { | |
| 1085 | match self { | |
| 1086 | ' ' | '\x09'..='\x0d' => true, | |
| 1087 | '\0'..='\u{84}' => false, | |
| 1088 | _ => unicode::White_Space(self), | |
| 1089 | } | |
| 1090 | } | |
| 1091 | ||
| 1032 | 1092 | /// Returns `true` if this `char` has the general category for control codes. |
| 1033 | 1093 | /// |
| 1034 | /// Control codes (code points with the general category of `Cc`) are described in Chapter 4 | |
| 1035 | /// (Character Properties) of the [Unicode Standard] and specified in the [Unicode Character | |
| 1036 | /// Database][ucd] [`UnicodeData.txt`]. | |
| 1094 | /// Control codes (code points with the general category of `Cc`) are [described] in Chapter 23 | |
| 1095 | /// (Special Areas and Format Characters) of the Unicode Standard, and [specified] in the Unicode Character | |
| 1096 | /// Database [`UnicodeData.txt`]. The full set of Unicode control codes is | |
| 1097 | /// `'\0'..='\x1f' | '\x7f'..='\u{9f}'`, and will never change. | |
| 1037 | 1098 | /// |
| 1038 | /// [Unicode Standard]: https://www.unicode.org/versions/latest/ | |
| 1039 | /// [ucd]: https://www.unicode.org/reports/tr44/ | |
| 1099 | /// [described]: https://www.unicode.org/versions/latest/core-spec/chapter-23/#G20365 | |
| 1100 | /// [specified]: https://www.unicode.org/reports/tr44/#GC_Values_Table | |
| 1040 | 1101 | /// [`UnicodeData.txt`]: https://www.unicode.org/Public/UCD/latest/ucd/UnicodeData.txt |
| 1041 | 1102 | /// |
| 1042 | 1103 | /// # Examples |
| ... | ... | @@ -1044,8 +1105,9 @@ impl char { |
| 1044 | 1105 | /// Basic usage: |
| 1045 | 1106 | /// |
| 1046 | 1107 | /// ``` |
| 1047 | /// // U+009C, STRING TERMINATOR | |
| 1048 | /// assert!(''.is_control()); | |
| 1108 | /// assert!('\t'.is_control()); | |
| 1109 | /// assert!('\n'.is_control()); | |
| 1110 | /// assert!('\u{9C}'.is_control()); // STRING TERMINATOR | |
| 1049 | 1111 | /// assert!(!'q'.is_control()); |
| 1050 | 1112 | /// ``` |
| 1051 | 1113 | #[must_use] |
| ... | ... | @@ -1060,85 +1122,176 @@ impl char { |
| 1060 | 1122 | matches!(self, '\0'..='\x1f' | '\x7f'..='\u{9f}') |
| 1061 | 1123 | } |
| 1062 | 1124 | |
| 1063 | /// Returns `true` if this `char` has the `Grapheme_Extend` property. | |
| 1125 | /// Returns `true` if this `char` has the general category for [private-use characters]. | |
| 1126 | /// These characters do not have an interpretation specified by Unicode; individual programs | |
| 1127 | /// and users are free to assign them whatever meaning they like. | |
| 1064 | 1128 | /// |
| 1065 | /// `Grapheme_Extend` is described in [Unicode Standard Annex #29 (Unicode Text | |
| 1066 | /// Segmentation)][uax29] and specified in the [Unicode Character Database][ucd] | |
| 1067 | /// [`DerivedCoreProperties.txt`]. | |
| 1129 | /// [private-use characters]: https://www.unicode.org/faq/private_use#private_use | |
| 1130 | /// | |
| 1131 | /// Private-use characters (code points with the general category of `Co`) are [described] in Chapter 23 | |
| 1132 | /// (Special Areas and Format Characters) of the Unicode Standard, and [specified] in the | |
| 1133 | /// Unicode Character Database [`UnicodeData.txt`]. The full set of private-use characters is | |
| 1134 | /// `'\u{E000}'..='\u{F8FF}' | '\u{F0000}'..='\u{FFFFD}' | '\u{100000}'..='\u{10FFFD}'`, | |
| 1135 | /// and will never change. | |
| 1136 | /// | |
| 1137 | /// [described]: https://www.unicode.org/versions/latest/core-spec/chapter-23/#G19184 | |
| 1138 | /// [specified]: https://www.unicode.org/reports/tr44/#GC_Values_Table | |
| 1139 | /// [`UnicodeData.txt`]: https://www.unicode.org/Public/UCD/latest/ucd/UnicodeData.txt | |
| 1068 | 1140 | /// |
| 1069 | /// [uax29]: https://www.unicode.org/reports/tr29/ | |
| 1070 | /// [ucd]: https://www.unicode.org/reports/tr44/ | |
| 1071 | /// [`DerivedCoreProperties.txt`]: https://www.unicode.org/Public/UCD/latest/ucd/DerivedCoreProperties.txt | |
| 1072 | 1141 | #[must_use] |
| 1073 | 1142 | #[inline] |
| 1074 | pub(crate) fn is_grapheme_extended(self) -> bool { | |
| 1075 | self > '\u{02FF}' && unicode::Grapheme_Extend(self) | |
| 1143 | const fn is_private_use(self) -> bool { | |
| 1144 | // According to | |
| 1145 | // https://www.unicode.org/policies/stability_policy.html#Property_Value, | |
| 1146 | // the set of codepoints in `Co` will never change. | |
| 1147 | // So we can just hard-code the patterns to match against instead of using a table. | |
| 1148 | matches!(self, '\u{E000}'..='\u{F8FF}' | '\u{F0000}'..='\u{FFFFD}' | '\u{100000}'..='\u{10FFFD}') | |
| 1076 | 1149 | } |
| 1077 | 1150 | |
| 1078 | /// Returns `true` if this `char` has the `Case_Ignorable` property. This narrow-use property | |
| 1079 | /// is used to implement context-dependent casing for the Greek letter sigma (uppercase 'Σ'), | |
| 1080 | /// which has two lowercase forms. | |
| 1151 | /// Returns `true` if this `char` has the general category for format control characters. | |
| 1081 | 1152 | /// |
| 1082 | /// `Case_Ignorable` is [described][D136] in Chapter 3 (Conformance) of the Unicode Core Specification, | |
| 1083 | /// and specified in the [Unicode Character Database][ucd] [`DerivedCoreProperties.txt`]. | |
| 1084 | /// See those resources, as well as [`to_lowercase()`]'s documentation, for more information. | |
| 1153 | /// Format controls (code points with the general category of `Cf`) are [described] in Chapter 4 | |
| 1154 | /// (Character Properties) of the Unicode Standard, and [specified] in the Unicode Character | |
| 1155 | /// Database [`UnicodeData.txt`]. | |
| 1085 | 1156 | /// |
| 1086 | /// [D136]: https://www.unicode.org/versions/latest/core-spec/chapter-3/#G63116 | |
| 1087 | /// [ucd]: https://www.unicode.org/reports/tr44/ | |
| 1088 | /// [`DerivedCoreProperties.txt`]: https://www.unicode.org/Public/UCD/latest/ucd/DerivedCoreProperties.txt | |
| 1089 | /// [`to_lowercase()`]: Self::to_lowercase() | |
| 1157 | /// [described]: https://www.unicode.org/versions/latest/core-spec/chapter-4/#G134153 | |
| 1158 | /// [specified]: https://www.unicode.org/reports/tr44/#GC_Values_Table | |
| 1159 | /// [`UnicodeData.txt`]: https://www.unicode.org/Public/UCD/latest/ucd/UnicodeData.txt | |
| 1160 | /// | |
| 1161 | /// # Examples | |
| 1162 | /// | |
| 1163 | /// Basic usage: | |
| 1164 | /// | |
| 1165 | /// ```ignore(private) | |
| 1166 | /// assert!('\u{AD}'.is_format_control()); // SOFT HYPHEN | |
| 1167 | /// assert!('\u{200B}'.is_format_control()); // ZERO WIDTH SPACE | |
| 1168 | /// assert!('\u{E0041}'.is_format_control()); // TAG LATIN CAPITAL LETTER A | |
| 1169 | /// assert!(''.is_format_control()); // ARABIC END OF AYAH | |
| 1170 | /// assert!(''.is_format_control()); // EGYPTIAN HIEROGLYPH INSERT AT TOP START | |
| 1171 | /// assert!(!'q'.is_format_control()); | |
| 1172 | /// ``` | |
| 1090 | 1173 | #[must_use] |
| 1091 | 1174 | #[inline] |
| 1092 | #[unstable(feature = "case_ignorable", issue = "154848")] | |
| 1093 | pub fn is_case_ignorable(self) -> bool { | |
| 1094 | if self.is_ascii() { | |
| 1095 | matches!(self, '\'' | '.' | ':' | '^' | '`') | |
| 1096 | } else { | |
| 1097 | unicode::Case_Ignorable(self) | |
| 1098 | } | |
| 1175 | fn is_format_control(self) -> bool { | |
| 1176 | self > '\u{AC}' && unicode::Cf(self) | |
| 1099 | 1177 | } |
| 1100 | 1178 | |
| 1101 | /// Returns `true` if this `char` has one of the general categories for numbers. | |
| 1179 | /// Returns `true` if this `char` has not yet been assigned a meaning by Unicode, as of | |
| 1180 | /// [`UNICODE_VERSION`]. | |
| 1102 | 1181 | /// |
| 1103 | /// The general categories for numbers (`Nd` for decimal digits, `Nl` for letter-like numeric | |
| 1104 | /// characters, and `No` for other numeric characters) are specified in the [Unicode Character | |
| 1105 | /// Database][ucd] [`UnicodeData.txt`]. | |
| 1182 | /// [`UNICODE_VERSION`]: Self::UNICODE_VERSION | |
| 1106 | 1183 | /// |
| 1107 | /// This method doesn't cover everything that could be considered a number, e.g. ideographic numbers like '三'. | |
| 1108 | /// If you want everything including characters with overlapping purposes then you might want to use | |
| 1109 | /// a unicode or language-processing library that exposes the appropriate character properties instead | |
| 1110 | /// of looking at the unicode categories. | |
| 1184 | /// These characters may have a meaning assigned in the future, | |
| 1185 | /// except for the 66 [noncharacters] which will never be assigned a meaning. | |
| 1111 | 1186 | /// |
| 1112 | /// If you want to parse ASCII decimal digits (0-9) or ASCII base-N, use | |
| 1113 | /// `is_ascii_digit` or `is_digit` instead. | |
| 1187 | /// [noncharacters]: https://www.unicode.org/faq/private_use#noncharacters | |
| 1114 | 1188 | /// |
| 1115 | /// [Unicode Standard]: https://www.unicode.org/versions/latest/ | |
| 1116 | /// [ucd]: https://www.unicode.org/reports/tr44/ | |
| 1189 | /// Many of Unicode's [stability policies] apply only to assigned characters. | |
| 1190 | /// | |
| 1191 | /// [stability policies]: https://www.unicode.org/policies/stability_policy.html | |
| 1192 | /// | |
| 1193 | /// Unassigned characters (code points with the general category of `Cn`) are [described] in Chapter 4 | |
| 1194 | /// (Character Properties) of the Unicode Standard, and [specified] in the Unicode Character Database | |
| 1195 | /// by their exclusion from [`UnicodeData.txt`]. | |
| 1196 | /// | |
| 1197 | /// [described]: https://www.unicode.org/versions/latest/core-spec/chapter-4/#G134153 | |
| 1198 | /// [specified]: https://www.unicode.org/reports/tr44/#GC_Values_Table | |
| 1117 | 1199 | /// [`UnicodeData.txt`]: https://www.unicode.org/Public/UCD/latest/ucd/UnicodeData.txt |
| 1118 | 1200 | /// |
| 1119 | 1201 | /// # Examples |
| 1120 | 1202 | /// |
| 1121 | 1203 | /// Basic usage: |
| 1122 | 1204 | /// |
| 1123 | /// ``` | |
| 1124 | /// assert!('٣'.is_numeric()); | |
| 1125 | /// assert!('7'.is_numeric()); | |
| 1126 | /// assert!('৬'.is_numeric()); | |
| 1127 | /// assert!('¾'.is_numeric()); | |
| 1128 | /// assert!('①'.is_numeric()); | |
| 1129 | /// assert!(!'K'.is_numeric()); | |
| 1130 | /// assert!(!'و'.is_numeric()); | |
| 1131 | /// assert!(!'藏'.is_numeric()); | |
| 1132 | /// assert!(!'三'.is_numeric()); | |
| 1205 | /// ```ignore(private) | |
| 1206 | /// assert!('\u{FFFE}'.is_unassigned()); // noncharacter, will never be assigned | |
| 1207 | /// | |
| 1208 | /// //assert!('\u{7AAAA}'.is_unassigned()); // not currently assigned, but may be in the future, | |
| 1209 | /// // so we shouldn't rely on the current status | |
| 1210 | /// | |
| 1211 | /// assert!(!'γ'.is_unassigned()); // once a character is assigned, it stays assigned forever | |
| 1133 | 1212 | /// ``` |
| 1134 | 1213 | #[must_use] |
| 1135 | #[stable(feature = "rust1", since = "1.0.0")] | |
| 1136 | 1214 | #[inline] |
| 1137 | pub fn is_numeric(self) -> bool { | |
| 1215 | fn is_unassigned(self) -> bool { | |
| 1138 | 1216 | match self { |
| 1139 | '0'..='9' => true, | |
| 1140 | '\0'..='\u{B1}' => false, | |
| 1141 | _ => unicode::N(self), | |
| 1217 | '\0'..='\u{377}' => false, | |
| 1218 | '\u{378}'..='\u{3FFFD}' => unicode::Cn_planes_0_3(self), | |
| 1219 | // Assigned character ranges in planes 4 and above. | |
| 1220 | // `src/tools/unicode-table-generator/src/main.rs` asserts that this is correct | |
| 1221 | '\u{E0001}' | |
| 1222 | | '\u{E0020}'..='\u{E007F}' | |
| 1223 | | '\u{E0100}'..='\u{E01EF}' | |
| 1224 | | '\u{F0000}'..='\u{FFFFD}' | |
| 1225 | | '\u{100000}'..='\u{10FFFD}' => false, | |
| 1226 | _ => true, | |
| 1227 | } | |
| 1228 | } | |
| 1229 | ||
| 1230 | /// Returns `true` if this `char` has the `Default_Ignorable_Code_Point` property. | |
| 1231 | /// These characters [should be displayed as invisible in fallback rendering](https://www.unicode.org/faq/unsup_char#3). | |
| 1232 | /// | |
| 1233 | /// `Default_Ignorable_Code_Point` is [described] in Chapter 5 (Implementation Guidelines) of the Unicode Standard, | |
| 1234 | /// and [specified] in the Unicode Character Database [`DerivedCoreProperties.txt`]. | |
| 1235 | /// | |
| 1236 | /// [described]: https://www.unicode.org/versions/latest/core-spec/chapter-5/#G40120 | |
| 1237 | /// [specified]: https://www.unicode.org/reports/tr44/#Default_Ignorable_Code_Point | |
| 1238 | /// [`DerivedCoreProperties.txt`]: https://www.unicode.org/Public/UCD/latest/ucd/DerivedCoreProperties.txt | |
| 1239 | /// | |
| 1240 | /// # Examples | |
| 1241 | /// | |
| 1242 | /// Basic usage: | |
| 1243 | /// | |
| 1244 | /// ```ignore(private) | |
| 1245 | /// assert!('\u{AD}'.is_default_ignorable()); // SOFT HYPHEN | |
| 1246 | /// assert!('\u{115F}'.is_default_ignorable()); // HANGUL CHOSEONG FILLER | |
| 1247 | /// assert!('\u{200B}'.is_default_ignorable()); // ZERO WIDTH SPACE | |
| 1248 | /// assert!('\u{E0041}'.is_default_ignorable()); // TAG LATIN CAPITAL LETTER A | |
| 1249 | /// assert!(!''.is_default_ignorable()); // ARABIC END OF AYAH | |
| 1250 | /// assert!(!''.is_default_ignorable()); // EGYPTIAN HIEROGLYPH INSERT AT TOP START | |
| 1251 | /// assert!(!' '.is_default_ignorable()); | |
| 1252 | /// assert!(!'\n'.is_default_ignorable()); | |
| 1253 | /// assert!(!'\0'.is_default_ignorable()); | |
| 1254 | /// assert!(!'q'.is_default_ignorable()); | |
| 1255 | #[must_use] | |
| 1256 | #[inline] | |
| 1257 | fn is_default_ignorable(self) -> bool { | |
| 1258 | self > '\u{AC}' && unicode::Default_Ignorable_Code_Point(self) | |
| 1259 | } | |
| 1260 | ||
| 1261 | /// Returns `true` if this `char` has the `Grapheme_Extend` property. | |
| 1262 | /// | |
| 1263 | /// `Grapheme_Extend` is [described] in Chapter 3 (Conformance) of the Unicode Standard, | |
| 1264 | /// and [specified] in the Unicode Character Database [`DerivedCoreProperties.txt`]. | |
| 1265 | /// | |
| 1266 | /// [described]: https://www.unicode.org/versions/latest/core-spec/chapter-3/#G41165 | |
| 1267 | /// [specified]: https://www.unicode.org/reports/tr44/#Grapheme_Extend | |
| 1268 | /// [`DerivedCoreProperties.txt`]: https://www.unicode.org/Public/UCD/latest/ucd/DerivedCoreProperties.txt | |
| 1269 | #[must_use] | |
| 1270 | #[inline] | |
| 1271 | fn is_grapheme_extender(self) -> bool { | |
| 1272 | self > '\u{02FF}' && unicode::Grapheme_Extend(self) | |
| 1273 | } | |
| 1274 | ||
| 1275 | /// Returns `true` if this `char` has the `Case_Ignorable` property. This narrow-use property | |
| 1276 | /// is used to implement context-dependent casing for the Greek letter sigma (uppercase 'Σ'), | |
| 1277 | /// which has two lowercase forms. | |
| 1278 | /// | |
| 1279 | /// `Case_Ignorable` is [described] in Chapter 3 (Conformance) of the Unicode Core Specification, | |
| 1280 | /// and [specified] in the Unicode Character Database [`DerivedCoreProperties.txt`]. | |
| 1281 | /// See those resources, as well as [`to_lowercase()`]'s documentation, for more information. | |
| 1282 | /// | |
| 1283 | /// [described]: https://www.unicode.org/versions/latest/core-spec/chapter-3/#G63116 | |
| 1284 | /// [specified]: https://www.unicode.org/reports/tr44/#Case_Ignorable | |
| 1285 | /// [`DerivedCoreProperties.txt`]: https://www.unicode.org/Public/UCD/latest/ucd/DerivedCoreProperties.txt | |
| 1286 | /// [`to_lowercase()`]: Self::to_lowercase() | |
| 1287 | #[must_use] | |
| 1288 | #[inline] | |
| 1289 | #[unstable(feature = "case_ignorable", issue = "154848")] | |
| 1290 | pub fn is_case_ignorable(self) -> bool { | |
| 1291 | if self.is_ascii() { | |
| 1292 | matches!(self, '\'' | '.' | ':' | '^' | '`') | |
| 1293 | } else { | |
| 1294 | unicode::Case_Ignorable(self) | |
| 1142 | 1295 | } |
| 1143 | 1296 | } |
| 1144 | 1297 | |
| ... | ... | @@ -2270,8 +2423,8 @@ impl char { |
| 2270 | 2423 | } |
| 2271 | 2424 | |
| 2272 | 2425 | pub(crate) struct EscapeDebugExtArgs { |
| 2273 | /// Escape Extended Grapheme codepoints? | |
| 2274 | pub(crate) escape_grapheme_extended: bool, | |
| 2426 | /// Escape Grapheme Extender codepoints? | |
| 2427 | pub(crate) escape_grapheme_extender: bool, | |
| 2275 | 2428 | |
| 2276 | 2429 | /// Escape single quotes? |
| 2277 | 2430 | pub(crate) escape_single_quote: bool, |
| ... | ... | @@ -2282,7 +2435,7 @@ pub(crate) struct EscapeDebugExtArgs { |
| 2282 | 2435 | |
| 2283 | 2436 | impl EscapeDebugExtArgs { |
| 2284 | 2437 | pub(crate) const ESCAPE_ALL: Self = Self { |
| 2285 | escape_grapheme_extended: true, | |
| 2438 | escape_grapheme_extender: true, | |
| 2286 | 2439 | escape_single_quote: true, |
| 2287 | 2440 | escape_double_quote: true, |
| 2288 | 2441 | }; |
library/core/src/fmt/mod.rs+2-2| ... | ... | @@ -2941,7 +2941,7 @@ impl Debug for str { |
| 2941 | 2941 | let mut chars = rest.chars(); |
| 2942 | 2942 | if let Some(c) = chars.next() { |
| 2943 | 2943 | let esc = c.escape_debug_ext(EscapeDebugExtArgs { |
| 2944 | escape_grapheme_extended: true, | |
| 2944 | escape_grapheme_extender: true, | |
| 2945 | 2945 | escape_single_quote: false, |
| 2946 | 2946 | escape_double_quote: true, |
| 2947 | 2947 | }); |
| ... | ... | @@ -2973,7 +2973,7 @@ impl Debug for char { |
| 2973 | 2973 | fn fmt(&self, f: &mut Formatter<'_>) -> Result { |
| 2974 | 2974 | f.write_char('\'')?; |
| 2975 | 2975 | let esc = self.escape_debug_ext(EscapeDebugExtArgs { |
| 2976 | escape_grapheme_extended: true, | |
| 2976 | escape_grapheme_extender: true, | |
| 2977 | 2977 | escape_single_quote: true, |
| 2978 | 2978 | escape_double_quote: false, |
| 2979 | 2979 | }); |
library/core/src/intrinsics/mod.rs+14-7| ... | ... | @@ -2874,11 +2874,12 @@ pub const unsafe fn size_of_val<T: ?Sized>(ptr: *const T) -> usize; |
| 2874 | 2874 | pub const unsafe fn align_of_val<T: ?Sized>(ptr: *const T) -> usize; |
| 2875 | 2875 | |
| 2876 | 2876 | #[rustc_intrinsic] |
| 2877 | #[rustc_comptime] | |
| 2877 | 2878 | #[unstable(feature = "core_intrinsics", issue = "none")] |
| 2878 | 2879 | /// Check if a type represented by a `TypeId` implements a trait represented by a `TypeId`. |
| 2879 | 2880 | /// It can only be called at compile time, the backends do |
| 2880 | 2881 | /// not implement it. If it implements the trait the dyn metadata gets returned for vtable access. |
| 2881 | pub const fn type_id_vtable( | |
| 2882 | pub fn type_id_vtable( | |
| 2882 | 2883 | _id: crate::any::TypeId, |
| 2883 | 2884 | _trait: crate::any::TypeId, |
| 2884 | 2885 | ) -> Option<ptr::DynMetadata<*const ()>> { |
| ... | ... | @@ -2922,7 +2923,8 @@ pub const fn type_name<T: ?Sized>() -> &'static str; |
| 2922 | 2923 | #[rustc_nounwind] |
| 2923 | 2924 | #[unstable(feature = "core_intrinsics", issue = "none")] |
| 2924 | 2925 | #[rustc_intrinsic] |
| 2925 | pub const fn type_id<T: ?Sized>() -> crate::any::TypeId; | |
| 2926 | #[rustc_comptime] | |
| 2927 | pub fn type_id<T: ?Sized>() -> crate::any::TypeId; | |
| 2926 | 2928 | |
| 2927 | 2929 | /// Tests (at compile-time) if two [`crate::any::TypeId`] instances identify the |
| 2928 | 2930 | /// same type. This is necessary because at const-eval time the actual discriminating |
| ... | ... | @@ -2944,7 +2946,8 @@ pub const fn type_id_eq(a: crate::any::TypeId, b: crate::any::TypeId) -> bool { |
| 2944 | 2946 | /// The more user-friendly version of this intrinsic is [`core::any::TypeId::size`]. |
| 2945 | 2947 | #[rustc_intrinsic] |
| 2946 | 2948 | #[unstable(feature = "core_intrinsics", issue = "none")] |
| 2947 | pub const fn size_of_type_id(_id: crate::any::TypeId) -> Option<usize> { | |
| 2949 | #[rustc_comptime] | |
| 2950 | pub fn size_of_type_id(_id: crate::any::TypeId) -> Option<usize> { | |
| 2948 | 2951 | panic!("`TypeId::size` can only be called at compile-time") |
| 2949 | 2952 | } |
| 2950 | 2953 | |
| ... | ... | @@ -2953,7 +2956,8 @@ pub const fn size_of_type_id(_id: crate::any::TypeId) -> Option<usize> { |
| 2953 | 2956 | /// The more user-friendly version of this intrinsic is [`core::any::TypeId::variants`]. |
| 2954 | 2957 | #[rustc_intrinsic] |
| 2955 | 2958 | #[unstable(feature = "core_intrinsics", issue = "none")] |
| 2956 | pub const fn type_id_variants(_id: crate::any::TypeId) -> usize { | |
| 2959 | #[rustc_comptime] | |
| 2960 | pub fn type_id_variants(_id: crate::any::TypeId) -> usize { | |
| 2957 | 2961 | panic!("`TypeId::variants` can only be called at compile-time") |
| 2958 | 2962 | } |
| 2959 | 2963 | |
| ... | ... | @@ -2962,7 +2966,8 @@ pub const fn type_id_variants(_id: crate::any::TypeId) -> usize { |
| 2962 | 2966 | /// The more user-friendly version of this intrinsic is [`core::any::TypeId::fields`]. |
| 2963 | 2967 | #[rustc_intrinsic] |
| 2964 | 2968 | #[unstable(feature = "core_intrinsics", issue = "none")] |
| 2965 | pub const fn type_id_fields(_id: crate::any::TypeId, _variant_index: usize) -> usize { | |
| 2969 | #[rustc_comptime] | |
| 2970 | pub fn type_id_fields(_id: crate::any::TypeId, _variant_index: usize) -> usize { | |
| 2966 | 2971 | panic!("`TypeId::fields` can only be called at compile-time") |
| 2967 | 2972 | } |
| 2968 | 2973 | |
| ... | ... | @@ -2973,7 +2978,8 @@ pub const fn type_id_fields(_id: crate::any::TypeId, _variant_index: usize) -> u |
| 2973 | 2978 | /// [`FieldRepresentingType`]: crate::field::FieldRepresentingType |
| 2974 | 2979 | #[rustc_intrinsic] |
| 2975 | 2980 | #[unstable(feature = "core_intrinsics", issue = "none")] |
| 2976 | pub const fn type_id_field_representing_type( | |
| 2981 | #[rustc_comptime] | |
| 2982 | pub fn type_id_field_representing_type( | |
| 2977 | 2983 | _id: crate::any::TypeId, |
| 2978 | 2984 | _variant_index: usize, |
| 2979 | 2985 | _field_index: usize, |
| ... | ... | @@ -2988,7 +2994,8 @@ pub const fn type_id_field_representing_type( |
| 2988 | 2994 | /// [`FieldRepresentingType`]: crate::field::FieldRepresentingType |
| 2989 | 2995 | #[rustc_intrinsic] |
| 2990 | 2996 | #[unstable(feature = "core_intrinsics", issue = "none")] |
| 2991 | pub const fn field_representing_type_actual_type_id( | |
| 2997 | #[rustc_comptime] | |
| 2998 | pub fn field_representing_type_actual_type_id( | |
| 2992 | 2999 | _frt_type_id: crate::any::TypeId, |
| 2993 | 3000 | ) -> crate::any::TypeId { |
| 2994 | 3001 | panic!("`FieldId::type_id` can only be called at compile-time") |
library/core/src/mem/type_info.rs+10-5| ... | ... | @@ -374,7 +374,8 @@ impl TypeId { |
| 374 | 374 | /// ``` |
| 375 | 375 | #[unstable(feature = "type_info", issue = "146922")] |
| 376 | 376 | #[rustc_const_unstable(feature = "type_info", issue = "146922")] |
| 377 | pub const fn size(self) -> Option<usize> { | |
| 377 | #[rustc_comptime] | |
| 378 | pub fn size(self) -> Option<usize> { | |
| 378 | 379 | intrinsics::size_of_type_id(self) |
| 379 | 380 | } |
| 380 | 381 | |
| ... | ... | @@ -399,7 +400,8 @@ impl TypeId { |
| 399 | 400 | /// ``` |
| 400 | 401 | #[unstable(feature = "type_info", issue = "146922")] |
| 401 | 402 | #[rustc_const_unstable(feature = "type_info", issue = "146922")] |
| 402 | pub const fn variants(self) -> usize { | |
| 403 | #[rustc_comptime] | |
| 404 | pub fn variants(self) -> usize { | |
| 403 | 405 | intrinsics::type_id_variants(self) |
| 404 | 406 | } |
| 405 | 407 | |
| ... | ... | @@ -461,7 +463,8 @@ impl TypeId { |
| 461 | 463 | /// ``` |
| 462 | 464 | #[unstable(feature = "type_info", issue = "146922")] |
| 463 | 465 | #[rustc_const_unstable(feature = "type_info", issue = "146922")] |
| 464 | pub const fn fields(self, variant_index: usize) -> usize { | |
| 466 | #[rustc_comptime] | |
| 467 | pub fn fields(self, variant_index: usize) -> usize { | |
| 465 | 468 | intrinsics::type_id_fields(self, variant_index) |
| 466 | 469 | } |
| 467 | 470 | |
| ... | ... | @@ -527,7 +530,8 @@ impl TypeId { |
| 527 | 530 | /// ``` |
| 528 | 531 | #[unstable(feature = "type_info", issue = "146922")] |
| 529 | 532 | #[rustc_const_unstable(feature = "type_info", issue = "146922")] |
| 530 | pub const fn field(self, variant_index: usize, field_index: usize) -> FieldId { | |
| 533 | #[rustc_comptime] | |
| 534 | pub fn field(self, variant_index: usize, field_index: usize) -> FieldId { | |
| 531 | 535 | FieldId { |
| 532 | 536 | frt_type_id: intrinsics::type_id_field_representing_type( |
| 533 | 537 | self, |
| ... | ... | @@ -571,7 +575,8 @@ impl FieldId { |
| 571 | 575 | /// ``` |
| 572 | 576 | #[unstable(feature = "type_info", issue = "146922")] |
| 573 | 577 | #[rustc_const_unstable(feature = "type_info", issue = "146922")] |
| 574 | pub const fn type_id(self) -> TypeId { | |
| 578 | #[rustc_comptime] | |
| 579 | pub fn type_id(self) -> TypeId { | |
| 575 | 580 | intrinsics::field_representing_type_actual_type_id(self.frt_type_id) |
| 576 | 581 | } |
| 577 | 582 | } |
library/core/src/range.rs+8-12| ... | ... | @@ -20,9 +20,11 @@ use crate::hash::Hash; |
| 20 | 20 | |
| 21 | 21 | mod iter; |
| 22 | 22 | |
| 23 | #[unstable(feature = "new_range_api_legacy", issue = "125687")] | |
| 23 | #[stable(feature = "new_range_api_legacy", since = "CURRENT_RUSTC_VERSION")] | |
| 24 | 24 | pub mod legacy; |
| 25 | 25 | |
| 26 | use core::ops::Bound::{self, Excluded, Included, Unbounded}; | |
| 27 | ||
| 26 | 28 | #[doc(inline)] |
| 27 | 29 | #[stable(feature = "new_range_from_api", since = "1.96.0")] |
| 28 | 30 | pub use iter::RangeFromIter; |
| ... | ... | @@ -33,19 +35,13 @@ pub use iter::RangeInclusiveIter; |
| 33 | 35 | #[stable(feature = "new_range_api", since = "1.96.0")] |
| 34 | 36 | pub use iter::RangeIter; |
| 35 | 37 | |
| 36 | // FIXME(#125687): re-exports temporarily removed | |
| 37 | // Because re-exports of stable items (Bound, RangeBounds, RangeFull, RangeTo) | |
| 38 | // can't be made unstable. | |
| 39 | // | |
| 40 | // #[doc(inline)] | |
| 41 | // #[unstable(feature = "new_range_api", issue = "125687")] | |
| 42 | // pub use crate::iter::Step; | |
| 43 | // #[doc(inline)] | |
| 44 | // #[unstable(feature = "new_range_api", issue = "125687")] | |
| 45 | // pub use crate::ops::{Bound, IntoBounds, OneSidedRange, RangeBounds, RangeFull, RangeTo}; | |
| 46 | 38 | use crate::iter::Step; |
| 47 | use crate::ops::Bound::{self, Excluded, Included, Unbounded}; | |
| 39 | // FIXME(one_sided_range): These types should move into this module. | |
| 40 | // FIXME(range_into_bounds): Ditto. Also consider re-exporting `RangeBounds` and related. | |
| 48 | 41 | use crate::ops::{IntoBounds, OneSidedRange, OneSidedRangeBound, RangeBounds}; |
| 42 | #[doc(inline)] | |
| 43 | #[stable(feature = "new_range_api_exports", since = "CURRENT_RUSTC_VERSION")] | |
| 44 | pub use crate::ops::{RangeFull, RangeTo}; | |
| 49 | 45 | |
| 50 | 46 | /// A (half-open) range bounded inclusively below and exclusively above. |
| 51 | 47 | /// |
library/core/src/range/legacy.rs+1| ... | ... | @@ -7,4 +7,5 @@ |
| 7 | 7 | //! The types here are equivalent to those in [`core::ops`]. |
| 8 | 8 | |
| 9 | 9 | #[doc(inline)] |
| 10 | #[stable(feature = "new_range_api_legacy", since = "CURRENT_RUSTC_VERSION")] | |
| 10 | 11 | pub use crate::ops::{Range, RangeFrom, RangeInclusive, RangeToInclusive}; |
library/core/src/str/lossy.rs+1-1| ... | ... | @@ -123,7 +123,7 @@ impl fmt::Debug for Debug<'_> { |
| 123 | 123 | let mut from = 0; |
| 124 | 124 | for (i, c) in valid.char_indices() { |
| 125 | 125 | let esc = c.escape_debug_ext(EscapeDebugExtArgs { |
| 126 | escape_grapheme_extended: true, | |
| 126 | escape_grapheme_extender: true, | |
| 127 | 127 | escape_single_quote: false, |
| 128 | 128 | escape_double_quote: true, |
| 129 | 129 | }); |
library/core/src/str/mod.rs+1-1| ... | ... | @@ -3266,7 +3266,7 @@ impl_fn_for_zst! { |
| 3266 | 3266 | #[derive(Clone)] |
| 3267 | 3267 | struct CharEscapeDebugContinue impl Fn = |c: char| -> char::EscapeDebug { |
| 3268 | 3268 | c.escape_debug_ext(EscapeDebugExtArgs { |
| 3269 | escape_grapheme_extended: false, | |
| 3269 | escape_grapheme_extender: false, | |
| 3270 | 3270 | escape_single_quote: true, |
| 3271 | 3271 | escape_double_quote: true |
| 3272 | 3272 | }) |
library/core/src/unicode/mod.rs+10-4| ... | ... | @@ -9,6 +9,9 @@ pub use unicode_data::conversions; |
| 9 | 9 | #[rustfmt::skip] |
| 10 | 10 | pub(crate) use unicode_data::alphabetic::lookup as Alphabetic; |
| 11 | 11 | pub(crate) use unicode_data::case_ignorable::lookup as Case_Ignorable; |
| 12 | pub(crate) use unicode_data::cf::lookup as Cf; | |
| 13 | pub(crate) use unicode_data::cn_planes_0_3::lookup as Cn_planes_0_3; | |
| 14 | pub(crate) use unicode_data::default_ignorable_code_point::lookup as Default_Ignorable_Code_Point; | |
| 12 | 15 | pub(crate) use unicode_data::grapheme_extend::lookup as Grapheme_Extend; |
| 13 | 16 | pub(crate) use unicode_data::lowercase::lookup as Lowercase; |
| 14 | 17 | pub(crate) use unicode_data::lt::lookup as Lt; |
| ... | ... | @@ -16,8 +19,6 @@ pub(crate) use unicode_data::n::lookup as N; |
| 16 | 19 | pub(crate) use unicode_data::uppercase::lookup as Uppercase; |
| 17 | 20 | pub(crate) use unicode_data::white_space::lookup as White_Space; |
| 18 | 21 | |
| 19 | pub(crate) mod printable; | |
| 20 | ||
| 21 | 22 | #[allow(unreachable_pub)] |
| 22 | 23 | pub mod unicode_data; |
| 23 | 24 | |
| ... | ... | @@ -27,8 +28,13 @@ pub mod unicode_data; |
| 27 | 28 | /// New versions of Unicode are released regularly and subsequently all methods |
| 28 | 29 | /// in the standard library depending on Unicode are updated. Therefore the |
| 29 | 30 | /// behavior of some `char` and `str` methods and the value of this constant |
| 30 | /// changes over time. This is *not* considered to be a breaking change. | |
| 31 | /// changes over time, within the boundaries of Unicode's [stability policies]. | |
| 32 | /// This is *not* considered to be a breaking change. | |
| 33 | /// | |
| 34 | /// [stability policies]: https://www.unicode.org/policies/stability_policy.html | |
| 31 | 35 | /// |
| 32 | 36 | /// The version numbering scheme is explained in |
| 33 | /// [Unicode 11.0 or later, Section 3.1 Versions of the Unicode Standard](https://www.unicode.org/versions/Unicode11.0.0/ch03.pdf#page=4). | |
| 37 | /// [Section 3.1 (Version Numbering)] of the Unicode Standard. | |
| 38 | /// | |
| 39 | /// [Section 3.1 (Version Numbering)]: https://www.unicode.org/versions/latest/core-spec/chapter-3/#G49512 | |
| 34 | 40 | pub const UNICODE_VERSION: (u8, u8, u8) = unicode_data::UNICODE_VERSION; |
library/core/src/unicode/printable.py deleted-258| ... | ... | @@ -1,258 +0,0 @@ |
| 1 | #!/usr/bin/env python | |
| 2 | ||
| 3 | # This script uses the following Unicode tables: | |
| 4 | # - UnicodeData.txt | |
| 5 | ||
| 6 | ||
| 7 | from collections import namedtuple | |
| 8 | import csv | |
| 9 | import os | |
| 10 | import subprocess | |
| 11 | ||
| 12 | NUM_CODEPOINTS = 0x110000 | |
| 13 | ||
| 14 | ||
| 15 | def to_ranges(iter): | |
| 16 | current = None | |
| 17 | for i in iter: | |
| 18 | if current is None or i != current[1] or i in (0x10000, 0x20000): | |
| 19 | if current is not None: | |
| 20 | yield tuple(current) | |
| 21 | current = [i, i + 1] | |
| 22 | else: | |
| 23 | current[1] += 1 | |
| 24 | if current is not None: | |
| 25 | yield tuple(current) | |
| 26 | ||
| 27 | ||
| 28 | def get_escaped(codepoints): | |
| 29 | for c in codepoints: | |
| 30 | if (c.class_ or "Cn") in "Cc Cf Cs Co Cn Zl Zp Zs".split() and c.value != ord( | |
| 31 | " " | |
| 32 | ): | |
| 33 | yield c.value | |
| 34 | ||
| 35 | ||
| 36 | def get_file(f): | |
| 37 | try: | |
| 38 | return open(os.path.basename(f)) | |
| 39 | except FileNotFoundError: | |
| 40 | subprocess.run(["curl", "-O", f], check=True) | |
| 41 | return open(os.path.basename(f)) | |
| 42 | ||
| 43 | ||
| 44 | Codepoint = namedtuple("Codepoint", "value class_") | |
| 45 | ||
| 46 | ||
| 47 | def get_codepoints(f): | |
| 48 | r = csv.reader(f, delimiter=";") | |
| 49 | prev_codepoint = 0 | |
| 50 | class_first = None | |
| 51 | for row in r: | |
| 52 | codepoint = int(row[0], 16) | |
| 53 | name = row[1] | |
| 54 | class_ = row[2] | |
| 55 | ||
| 56 | if class_first is not None: | |
| 57 | if not name.endswith("Last>"): | |
| 58 | raise ValueError("Missing Last after First") | |
| 59 | ||
| 60 | for c in range(prev_codepoint + 1, codepoint): | |
| 61 | yield Codepoint(c, class_first) | |
| 62 | ||
| 63 | class_first = None | |
| 64 | if name.endswith("First>"): | |
| 65 | class_first = class_ | |
| 66 | ||
| 67 | yield Codepoint(codepoint, class_) | |
| 68 | prev_codepoint = codepoint | |
| 69 | ||
| 70 | if class_first is not None: | |
| 71 | raise ValueError("Missing Last after First") | |
| 72 | ||
| 73 | for c in range(prev_codepoint + 1, NUM_CODEPOINTS): | |
| 74 | yield Codepoint(c, None) | |
| 75 | ||
| 76 | ||
| 77 | def compress_singletons(singletons): | |
| 78 | uppers = [] # (upper, # items in lowers) | |
| 79 | lowers = [] | |
| 80 | ||
| 81 | for i in singletons: | |
| 82 | upper = i >> 8 | |
| 83 | lower = i & 0xFF | |
| 84 | if len(uppers) == 0 or uppers[-1][0] != upper: | |
| 85 | uppers.append((upper, 1)) | |
| 86 | else: | |
| 87 | upper, count = uppers[-1] | |
| 88 | uppers[-1] = upper, count + 1 | |
| 89 | lowers.append(lower) | |
| 90 | ||
| 91 | return uppers, lowers | |
| 92 | ||
| 93 | ||
| 94 | def compress_normal(normal): | |
| 95 | # lengths 0x00..0x7f are encoded as 00, 01, ..., 7e, 7f | |
| 96 | # lengths 0x80..0x7fff are encoded as 80 80, 80 81, ..., ff fe, ff ff | |
| 97 | compressed = [] # [truelen, (truelenaux), falselen, (falselenaux)] | |
| 98 | ||
| 99 | prev_start = 0 | |
| 100 | for start, count in normal: | |
| 101 | truelen = start - prev_start | |
| 102 | falselen = count | |
| 103 | prev_start = start + count | |
| 104 | ||
| 105 | assert truelen < 0x8000 and falselen < 0x8000 | |
| 106 | entry = [] | |
| 107 | if truelen > 0x7F: | |
| 108 | entry.append(0x80 | (truelen >> 8)) | |
| 109 | entry.append(truelen & 0xFF) | |
| 110 | else: | |
| 111 | entry.append(truelen & 0x7F) | |
| 112 | if falselen > 0x7F: | |
| 113 | entry.append(0x80 | (falselen >> 8)) | |
| 114 | entry.append(falselen & 0xFF) | |
| 115 | else: | |
| 116 | entry.append(falselen & 0x7F) | |
| 117 | ||
| 118 | compressed.append(entry) | |
| 119 | ||
| 120 | return compressed | |
| 121 | ||
| 122 | ||
| 123 | def print_singletons(uppers, lowers, uppersname, lowersname): | |
| 124 | print("#[rustfmt::skip]") | |
| 125 | print("const {}: &[(u8, u8)] = &[".format(uppersname)) | |
| 126 | for u, c in uppers: | |
| 127 | print(" ({:#04x}, {}),".format(u, c)) | |
| 128 | print("];") | |
| 129 | print("#[rustfmt::skip]") | |
| 130 | print("const {}: &[u8] = &[".format(lowersname)) | |
| 131 | for i in range(0, len(lowers), 8): | |
| 132 | print( | |
| 133 | " {}".format(" ".join("{:#04x},".format(x) for x in lowers[i : i + 8])) | |
| 134 | ) | |
| 135 | print("];") | |
| 136 | ||
| 137 | ||
| 138 | def print_normal(normal, normalname): | |
| 139 | print("#[rustfmt::skip]") | |
| 140 | print("const {}: &[u8] = &[".format(normalname)) | |
| 141 | for v in normal: | |
| 142 | print(" {}".format(" ".join("{:#04x},".format(i) for i in v))) | |
| 143 | print("];") | |
| 144 | ||
| 145 | ||
| 146 | def main(): | |
| 147 | file = get_file("https://www.unicode.org/Public/UNIDATA/UnicodeData.txt") | |
| 148 | ||
| 149 | codepoints = get_codepoints(file) | |
| 150 | ||
| 151 | CUTOFF = 0x10000 | |
| 152 | singletons0 = [] | |
| 153 | singletons1 = [] | |
| 154 | normal0 = [] | |
| 155 | normal1 = [] | |
| 156 | extra = [] | |
| 157 | ||
| 158 | for a, b in to_ranges(get_escaped(codepoints)): | |
| 159 | if a > 2 * CUTOFF: | |
| 160 | extra.append((a, b - a)) | |
| 161 | elif a == b - 1: | |
| 162 | if a & CUTOFF: | |
| 163 | singletons1.append(a & ~CUTOFF) | |
| 164 | else: | |
| 165 | singletons0.append(a) | |
| 166 | elif a == b - 2: | |
| 167 | if a & CUTOFF: | |
| 168 | singletons1.append(a & ~CUTOFF) | |
| 169 | singletons1.append((a + 1) & ~CUTOFF) | |
| 170 | else: | |
| 171 | singletons0.append(a) | |
| 172 | singletons0.append(a + 1) | |
| 173 | else: | |
| 174 | if a >= 2 * CUTOFF: | |
| 175 | extra.append((a, b - a)) | |
| 176 | elif a & CUTOFF: | |
| 177 | normal1.append((a & ~CUTOFF, b - a)) | |
| 178 | else: | |
| 179 | normal0.append((a, b - a)) | |
| 180 | ||
| 181 | singletons0u, singletons0l = compress_singletons(singletons0) | |
| 182 | singletons1u, singletons1l = compress_singletons(singletons1) | |
| 183 | normal0 = compress_normal(normal0) | |
| 184 | normal1 = compress_normal(normal1) | |
| 185 | ||
| 186 | print("""\ | |
| 187 | // NOTE: The following code was generated by "library/core/src/unicode/printable.py", | |
| 188 | // do not edit directly! | |
| 189 | ||
| 190 | fn check(x: u16, singletonuppers: &[(u8, u8)], singletonlowers: &[u8], normal: &[u8]) -> bool { | |
| 191 | let xupper = (x >> 8) as u8; | |
| 192 | let mut lowerstart = 0; | |
| 193 | for &(upper, lowercount) in singletonuppers { | |
| 194 | let lowerend = lowerstart + lowercount as usize; | |
| 195 | if xupper == upper { | |
| 196 | for &lower in &singletonlowers[lowerstart..lowerend] { | |
| 197 | if lower == x as u8 { | |
| 198 | return false; | |
| 199 | } | |
| 200 | } | |
| 201 | } else if xupper < upper { | |
| 202 | break; | |
| 203 | } | |
| 204 | lowerstart = lowerend; | |
| 205 | } | |
| 206 | ||
| 207 | let mut x = x as i32; | |
| 208 | let mut normal = normal.iter().cloned(); | |
| 209 | let mut current = true; | |
| 210 | while let Some(v) = normal.next() { | |
| 211 | let len = if v & 0x80 != 0 { | |
| 212 | ((v & 0x7f) as i32) << 8 | normal.next().unwrap() as i32 | |
| 213 | } else { | |
| 214 | v as i32 | |
| 215 | }; | |
| 216 | x -= len; | |
| 217 | if x < 0 { | |
| 218 | break; | |
| 219 | } | |
| 220 | current = !current; | |
| 221 | } | |
| 222 | current | |
| 223 | } | |
| 224 | ||
| 225 | pub(crate) fn is_printable(x: char) -> bool { | |
| 226 | let x = x as u32; | |
| 227 | let lower = x as u16; | |
| 228 | ||
| 229 | if x < 32 { | |
| 230 | // ASCII fast path | |
| 231 | false | |
| 232 | } else if x < 127 { | |
| 233 | // ASCII fast path | |
| 234 | true | |
| 235 | } else if x < 0x10000 { | |
| 236 | check(lower, SINGLETONS0U, SINGLETONS0L, NORMAL0) | |
| 237 | } else if x < 0x20000 { | |
| 238 | check(lower, SINGLETONS1U, SINGLETONS1L, NORMAL1) | |
| 239 | } else {\ | |
| 240 | """) | |
| 241 | for a, b in extra: | |
| 242 | print(" if 0x{:x} <= x && x < 0x{:x} {{".format(a, a + b)) | |
| 243 | print(" return false;") | |
| 244 | print(" }") | |
| 245 | print("""\ | |
| 246 | true | |
| 247 | } | |
| 248 | }\ | |
| 249 | """) | |
| 250 | print() | |
| 251 | print_singletons(singletons0u, singletons0l, "SINGLETONS0U", "SINGLETONS0L") | |
| 252 | print_singletons(singletons1u, singletons1l, "SINGLETONS1U", "SINGLETONS1L") | |
| 253 | print_normal(normal0, "NORMAL0") | |
| 254 | print_normal(normal1, "NORMAL1") | |
| 255 | ||
| 256 | ||
| 257 | if __name__ == "__main__": | |
| 258 | main() |
library/core/src/unicode/printable.rs deleted-608| ... | ... | @@ -1,608 +0,0 @@ |
| 1 | // NOTE: The following code was generated by "library/core/src/unicode/printable.py", | |
| 2 | // do not edit directly! | |
| 3 | ||
| 4 | fn check(x: u16, singletonuppers: &[(u8, u8)], singletonlowers: &[u8], normal: &[u8]) -> bool { | |
| 5 | let xupper = (x >> 8) as u8; | |
| 6 | let mut lowerstart = 0; | |
| 7 | for &(upper, lowercount) in singletonuppers { | |
| 8 | let lowerend = lowerstart + lowercount as usize; | |
| 9 | if xupper == upper { | |
| 10 | for &lower in &singletonlowers[lowerstart..lowerend] { | |
| 11 | if lower == x as u8 { | |
| 12 | return false; | |
| 13 | } | |
| 14 | } | |
| 15 | } else if xupper < upper { | |
| 16 | break; | |
| 17 | } | |
| 18 | lowerstart = lowerend; | |
| 19 | } | |
| 20 | ||
| 21 | let mut x = x as i32; | |
| 22 | let mut normal = normal.iter().cloned(); | |
| 23 | let mut current = true; | |
| 24 | while let Some(v) = normal.next() { | |
| 25 | let len = if v & 0x80 != 0 { | |
| 26 | ((v & 0x7f) as i32) << 8 | normal.next().unwrap() as i32 | |
| 27 | } else { | |
| 28 | v as i32 | |
| 29 | }; | |
| 30 | x -= len; | |
| 31 | if x < 0 { | |
| 32 | break; | |
| 33 | } | |
| 34 | current = !current; | |
| 35 | } | |
| 36 | current | |
| 37 | } | |
| 38 | ||
| 39 | pub(crate) fn is_printable(x: char) -> bool { | |
| 40 | let x = x as u32; | |
| 41 | let lower = x as u16; | |
| 42 | ||
| 43 | if x < 32 { | |
| 44 | // ASCII fast path | |
| 45 | false | |
| 46 | } else if x < 127 { | |
| 47 | // ASCII fast path | |
| 48 | true | |
| 49 | } else if x < 0x10000 { | |
| 50 | check(lower, SINGLETONS0U, SINGLETONS0L, NORMAL0) | |
| 51 | } else if x < 0x20000 { | |
| 52 | check(lower, SINGLETONS1U, SINGLETONS1L, NORMAL1) | |
| 53 | } else { | |
| 54 | if 0x2a6e0 <= x && x < 0x2a700 { | |
| 55 | return false; | |
| 56 | } | |
| 57 | if 0x2b81e <= x && x < 0x2b820 { | |
| 58 | return false; | |
| 59 | } | |
| 60 | if 0x2ceae <= x && x < 0x2ceb0 { | |
| 61 | return false; | |
| 62 | } | |
| 63 | if 0x2ebe1 <= x && x < 0x2ebf0 { | |
| 64 | return false; | |
| 65 | } | |
| 66 | if 0x2ee5e <= x && x < 0x2f800 { | |
| 67 | return false; | |
| 68 | } | |
| 69 | if 0x2fa1e <= x && x < 0x30000 { | |
| 70 | return false; | |
| 71 | } | |
| 72 | if 0x3134b <= x && x < 0x31350 { | |
| 73 | return false; | |
| 74 | } | |
| 75 | if 0x3347a <= x && x < 0xe0100 { | |
| 76 | return false; | |
| 77 | } | |
| 78 | if 0xe01f0 <= x && x < 0x110000 { | |
| 79 | return false; | |
| 80 | } | |
| 81 | true | |
| 82 | } | |
| 83 | } | |
| 84 | ||
| 85 | #[rustfmt::skip] | |
| 86 | const SINGLETONS0U: &[(u8, u8)] = &[ | |
| 87 | (0x00, 1), | |
| 88 | (0x03, 5), | |
| 89 | (0x05, 6), | |
| 90 | (0x06, 2), | |
| 91 | (0x07, 6), | |
| 92 | (0x08, 7), | |
| 93 | (0x09, 17), | |
| 94 | (0x0a, 28), | |
| 95 | (0x0b, 25), | |
| 96 | (0x0c, 25), | |
| 97 | (0x0d, 16), | |
| 98 | (0x0e, 12), | |
| 99 | (0x0f, 4), | |
| 100 | (0x10, 3), | |
| 101 | (0x12, 18), | |
| 102 | (0x13, 9), | |
| 103 | (0x16, 1), | |
| 104 | (0x17, 4), | |
| 105 | (0x18, 1), | |
| 106 | (0x19, 3), | |
| 107 | (0x1a, 9), | |
| 108 | (0x1b, 1), | |
| 109 | (0x1c, 2), | |
| 110 | (0x1f, 22), | |
| 111 | (0x20, 3), | |
| 112 | (0x2b, 2), | |
| 113 | (0x2d, 11), | |
| 114 | (0x2e, 1), | |
| 115 | (0x30, 4), | |
| 116 | (0x31, 2), | |
| 117 | (0x32, 1), | |
| 118 | (0xa9, 2), | |
| 119 | (0xaa, 4), | |
| 120 | (0xab, 8), | |
| 121 | (0xfa, 2), | |
| 122 | (0xfb, 5), | |
| 123 | (0xfe, 3), | |
| 124 | (0xff, 9), | |
| 125 | ]; | |
| 126 | #[rustfmt::skip] | |
| 127 | const SINGLETONS0L: &[u8] = &[ | |
| 128 | 0xad, 0x78, 0x79, 0x8b, 0x8d, 0xa2, 0x30, 0x57, | |
| 129 | 0x58, 0x8b, 0x8c, 0x90, 0x1c, 0xdd, 0x0e, 0x0f, | |
| 130 | 0x4b, 0x4c, 0xfb, 0xfc, 0x2e, 0x2f, 0x3f, 0x5c, | |
| 131 | 0x5d, 0x5f, 0xe2, 0x84, 0x8d, 0x8e, 0x91, 0x92, | |
| 132 | 0xa9, 0xb1, 0xba, 0xbb, 0xc5, 0xc6, 0xc9, 0xca, | |
| 133 | 0xde, 0xe4, 0xe5, 0xff, 0x00, 0x04, 0x11, 0x12, | |
| 134 | 0x29, 0x31, 0x34, 0x37, 0x3a, 0x3b, 0x3d, 0x49, | |
| 135 | 0x4a, 0x5d, 0x84, 0x8e, 0x92, 0xa9, 0xb1, 0xb4, | |
| 136 | 0xba, 0xbb, 0xc6, 0xca, 0xce, 0xcf, 0xe4, 0xe5, | |
| 137 | 0x00, 0x04, 0x0d, 0x0e, 0x11, 0x12, 0x29, 0x31, | |
| 138 | 0x34, 0x3a, 0x3b, 0x45, 0x46, 0x49, 0x4a, 0x5e, | |
| 139 | 0x64, 0x65, 0x84, 0x91, 0x9b, 0x9d, 0xc9, 0xce, | |
| 140 | 0xcf, 0x0d, 0x11, 0x29, 0x3a, 0x3b, 0x45, 0x49, | |
| 141 | 0x57, 0x5b, 0x5e, 0x5f, 0x64, 0x65, 0x8d, 0x91, | |
| 142 | 0xa9, 0xb4, 0xba, 0xbb, 0xc5, 0xc9, 0xdf, 0xe4, | |
| 143 | 0xe5, 0xf0, 0x0d, 0x11, 0x45, 0x49, 0x64, 0x65, | |
| 144 | 0x80, 0x84, 0xb2, 0xbc, 0xbe, 0xbf, 0xd5, 0xd7, | |
| 145 | 0xf0, 0xf1, 0x83, 0x85, 0x8b, 0xa4, 0xa6, 0xbe, | |
| 146 | 0xbf, 0xc5, 0xc7, 0xcf, 0xda, 0xdb, 0x48, 0x98, | |
| 147 | 0xbd, 0xcd, 0xc6, 0xce, 0xcf, 0x49, 0x4e, 0x4f, | |
| 148 | 0x57, 0x59, 0x5e, 0x5f, 0x89, 0x8e, 0x8f, 0xb1, | |
| 149 | 0xb6, 0xb7, 0xbf, 0xc1, 0xc6, 0xc7, 0xd7, 0x11, | |
| 150 | 0x16, 0x17, 0x5b, 0x5c, 0xf6, 0xf7, 0xfe, 0xff, | |
| 151 | 0x80, 0x6d, 0x71, 0xde, 0xdf, 0x0e, 0x1f, 0x6e, | |
| 152 | 0x6f, 0x1c, 0x1d, 0x5f, 0x7d, 0x7e, 0xae, 0xaf, | |
| 153 | 0xde, 0xdf, 0x4d, 0xbb, 0xbc, 0x16, 0x17, 0x1e, | |
| 154 | 0x1f, 0x46, 0x47, 0x4e, 0x4f, 0x58, 0x5a, 0x5c, | |
| 155 | 0x5e, 0x7e, 0x7f, 0xb5, 0xc5, 0xd4, 0xd5, 0xdc, | |
| 156 | 0xf0, 0xf1, 0xf5, 0x72, 0x73, 0x8f, 0x74, 0x75, | |
| 157 | 0x26, 0x2e, 0x2f, 0xa7, 0xaf, 0xb7, 0xbf, 0xc7, | |
| 158 | 0xcf, 0xd7, 0xdf, 0x9a, 0x00, 0x40, 0x97, 0x98, | |
| 159 | 0x30, 0x8f, 0x1f, 0xce, 0xff, 0x4e, 0x4f, 0x5a, | |
| 160 | 0x5b, 0x07, 0x08, 0x0f, 0x10, 0x27, 0x2f, 0xee, | |
| 161 | 0xef, 0x6e, 0x6f, 0x37, 0x3d, 0x3f, 0x42, 0x45, | |
| 162 | 0x53, 0x67, 0x75, 0xc8, 0xc9, 0xd0, 0xd1, 0xd8, | |
| 163 | 0xd9, 0xe7, 0xfe, 0xff, | |
| 164 | ]; | |
| 165 | #[rustfmt::skip] | |
| 166 | const SINGLETONS1U: &[(u8, u8)] = &[ | |
| 167 | (0x00, 6), | |
| 168 | (0x01, 1), | |
| 169 | (0x03, 1), | |
| 170 | (0x04, 2), | |
| 171 | (0x05, 7), | |
| 172 | (0x07, 2), | |
| 173 | (0x08, 8), | |
| 174 | (0x09, 2), | |
| 175 | (0x0a, 5), | |
| 176 | (0x0b, 2), | |
| 177 | (0x0e, 4), | |
| 178 | (0x10, 1), | |
| 179 | (0x11, 2), | |
| 180 | (0x12, 5), | |
| 181 | (0x13, 28), | |
| 182 | (0x14, 1), | |
| 183 | (0x15, 2), | |
| 184 | (0x17, 2), | |
| 185 | (0x19, 13), | |
| 186 | (0x1c, 5), | |
| 187 | (0x1d, 8), | |
| 188 | (0x1f, 1), | |
| 189 | (0x24, 1), | |
| 190 | (0x6a, 4), | |
| 191 | (0x6b, 2), | |
| 192 | (0x6e, 2), | |
| 193 | (0xaf, 3), | |
| 194 | (0xb1, 2), | |
| 195 | (0xbc, 2), | |
| 196 | (0xcf, 2), | |
| 197 | (0xd1, 2), | |
| 198 | (0xd4, 12), | |
| 199 | (0xd5, 9), | |
| 200 | (0xd6, 2), | |
| 201 | (0xd7, 2), | |
| 202 | (0xda, 1), | |
| 203 | (0xe0, 5), | |
| 204 | (0xe1, 2), | |
| 205 | (0xe6, 1), | |
| 206 | (0xe7, 4), | |
| 207 | (0xe8, 2), | |
| 208 | (0xee, 32), | |
| 209 | (0xf0, 4), | |
| 210 | (0xf8, 2), | |
| 211 | (0xfa, 5), | |
| 212 | (0xfb, 1), | |
| 213 | ]; | |
| 214 | #[rustfmt::skip] | |
| 215 | const SINGLETONS1L: &[u8] = &[ | |
| 216 | 0x0c, 0x27, 0x3b, 0x3e, 0x4e, 0x4f, 0x8f, 0x9e, | |
| 217 | 0x9e, 0x9f, 0x7b, 0x8b, 0x93, 0x96, 0xa2, 0xb2, | |
| 218 | 0xba, 0x86, 0xb1, 0x06, 0x07, 0x09, 0x36, 0x3d, | |
| 219 | 0x3e, 0x56, 0xf3, 0xd0, 0xd1, 0x04, 0x14, 0x18, | |
| 220 | 0x36, 0x37, 0x56, 0x57, 0x7f, 0xaa, 0xae, 0xaf, | |
| 221 | 0xbd, 0x35, 0xe0, 0x12, 0x87, 0x89, 0x8e, 0x9e, | |
| 222 | 0x04, 0x0d, 0x0e, 0x11, 0x12, 0x29, 0x31, 0x34, | |
| 223 | 0x3a, 0x45, 0x46, 0x49, 0x4a, 0x4e, 0x4f, 0x64, | |
| 224 | 0x65, 0x8a, 0x8c, 0x8d, 0x8f, 0xb6, 0xc1, 0xc3, | |
| 225 | 0xc4, 0xc6, 0xcb, 0xd6, 0x5c, 0xb6, 0xb7, 0x1b, | |
| 226 | 0x1c, 0x07, 0x08, 0x0a, 0x0b, 0x14, 0x17, 0x36, | |
| 227 | 0x39, 0x3a, 0xa8, 0xa9, 0xd8, 0xd9, 0x09, 0x37, | |
| 228 | 0x90, 0x91, 0xa8, 0x07, 0x0a, 0x3b, 0x3e, 0x66, | |
| 229 | 0x69, 0x8f, 0x92, 0x11, 0x6f, 0x5f, 0xbf, 0xee, | |
| 230 | 0xef, 0x5a, 0x62, 0xb9, 0xba, 0xf4, 0xfc, 0xff, | |
| 231 | 0x53, 0x54, 0x9a, 0x9b, 0x2e, 0x2f, 0x27, 0x28, | |
| 232 | 0x55, 0x9d, 0xa0, 0xa1, 0xa3, 0xa4, 0xa7, 0xa8, | |
| 233 | 0xad, 0xba, 0xbc, 0xc4, 0x06, 0x0b, 0x0c, 0x15, | |
| 234 | 0x1d, 0x3a, 0x3f, 0x45, 0x51, 0xa6, 0xa7, 0xcc, | |
| 235 | 0xcd, 0xa0, 0x07, 0x19, 0x1a, 0x22, 0x25, 0x3e, | |
| 236 | 0x3f, 0xdf, 0xe7, 0xec, 0xef, 0xff, 0xc5, 0xc6, | |
| 237 | 0x04, 0x20, 0x23, 0x25, 0x26, 0x28, 0x33, 0x38, | |
| 238 | 0x3a, 0x48, 0x4a, 0x4c, 0x50, 0x53, 0x55, 0x56, | |
| 239 | 0x58, 0x5a, 0x5c, 0x5e, 0x60, 0x63, 0x65, 0x66, | |
| 240 | 0x6b, 0x73, 0x78, 0x7d, 0x7f, 0x8a, 0xa4, 0xaa, | |
| 241 | 0xaf, 0xb0, 0xc0, 0xd0, 0xae, 0xaf, 0x6e, 0x6f, | |
| 242 | 0xc7, 0xdd, 0xde, 0x93, | |
| 243 | ]; | |
| 244 | #[rustfmt::skip] | |
| 245 | const NORMAL0: &[u8] = &[ | |
| 246 | 0x00, 0x20, | |
| 247 | 0x5f, 0x22, | |
| 248 | 0x82, 0xdf, 0x04, | |
| 249 | 0x82, 0x44, 0x08, | |
| 250 | 0x1b, 0x04, | |
| 251 | 0x06, 0x11, | |
| 252 | 0x81, 0xac, 0x0e, | |
| 253 | 0x80, 0xab, 0x05, | |
| 254 | 0x20, 0x07, | |
| 255 | 0x81, 0x1c, 0x03, | |
| 256 | 0x19, 0x08, | |
| 257 | 0x01, 0x04, | |
| 258 | 0x2f, 0x04, | |
| 259 | 0x34, 0x04, | |
| 260 | 0x07, 0x03, | |
| 261 | 0x01, 0x07, | |
| 262 | 0x06, 0x07, | |
| 263 | 0x11, 0x0a, | |
| 264 | 0x50, 0x0f, | |
| 265 | 0x12, 0x07, | |
| 266 | 0x55, 0x07, | |
| 267 | 0x03, 0x04, | |
| 268 | 0x1c, 0x0a, | |
| 269 | 0x09, 0x03, | |
| 270 | 0x08, 0x03, | |
| 271 | 0x07, 0x03, | |
| 272 | 0x02, 0x03, | |
| 273 | 0x03, 0x03, | |
| 274 | 0x0c, 0x04, | |
| 275 | 0x05, 0x03, | |
| 276 | 0x0b, 0x06, | |
| 277 | 0x01, 0x0e, | |
| 278 | 0x15, 0x05, | |
| 279 | 0x4e, 0x07, | |
| 280 | 0x1b, 0x07, | |
| 281 | 0x57, 0x07, | |
| 282 | 0x02, 0x05, | |
| 283 | 0x18, 0x0c, | |
| 284 | 0x50, 0x04, | |
| 285 | 0x43, 0x03, | |
| 286 | 0x2d, 0x03, | |
| 287 | 0x01, 0x04, | |
| 288 | 0x11, 0x06, | |
| 289 | 0x0f, 0x0c, | |
| 290 | 0x3a, 0x04, | |
| 291 | 0x1d, 0x25, | |
| 292 | 0x5f, 0x20, | |
| 293 | 0x6d, 0x04, | |
| 294 | 0x6a, 0x25, | |
| 295 | 0x80, 0xc8, 0x05, | |
| 296 | 0x82, 0xb0, 0x03, | |
| 297 | 0x1a, 0x06, | |
| 298 | 0x82, 0xfd, 0x03, | |
| 299 | 0x59, 0x07, | |
| 300 | 0x16, 0x09, | |
| 301 | 0x18, 0x09, | |
| 302 | 0x14, 0x0c, | |
| 303 | 0x14, 0x0c, | |
| 304 | 0x6a, 0x06, | |
| 305 | 0x0a, 0x06, | |
| 306 | 0x1a, 0x06, | |
| 307 | 0x59, 0x07, | |
| 308 | 0x2b, 0x05, | |
| 309 | 0x46, 0x0a, | |
| 310 | 0x2c, 0x04, | |
| 311 | 0x0c, 0x04, | |
| 312 | 0x01, 0x03, | |
| 313 | 0x31, 0x0b, | |
| 314 | 0x2c, 0x04, | |
| 315 | 0x1a, 0x06, | |
| 316 | 0x0b, 0x03, | |
| 317 | 0x80, 0xac, 0x06, | |
| 318 | 0x0a, 0x06, | |
| 319 | 0x4c, 0x14, | |
| 320 | 0x80, 0xf4, 0x08, | |
| 321 | 0x3c, 0x03, | |
| 322 | 0x0f, 0x03, | |
| 323 | 0x3e, 0x05, | |
| 324 | 0x38, 0x08, | |
| 325 | 0x2b, 0x05, | |
| 326 | 0x82, 0xff, 0x11, | |
| 327 | 0x18, 0x08, | |
| 328 | 0x2f, 0x11, | |
| 329 | 0x2d, 0x03, | |
| 330 | 0x22, 0x0e, | |
| 331 | 0x21, 0x0f, | |
| 332 | 0x80, 0x8c, 0x04, | |
| 333 | 0x82, 0x9a, 0x16, | |
| 334 | 0x0b, 0x15, | |
| 335 | 0x88, 0x94, 0x05, | |
| 336 | 0x2f, 0x05, | |
| 337 | 0x3b, 0x07, | |
| 338 | 0x02, 0x0e, | |
| 339 | 0x18, 0x09, | |
| 340 | 0x80, 0xbe, 0x22, | |
| 341 | 0x74, 0x0c, | |
| 342 | 0x80, 0xd6, 0x1a, | |
| 343 | 0x81, 0x10, 0x05, | |
| 344 | 0x80, 0xe1, 0x09, | |
| 345 | 0xf2, 0x9e, 0x03, | |
| 346 | 0x37, 0x09, | |
| 347 | 0x81, 0x5c, 0x14, | |
| 348 | 0x80, 0xb8, 0x08, | |
| 349 | 0x80, 0xdd, 0x14, | |
| 350 | 0x3c, 0x03, | |
| 351 | 0x0a, 0x06, | |
| 352 | 0x38, 0x08, | |
| 353 | 0x46, 0x08, | |
| 354 | 0x0c, 0x06, | |
| 355 | 0x74, 0x0b, | |
| 356 | 0x1e, 0x03, | |
| 357 | 0x5a, 0x04, | |
| 358 | 0x59, 0x09, | |
| 359 | 0x80, 0x83, 0x18, | |
| 360 | 0x1c, 0x0a, | |
| 361 | 0x16, 0x09, | |
| 362 | 0x4c, 0x04, | |
| 363 | 0x80, 0x8a, 0x06, | |
| 364 | 0xab, 0xa4, 0x0c, | |
| 365 | 0x17, 0x04, | |
| 366 | 0x31, 0xa1, 0x04, | |
| 367 | 0x81, 0xda, 0x26, | |
| 368 | 0x07, 0x0c, | |
| 369 | 0x05, 0x05, | |
| 370 | 0x82, 0xb3, 0x20, | |
| 371 | 0x2a, 0x06, | |
| 372 | 0x4c, 0x04, | |
| 373 | 0x80, 0x8d, 0x04, | |
| 374 | 0x80, 0xbe, 0x03, | |
| 375 | 0x1b, 0x03, | |
| 376 | 0x0f, 0x0d, | |
| 377 | ]; | |
| 378 | #[rustfmt::skip] | |
| 379 | const NORMAL1: &[u8] = &[ | |
| 380 | 0x5e, 0x22, | |
| 381 | 0x7b, 0x05, | |
| 382 | 0x03, 0x04, | |
| 383 | 0x2d, 0x03, | |
| 384 | 0x66, 0x03, | |
| 385 | 0x01, 0x2f, | |
| 386 | 0x2e, 0x80, 0x82, | |
| 387 | 0x1d, 0x03, | |
| 388 | 0x31, 0x0f, | |
| 389 | 0x1c, 0x04, | |
| 390 | 0x24, 0x09, | |
| 391 | 0x1e, 0x05, | |
| 392 | 0x2b, 0x05, | |
| 393 | 0x44, 0x04, | |
| 394 | 0x0e, 0x2a, | |
| 395 | 0x80, 0xaa, 0x06, | |
| 396 | 0x24, 0x04, | |
| 397 | 0x24, 0x04, | |
| 398 | 0x28, 0x08, | |
| 399 | 0x34, 0x0b, | |
| 400 | 0x4e, 0x03, | |
| 401 | 0x34, 0x0c, | |
| 402 | 0x81, 0x37, 0x09, | |
| 403 | 0x16, 0x0a, | |
| 404 | 0x08, 0x18, | |
| 405 | 0x3b, 0x45, | |
| 406 | 0x39, 0x03, | |
| 407 | 0x63, 0x08, | |
| 408 | 0x09, 0x30, | |
| 409 | 0x16, 0x05, | |
| 410 | 0x21, 0x03, | |
| 411 | 0x1b, 0x05, | |
| 412 | 0x1b, 0x26, | |
| 413 | 0x38, 0x04, | |
| 414 | 0x4b, 0x05, | |
| 415 | 0x2f, 0x04, | |
| 416 | 0x0a, 0x07, | |
| 417 | 0x09, 0x07, | |
| 418 | 0x40, 0x20, | |
| 419 | 0x27, 0x04, | |
| 420 | 0x0c, 0x09, | |
| 421 | 0x36, 0x03, | |
| 422 | 0x3a, 0x05, | |
| 423 | 0x1a, 0x07, | |
| 424 | 0x04, 0x0c, | |
| 425 | 0x07, 0x50, | |
| 426 | 0x49, 0x37, | |
| 427 | 0x33, 0x0d, | |
| 428 | 0x33, 0x07, | |
| 429 | 0x2e, 0x08, | |
| 430 | 0x0a, 0x06, | |
| 431 | 0x26, 0x03, | |
| 432 | 0x1d, 0x08, | |
| 433 | 0x02, 0x80, 0xd0, | |
| 434 | 0x52, 0x10, | |
| 435 | 0x06, 0x08, | |
| 436 | 0x09, 0x21, | |
| 437 | 0x2e, 0x08, | |
| 438 | 0x2a, 0x16, | |
| 439 | 0x1a, 0x26, | |
| 440 | 0x1c, 0x14, | |
| 441 | 0x17, 0x09, | |
| 442 | 0x4e, 0x04, | |
| 443 | 0x24, 0x09, | |
| 444 | 0x44, 0x0d, | |
| 445 | 0x19, 0x07, | |
| 446 | 0x0a, 0x06, | |
| 447 | 0x48, 0x08, | |
| 448 | 0x27, 0x09, | |
| 449 | 0x75, 0x0b, | |
| 450 | 0x42, 0x3e, | |
| 451 | 0x2a, 0x06, | |
| 452 | 0x3b, 0x05, | |
| 453 | 0x0a, 0x06, | |
| 454 | 0x51, 0x06, | |
| 455 | 0x01, 0x05, | |
| 456 | 0x10, 0x03, | |
| 457 | 0x05, 0x0b, | |
| 458 | 0x59, 0x08, | |
| 459 | 0x02, 0x1d, | |
| 460 | 0x62, 0x1e, | |
| 461 | 0x48, 0x08, | |
| 462 | 0x0a, 0x80, 0xa6, | |
| 463 | 0x5e, 0x22, | |
| 464 | 0x45, 0x0b, | |
| 465 | 0x0a, 0x06, | |
| 466 | 0x0d, 0x13, | |
| 467 | 0x3a, 0x06, | |
| 468 | 0x0a, 0x06, | |
| 469 | 0x14, 0x1c, | |
| 470 | 0x2c, 0x04, | |
| 471 | 0x17, 0x80, 0xb9, | |
| 472 | 0x3c, 0x64, | |
| 473 | 0x53, 0x0c, | |
| 474 | 0x48, 0x09, | |
| 475 | 0x0a, 0x46, | |
| 476 | 0x45, 0x1b, | |
| 477 | 0x48, 0x08, | |
| 478 | 0x53, 0x0d, | |
| 479 | 0x49, 0x07, | |
| 480 | 0x0a, 0x56, | |
| 481 | 0x08, 0x58, | |
| 482 | 0x22, 0x0e, | |
| 483 | 0x0a, 0x06, | |
| 484 | 0x46, 0x0a, | |
| 485 | 0x1d, 0x03, | |
| 486 | 0x47, 0x49, | |
| 487 | 0x37, 0x03, | |
| 488 | 0x0e, 0x08, | |
| 489 | 0x0a, 0x06, | |
| 490 | 0x39, 0x07, | |
| 491 | 0x0a, 0x06, | |
| 492 | 0x2c, 0x04, | |
| 493 | 0x0a, 0x80, 0xf6, | |
| 494 | 0x19, 0x07, | |
| 495 | 0x3b, 0x03, | |
| 496 | 0x1d, 0x55, | |
| 497 | 0x01, 0x0f, | |
| 498 | 0x32, 0x0d, | |
| 499 | 0x83, 0x9b, 0x66, | |
| 500 | 0x75, 0x0b, | |
| 501 | 0x80, 0xc4, 0x8a, 0x4c, | |
| 502 | 0x63, 0x0d, | |
| 503 | 0x84, 0x30, 0x10, | |
| 504 | 0x16, 0x0a, | |
| 505 | 0x8f, 0x9b, 0x05, | |
| 506 | 0x82, 0x47, 0x9a, 0xb9, | |
| 507 | 0x3a, 0x86, 0xc6, | |
| 508 | 0x82, 0x39, 0x07, | |
| 509 | 0x2a, 0x04, | |
| 510 | 0x5c, 0x06, | |
| 511 | 0x26, 0x0a, | |
| 512 | 0x46, 0x0a, | |
| 513 | 0x28, 0x05, | |
| 514 | 0x13, 0x81, 0xb0, | |
| 515 | 0x3a, 0x80, 0xc6, | |
| 516 | 0x5b, 0x05, | |
| 517 | 0x34, 0x2c, | |
| 518 | 0x4b, 0x04, | |
| 519 | 0x39, 0x07, | |
| 520 | 0x11, 0x40, | |
| 521 | 0x05, 0x0b, | |
| 522 | 0x07, 0x09, | |
| 523 | 0x9c, 0xd6, 0x29, | |
| 524 | 0x20, 0x61, | |
| 525 | 0x73, 0xa1, 0xfd, | |
| 526 | 0x81, 0x33, 0x0f, | |
| 527 | 0x01, 0x1d, | |
| 528 | 0x06, 0x0e, | |
| 529 | 0x04, 0x08, | |
| 530 | 0x81, 0x8c, 0x89, 0x04, | |
| 531 | 0x6b, 0x05, | |
| 532 | 0x0d, 0x03, | |
| 533 | 0x09, 0x07, | |
| 534 | 0x10, 0x8f, 0x60, | |
| 535 | 0x80, 0xfd, 0x03, | |
| 536 | 0x81, 0xb4, 0x06, | |
| 537 | 0x17, 0x0f, | |
| 538 | 0x11, 0x0f, | |
| 539 | 0x47, 0x09, | |
| 540 | 0x74, 0x3c, | |
| 541 | 0x80, 0xf6, 0x0a, | |
| 542 | 0x73, 0x08, | |
| 543 | 0x70, 0x15, | |
| 544 | 0x46, 0x7a, | |
| 545 | 0x14, 0x0c, | |
| 546 | 0x14, 0x0c, | |
| 547 | 0x57, 0x09, | |
| 548 | 0x19, 0x80, 0x87, | |
| 549 | 0x81, 0x47, 0x03, | |
| 550 | 0x85, 0x42, 0x0f, | |
| 551 | 0x15, 0x84, 0x50, | |
| 552 | 0x1f, 0x06, | |
| 553 | 0x06, 0x80, 0xd5, | |
| 554 | 0x2b, 0x05, | |
| 555 | 0x3e, 0x21, | |
| 556 | 0x01, 0x70, | |
| 557 | 0x2d, 0x03, | |
| 558 | 0x1a, 0x04, | |
| 559 | 0x02, 0x81, 0x40, | |
| 560 | 0x1f, 0x11, | |
| 561 | 0x3a, 0x05, | |
| 562 | 0x01, 0x81, 0xd0, | |
| 563 | 0x2a, 0x80, 0xd6, | |
| 564 | 0x2b, 0x04, | |
| 565 | 0x01, 0x80, 0xc0, | |
| 566 | 0x36, 0x08, | |
| 567 | 0x02, 0x80, 0xe0, | |
| 568 | 0x80, 0xf7, 0x29, | |
| 569 | 0x4c, 0x04, | |
| 570 | 0x0a, 0x04, | |
| 571 | 0x02, 0x83, 0x11, | |
| 572 | 0x44, 0x4c, | |
| 573 | 0x3d, 0x80, 0xc2, | |
| 574 | 0x3c, 0x06, | |
| 575 | 0x01, 0x04, | |
| 576 | 0x55, 0x05, | |
| 577 | 0x1b, 0x34, | |
| 578 | 0x02, 0x81, 0x0e, | |
| 579 | 0x2c, 0x04, | |
| 580 | 0x64, 0x0c, | |
| 581 | 0x56, 0x0a, | |
| 582 | 0x80, 0xae, 0x38, | |
| 583 | 0x1d, 0x0d, | |
| 584 | 0x2c, 0x04, | |
| 585 | 0x09, 0x07, | |
| 586 | 0x02, 0x0e, | |
| 587 | 0x06, 0x80, 0x9a, | |
| 588 | 0x83, 0xd9, 0x03, | |
| 589 | 0x11, 0x03, | |
| 590 | 0x0d, 0x03, | |
| 591 | 0x80, 0xda, 0x06, | |
| 592 | 0x0c, 0x04, | |
| 593 | 0x01, 0x0f, | |
| 594 | 0x0c, 0x04, | |
| 595 | 0x38, 0x08, | |
| 596 | 0x0a, 0x06, | |
| 597 | 0x28, 0x08, | |
| 598 | 0x2c, 0x04, | |
| 599 | 0x02, 0x0e, | |
| 600 | 0x09, 0x27, | |
| 601 | 0x81, 0x58, 0x08, | |
| 602 | 0x1d, 0x03, | |
| 603 | 0x0b, 0x03, | |
| 604 | 0x3b, 0x04, | |
| 605 | 0x1e, 0x04, | |
| 606 | 0x0a, 0x07, | |
| 607 | 0x80, 0xfb, 0x84, 0x05, | |
| 608 | ]; |
library/core/src/unicode/unicode_data.rs+203-13| ... | ... | @@ -1,17 +1,20 @@ |
| 1 | 1 | //! This file is generated by `./x run src/tools/unicode-table-generator`; do not edit manually! |
| 2 | // Alphabetic : 1723 bytes, 147369 codepoints in 759 ranges (U+0000AA - U+03347A) using skiplist | |
| 3 | // Case_Ignorable : 1063 bytes, 2789 codepoints in 459 ranges (U+0000A8 - U+0E01F0) using skiplist | |
| 4 | // Grapheme_Extend : 899 bytes, 2232 codepoints in 383 ranges (U+000300 - U+0E01F0) using skiplist | |
| 5 | // Lowercase : 943 bytes, 2569 codepoints in 676 ranges (U+0000AA - U+01E944) using bitset | |
| 6 | // Lt : 33 bytes, 31 codepoints in 10 ranges (U+0001C5 - U+001FFD) using skiplist | |
| 7 | // N : 463 bytes, 1914 codepoints in 145 ranges (U+0000B2 - U+01FBFA) using skiplist | |
| 8 | // Uppercase : 799 bytes, 1980 codepoints in 659 ranges (U+0000C0 - U+01F18A) using bitset | |
| 9 | // White_Space : 256 bytes, 19 codepoints in 8 ranges (U+000085 - U+003001) using cascading | |
| 10 | // to_lower : 1112 bytes, 1462 codepoints in 185 ranges (U+0000C0 - U+01E921) using 2-level LUT | |
| 11 | // to_upper : 1998 bytes, 1554 codepoints in 299 ranges (U+0000B5 - U+01E943) using 2-level LUT | |
| 12 | // to_title : 340 bytes, 135 codepoints in 49 ranges (U+0000DF - U+00FB17) using 2-level LUT | |
| 13 | // to_casefold : 32 bytes, 174 codepoints in 5 ranges (U+000131 - U+00ABBF) using 2-level LUT | |
| 14 | // Total : 9661 bytes | |
| 2 | // Alphabetic : 1723 bytes, 147369 codepoints in 759 ranges (U+0000AA - U+03347A) using skiplist | |
| 3 | // Case_Ignorable : 1063 bytes, 2789 codepoints in 459 ranges (U+0000A8 - U+0E01F0) using skiplist | |
| 4 | // Cf : 87 bytes, 170 codepoints in 21 ranges (U+0000AD - U+0E0080) using skiplist | |
| 5 | // Cn_Planes_0_3 : 1677 bytes, 94165 codepoints in 730 ranges (U+000378 - U+03FFFE) using skiplist | |
| 6 | // Default_Ignorable_Code_Point: 83 bytes, 4174 codepoints in 17 ranges (U+0000AD - U+0E1000) using skiplist | |
| 7 | // Grapheme_Extend : 899 bytes, 2232 codepoints in 383 ranges (U+000300 - U+0E01F0) using skiplist | |
| 8 | // Lowercase : 943 bytes, 2569 codepoints in 676 ranges (U+0000AA - U+01E944) using bitset | |
| 9 | // Lt : 33 bytes, 31 codepoints in 10 ranges (U+0001C5 - U+001FFD) using skiplist | |
| 10 | // N : 463 bytes, 1914 codepoints in 145 ranges (U+0000B2 - U+01FBFA) using skiplist | |
| 11 | // Uppercase : 799 bytes, 1980 codepoints in 659 ranges (U+0000C0 - U+01F18A) using bitset | |
| 12 | // White_Space : 256 bytes, 19 codepoints in 8 ranges (U+000085 - U+003001) using cascading | |
| 13 | // to_lower : 1112 bytes, 1462 codepoints in 185 ranges (U+0000C0 - U+01E921) using 2-level LUT | |
| 14 | // to_upper : 1998 bytes, 1554 codepoints in 299 ranges (U+0000B5 - U+01E943) using 2-level LUT | |
| 15 | // to_title : 340 bytes, 135 codepoints in 49 ranges (U+0000DF - U+00FB17) using 2-level LUT | |
| 16 | // to_casefold : 32 bytes, 174 codepoints in 5 ranges (U+000131 - U+00ABBF) using 2-level LUT | |
| 17 | // Total : 11508 bytes | |
| 15 | 18 | |
| 16 | 19 | #[inline(always)] |
| 17 | 20 | const fn bitset_search< |
| ... | ... | @@ -338,6 +341,193 @@ pub mod case_ignorable { |
| 338 | 341 | } |
| 339 | 342 | } |
| 340 | 343 | |
| 344 | #[rustfmt::skip] | |
| 345 | pub mod cf { | |
| 346 | use super::ShortOffsetRunHeader; | |
| 347 | ||
| 348 | static SHORT_OFFSET_RUNS: [ShortOffsetRunHeader; 11] = [ | |
| 349 | ShortOffsetRunHeader::new(0, 1536), ShortOffsetRunHeader::new(3, 2192), | |
| 350 | ShortOffsetRunHeader::new(11, 6158), ShortOffsetRunHeader::new(15, 8203), | |
| 351 | ShortOffsetRunHeader::new(17, 65279), ShortOffsetRunHeader::new(25, 69821), | |
| 352 | ShortOffsetRunHeader::new(29, 78896), ShortOffsetRunHeader::new(33, 113824), | |
| 353 | ShortOffsetRunHeader::new(35, 119155), ShortOffsetRunHeader::new(37, 917505), | |
| 354 | ShortOffsetRunHeader::new(39, 2031744), | |
| 355 | ]; | |
| 356 | static OFFSETS: [u8; 43] = [ | |
| 357 | 173, 1, 0, 6, 22, 1, 192, 1, 49, 1, 0, 2, 80, 1, 0, 1, 0, 5, 26, 5, 49, 5, 1, 10, 0, 1, | |
| 358 | 249, 3, 0, 1, 15, 1, 0, 16, 0, 4, 0, 8, 0, 1, 30, 96, 0, | |
| 359 | ]; | |
| 360 | #[inline] | |
| 361 | pub fn lookup(c: char) -> bool { | |
| 362 | debug_assert!(!c.is_ascii()); | |
| 363 | (c as u32) >= 0xad && lookup_slow(c) | |
| 364 | } | |
| 365 | ||
| 366 | #[inline(never)] | |
| 367 | fn lookup_slow(c: char) -> bool { | |
| 368 | const { | |
| 369 | assert!(SHORT_OFFSET_RUNS.last().unwrap().0 > char::MAX as u32); | |
| 370 | let mut i = 0; | |
| 371 | while i < SHORT_OFFSET_RUNS.len() { | |
| 372 | assert!(SHORT_OFFSET_RUNS[i].start_index() < OFFSETS.len()); | |
| 373 | i += 1; | |
| 374 | } | |
| 375 | } | |
| 376 | // SAFETY: We just ensured the last element of `SHORT_OFFSET_RUNS` is greater than `std::char::MAX` | |
| 377 | // and the start indices of all elements in `SHORT_OFFSET_RUNS` are smaller than `OFFSETS.len()`. | |
| 378 | unsafe { super::skip_search(c, &SHORT_OFFSET_RUNS, &OFFSETS) } | |
| 379 | } | |
| 380 | } | |
| 381 | ||
| 382 | #[rustfmt::skip] | |
| 383 | pub mod cn_planes_0_3 { | |
| 384 | use super::ShortOffsetRunHeader; | |
| 385 | ||
| 386 | static SHORT_OFFSET_RUNS: [ShortOffsetRunHeader; 54] = [ | |
| 387 | ShortOffsetRunHeader::new(0, 888), ShortOffsetRunHeader::new(1, 1328), | |
| 388 | ShortOffsetRunHeader::new(11, 1806), ShortOffsetRunHeader::new(25, 4681), | |
| 389 | ShortOffsetRunHeader::new(325, 5789), ShortOffsetRunHeader::new(365, 7958), | |
| 390 | ShortOffsetRunHeader::new(445, 9258), ShortOffsetRunHeader::new(491, 11124), | |
| 391 | ShortOffsetRunHeader::new(495, 11508), ShortOffsetRunHeader::new(497, 42125), | |
| 392 | ShortOffsetRunHeader::new(549, 42540), ShortOffsetRunHeader::new(553, 55204), | |
| 393 | ShortOffsetRunHeader::new(605, 64110), ShortOffsetRunHeader::new(611, 64976), | |
| 394 | ShortOffsetRunHeader::new(629, 67383), ShortOffsetRunHeader::new(735, 74650), | |
| 395 | ShortOffsetRunHeader::new(1067, 77712), ShortOffsetRunHeader::new(1074, 78934), | |
| 396 | ShortOffsetRunHeader::new(1077, 82939), ShortOffsetRunHeader::new(1079, 83527), | |
| 397 | ShortOffsetRunHeader::new(1081, 90368), ShortOffsetRunHeader::new(1082, 92160), | |
| 398 | ShortOffsetRunHeader::new(1084, 92729), ShortOffsetRunHeader::new(1085, 93504), | |
| 399 | ShortOffsetRunHeader::new(1108, 101590), ShortOffsetRunHeader::new(1127, 110576), | |
| 400 | ShortOffsetRunHeader::new(1132, 110883), ShortOffsetRunHeader::new(1139, 111356), | |
| 401 | ShortOffsetRunHeader::new(1149, 113664), ShortOffsetRunHeader::new(1150, 117760), | |
| 402 | ShortOffsetRunHeader::new(1160, 118452), ShortOffsetRunHeader::new(1163, 120486), | |
| 403 | ShortOffsetRunHeader::new(1227, 120780), ShortOffsetRunHeader::new(1229, 121484), | |
| 404 | ShortOffsetRunHeader::new(1231, 122624), ShortOffsetRunHeader::new(1236, 123536), | |
| 405 | ShortOffsetRunHeader::new(1262, 124112), ShortOffsetRunHeader::new(1268, 126065), | |
| 406 | ShortOffsetRunHeader::new(1298, 126976), ShortOffsetRunHeader::new(1370, 128729), | |
| 407 | ShortOffsetRunHeader::new(1395, 129624), ShortOffsetRunHeader::new(1423, 131072), | |
| 408 | ShortOffsetRunHeader::new(1444, 173792), ShortOffsetRunHeader::new(1445, 178206), | |
| 409 | ShortOffsetRunHeader::new(1447, 183982), ShortOffsetRunHeader::new(1449, 191457), | |
| 410 | ShortOffsetRunHeader::new(1451, 192094), ShortOffsetRunHeader::new(1453, 194560), | |
| 411 | ShortOffsetRunHeader::new(1454, 195102), ShortOffsetRunHeader::new(1455, 196608), | |
| 412 | ShortOffsetRunHeader::new(1456, 201547), ShortOffsetRunHeader::new(1457, 210042), | |
| 413 | ShortOffsetRunHeader::new(1459, 262142), ShortOffsetRunHeader::new(1460, 1376254), | |
| 414 | ]; | |
| 415 | static OFFSETS: [u8; 1461] = [ | |
| 416 | 0, 2, 6, 4, 7, 1, 1, 1, 20, 1, 0, 1, 38, 2, 50, 2, 3, 1, 55, 8, 27, 4, 6, 11, 0, 1, 60, 2, | |
| 417 | 101, 14, 59, 2, 49, 2, 15, 1, 28, 2, 1, 1, 11, 5, 34, 5, 237, 1, 8, 2, 2, 2, 22, 1, 7, 1, 1, | |
| 418 | 3, 4, 2, 9, 2, 2, 2, 4, 8, 1, 4, 2, 1, 5, 2, 25, 2, 3, 1, 6, 4, 2, 2, 22, 1, 7, 1, 2, 1, 2, | |
| 419 | 1, 2, 2, 1, 1, 5, 4, 2, 2, 3, 3, 1, 7, 4, 1, 1, 7, 17, 10, 3, 1, 9, 1, 3, 1, 22, 1, 7, 1, 2, | |
| 420 | 1, 5, 2, 10, 1, 3, 1, 3, 2, 1, 15, 4, 2, 12, 7, 7, 1, 3, 1, 8, 2, 2, 2, 22, 1, 7, 1, 2, 1, | |
| 421 | 5, 2, 9, 2, 2, 2, 3, 7, 3, 4, 2, 1, 5, 2, 18, 10, 2, 1, 6, 3, 3, 1, 4, 3, 2, 1, 1, 1, 2, 3, | |
| 422 | 2, 3, 3, 3, 12, 4, 5, 3, 3, 1, 4, 2, 1, 6, 1, 14, 21, 5, 13, 1, 3, 1, 23, 1, 16, 2, 9, 1, 3, | |
| 423 | 1, 4, 7, 2, 1, 3, 1, 2, 2, 4, 2, 10, 7, 22, 1, 3, 1, 23, 1, 10, 1, 5, 2, 9, 1, 3, 1, 4, 7, | |
| 424 | 2, 5, 3, 1, 4, 2, 10, 1, 3, 12, 13, 1, 3, 1, 51, 1, 3, 1, 6, 4, 16, 2, 26, 1, 3, 1, 18, 3, | |
| 425 | 24, 1, 9, 1, 1, 2, 7, 3, 1, 4, 6, 1, 1, 1, 8, 6, 10, 2, 3, 12, 58, 4, 29, 37, 2, 1, 1, 1, 5, | |
| 426 | 1, 24, 1, 1, 1, 23, 2, 5, 1, 1, 1, 7, 1, 10, 2, 4, 32, 72, 1, 36, 4, 39, 1, 36, 1, 15, 1, | |
| 427 | 13, 37, 198, 1, 1, 5, 1, 2, 0, 1, 4, 2, 7, 1, 1, 1, 4, 2, 41, 1, 4, 2, 33, 1, 4, 2, 7, 1, 1, | |
| 428 | 1, 4, 2, 15, 1, 57, 1, 4, 2, 67, 2, 32, 3, 26, 6, 86, 2, 6, 2, 0, 3, 89, 7, 22, 9, 24, 9, | |
| 429 | 20, 12, 13, 1, 3, 1, 2, 12, 94, 2, 10, 6, 10, 6, 26, 6, 89, 7, 43, 5, 70, 10, 31, 1, 12, 4, | |
| 430 | 12, 4, 1, 3, 42, 2, 5, 11, 44, 4, 26, 6, 11, 3, 62, 2, 65, 1, 29, 2, 11, 6, 10, 6, 14, 2, | |
| 431 | 46, 2, 12, 20, 77, 1, 166, 8, 60, 3, 15, 3, 62, 5, 43, 2, 11, 8, 43, 5, 0, 2, 6, 2, 38, 2, | |
| 432 | 6, 2, 8, 1, 1, 1, 1, 1, 1, 1, 31, 2, 53, 1, 15, 1, 14, 2, 6, 1, 19, 2, 3, 1, 9, 1, 101, 1, | |
| 433 | 12, 2, 27, 1, 13, 3, 34, 14, 33, 15, 140, 4, 0, 22, 11, 21, 0, 2, 0, 5, 45, 1, 1, 5, 1, 2, | |
| 434 | 56, 7, 2, 14, 24, 9, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 126, 34, 26, 1, 89, 12, | |
| 435 | 214, 26, 80, 1, 86, 2, 103, 5, 43, 1, 94, 1, 86, 9, 48, 1, 0, 3, 55, 9, 0, 20, 184, 8, 221, | |
| 436 | 20, 60, 3, 10, 6, 56, 8, 70, 8, 12, 6, 116, 11, 30, 3, 78, 1, 11, 4, 33, 1, 55, 9, 14, 2, | |
| 437 | 10, 2, 103, 24, 28, 10, 6, 2, 6, 2, 6, 9, 7, 1, 7, 1, 60, 4, 126, 2, 10, 6, 0, 12, 23, 4, | |
| 438 | 49, 4, 0, 2, 106, 38, 7, 12, 5, 5, 26, 1, 5, 1, 1, 1, 2, 1, 2, 1, 0, 32, 42, 6, 51, 1, 19, | |
| 439 | 1, 4, 4, 5, 1, 135, 2, 1, 1, 190, 3, 6, 2, 6, 2, 6, 2, 3, 3, 7, 1, 7, 10, 5, 2, 12, 1, 26, | |
| 440 | 1, 19, 1, 2, 1, 15, 2, 14, 34, 123, 5, 3, 4, 45, 3, 88, 1, 13, 3, 1, 47, 46, 130, 29, 3, 49, | |
| 441 | 15, 28, 4, 36, 9, 30, 5, 43, 5, 30, 1, 37, 4, 14, 42, 158, 2, 10, 6, 36, 4, 36, 4, 40, 8, | |
| 442 | 52, 11, 12, 1, 15, 1, 7, 1, 2, 1, 11, 1, 15, 1, 7, 1, 2, 3, 52, 12, 0, 9, 22, 10, 8, 24, 6, | |
| 443 | 1, 42, 1, 9, 69, 6, 2, 1, 1, 44, 1, 2, 3, 1, 2, 23, 1, 72, 8, 9, 48, 19, 1, 2, 5, 33, 3, 27, | |
| 444 | 5, 27, 38, 56, 4, 20, 2, 50, 1, 2, 5, 8, 1, 3, 1, 29, 2, 3, 4, 10, 7, 9, 7, 64, 32, 39, 4, | |
| 445 | 12, 9, 54, 3, 29, 2, 27, 5, 26, 7, 4, 12, 7, 80, 73, 55, 51, 13, 51, 7, 46, 8, 10, 6, 38, 3, | |
| 446 | 29, 8, 2, 208, 31, 1, 42, 1, 3, 2, 2, 16, 6, 8, 9, 33, 46, 8, 42, 22, 26, 38, 28, 20, 23, 9, | |
| 447 | 78, 4, 36, 9, 68, 10, 1, 2, 25, 7, 10, 6, 53, 1, 18, 8, 39, 9, 96, 1, 20, 11, 18, 1, 47, 62, | |
| 448 | 7, 1, 1, 1, 4, 1, 15, 1, 11, 6, 59, 5, 10, 6, 4, 1, 8, 2, 2, 2, 22, 1, 7, 1, 2, 1, 5, 1, 10, | |
| 449 | 2, 2, 2, 3, 2, 1, 6, 1, 5, 7, 2, 7, 3, 5, 11, 10, 1, 1, 2, 1, 1, 38, 1, 10, 1, 1, 2, 1, 1, | |
| 450 | 4, 1, 10, 1, 2, 8, 2, 29, 92, 1, 5, 30, 72, 8, 10, 166, 54, 2, 38, 34, 69, 11, 10, 6, 13, | |
| 451 | 19, 58, 6, 10, 6, 20, 28, 27, 2, 15, 4, 23, 185, 60, 100, 83, 12, 8, 2, 1, 2, 8, 1, 2, 1, | |
| 452 | 30, 1, 2, 2, 12, 9, 10, 70, 8, 2, 46, 2, 11, 27, 72, 8, 83, 13, 73, 7, 10, 86, 8, 88, 34, | |
| 453 | 14, 10, 6, 9, 1, 45, 1, 14, 10, 29, 3, 32, 2, 22, 1, 14, 73, 7, 1, 2, 1, 44, 3, 1, 1, 2, 1, | |
| 454 | 9, 8, 10, 6, 6, 1, 2, 1, 37, 1, 2, 1, 6, 7, 10, 6, 44, 4, 10, 246, 25, 7, 17, 1, 41, 3, 29, | |
| 455 | 85, 1, 15, 50, 13, 0, 102, 111, 1, 5, 11, 196, 0, 99, 13, 0, 10, 0, 5, 0, 0, 58, 0, 0, 7, | |
| 456 | 31, 1, 10, 4, 81, 1, 10, 6, 30, 2, 6, 10, 70, 10, 10, 1, 7, 1, 21, 5, 19, 0, 58, 198, 91, 5, | |
| 457 | 25, 2, 25, 44, 75, 4, 57, 7, 17, 64, 5, 11, 7, 9, 0, 41, 32, 97, 115, 0, 4, 1, 7, 1, 2, 1, | |
| 458 | 0, 15, 1, 29, 3, 2, 1, 14, 4, 8, 0, 0, 107, 5, 13, 3, 9, 7, 10, 2, 8, 0, 253, 3, 0, 6, 23, | |
| 459 | 15, 17, 15, 46, 2, 23, 9, 116, 60, 246, 10, 39, 2, 194, 21, 70, 122, 20, 12, 20, 12, 87, 9, | |
| 460 | 25, 135, 85, 1, 71, 1, 2, 2, 1, 2, 2, 2, 4, 1, 12, 1, 1, 1, 7, 1, 65, 1, 4, 2, 8, 1, 7, 1, | |
| 461 | 28, 1, 4, 1, 5, 1, 1, 3, 7, 1, 0, 2, 0, 2, 0, 15, 5, 1, 15, 0, 31, 6, 6, 213, 7, 1, 17, 2, | |
| 462 | 7, 1, 2, 1, 5, 5, 62, 33, 1, 112, 45, 3, 14, 2, 10, 4, 2, 0, 31, 17, 58, 5, 1, 0, 42, 214, | |
| 463 | 43, 4, 1, 192, 31, 1, 22, 8, 2, 224, 7, 1, 4, 1, 2, 1, 15, 1, 197, 2, 16, 41, 76, 4, 10, 4, | |
| 464 | 2, 0, 68, 76, 61, 194, 4, 1, 27, 1, 2, 1, 1, 2, 1, 1, 10, 1, 4, 1, 1, 1, 1, 6, 1, 4, 1, 1, | |
| 465 | 1, 1, 1, 1, 3, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 2, 4, 1, 7, 1, 4, 1, 4, | |
| 466 | 1, 1, 1, 10, 1, 17, 5, 3, 1, 5, 1, 17, 52, 2, 0, 44, 4, 100, 12, 15, 2, 15, 1, 15, 1, 37, | |
| 467 | 10, 174, 56, 29, 13, 44, 4, 9, 7, 2, 14, 6, 154, 0, 3, 17, 3, 13, 3, 218, 6, 12, 4, 1, 15, | |
| 468 | 12, 4, 56, 8, 10, 6, 40, 8, 30, 2, 12, 4, 2, 14, 9, 39, 0, 8, 14, 2, 13, 3, 11, 3, 57, 1, 1, | |
| 469 | 4, 16, 2, 12, 4, 10, 7, 147, 1, 103, 0, 0, 32, 0, 2, 0, 2, 0, 15, 0, 0, 0, 0, 0, 5, 0, 0, 0, | |
| 470 | ]; | |
| 471 | #[inline] | |
| 472 | pub fn lookup(c: char) -> bool { | |
| 473 | debug_assert!(!c.is_ascii()); | |
| 474 | (c as u32) >= 0x378 && lookup_slow(c) | |
| 475 | } | |
| 476 | ||
| 477 | #[inline(never)] | |
| 478 | fn lookup_slow(c: char) -> bool { | |
| 479 | const { | |
| 480 | assert!(SHORT_OFFSET_RUNS.last().unwrap().0 > char::MAX as u32); | |
| 481 | let mut i = 0; | |
| 482 | while i < SHORT_OFFSET_RUNS.len() { | |
| 483 | assert!(SHORT_OFFSET_RUNS[i].start_index() < OFFSETS.len()); | |
| 484 | i += 1; | |
| 485 | } | |
| 486 | } | |
| 487 | // SAFETY: We just ensured the last element of `SHORT_OFFSET_RUNS` is greater than `std::char::MAX` | |
| 488 | // and the start indices of all elements in `SHORT_OFFSET_RUNS` are smaller than `OFFSETS.len()`. | |
| 489 | unsafe { super::skip_search(c, &SHORT_OFFSET_RUNS, &OFFSETS) } | |
| 490 | } | |
| 491 | } | |
| 492 | ||
| 493 | #[rustfmt::skip] | |
| 494 | pub mod default_ignorable_code_point { | |
| 495 | use super::ShortOffsetRunHeader; | |
| 496 | ||
| 497 | static SHORT_OFFSET_RUNS: [ShortOffsetRunHeader; 12] = [ | |
| 498 | ShortOffsetRunHeader::new(0, 847), ShortOffsetRunHeader::new(3, 1564), | |
| 499 | ShortOffsetRunHeader::new(5, 4447), ShortOffsetRunHeader::new(7, 6068), | |
| 500 | ShortOffsetRunHeader::new(9, 8203), ShortOffsetRunHeader::new(13, 12644), | |
| 501 | ShortOffsetRunHeader::new(19, 65024), ShortOffsetRunHeader::new(21, 113824), | |
| 502 | ShortOffsetRunHeader::new(29, 119155), ShortOffsetRunHeader::new(31, 917504), | |
| 503 | ShortOffsetRunHeader::new(33, 921600), ShortOffsetRunHeader::new(34, 2035712), | |
| 504 | ]; | |
| 505 | static OFFSETS: [u8; 35] = [ | |
| 506 | 173, 1, 0, 1, 0, 1, 0, 2, 0, 2, 85, 5, 0, 5, 26, 5, 49, 16, 0, 1, 0, 16, 239, 1, 160, 1, | |
| 507 | 79, 9, 0, 4, 0, 8, 0, 0, 0, | |
| 508 | ]; | |
| 509 | #[inline] | |
| 510 | pub fn lookup(c: char) -> bool { | |
| 511 | debug_assert!(!c.is_ascii()); | |
| 512 | (c as u32) >= 0xad && lookup_slow(c) | |
| 513 | } | |
| 514 | ||
| 515 | #[inline(never)] | |
| 516 | fn lookup_slow(c: char) -> bool { | |
| 517 | const { | |
| 518 | assert!(SHORT_OFFSET_RUNS.last().unwrap().0 > char::MAX as u32); | |
| 519 | let mut i = 0; | |
| 520 | while i < SHORT_OFFSET_RUNS.len() { | |
| 521 | assert!(SHORT_OFFSET_RUNS[i].start_index() < OFFSETS.len()); | |
| 522 | i += 1; | |
| 523 | } | |
| 524 | } | |
| 525 | // SAFETY: We just ensured the last element of `SHORT_OFFSET_RUNS` is greater than `std::char::MAX` | |
| 526 | // and the start indices of all elements in `SHORT_OFFSET_RUNS` are smaller than `OFFSETS.len()`. | |
| 527 | unsafe { super::skip_search(c, &SHORT_OFFSET_RUNS, &OFFSETS) } | |
| 528 | } | |
| 529 | } | |
| 530 | ||
| 341 | 531 | #[rustfmt::skip] |
| 342 | 532 | pub mod grapheme_extend { |
| 343 | 533 | use super::ShortOffsetRunHeader; |
library/core/src/wtf8.rs+1-1| ... | ... | @@ -147,7 +147,7 @@ impl fmt::Debug for Wtf8 { |
| 147 | 147 | use crate::fmt::Write as _; |
| 148 | 148 | for c in s.chars().flat_map(|c| { |
| 149 | 149 | c.escape_debug_ext(EscapeDebugExtArgs { |
| 150 | escape_grapheme_extended: true, | |
| 150 | escape_grapheme_extender: true, | |
| 151 | 151 | escape_single_quote: false, |
| 152 | 152 | escape_double_quote: true, |
| 153 | 153 | }) |
library/coretests/tests/unicode.rs+26-4| ... | ... | @@ -1,3 +1,4 @@ |
| 1 | use core::iter::Step; | |
| 1 | 2 | use core::unicode::unicode_data; |
| 2 | 3 | use std::ops::RangeInclusive; |
| 3 | 4 | |
| ... | ... | @@ -19,7 +20,7 @@ fn test_boolean_property(ranges: &[RangeInclusive<char>], lookup: fn(char) -> bo |
| 19 | 20 | for c in range.clone() { |
| 20 | 21 | assert!(lookup(c), "{c:?}"); |
| 21 | 22 | } |
| 22 | start = char::from_u32(*range.end() as u32 + 1).unwrap(); | |
| 23 | start = Step::forward(*range.end(), 1); | |
| 23 | 24 | } |
| 24 | 25 | for c in start..=char::MAX { |
| 25 | 26 | assert!(!lookup(c), "{c:?}"); |
| ... | ... | @@ -60,9 +61,23 @@ fn case_ignorable() { |
| 60 | 61 | |
| 61 | 62 | #[test] |
| 62 | 63 | #[cfg_attr(miri, ignore)] // Miri is too slow |
| 63 | fn lt() { | |
| 64 | test_boolean_property(test_data::LT, unicode_data::lt::lookup); | |
| 65 | test_boolean_property(test_data::LT, char::is_titlecase); | |
| 64 | fn cf() { | |
| 65 | test_boolean_property(test_data::CF, unicode_data::cf::lookup); | |
| 66 | } | |
| 67 | ||
| 68 | #[test] | |
| 69 | #[cfg_attr(miri, ignore)] // Miri is too slow | |
| 70 | fn cn_planes_0_3() { | |
| 71 | test_boolean_property(test_data::CN_PLANES_0_3, unicode_data::cn_planes_0_3::lookup); | |
| 72 | } | |
| 73 | ||
| 74 | #[test] | |
| 75 | #[cfg_attr(miri, ignore)] // Miri is too slow | |
| 76 | fn default_ignorable_code_point() { | |
| 77 | test_boolean_property( | |
| 78 | test_data::DEFAULT_IGNORABLE_CODE_POINT, | |
| 79 | unicode_data::default_ignorable_code_point::lookup, | |
| 80 | ); | |
| 66 | 81 | } |
| 67 | 82 | |
| 68 | 83 | #[test] |
| ... | ... | @@ -78,6 +93,13 @@ fn lowercase() { |
| 78 | 93 | test_boolean_property(test_data::LOWERCASE, char::is_lowercase); |
| 79 | 94 | } |
| 80 | 95 | |
| 96 | #[test] | |
| 97 | #[cfg_attr(miri, ignore)] // Miri is too slow | |
| 98 | fn lt() { | |
| 99 | test_boolean_property(test_data::LT, unicode_data::lt::lookup); | |
| 100 | test_boolean_property(test_data::LT, char::is_titlecase); | |
| 101 | } | |
| 102 | ||
| 81 | 103 | #[test] |
| 82 | 104 | #[cfg_attr(miri, ignore)] // Miri is too slow |
| 83 | 105 | fn n() { |
library/coretests/tests/unicode/test_data.rs+256| ... | ... | @@ -392,6 +392,262 @@ pub(super) static CASE_IGNORABLE: &[RangeInclusive<char>; 459] = &[ |
| 392 | 392 | '\u{e0100}'..='\u{e01ef}', |
| 393 | 393 | ]; |
| 394 | 394 | |
| 395 | #[rustfmt::skip] | |
| 396 | pub(super) static CF: &[RangeInclusive<char>; 21] = &[ | |
| 397 | '\u{ad}'..='\u{ad}', '\u{600}'..='\u{605}', '\u{61c}'..='\u{61c}', '\u{6dd}'..='\u{6dd}', | |
| 398 | '\u{70f}'..='\u{70f}', '\u{890}'..='\u{891}', '\u{8e2}'..='\u{8e2}', | |
| 399 | '\u{180e}'..='\u{180e}', '\u{200b}'..='\u{200f}', '\u{202a}'..='\u{202e}', | |
| 400 | '\u{2060}'..='\u{2064}', '\u{2066}'..='\u{206f}', '\u{feff}'..='\u{feff}', | |
| 401 | '\u{fff9}'..='\u{fffb}', '\u{110bd}'..='\u{110bd}', '\u{110cd}'..='\u{110cd}', | |
| 402 | '\u{13430}'..='\u{1343f}', '\u{1bca0}'..='\u{1bca3}', '\u{1d173}'..='\u{1d17a}', | |
| 403 | '\u{e0001}'..='\u{e0001}', '\u{e0020}'..='\u{e007f}', | |
| 404 | ]; | |
| 405 | ||
| 406 | #[rustfmt::skip] | |
| 407 | pub(super) static CN_PLANES_0_3: &[RangeInclusive<char>; 730] = &[ | |
| 408 | '\u{378}'..='\u{379}', '\u{380}'..='\u{383}', '\u{38b}'..='\u{38b}', '\u{38d}'..='\u{38d}', | |
| 409 | '\u{3a2}'..='\u{3a2}', '\u{530}'..='\u{530}', '\u{557}'..='\u{558}', '\u{58b}'..='\u{58c}', | |
| 410 | '\u{590}'..='\u{590}', '\u{5c8}'..='\u{5cf}', '\u{5eb}'..='\u{5ee}', '\u{5f5}'..='\u{5ff}', | |
| 411 | '\u{70e}'..='\u{70e}', '\u{74b}'..='\u{74c}', '\u{7b2}'..='\u{7bf}', '\u{7fb}'..='\u{7fc}', | |
| 412 | '\u{82e}'..='\u{82f}', '\u{83f}'..='\u{83f}', '\u{85c}'..='\u{85d}', '\u{85f}'..='\u{85f}', | |
| 413 | '\u{86b}'..='\u{86f}', '\u{892}'..='\u{896}', '\u{984}'..='\u{984}', '\u{98d}'..='\u{98e}', | |
| 414 | '\u{991}'..='\u{992}', '\u{9a9}'..='\u{9a9}', '\u{9b1}'..='\u{9b1}', '\u{9b3}'..='\u{9b5}', | |
| 415 | '\u{9ba}'..='\u{9bb}', '\u{9c5}'..='\u{9c6}', '\u{9c9}'..='\u{9ca}', '\u{9cf}'..='\u{9d6}', | |
| 416 | '\u{9d8}'..='\u{9db}', '\u{9de}'..='\u{9de}', '\u{9e4}'..='\u{9e5}', '\u{9ff}'..='\u{a00}', | |
| 417 | '\u{a04}'..='\u{a04}', '\u{a0b}'..='\u{a0e}', '\u{a11}'..='\u{a12}', '\u{a29}'..='\u{a29}', | |
| 418 | '\u{a31}'..='\u{a31}', '\u{a34}'..='\u{a34}', '\u{a37}'..='\u{a37}', '\u{a3a}'..='\u{a3b}', | |
| 419 | '\u{a3d}'..='\u{a3d}', '\u{a43}'..='\u{a46}', '\u{a49}'..='\u{a4a}', '\u{a4e}'..='\u{a50}', | |
| 420 | '\u{a52}'..='\u{a58}', '\u{a5d}'..='\u{a5d}', '\u{a5f}'..='\u{a65}', '\u{a77}'..='\u{a80}', | |
| 421 | '\u{a84}'..='\u{a84}', '\u{a8e}'..='\u{a8e}', '\u{a92}'..='\u{a92}', '\u{aa9}'..='\u{aa9}', | |
| 422 | '\u{ab1}'..='\u{ab1}', '\u{ab4}'..='\u{ab4}', '\u{aba}'..='\u{abb}', '\u{ac6}'..='\u{ac6}', | |
| 423 | '\u{aca}'..='\u{aca}', '\u{ace}'..='\u{acf}', '\u{ad1}'..='\u{adf}', '\u{ae4}'..='\u{ae5}', | |
| 424 | '\u{af2}'..='\u{af8}', '\u{b00}'..='\u{b00}', '\u{b04}'..='\u{b04}', '\u{b0d}'..='\u{b0e}', | |
| 425 | '\u{b11}'..='\u{b12}', '\u{b29}'..='\u{b29}', '\u{b31}'..='\u{b31}', '\u{b34}'..='\u{b34}', | |
| 426 | '\u{b3a}'..='\u{b3b}', '\u{b45}'..='\u{b46}', '\u{b49}'..='\u{b4a}', '\u{b4e}'..='\u{b54}', | |
| 427 | '\u{b58}'..='\u{b5b}', '\u{b5e}'..='\u{b5e}', '\u{b64}'..='\u{b65}', '\u{b78}'..='\u{b81}', | |
| 428 | '\u{b84}'..='\u{b84}', '\u{b8b}'..='\u{b8d}', '\u{b91}'..='\u{b91}', '\u{b96}'..='\u{b98}', | |
| 429 | '\u{b9b}'..='\u{b9b}', '\u{b9d}'..='\u{b9d}', '\u{ba0}'..='\u{ba2}', '\u{ba5}'..='\u{ba7}', | |
| 430 | '\u{bab}'..='\u{bad}', '\u{bba}'..='\u{bbd}', '\u{bc3}'..='\u{bc5}', '\u{bc9}'..='\u{bc9}', | |
| 431 | '\u{bce}'..='\u{bcf}', '\u{bd1}'..='\u{bd6}', '\u{bd8}'..='\u{be5}', '\u{bfb}'..='\u{bff}', | |
| 432 | '\u{c0d}'..='\u{c0d}', '\u{c11}'..='\u{c11}', '\u{c29}'..='\u{c29}', '\u{c3a}'..='\u{c3b}', | |
| 433 | '\u{c45}'..='\u{c45}', '\u{c49}'..='\u{c49}', '\u{c4e}'..='\u{c54}', '\u{c57}'..='\u{c57}', | |
| 434 | '\u{c5b}'..='\u{c5b}', '\u{c5e}'..='\u{c5f}', '\u{c64}'..='\u{c65}', '\u{c70}'..='\u{c76}', | |
| 435 | '\u{c8d}'..='\u{c8d}', '\u{c91}'..='\u{c91}', '\u{ca9}'..='\u{ca9}', '\u{cb4}'..='\u{cb4}', | |
| 436 | '\u{cba}'..='\u{cbb}', '\u{cc5}'..='\u{cc5}', '\u{cc9}'..='\u{cc9}', '\u{cce}'..='\u{cd4}', | |
| 437 | '\u{cd7}'..='\u{cdb}', '\u{cdf}'..='\u{cdf}', '\u{ce4}'..='\u{ce5}', '\u{cf0}'..='\u{cf0}', | |
| 438 | '\u{cf4}'..='\u{cff}', '\u{d0d}'..='\u{d0d}', '\u{d11}'..='\u{d11}', '\u{d45}'..='\u{d45}', | |
| 439 | '\u{d49}'..='\u{d49}', '\u{d50}'..='\u{d53}', '\u{d64}'..='\u{d65}', '\u{d80}'..='\u{d80}', | |
| 440 | '\u{d84}'..='\u{d84}', '\u{d97}'..='\u{d99}', '\u{db2}'..='\u{db2}', '\u{dbc}'..='\u{dbc}', | |
| 441 | '\u{dbe}'..='\u{dbf}', '\u{dc7}'..='\u{dc9}', '\u{dcb}'..='\u{dce}', '\u{dd5}'..='\u{dd5}', | |
| 442 | '\u{dd7}'..='\u{dd7}', '\u{de0}'..='\u{de5}', '\u{df0}'..='\u{df1}', '\u{df5}'..='\u{e00}', | |
| 443 | '\u{e3b}'..='\u{e3e}', '\u{e5c}'..='\u{e80}', '\u{e83}'..='\u{e83}', '\u{e85}'..='\u{e85}', | |
| 444 | '\u{e8b}'..='\u{e8b}', '\u{ea4}'..='\u{ea4}', '\u{ea6}'..='\u{ea6}', '\u{ebe}'..='\u{ebf}', | |
| 445 | '\u{ec5}'..='\u{ec5}', '\u{ec7}'..='\u{ec7}', '\u{ecf}'..='\u{ecf}', '\u{eda}'..='\u{edb}', | |
| 446 | '\u{ee0}'..='\u{eff}', '\u{f48}'..='\u{f48}', '\u{f6d}'..='\u{f70}', '\u{f98}'..='\u{f98}', | |
| 447 | '\u{fbd}'..='\u{fbd}', '\u{fcd}'..='\u{fcd}', '\u{fdb}'..='\u{fff}', | |
| 448 | '\u{10c6}'..='\u{10c6}', '\u{10c8}'..='\u{10cc}', '\u{10ce}'..='\u{10cf}', | |
| 449 | '\u{1249}'..='\u{1249}', '\u{124e}'..='\u{124f}', '\u{1257}'..='\u{1257}', | |
| 450 | '\u{1259}'..='\u{1259}', '\u{125e}'..='\u{125f}', '\u{1289}'..='\u{1289}', | |
| 451 | '\u{128e}'..='\u{128f}', '\u{12b1}'..='\u{12b1}', '\u{12b6}'..='\u{12b7}', | |
| 452 | '\u{12bf}'..='\u{12bf}', '\u{12c1}'..='\u{12c1}', '\u{12c6}'..='\u{12c7}', | |
| 453 | '\u{12d7}'..='\u{12d7}', '\u{1311}'..='\u{1311}', '\u{1316}'..='\u{1317}', | |
| 454 | '\u{135b}'..='\u{135c}', '\u{137d}'..='\u{137f}', '\u{139a}'..='\u{139f}', | |
| 455 | '\u{13f6}'..='\u{13f7}', '\u{13fe}'..='\u{13ff}', '\u{169d}'..='\u{169f}', | |
| 456 | '\u{16f9}'..='\u{16ff}', '\u{1716}'..='\u{171e}', '\u{1737}'..='\u{173f}', | |
| 457 | '\u{1754}'..='\u{175f}', '\u{176d}'..='\u{176d}', '\u{1771}'..='\u{1771}', | |
| 458 | '\u{1774}'..='\u{177f}', '\u{17de}'..='\u{17df}', '\u{17ea}'..='\u{17ef}', | |
| 459 | '\u{17fa}'..='\u{17ff}', '\u{181a}'..='\u{181f}', '\u{1879}'..='\u{187f}', | |
| 460 | '\u{18ab}'..='\u{18af}', '\u{18f6}'..='\u{18ff}', '\u{191f}'..='\u{191f}', | |
| 461 | '\u{192c}'..='\u{192f}', '\u{193c}'..='\u{193f}', '\u{1941}'..='\u{1943}', | |
| 462 | '\u{196e}'..='\u{196f}', '\u{1975}'..='\u{197f}', '\u{19ac}'..='\u{19af}', | |
| 463 | '\u{19ca}'..='\u{19cf}', '\u{19db}'..='\u{19dd}', '\u{1a1c}'..='\u{1a1d}', | |
| 464 | '\u{1a5f}'..='\u{1a5f}', '\u{1a7d}'..='\u{1a7e}', '\u{1a8a}'..='\u{1a8f}', | |
| 465 | '\u{1a9a}'..='\u{1a9f}', '\u{1aae}'..='\u{1aaf}', '\u{1ade}'..='\u{1adf}', | |
| 466 | '\u{1aec}'..='\u{1aff}', '\u{1b4d}'..='\u{1b4d}', '\u{1bf4}'..='\u{1bfb}', | |
| 467 | '\u{1c38}'..='\u{1c3a}', '\u{1c4a}'..='\u{1c4c}', '\u{1c8b}'..='\u{1c8f}', | |
| 468 | '\u{1cbb}'..='\u{1cbc}', '\u{1cc8}'..='\u{1ccf}', '\u{1cfb}'..='\u{1cff}', | |
| 469 | '\u{1f16}'..='\u{1f17}', '\u{1f1e}'..='\u{1f1f}', '\u{1f46}'..='\u{1f47}', | |
| 470 | '\u{1f4e}'..='\u{1f4f}', '\u{1f58}'..='\u{1f58}', '\u{1f5a}'..='\u{1f5a}', | |
| 471 | '\u{1f5c}'..='\u{1f5c}', '\u{1f5e}'..='\u{1f5e}', '\u{1f7e}'..='\u{1f7f}', | |
| 472 | '\u{1fb5}'..='\u{1fb5}', '\u{1fc5}'..='\u{1fc5}', '\u{1fd4}'..='\u{1fd5}', | |
| 473 | '\u{1fdc}'..='\u{1fdc}', '\u{1ff0}'..='\u{1ff1}', '\u{1ff5}'..='\u{1ff5}', | |
| 474 | '\u{1fff}'..='\u{1fff}', '\u{2065}'..='\u{2065}', '\u{2072}'..='\u{2073}', | |
| 475 | '\u{208f}'..='\u{208f}', '\u{209d}'..='\u{209f}', '\u{20c2}'..='\u{20cf}', | |
| 476 | '\u{20f1}'..='\u{20ff}', '\u{218c}'..='\u{218f}', '\u{242a}'..='\u{243f}', | |
| 477 | '\u{244b}'..='\u{245f}', '\u{2b74}'..='\u{2b75}', '\u{2cf4}'..='\u{2cf8}', | |
| 478 | '\u{2d26}'..='\u{2d26}', '\u{2d28}'..='\u{2d2c}', '\u{2d2e}'..='\u{2d2f}', | |
| 479 | '\u{2d68}'..='\u{2d6e}', '\u{2d71}'..='\u{2d7e}', '\u{2d97}'..='\u{2d9f}', | |
| 480 | '\u{2da7}'..='\u{2da7}', '\u{2daf}'..='\u{2daf}', '\u{2db7}'..='\u{2db7}', | |
| 481 | '\u{2dbf}'..='\u{2dbf}', '\u{2dc7}'..='\u{2dc7}', '\u{2dcf}'..='\u{2dcf}', | |
| 482 | '\u{2dd7}'..='\u{2dd7}', '\u{2ddf}'..='\u{2ddf}', '\u{2e5e}'..='\u{2e7f}', | |
| 483 | '\u{2e9a}'..='\u{2e9a}', '\u{2ef4}'..='\u{2eff}', '\u{2fd6}'..='\u{2fef}', | |
| 484 | '\u{3040}'..='\u{3040}', '\u{3097}'..='\u{3098}', '\u{3100}'..='\u{3104}', | |
| 485 | '\u{3130}'..='\u{3130}', '\u{318f}'..='\u{318f}', '\u{31e6}'..='\u{31ee}', | |
| 486 | '\u{321f}'..='\u{321f}', '\u{a48d}'..='\u{a48f}', '\u{a4c7}'..='\u{a4cf}', | |
| 487 | '\u{a62c}'..='\u{a63f}', '\u{a6f8}'..='\u{a6ff}', '\u{a7dd}'..='\u{a7f0}', | |
| 488 | '\u{a82d}'..='\u{a82f}', '\u{a83a}'..='\u{a83f}', '\u{a878}'..='\u{a87f}', | |
| 489 | '\u{a8c6}'..='\u{a8cd}', '\u{a8da}'..='\u{a8df}', '\u{a954}'..='\u{a95e}', | |
| 490 | '\u{a97d}'..='\u{a97f}', '\u{a9ce}'..='\u{a9ce}', '\u{a9da}'..='\u{a9dd}', | |
| 491 | '\u{a9ff}'..='\u{a9ff}', '\u{aa37}'..='\u{aa3f}', '\u{aa4e}'..='\u{aa4f}', | |
| 492 | '\u{aa5a}'..='\u{aa5b}', '\u{aac3}'..='\u{aada}', '\u{aaf7}'..='\u{ab00}', | |
| 493 | '\u{ab07}'..='\u{ab08}', '\u{ab0f}'..='\u{ab10}', '\u{ab17}'..='\u{ab1f}', | |
| 494 | '\u{ab27}'..='\u{ab27}', '\u{ab2f}'..='\u{ab2f}', '\u{ab6c}'..='\u{ab6f}', | |
| 495 | '\u{abee}'..='\u{abef}', '\u{abfa}'..='\u{abff}', '\u{d7a4}'..='\u{d7af}', | |
| 496 | '\u{d7c7}'..='\u{d7ca}', '\u{d7fc}'..='\u{d7ff}', '\u{fa6e}'..='\u{fa6f}', | |
| 497 | '\u{fada}'..='\u{faff}', '\u{fb07}'..='\u{fb12}', '\u{fb18}'..='\u{fb1c}', | |
| 498 | '\u{fb37}'..='\u{fb37}', '\u{fb3d}'..='\u{fb3d}', '\u{fb3f}'..='\u{fb3f}', | |
| 499 | '\u{fb42}'..='\u{fb42}', '\u{fb45}'..='\u{fb45}', '\u{fdd0}'..='\u{fdef}', | |
| 500 | '\u{fe1a}'..='\u{fe1f}', '\u{fe53}'..='\u{fe53}', '\u{fe67}'..='\u{fe67}', | |
| 501 | '\u{fe6c}'..='\u{fe6f}', '\u{fe75}'..='\u{fe75}', '\u{fefd}'..='\u{fefe}', | |
| 502 | '\u{ff00}'..='\u{ff00}', '\u{ffbf}'..='\u{ffc1}', '\u{ffc8}'..='\u{ffc9}', | |
| 503 | '\u{ffd0}'..='\u{ffd1}', '\u{ffd8}'..='\u{ffd9}', '\u{ffdd}'..='\u{ffdf}', | |
| 504 | '\u{ffe7}'..='\u{ffe7}', '\u{ffef}'..='\u{fff8}', '\u{fffe}'..='\u{ffff}', | |
| 505 | '\u{1000c}'..='\u{1000c}', '\u{10027}'..='\u{10027}', '\u{1003b}'..='\u{1003b}', | |
| 506 | '\u{1003e}'..='\u{1003e}', '\u{1004e}'..='\u{1004f}', '\u{1005e}'..='\u{1007f}', | |
| 507 | '\u{100fb}'..='\u{100ff}', '\u{10103}'..='\u{10106}', '\u{10134}'..='\u{10136}', | |
| 508 | '\u{1018f}'..='\u{1018f}', '\u{1019d}'..='\u{1019f}', '\u{101a1}'..='\u{101cf}', | |
| 509 | '\u{101fe}'..='\u{1027f}', '\u{1029d}'..='\u{1029f}', '\u{102d1}'..='\u{102df}', | |
| 510 | '\u{102fc}'..='\u{102ff}', '\u{10324}'..='\u{1032c}', '\u{1034b}'..='\u{1034f}', | |
| 511 | '\u{1037b}'..='\u{1037f}', '\u{1039e}'..='\u{1039e}', '\u{103c4}'..='\u{103c7}', | |
| 512 | '\u{103d6}'..='\u{103ff}', '\u{1049e}'..='\u{1049f}', '\u{104aa}'..='\u{104af}', | |
| 513 | '\u{104d4}'..='\u{104d7}', '\u{104fc}'..='\u{104ff}', '\u{10528}'..='\u{1052f}', | |
| 514 | '\u{10564}'..='\u{1056e}', '\u{1057b}'..='\u{1057b}', '\u{1058b}'..='\u{1058b}', | |
| 515 | '\u{10593}'..='\u{10593}', '\u{10596}'..='\u{10596}', '\u{105a2}'..='\u{105a2}', | |
| 516 | '\u{105b2}'..='\u{105b2}', '\u{105ba}'..='\u{105ba}', '\u{105bd}'..='\u{105bf}', | |
| 517 | '\u{105f4}'..='\u{105ff}', '\u{10737}'..='\u{1073f}', '\u{10756}'..='\u{1075f}', | |
| 518 | '\u{10768}'..='\u{1077f}', '\u{10786}'..='\u{10786}', '\u{107b1}'..='\u{107b1}', | |
| 519 | '\u{107bb}'..='\u{107ff}', '\u{10806}'..='\u{10807}', '\u{10809}'..='\u{10809}', | |
| 520 | '\u{10836}'..='\u{10836}', '\u{10839}'..='\u{1083b}', '\u{1083d}'..='\u{1083e}', | |
| 521 | '\u{10856}'..='\u{10856}', '\u{1089f}'..='\u{108a6}', '\u{108b0}'..='\u{108df}', | |
| 522 | '\u{108f3}'..='\u{108f3}', '\u{108f6}'..='\u{108fa}', '\u{1091c}'..='\u{1091e}', | |
| 523 | '\u{1093a}'..='\u{1093e}', '\u{1095a}'..='\u{1097f}', '\u{109b8}'..='\u{109bb}', | |
| 524 | '\u{109d0}'..='\u{109d1}', '\u{10a04}'..='\u{10a04}', '\u{10a07}'..='\u{10a0b}', | |
| 525 | '\u{10a14}'..='\u{10a14}', '\u{10a18}'..='\u{10a18}', '\u{10a36}'..='\u{10a37}', | |
| 526 | '\u{10a3b}'..='\u{10a3e}', '\u{10a49}'..='\u{10a4f}', '\u{10a59}'..='\u{10a5f}', | |
| 527 | '\u{10aa0}'..='\u{10abf}', '\u{10ae7}'..='\u{10aea}', '\u{10af7}'..='\u{10aff}', | |
| 528 | '\u{10b36}'..='\u{10b38}', '\u{10b56}'..='\u{10b57}', '\u{10b73}'..='\u{10b77}', | |
| 529 | '\u{10b92}'..='\u{10b98}', '\u{10b9d}'..='\u{10ba8}', '\u{10bb0}'..='\u{10bff}', | |
| 530 | '\u{10c49}'..='\u{10c7f}', '\u{10cb3}'..='\u{10cbf}', '\u{10cf3}'..='\u{10cf9}', | |
| 531 | '\u{10d28}'..='\u{10d2f}', '\u{10d3a}'..='\u{10d3f}', '\u{10d66}'..='\u{10d68}', | |
| 532 | '\u{10d86}'..='\u{10d8d}', '\u{10d90}'..='\u{10e5f}', '\u{10e7f}'..='\u{10e7f}', | |
| 533 | '\u{10eaa}'..='\u{10eaa}', '\u{10eae}'..='\u{10eaf}', '\u{10eb2}'..='\u{10ec1}', | |
| 534 | '\u{10ec8}'..='\u{10ecf}', '\u{10ed9}'..='\u{10ef9}', '\u{10f28}'..='\u{10f2f}', | |
| 535 | '\u{10f5a}'..='\u{10f6f}', '\u{10f8a}'..='\u{10faf}', '\u{10fcc}'..='\u{10fdf}', | |
| 536 | '\u{10ff7}'..='\u{10fff}', '\u{1104e}'..='\u{11051}', '\u{11076}'..='\u{1107e}', | |
| 537 | '\u{110c3}'..='\u{110cc}', '\u{110ce}'..='\u{110cf}', '\u{110e9}'..='\u{110ef}', | |
| 538 | '\u{110fa}'..='\u{110ff}', '\u{11135}'..='\u{11135}', '\u{11148}'..='\u{1114f}', | |
| 539 | '\u{11177}'..='\u{1117f}', '\u{111e0}'..='\u{111e0}', '\u{111f5}'..='\u{111ff}', | |
| 540 | '\u{11212}'..='\u{11212}', '\u{11242}'..='\u{1127f}', '\u{11287}'..='\u{11287}', | |
| 541 | '\u{11289}'..='\u{11289}', '\u{1128e}'..='\u{1128e}', '\u{1129e}'..='\u{1129e}', | |
| 542 | '\u{112aa}'..='\u{112af}', '\u{112eb}'..='\u{112ef}', '\u{112fa}'..='\u{112ff}', | |
| 543 | '\u{11304}'..='\u{11304}', '\u{1130d}'..='\u{1130e}', '\u{11311}'..='\u{11312}', | |
| 544 | '\u{11329}'..='\u{11329}', '\u{11331}'..='\u{11331}', '\u{11334}'..='\u{11334}', | |
| 545 | '\u{1133a}'..='\u{1133a}', '\u{11345}'..='\u{11346}', '\u{11349}'..='\u{1134a}', | |
| 546 | '\u{1134e}'..='\u{1134f}', '\u{11351}'..='\u{11356}', '\u{11358}'..='\u{1135c}', | |
| 547 | '\u{11364}'..='\u{11365}', '\u{1136d}'..='\u{1136f}', '\u{11375}'..='\u{1137f}', | |
| 548 | '\u{1138a}'..='\u{1138a}', '\u{1138c}'..='\u{1138d}', '\u{1138f}'..='\u{1138f}', | |
| 549 | '\u{113b6}'..='\u{113b6}', '\u{113c1}'..='\u{113c1}', '\u{113c3}'..='\u{113c4}', | |
| 550 | '\u{113c6}'..='\u{113c6}', '\u{113cb}'..='\u{113cb}', '\u{113d6}'..='\u{113d6}', | |
| 551 | '\u{113d9}'..='\u{113e0}', '\u{113e3}'..='\u{113ff}', '\u{1145c}'..='\u{1145c}', | |
| 552 | '\u{11462}'..='\u{1147f}', '\u{114c8}'..='\u{114cf}', '\u{114da}'..='\u{1157f}', | |
| 553 | '\u{115b6}'..='\u{115b7}', '\u{115de}'..='\u{115ff}', '\u{11645}'..='\u{1164f}', | |
| 554 | '\u{1165a}'..='\u{1165f}', '\u{1166d}'..='\u{1167f}', '\u{116ba}'..='\u{116bf}', | |
| 555 | '\u{116ca}'..='\u{116cf}', '\u{116e4}'..='\u{116ff}', '\u{1171b}'..='\u{1171c}', | |
| 556 | '\u{1172c}'..='\u{1172f}', '\u{11747}'..='\u{117ff}', '\u{1183c}'..='\u{1189f}', | |
| 557 | '\u{118f3}'..='\u{118fe}', '\u{11907}'..='\u{11908}', '\u{1190a}'..='\u{1190b}', | |
| 558 | '\u{11914}'..='\u{11914}', '\u{11917}'..='\u{11917}', '\u{11936}'..='\u{11936}', | |
| 559 | '\u{11939}'..='\u{1193a}', '\u{11947}'..='\u{1194f}', '\u{1195a}'..='\u{1199f}', | |
| 560 | '\u{119a8}'..='\u{119a9}', '\u{119d8}'..='\u{119d9}', '\u{119e5}'..='\u{119ff}', | |
| 561 | '\u{11a48}'..='\u{11a4f}', '\u{11aa3}'..='\u{11aaf}', '\u{11af9}'..='\u{11aff}', | |
| 562 | '\u{11b0a}'..='\u{11b5f}', '\u{11b68}'..='\u{11bbf}', '\u{11be2}'..='\u{11bef}', | |
| 563 | '\u{11bfa}'..='\u{11bff}', '\u{11c09}'..='\u{11c09}', '\u{11c37}'..='\u{11c37}', | |
| 564 | '\u{11c46}'..='\u{11c4f}', '\u{11c6d}'..='\u{11c6f}', '\u{11c90}'..='\u{11c91}', | |
| 565 | '\u{11ca8}'..='\u{11ca8}', '\u{11cb7}'..='\u{11cff}', '\u{11d07}'..='\u{11d07}', | |
| 566 | '\u{11d0a}'..='\u{11d0a}', '\u{11d37}'..='\u{11d39}', '\u{11d3b}'..='\u{11d3b}', | |
| 567 | '\u{11d3e}'..='\u{11d3e}', '\u{11d48}'..='\u{11d4f}', '\u{11d5a}'..='\u{11d5f}', | |
| 568 | '\u{11d66}'..='\u{11d66}', '\u{11d69}'..='\u{11d69}', '\u{11d8f}'..='\u{11d8f}', | |
| 569 | '\u{11d92}'..='\u{11d92}', '\u{11d99}'..='\u{11d9f}', '\u{11daa}'..='\u{11daf}', | |
| 570 | '\u{11ddc}'..='\u{11ddf}', '\u{11dea}'..='\u{11edf}', '\u{11ef9}'..='\u{11eff}', | |
| 571 | '\u{11f11}'..='\u{11f11}', '\u{11f3b}'..='\u{11f3d}', '\u{11f5b}'..='\u{11faf}', | |
| 572 | '\u{11fb1}'..='\u{11fbf}', '\u{11ff2}'..='\u{11ffe}', '\u{1239a}'..='\u{123ff}', | |
| 573 | '\u{1246f}'..='\u{1246f}', '\u{12475}'..='\u{1247f}', '\u{12544}'..='\u{12f8f}', | |
| 574 | '\u{12ff3}'..='\u{12fff}', '\u{13456}'..='\u{1345f}', '\u{143fb}'..='\u{143ff}', | |
| 575 | '\u{14647}'..='\u{160ff}', '\u{1613a}'..='\u{167ff}', '\u{16a39}'..='\u{16a3f}', | |
| 576 | '\u{16a5f}'..='\u{16a5f}', '\u{16a6a}'..='\u{16a6d}', '\u{16abf}'..='\u{16abf}', | |
| 577 | '\u{16aca}'..='\u{16acf}', '\u{16aee}'..='\u{16aef}', '\u{16af6}'..='\u{16aff}', | |
| 578 | '\u{16b46}'..='\u{16b4f}', '\u{16b5a}'..='\u{16b5a}', '\u{16b62}'..='\u{16b62}', | |
| 579 | '\u{16b78}'..='\u{16b7c}', '\u{16b90}'..='\u{16d3f}', '\u{16d7a}'..='\u{16e3f}', | |
| 580 | '\u{16e9b}'..='\u{16e9f}', '\u{16eb9}'..='\u{16eba}', '\u{16ed4}'..='\u{16eff}', | |
| 581 | '\u{16f4b}'..='\u{16f4e}', '\u{16f88}'..='\u{16f8e}', '\u{16fa0}'..='\u{16fdf}', | |
| 582 | '\u{16fe5}'..='\u{16fef}', '\u{16ff7}'..='\u{16fff}', '\u{18cd6}'..='\u{18cfe}', | |
| 583 | '\u{18d1f}'..='\u{18d7f}', '\u{18df3}'..='\u{1afef}', '\u{1aff4}'..='\u{1aff4}', | |
| 584 | '\u{1affc}'..='\u{1affc}', '\u{1afff}'..='\u{1afff}', '\u{1b123}'..='\u{1b131}', | |
| 585 | '\u{1b133}'..='\u{1b14f}', '\u{1b153}'..='\u{1b154}', '\u{1b156}'..='\u{1b163}', | |
| 586 | '\u{1b168}'..='\u{1b16f}', '\u{1b2fc}'..='\u{1bbff}', '\u{1bc6b}'..='\u{1bc6f}', | |
| 587 | '\u{1bc7d}'..='\u{1bc7f}', '\u{1bc89}'..='\u{1bc8f}', '\u{1bc9a}'..='\u{1bc9b}', | |
| 588 | '\u{1bca4}'..='\u{1cbff}', '\u{1ccfd}'..='\u{1ccff}', '\u{1ceb4}'..='\u{1ceb9}', | |
| 589 | '\u{1ced1}'..='\u{1cedf}', '\u{1cef1}'..='\u{1ceff}', '\u{1cf2e}'..='\u{1cf2f}', | |
| 590 | '\u{1cf47}'..='\u{1cf4f}', '\u{1cfc4}'..='\u{1cfff}', '\u{1d0f6}'..='\u{1d0ff}', | |
| 591 | '\u{1d127}'..='\u{1d128}', '\u{1d1eb}'..='\u{1d1ff}', '\u{1d246}'..='\u{1d2bf}', | |
| 592 | '\u{1d2d4}'..='\u{1d2df}', '\u{1d2f4}'..='\u{1d2ff}', '\u{1d357}'..='\u{1d35f}', | |
| 593 | '\u{1d379}'..='\u{1d3ff}', '\u{1d455}'..='\u{1d455}', '\u{1d49d}'..='\u{1d49d}', | |
| 594 | '\u{1d4a0}'..='\u{1d4a1}', '\u{1d4a3}'..='\u{1d4a4}', '\u{1d4a7}'..='\u{1d4a8}', | |
| 595 | '\u{1d4ad}'..='\u{1d4ad}', '\u{1d4ba}'..='\u{1d4ba}', '\u{1d4bc}'..='\u{1d4bc}', | |
| 596 | '\u{1d4c4}'..='\u{1d4c4}', '\u{1d506}'..='\u{1d506}', '\u{1d50b}'..='\u{1d50c}', | |
| 597 | '\u{1d515}'..='\u{1d515}', '\u{1d51d}'..='\u{1d51d}', '\u{1d53a}'..='\u{1d53a}', | |
| 598 | '\u{1d53f}'..='\u{1d53f}', '\u{1d545}'..='\u{1d545}', '\u{1d547}'..='\u{1d549}', | |
| 599 | '\u{1d551}'..='\u{1d551}', '\u{1d6a6}'..='\u{1d6a7}', '\u{1d7cc}'..='\u{1d7cd}', | |
| 600 | '\u{1da8c}'..='\u{1da9a}', '\u{1daa0}'..='\u{1daa0}', '\u{1dab0}'..='\u{1deff}', | |
| 601 | '\u{1df1f}'..='\u{1df24}', '\u{1df2b}'..='\u{1dfff}', '\u{1e007}'..='\u{1e007}', | |
| 602 | '\u{1e019}'..='\u{1e01a}', '\u{1e022}'..='\u{1e022}', '\u{1e025}'..='\u{1e025}', | |
| 603 | '\u{1e02b}'..='\u{1e02f}', '\u{1e06e}'..='\u{1e08e}', '\u{1e090}'..='\u{1e0ff}', | |
| 604 | '\u{1e12d}'..='\u{1e12f}', '\u{1e13e}'..='\u{1e13f}', '\u{1e14a}'..='\u{1e14d}', | |
| 605 | '\u{1e150}'..='\u{1e28f}', '\u{1e2af}'..='\u{1e2bf}', '\u{1e2fa}'..='\u{1e2fe}', | |
| 606 | '\u{1e300}'..='\u{1e4cf}', '\u{1e4fa}'..='\u{1e5cf}', '\u{1e5fb}'..='\u{1e5fe}', | |
| 607 | '\u{1e600}'..='\u{1e6bf}', '\u{1e6df}'..='\u{1e6df}', '\u{1e6f6}'..='\u{1e6fd}', | |
| 608 | '\u{1e700}'..='\u{1e7df}', '\u{1e7e7}'..='\u{1e7e7}', '\u{1e7ec}'..='\u{1e7ec}', | |
| 609 | '\u{1e7ef}'..='\u{1e7ef}', '\u{1e7ff}'..='\u{1e7ff}', '\u{1e8c5}'..='\u{1e8c6}', | |
| 610 | '\u{1e8d7}'..='\u{1e8ff}', '\u{1e94c}'..='\u{1e94f}', '\u{1e95a}'..='\u{1e95d}', | |
| 611 | '\u{1e960}'..='\u{1ec70}', '\u{1ecb5}'..='\u{1ed00}', '\u{1ed3e}'..='\u{1edff}', | |
| 612 | '\u{1ee04}'..='\u{1ee04}', '\u{1ee20}'..='\u{1ee20}', '\u{1ee23}'..='\u{1ee23}', | |
| 613 | '\u{1ee25}'..='\u{1ee26}', '\u{1ee28}'..='\u{1ee28}', '\u{1ee33}'..='\u{1ee33}', | |
| 614 | '\u{1ee38}'..='\u{1ee38}', '\u{1ee3a}'..='\u{1ee3a}', '\u{1ee3c}'..='\u{1ee41}', | |
| 615 | '\u{1ee43}'..='\u{1ee46}', '\u{1ee48}'..='\u{1ee48}', '\u{1ee4a}'..='\u{1ee4a}', | |
| 616 | '\u{1ee4c}'..='\u{1ee4c}', '\u{1ee50}'..='\u{1ee50}', '\u{1ee53}'..='\u{1ee53}', | |
| 617 | '\u{1ee55}'..='\u{1ee56}', '\u{1ee58}'..='\u{1ee58}', '\u{1ee5a}'..='\u{1ee5a}', | |
| 618 | '\u{1ee5c}'..='\u{1ee5c}', '\u{1ee5e}'..='\u{1ee5e}', '\u{1ee60}'..='\u{1ee60}', | |
| 619 | '\u{1ee63}'..='\u{1ee63}', '\u{1ee65}'..='\u{1ee66}', '\u{1ee6b}'..='\u{1ee6b}', | |
| 620 | '\u{1ee73}'..='\u{1ee73}', '\u{1ee78}'..='\u{1ee78}', '\u{1ee7d}'..='\u{1ee7d}', | |
| 621 | '\u{1ee7f}'..='\u{1ee7f}', '\u{1ee8a}'..='\u{1ee8a}', '\u{1ee9c}'..='\u{1eea0}', | |
| 622 | '\u{1eea4}'..='\u{1eea4}', '\u{1eeaa}'..='\u{1eeaa}', '\u{1eebc}'..='\u{1eeef}', | |
| 623 | '\u{1eef2}'..='\u{1efff}', '\u{1f02c}'..='\u{1f02f}', '\u{1f094}'..='\u{1f09f}', | |
| 624 | '\u{1f0af}'..='\u{1f0b0}', '\u{1f0c0}'..='\u{1f0c0}', '\u{1f0d0}'..='\u{1f0d0}', | |
| 625 | '\u{1f0f6}'..='\u{1f0ff}', '\u{1f1ae}'..='\u{1f1e5}', '\u{1f203}'..='\u{1f20f}', | |
| 626 | '\u{1f23c}'..='\u{1f23f}', '\u{1f249}'..='\u{1f24f}', '\u{1f252}'..='\u{1f25f}', | |
| 627 | '\u{1f266}'..='\u{1f2ff}', '\u{1f6d9}'..='\u{1f6db}', '\u{1f6ed}'..='\u{1f6ef}', | |
| 628 | '\u{1f6fd}'..='\u{1f6ff}', '\u{1f7da}'..='\u{1f7df}', '\u{1f7ec}'..='\u{1f7ef}', | |
| 629 | '\u{1f7f1}'..='\u{1f7ff}', '\u{1f80c}'..='\u{1f80f}', '\u{1f848}'..='\u{1f84f}', | |
| 630 | '\u{1f85a}'..='\u{1f85f}', '\u{1f888}'..='\u{1f88f}', '\u{1f8ae}'..='\u{1f8af}', | |
| 631 | '\u{1f8bc}'..='\u{1f8bf}', '\u{1f8c2}'..='\u{1f8cf}', '\u{1f8d9}'..='\u{1f8ff}', | |
| 632 | '\u{1fa58}'..='\u{1fa5f}', '\u{1fa6e}'..='\u{1fa6f}', '\u{1fa7d}'..='\u{1fa7f}', | |
| 633 | '\u{1fa8b}'..='\u{1fa8d}', '\u{1fac7}'..='\u{1fac7}', '\u{1fac9}'..='\u{1facc}', | |
| 634 | '\u{1fadd}'..='\u{1fade}', '\u{1faeb}'..='\u{1faee}', '\u{1faf9}'..='\u{1faff}', | |
| 635 | '\u{1fb93}'..='\u{1fb93}', '\u{1fbfb}'..='\u{1ffff}', '\u{2a6e0}'..='\u{2a6ff}', | |
| 636 | '\u{2b81e}'..='\u{2b81f}', '\u{2ceae}'..='\u{2ceaf}', '\u{2ebe1}'..='\u{2ebef}', | |
| 637 | '\u{2ee5e}'..='\u{2f7ff}', '\u{2fa1e}'..='\u{2ffff}', '\u{3134b}'..='\u{3134f}', | |
| 638 | '\u{3347a}'..='\u{3fffd}', | |
| 639 | ]; | |
| 640 | ||
| 641 | #[rustfmt::skip] | |
| 642 | pub(super) static DEFAULT_IGNORABLE_CODE_POINT: &[RangeInclusive<char>; 17] = &[ | |
| 643 | '\u{ad}'..='\u{ad}', '\u{34f}'..='\u{34f}', '\u{61c}'..='\u{61c}', '\u{115f}'..='\u{1160}', | |
| 644 | '\u{17b4}'..='\u{17b5}', '\u{180b}'..='\u{180f}', '\u{200b}'..='\u{200f}', | |
| 645 | '\u{202a}'..='\u{202e}', '\u{2060}'..='\u{206f}', '\u{3164}'..='\u{3164}', | |
| 646 | '\u{fe00}'..='\u{fe0f}', '\u{feff}'..='\u{feff}', '\u{ffa0}'..='\u{ffa0}', | |
| 647 | '\u{fff0}'..='\u{fff8}', '\u{1bca0}'..='\u{1bca3}', '\u{1d173}'..='\u{1d17a}', | |
| 648 | '\u{e0000}'..='\u{e0fff}', | |
| 649 | ]; | |
| 650 | ||
| 395 | 651 | #[rustfmt::skip] |
| 396 | 652 | pub(super) static GRAPHEME_EXTEND: &[RangeInclusive<char>; 383] = &[ |
| 397 | 653 | '\u{300}'..='\u{36f}', '\u{483}'..='\u{489}', '\u{591}'..='\u{5bd}', '\u{5bf}'..='\u{5bf}', |
library/std/src/collections/hash/map.rs+71-5| ... | ... | @@ -2538,9 +2538,42 @@ impl<'a, K, V, A: Allocator> Entry<'a, K, V, A> { |
| 2538 | 2538 | #[inline] |
| 2539 | 2539 | #[stable(feature = "rust1", since = "1.0.0")] |
| 2540 | 2540 | pub fn or_insert_with<F: FnOnce() -> V>(self, default: F) -> &'a mut V { |
| 2541 | self.or_try_insert_with(|| Result::<_, !>::Ok(default())).unwrap() | |
| 2542 | } | |
| 2543 | ||
| 2544 | /// Ensures a value is in the entry by inserting the result of a fallible default function | |
| 2545 | /// if empty, and returns a mutable reference to the value in the entry. | |
| 2546 | /// | |
| 2547 | /// This method works identically to [`or_insert_with`] except that the default function | |
| 2548 | /// should return a `Result` and, in the case of an error, the error is propagated. | |
| 2549 | /// | |
| 2550 | /// [`or_insert_with`]: Self::or_insert_with | |
| 2551 | /// | |
| 2552 | /// # Examples | |
| 2553 | /// | |
| 2554 | /// ``` | |
| 2555 | /// #![feature(try_entry)] | |
| 2556 | /// # fn main() -> Result<(), std::num::ParseIntError> { | |
| 2557 | /// use std::collections::HashMap; | |
| 2558 | /// | |
| 2559 | /// let mut map: HashMap<&str, usize> = HashMap::new(); | |
| 2560 | /// let value = "42"; | |
| 2561 | /// | |
| 2562 | /// map.entry("poneyland").or_try_insert_with(|| value.parse())?; | |
| 2563 | /// | |
| 2564 | /// assert_eq!(map["poneyland"], 42); | |
| 2565 | /// # Ok(()) | |
| 2566 | /// # } | |
| 2567 | /// ``` | |
| 2568 | #[inline] | |
| 2569 | #[unstable(feature = "try_entry", issue = "157354")] | |
| 2570 | pub fn or_try_insert_with<F: FnOnce() -> Result<V, E>, E>( | |
| 2571 | self, | |
| 2572 | default: F, | |
| 2573 | ) -> Result<&'a mut V, E> { | |
| 2541 | 2574 | match self { |
| 2542 | Occupied(entry) => entry.into_mut(), | |
| 2543 | Vacant(entry) => entry.insert(default()), | |
| 2575 | Occupied(entry) => Ok(entry.into_mut()), | |
| 2576 | Vacant(entry) => Ok(entry.insert(default()?)), | |
| 2544 | 2577 | } |
| 2545 | 2578 | } |
| 2546 | 2579 | |
| ... | ... | @@ -2565,11 +2598,44 @@ impl<'a, K, V, A: Allocator> Entry<'a, K, V, A> { |
| 2565 | 2598 | #[inline] |
| 2566 | 2599 | #[stable(feature = "or_insert_with_key", since = "1.50.0")] |
| 2567 | 2600 | pub fn or_insert_with_key<F: FnOnce(&K) -> V>(self, default: F) -> &'a mut V { |
| 2601 | self.or_try_insert_with_key(|k| Result::<_, !>::Ok(default(k))).into_ok() | |
| 2602 | } | |
| 2603 | ||
| 2604 | /// Ensures a value is in the entry by inserting, if empty, the result of the default function. | |
| 2605 | /// This method allows for generating key-derived values for insertion by providing the default | |
| 2606 | /// function a reference to the key that was moved during the `entry(key)` method call. | |
| 2607 | /// | |
| 2608 | /// This method works identically to [`or_insert_with_key`] except that the default function | |
| 2609 | /// should return a `Result` and, in the case of an error, the error is propagated. | |
| 2610 | /// | |
| 2611 | /// [`or_insert_with_key`]: Self::or_insert_with_key | |
| 2612 | /// | |
| 2613 | /// # Examples | |
| 2614 | /// | |
| 2615 | /// ``` | |
| 2616 | /// #![feature(try_entry)] | |
| 2617 | /// # fn main() -> Result<(), std::num::ParseIntError> { | |
| 2618 | /// use std::collections::HashMap; | |
| 2619 | /// | |
| 2620 | /// let mut map: HashMap<&str, usize> = HashMap::new(); | |
| 2621 | /// | |
| 2622 | /// map.entry("42").or_try_insert_with_key(|key| key.parse())?; | |
| 2623 | /// | |
| 2624 | /// assert_eq!(map["42"], 42); | |
| 2625 | /// # Ok(()) | |
| 2626 | /// # } | |
| 2627 | /// ``` | |
| 2628 | #[inline] | |
| 2629 | #[unstable(feature = "try_entry", issue = "157354")] | |
| 2630 | pub fn or_try_insert_with_key<F: FnOnce(&K) -> Result<V, E>, E>( | |
| 2631 | self, | |
| 2632 | default: F, | |
| 2633 | ) -> Result<&'a mut V, E> { | |
| 2568 | 2634 | match self { |
| 2569 | Occupied(entry) => entry.into_mut(), | |
| 2635 | Occupied(entry) => Ok(entry.into_mut()), | |
| 2570 | 2636 | Vacant(entry) => { |
| 2571 | let value = default(entry.key()); | |
| 2572 | entry.insert(value) | |
| 2637 | let value = default(entry.key())?; | |
| 2638 | Ok(entry.insert(value)) | |
| 2573 | 2639 | } |
| 2574 | 2640 | } |
| 2575 | 2641 | } |
library/std/src/env.rs+6| ... | ... | @@ -101,6 +101,12 @@ pub struct VarsOs { |
| 101 | 101 | inner: env_imp::Env, |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | #[stable(feature = "env_vars_unimpl_send_sync", since = "CURRENT_RUSTC_VERSION")] | |
| 105 | impl !Send for VarsOs {} | |
| 106 | ||
| 107 | #[stable(feature = "env_vars_unimpl_send_sync", since = "CURRENT_RUSTC_VERSION")] | |
| 108 | impl !Sync for VarsOs {} | |
| 109 | ||
| 104 | 110 | /// Returns an iterator of (variable, value) pairs of strings, for all the |
| 105 | 111 | /// environment variables of the current process. |
| 106 | 112 | /// |
library/std/src/lib.rs+1| ... | ... | @@ -313,6 +313,7 @@ |
| 313 | 313 | #![feature(try_blocks)] |
| 314 | 314 | #![feature(try_trait_v2)] |
| 315 | 315 | #![feature(type_alias_impl_trait)] |
| 316 | #![feature(unwrap_infallible)] | |
| 316 | 317 | // tidy-alphabetical-end |
| 317 | 318 | // |
| 318 | 319 | // Library features (core): |
library/std/src/sys/env/common.rs-3| ... | ... | @@ -17,9 +17,6 @@ impl fmt::Debug for Env { |
| 17 | 17 | } |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | impl !Send for Env {} | |
| 21 | impl !Sync for Env {} | |
| 22 | ||
| 23 | 20 | impl Iterator for Env { |
| 24 | 21 | type Item = (OsString, OsString); |
| 25 | 22 | fn next(&mut self) -> Option<(OsString, OsString)> { |
library/std/src/sys/pal/windows/c/bindings.txt+3| ... | ... | @@ -2154,6 +2154,8 @@ GENERIC_ALL |
| 2154 | 2154 | GENERIC_EXECUTE |
| 2155 | 2155 | GENERIC_READ |
| 2156 | 2156 | GENERIC_WRITE |
| 2157 | GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | |
| 2158 | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT | |
| 2157 | 2159 | GetActiveProcessorCount |
| 2158 | 2160 | getaddrinfo |
| 2159 | 2161 | GetCommandLineW |
| ... | ... | @@ -2178,6 +2180,7 @@ GetFullPathNameW |
| 2178 | 2180 | GetLastError |
| 2179 | 2181 | GetModuleFileNameW |
| 2180 | 2182 | GetModuleHandleA |
| 2183 | GetModuleHandleExW | |
| 2181 | 2184 | GetModuleHandleW |
| 2182 | 2185 | GetOverlappedResult |
| 2183 | 2186 | getpeername |
library/std/src/sys/pal/windows/c/windows_sys.rs+3| ... | ... | @@ -56,6 +56,7 @@ windows_link::link!("kernel32.dll" "system" fn GetFullPathNameW(lpfilename : PCW |
| 56 | 56 | windows_link::link!("kernel32.dll" "system" fn GetLastError() -> WIN32_ERROR); |
| 57 | 57 | windows_link::link!("kernel32.dll" "system" fn GetModuleFileNameW(hmodule : HMODULE, lpfilename : PWSTR, nsize : u32) -> u32); |
| 58 | 58 | windows_link::link!("kernel32.dll" "system" fn GetModuleHandleA(lpmodulename : PCSTR) -> HMODULE); |
| 59 | windows_link::link!("kernel32.dll" "system" fn GetModuleHandleExW(dwflags : u32, lpmodulename : PCWSTR, phmodule : *mut HMODULE) -> BOOL); | |
| 59 | 60 | windows_link::link!("kernel32.dll" "system" fn GetModuleHandleW(lpmodulename : PCWSTR) -> HMODULE); |
| 60 | 61 | windows_link::link!("kernel32.dll" "system" fn GetOverlappedResult(hfile : HANDLE, lpoverlapped : *const OVERLAPPED, lpnumberofbytestransferred : *mut u32, bwait : BOOL) -> BOOL); |
| 61 | 62 | windows_link::link!("kernel32.dll" "system" fn GetProcAddress(hmodule : HMODULE, lpprocname : PCSTR) -> FARPROC); |
| ... | ... | @@ -2716,6 +2717,8 @@ pub const GENERIC_EXECUTE: GENERIC_ACCESS_RIGHTS = 536870912u32; |
| 2716 | 2717 | pub const GENERIC_READ: GENERIC_ACCESS_RIGHTS = 2147483648u32; |
| 2717 | 2718 | pub const GENERIC_WRITE: GENERIC_ACCESS_RIGHTS = 1073741824u32; |
| 2718 | 2719 | pub type GETFINALPATHNAMEBYHANDLE_FLAGS = u32; |
| 2720 | pub const GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS: u32 = 4u32; | |
| 2721 | pub const GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT: u32 = 2u32; | |
| 2719 | 2722 | #[repr(C)] |
| 2720 | 2723 | #[derive(Clone, Copy)] |
| 2721 | 2724 | pub struct GUID { |
library/std/src/sys/thread_local/guard/windows.rs+47-3| ... | ... | @@ -159,9 +159,11 @@ pub fn enable() { |
| 159 | 159 | // |
| 160 | 160 | // Miri has no DLL unloading so we can skip this step here. |
| 161 | 161 | if !cfg!(miri) { |
| 162 | let res = unsafe { c::atexit(free_fls_key_at_exit) }; | |
| 163 | if res != 0 { | |
| 164 | rtabort!("failed to register fls atexit hook"); | |
| 162 | if cleanup_is_unloadable() { | |
| 163 | let res = unsafe { c::atexit(free_fls_key_at_exit) }; | |
| 164 | if res != 0 { | |
| 165 | rtabort!("failed to register fls atexit hook"); | |
| 166 | } | |
| 165 | 167 | } |
| 166 | 168 | } |
| 167 | 169 | |
| ... | ... | @@ -179,6 +181,48 @@ pub fn enable() { |
| 179 | 181 | } |
| 180 | 182 | } |
| 181 | 183 | |
| 184 | /// Checks if `cleanup` is in a different module from the main executable, | |
| 185 | /// using `GetModuleHandleExW(FLAG_FROM_ADDRESS, cleanup) != GetModuleHandleW(ptr::null())`. | |
| 186 | /// | |
| 187 | /// If `cleanup` lives in the main executable, its code cannot be unmapped | |
| 188 | /// before process exit, so no unload hook is needed. | |
| 189 | /// | |
| 190 | /// If it lives in a DLL, the DLL may be unloaded while the process keeps | |
| 191 | /// running, so the FLS callback must be unregistered before that image is | |
| 192 | /// unmapped. | |
| 193 | /// | |
| 194 | /// On failure, return true, which assumes it can be unloaded. | |
| 195 | fn cleanup_is_unloadable() -> bool { | |
| 196 | // Get a handle to the module of `cleanup`. | |
| 197 | let cleanup_module = { | |
| 198 | let mut handle: c::HMODULE = ptr::null_mut(); | |
| 199 | ||
| 200 | let res = unsafe { | |
| 201 | c::GetModuleHandleExW( | |
| 202 | c::GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | |
| 203 | | c::GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, | |
| 204 | cleanup as *const () as c::PCWSTR, | |
| 205 | &mut handle, | |
| 206 | ) | |
| 207 | }; | |
| 208 | ||
| 209 | if res == c::FALSE || handle.is_null() { | |
| 210 | return true; | |
| 211 | } | |
| 212 | ||
| 213 | handle | |
| 214 | }; | |
| 215 | ||
| 216 | // Get a handle to the file used to create the calling process (.exe file). | |
| 217 | let main_exe_module = unsafe { c::GetModuleHandleW(ptr::null()) }; | |
| 218 | ||
| 219 | if main_exe_module.is_null() { | |
| 220 | return true; | |
| 221 | } | |
| 222 | ||
| 223 | cleanup_module != main_exe_module | |
| 224 | } | |
| 225 | ||
| 182 | 226 | extern "C" fn free_fls_key_at_exit() { |
| 183 | 227 | // The main purpose of this hook is to free the FLS slot during DLL unload. |
| 184 | 228 | // However, this hook will also be called during normal process exit, while other Rust threads are still running, |
library/std/src/thread/local.rs+2-2| ... | ... | @@ -104,8 +104,8 @@ use crate::fmt; |
| 104 | 104 | /// If a process loads a Rust `cdylib`, it must not cause the Rust TLS destructor support |
| 105 | 105 | // to be initialized for the first time during process shutdown. |
| 106 | 106 | /// |
| 107 | /// When dynamically unloading a Rust `cdylib`, threads with pending TLS destructors | |
| 108 | /// may run during the unload or may be leaked. | |
| 107 | /// When dynamically unloading a Rust `cdylib`, pending TLS destructors may run | |
| 108 | // during the unload or may be leaked. | |
| 109 | 109 | /// |
| 110 | 110 | /// [converted into a fiber]: https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-convertthreadtofiber |
| 111 | 111 | /// [converted back into a thread]: https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-convertfibertothread |
library/std/src/time.rs+3-3| ... | ... | @@ -137,9 +137,9 @@ use crate::sys::{FromInner, IntoInner, time}; |
| 137 | 137 | /// if available, which is the case for all [tier 1] platforms. |
| 138 | 138 | /// In practice such guarantees are – under rare circumstances – broken by hardware, virtualization |
| 139 | 139 | /// or operating system bugs. To work around these bugs and platforms not offering monotonic clocks |
| 140 | /// [`duration_since`], [`elapsed`] and [`sub`] saturate to zero. In older Rust versions this | |
| 141 | /// lead to a panic instead. [`checked_duration_since`] can be used to detect and handle situations | |
| 142 | /// where monotonicity is violated, or `Instant`s are subtracted in the wrong order. | |
| 140 | /// [`duration_since`], [`elapsed`] and [`sub`](#impl-Sub-for-Instant) saturate to zero. In older | |
| 141 | /// Rust versions this lead to a panic instead. [`checked_duration_since`] can be used to detect and | |
| 142 | /// handle situations where monotonicity is violated, or `Instant`s are subtracted in the wrong order. | |
| 143 | 143 | /// |
| 144 | 144 | /// This workaround obscures programming errors where earlier and later instants are accidentally |
| 145 | 145 | /// swapped. For this reason future Rust versions may reintroduce panics. |
license-metadata.json+22-10| ... | ... | @@ -3,6 +3,28 @@ |
| 3 | 3 | "children": [ |
| 4 | 4 | { |
| 5 | 5 | "children": [ |
| 6 | { | |
| 7 | "children": [ | |
| 8 | { | |
| 9 | "license": { | |
| 10 | "copyright": [ | |
| 11 | "The Rust Project Developers (see https://thanks.rust-lang.org)" | |
| 12 | ], | |
| 13 | "spdx": "Apache-2.0 OR MIT" | |
| 14 | }, | |
| 15 | "name": "mod.rs", | |
| 16 | "type": "file" | |
| 17 | } | |
| 18 | ], | |
| 19 | "license": { | |
| 20 | "copyright": [ | |
| 21 | "1991-2024 Unicode, Inc" | |
| 22 | ], | |
| 23 | "spdx": "Unicode-3.0" | |
| 24 | }, | |
| 25 | "name": "library/core/src/unicode", | |
| 26 | "type": "directory" | |
| 27 | }, | |
| 6 | 28 | { |
| 7 | 29 | "children": [ |
| 8 | 30 | { |
| ... | ... | @@ -178,16 +200,6 @@ |
| 178 | 200 | "name": "library/backtrace", |
| 179 | 201 | "type": "directory" |
| 180 | 202 | }, |
| 181 | { | |
| 182 | "license": { | |
| 183 | "copyright": [ | |
| 184 | "1991-2024 Unicode, Inc" | |
| 185 | ], | |
| 186 | "spdx": "Unicode-3.0" | |
| 187 | }, | |
| 188 | "name": "library/core/src/unicode/unicode_data.rs", | |
| 189 | "type": "file" | |
| 190 | }, | |
| 191 | 203 | { |
| 192 | 204 | "children": [], |
| 193 | 205 | "license": { |
package.json+1-1| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | { |
| 2 | 2 | "dependencies": { |
| 3 | "browser-ui-test": "^0.23.5", | |
| 3 | "browser-ui-test": "^0.24.0", | |
| 4 | 4 | "es-check": "^9.4.4", |
| 5 | 5 | "eslint": "^8.57.1", |
| 6 | 6 | "typescript": "^5.8.3" |
src/ci/docker/host-x86_64/pr-check-1/Dockerfile+2| ... | ... | @@ -36,6 +36,8 @@ RUN pip3 install --no-deps --no-cache-dir --require-hashes -r /tmp/reuse-require |
| 36 | 36 | COPY host-x86_64/pr-check-1/check-default-config-profiles.sh /scripts/ |
| 37 | 37 | COPY host-x86_64/pr-check-1/validate-toolstate.sh /scripts/ |
| 38 | 38 | |
| 39 | ENV PUPPETEER_SKIP_DOWNLOAD 1 | |
| 40 | ||
| 39 | 41 | # Check library crates on all tier 1 targets. |
| 40 | 42 | # We disable optimized compiler built-ins because that requires a C toolchain for the target. |
| 41 | 43 | # We also skip the x86_64-unknown-linux-gnu target as it is well-tested by other jobs. |
src/ci/docker/host-x86_64/tidy/Dockerfile+2| ... | ... | @@ -24,6 +24,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ |
| 24 | 24 | mingw-w64 \ |
| 25 | 25 | && rm -rf /var/lib/apt/lists/* |
| 26 | 26 | |
| 27 | ENV PUPPETEER_SKIP_DOWNLOAD 1 | |
| 28 | ||
| 27 | 29 | COPY scripts/nodejs.sh /scripts/ |
| 28 | 30 | RUN sh /scripts/nodejs.sh /node |
| 29 | 31 | ENV PATH="/node/bin:${PATH}" |
src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile+11| ... | ... | @@ -56,6 +56,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ |
| 56 | 56 | lsb-release \ |
| 57 | 57 | xdg-utils \ |
| 58 | 58 | wget \ |
| 59 | unzip \ | |
| 59 | 60 | # libgccjit dependencies |
| 60 | 61 | flex \ |
| 61 | 62 | libmpfr-dev \ |
| ... | ... | @@ -72,6 +73,16 @@ ENV GCC_EXEC_PREFIX="/usr/lib/gcc/" |
| 72 | 73 | |
| 73 | 74 | COPY host-x86_64/x86_64-gnu-tools/checktools.sh /tmp/ |
| 74 | 75 | |
| 76 | # The version used by current `browser-ui-test` version. To be removed once `yarn` can download | |
| 77 | # it without failing... | |
| 78 | RUN curl https://ci-mirrors.rust-lang.org/rustc/chrome-linux64.zip > chrome-linux64.zip | |
| 79 | RUN unzip -d /usr/bin/ chrome-linux64.zip && rm chrome-linux64.zip | |
| 80 | ||
| 81 | # We already downloaded chromium so no need to download it again. | |
| 82 | ENV PUPPETEER_SKIP_DOWNLOAD 1 | |
| 83 | # We provide the path to the extracted chrome binary. | |
| 84 | ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chrome-linux64/chrome | |
| 85 | ||
| 75 | 86 | COPY scripts/nodejs.sh /scripts/ |
| 76 | 87 | RUN sh /scripts/nodejs.sh /node |
| 77 | 88 | ENV PATH="/node/bin:${PATH}" |
src/ci/docker/scripts/nodejs.sh+1-1| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | |
| 3 | 3 | set -ex |
| 4 | 4 | |
| 5 | NODEJS_VERSION=v20.12.2 | |
| 5 | NODEJS_VERSION=v24.15.0 | |
| 6 | 6 | YARN_VERSION=1.22.22 |
| 7 | 7 | INSTALL_PATH=${1:-/node} |
| 8 | 8 |
src/doc/rustc/src/platform-support.md+21-17| ... | ... | @@ -352,23 +352,23 @@ target | std | host | notes |
| 352 | 352 | [`loongarch32-unknown-none-softfloat`](platform-support/loongarch-none.md) | * | | LoongArch32 Bare-metal (ILP32S ABI) |
| 353 | 353 | [`m68k-unknown-linux-gnu`](platform-support/m68k-unknown-linux-gnu.md) | ? | | Motorola 680x0 Linux |
| 354 | 354 | [`m68k-unknown-none-elf`](platform-support/m68k-unknown-none-elf.md) | | | Motorola 680x0 |
| 355 | `mips-unknown-linux-gnu` | ✓ | ✓ | MIPS Linux (kernel 4.4, glibc 2.23) | |
| 356 | `mips-unknown-linux-musl` | ✓ | | MIPS Linux with musl 1.2.5 | |
| 357 | `mips-unknown-linux-uclibc` | ✓ | | MIPS Linux with uClibc | |
| 358 | [`mips64-openwrt-linux-musl`](platform-support/mips64-openwrt-linux-musl.md) | ? | | MIPS64 for OpenWrt Linux musl 1.2.5 | |
| 359 | `mips64-unknown-linux-gnuabi64` | ✓ | ✓ | MIPS64 Linux, N64 ABI (kernel 4.4, glibc 2.23) | |
| 360 | [`mips64-unknown-linux-muslabi64`](platform-support/mips64-unknown-linux-muslabi64.md) | ✓ | ✓ | MIPS64 Linux, N64 ABI, musl 1.2.5 | |
| 361 | `mips64el-unknown-linux-gnuabi64` | ✓ | ✓ | MIPS64 (little endian) Linux, N64 ABI (kernel 4.4, glibc 2.23) | |
| 362 | `mips64el-unknown-linux-muslabi64` | ✓ | | MIPS64 (little endian) Linux, N64 ABI, musl 1.2.5 | |
| 363 | `mipsel-sony-psp` | * | | MIPS (LE) Sony PlayStation Portable (PSP) | |
| 364 | [`mipsel-sony-psx`](platform-support/mipsel-sony-psx.md) | * | | MIPS (LE) Sony PlayStation 1 (PSX) | |
| 365 | [`mipsel-unknown-linux-gnu`](platform-support/mipsel-unknown-linux-gnu.md) | ✓ | ✓ | MIPS (little endian) Linux (kernel 4.4, glibc 2.23) | |
| 366 | `mipsel-unknown-linux-musl` | ✓ | | MIPS (little endian) Linux with musl 1.2.5 | |
| 367 | `mipsel-unknown-linux-uclibc` | ✓ | | MIPS (LE) Linux with uClibc | |
| 368 | [`mipsel-unknown-netbsd`](platform-support/netbsd.md) | ✓ | ✓ | 32-bit MIPS (LE), requires mips32 cpu support | |
| 369 | `mipsel-unknown-none` | * | | Bare MIPS (LE) softfloat | |
| 370 | [`mips-mti-none-elf`](platform-support/mips-mti-none-elf.md) | * | | Bare MIPS32r2 (BE) softfloat | |
| 371 | [`mipsel-mti-none-elf`](platform-support/mips-mti-none-elf.md) | * | | Bare MIPS32r2 (LE) softfloat | |
| 355 | `mips-unknown-linux-gnu` | ✓ | ✓ | MIPS Linux (kernel 4.4, glibc 2.23) [^snan-inverted] | |
| 356 | `mips-unknown-linux-musl` | ✓ | | MIPS Linux with musl 1.2.5 [^snan-inverted] | |
| 357 | `mips-unknown-linux-uclibc` | ✓ | | MIPS Linux with uClibc [^snan-inverted] | |
| 358 | [`mips64-openwrt-linux-musl`](platform-support/mips64-openwrt-linux-musl.md) | ? | | MIPS64 for OpenWrt Linux musl 1.2.5 [^snan-inverted] | |
| 359 | `mips64-unknown-linux-gnuabi64` | ✓ | ✓ | MIPS64 Linux, N64 ABI (kernel 4.4, glibc 2.23) [^snan-inverted] | |
| 360 | [`mips64-unknown-linux-muslabi64`](platform-support/mips64-unknown-linux-muslabi64.md) | ✓ | ✓ | MIPS64 Linux, N64 ABI, musl 1.2.5 [^snan-inverted] | |
| 361 | `mips64el-unknown-linux-gnuabi64` | ✓ | ✓ | MIPS64 (little endian) Linux, N64 ABI (kernel 4.4, glibc 2.23) [^snan-inverted] | |
| 362 | `mips64el-unknown-linux-muslabi64` | ✓ | | MIPS64 (little endian) Linux, N64 ABI, musl 1.2.5 [^snan-inverted] | |
| 363 | `mipsel-sony-psp` | * | | MIPS (LE) Sony PlayStation Portable (PSP) [^snan-inverted] | |
| 364 | [`mipsel-sony-psx`](platform-support/mipsel-sony-psx.md) | * | | MIPS (LE) Sony PlayStation 1 (PSX) [^snan-inverted] | |
| 365 | [`mipsel-unknown-linux-gnu`](platform-support/mipsel-unknown-linux-gnu.md) | ✓ | ✓ | MIPS (little endian) Linux (kernel 4.4, glibc 2.23) [^snan-inverted] | |
| 366 | `mipsel-unknown-linux-musl` | ✓ | | MIPS (little endian) Linux with musl 1.2.5 [^snan-inverted] | |
| 367 | `mipsel-unknown-linux-uclibc` | ✓ | | MIPS (LE) Linux with uClibc [^snan-inverted] | |
| 368 | [`mipsel-unknown-netbsd`](platform-support/netbsd.md) | ✓ | ✓ | 32-bit MIPS (LE), requires mips32 cpu support [^snan-inverted] | |
| 369 | `mipsel-unknown-none` | * | | Bare MIPS (LE) softfloat [^snan-inverted] | |
| 370 | [`mips-mti-none-elf`](platform-support/mips-mti-none-elf.md) | * | | Bare MIPS32r2 (BE) softfloat [^snan-inverted] | |
| 371 | [`mipsel-mti-none-elf`](platform-support/mips-mti-none-elf.md) | * | | Bare MIPS32r2 (LE) softfloat [^snan-inverted] | |
| 372 | 372 | [`mipsisa32r6-unknown-linux-gnu`](platform-support/mips-release-6.md) | ? | | 32-bit MIPS Release 6 Big Endian |
| 373 | 373 | [`mipsisa32r6el-unknown-linux-gnu`](platform-support/mips-release-6.md) | ? | | 32-bit MIPS Release 6 Little Endian |
| 374 | 374 | [`mipsisa64r6-unknown-linux-gnuabi64`](platform-support/mips-release-6.md) | ? | | 64-bit MIPS Release 6 Big Endian |
| ... | ... | @@ -472,3 +472,7 @@ target | std | host | notes |
| 472 | 472 | |
| 473 | 473 | [runs on NVIDIA GPUs]: https://github.com/japaric-archived/nvptx#targets |
| 474 | 474 | [the AMD GPU]: https://llvm.org/docs/AMDGPUUsage.html#processors |
| 475 | ||
| 476 | [^snan-inverted]: On these targets, the treatment of floating-point NaN values is non-compliant. The bit representation for signaling NaNs is inverted compared to [what Rust expects](../std/primitive.f32.html). This means that operations that are expected to return a quiet NaN may return a signaling NaN. See [issue #68925][snan-issue]. | |
| 477 | ||
| 478 | [snan-issue]: https://github.com/rust-lang/rust/issues/68925 |
src/librustdoc/clean/mod.rs+2-2| ... | ... | @@ -1271,14 +1271,14 @@ fn clean_trait_item<'tcx>(trait_item: &hir::TraitItem<'tcx>, cx: &mut DocContext |
| 1271 | 1271 | let local_did = trait_item.owner_id.to_def_id(); |
| 1272 | 1272 | cx.with_param_env(local_did, |cx| { |
| 1273 | 1273 | let inner = match trait_item.kind { |
| 1274 | hir::TraitItemKind::Const(ty, Some(default), _) => { | |
| 1274 | hir::TraitItemKind::Const(ty, Some(default)) => { | |
| 1275 | 1275 | ProvidedAssocConstItem(Box::new(Constant { |
| 1276 | 1276 | generics: enter_impl_trait(cx, |cx| clean_generics(trait_item.generics, cx)), |
| 1277 | 1277 | kind: clean_const_item_rhs(default, local_did), |
| 1278 | 1278 | type_: clean_ty(ty, cx), |
| 1279 | 1279 | })) |
| 1280 | 1280 | } |
| 1281 | hir::TraitItemKind::Const(ty, None, _) => { | |
| 1281 | hir::TraitItemKind::Const(ty, None) => { | |
| 1282 | 1282 | let generics = enter_impl_trait(cx, |cx| clean_generics(trait_item.generics, cx)); |
| 1283 | 1283 | RequiredAssocConstItem(generics, Box::new(clean_ty(ty, cx))) |
| 1284 | 1284 | } |
src/tools/clippy/clippy_lints/src/non_copy_const.rs+2-2| ... | ... | @@ -757,7 +757,7 @@ impl<'tcx> LateLintPass<'tcx> for NonCopyConst<'tcx> { |
| 757 | 757 | } |
| 758 | 758 | |
| 759 | 759 | fn check_trait_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx TraitItem<'_>) { |
| 760 | if let TraitItemKind::Const(_, ct_rhs_opt, _) = item.kind | |
| 760 | if let TraitItemKind::Const(_, ct_rhs_opt) = item.kind | |
| 761 | 761 | && let ty = cx.tcx.type_of(item.owner_id).instantiate_identity().skip_norm_wip() |
| 762 | 762 | && match self.is_ty_freeze(cx.tcx, cx.typing_env(), ty) { |
| 763 | 763 | IsFreeze::No => true, |
| ... | ... | @@ -958,7 +958,7 @@ fn get_const_hir_value<'tcx>( |
| 958 | 958 | { |
| 959 | 959 | match tcx.hir_node(tcx.local_def_id_to_hir_id(did)) { |
| 960 | 960 | Node::ImplItem(item) if let ImplItemKind::Const(.., ct_rhs) = item.kind => (did, ct_rhs), |
| 961 | Node::TraitItem(item) if let TraitItemKind::Const(_, Some(ct_rhs), _) = item.kind => (did, ct_rhs), | |
| 961 | Node::TraitItem(item) if let TraitItemKind::Const(_, Some(ct_rhs)) = item.kind => (did, ct_rhs), | |
| 962 | 962 | _ => return None, |
| 963 | 963 | } |
| 964 | 964 | }, |
src/tools/clippy/clippy_lints/src/types/mod.rs+1-1| ... | ... | @@ -514,7 +514,7 @@ impl<'tcx> LateLintPass<'tcx> for Types { |
| 514 | 514 | }; |
| 515 | 515 | |
| 516 | 516 | match item.kind { |
| 517 | TraitItemKind::Const(ty, _, _) | TraitItemKind::Type(_, Some(ty)) => { | |
| 517 | TraitItemKind::Const(ty, _) | TraitItemKind::Type(_, Some(ty)) => { | |
| 518 | 518 | self.check_ty(cx, ty, context); |
| 519 | 519 | }, |
| 520 | 520 | TraitItemKind::Fn(ref sig, trait_method) => { |
src/tools/clippy/clippy_utils/src/ty/mod.rs+7-5| ... | ... | @@ -1050,11 +1050,13 @@ pub fn make_projection<'tcx>( |
| 1050 | 1050 | #[cfg(debug_assertions)] |
| 1051 | 1051 | assert_generic_args_match(tcx, assoc_item.def_id, args); |
| 1052 | 1052 | |
| 1053 | Some(AliasTy::new_from_args( | |
| 1054 | tcx, | |
| 1055 | ty::AliasTyKind::new_from_def_id(tcx, assoc_item.def_id), | |
| 1056 | args, | |
| 1057 | )) | |
| 1053 | let kind = if let DefKind::Impl { of_trait: false } = tcx.def_kind(tcx.parent(assoc_item.def_id)) { | |
| 1054 | ty::AliasTyKind::Inherent { def_id: assoc_item.def_id } | |
| 1055 | } else { | |
| 1056 | ty::AliasTyKind::Projection { def_id: assoc_item.def_id } | |
| 1057 | }; | |
| 1058 | ||
| 1059 | Some(AliasTy::new_from_args(tcx, kind, args)) | |
| 1058 | 1060 | } |
| 1059 | 1061 | helper( |
| 1060 | 1062 | tcx, |
src/tools/compiletest/src/runtest.rs+22-5| ... | ... | @@ -2304,6 +2304,23 @@ impl<'test> TestCx<'test> { |
| 2304 | 2304 | self.props.compile_flags.iter().any(|s| s.contains("--color=always")) |
| 2305 | 2305 | } |
| 2306 | 2306 | |
| 2307 | /// Returns the lines for the by-lines comparison, normalized for the | |
| 2308 | /// parallel front-end: for SVG output, strip the header line and `y` | |
| 2309 | /// offsets; otherwise, filter out padded empty code lines (a single `|`). | |
| 2310 | fn lines_for_comparison(&self, output: &str) -> Vec<String> { | |
| 2311 | if self.force_color_svg() { | |
| 2312 | let strip_y = static_regex!(r#"y="\d+px""#); | |
| 2313 | output | |
| 2314 | .lines() | |
| 2315 | // anstyle_svg causes environment-dependent width parameter | |
| 2316 | .skip(1) | |
| 2317 | .map(|line| strip_y.replace_all(line, r#"y="0px""#).into_owned()) | |
| 2318 | .collect() | |
| 2319 | } else { | |
| 2320 | output.lines().filter(|l| l.trim() != "|").map(str::to_owned).collect() | |
| 2321 | } | |
| 2322 | } | |
| 2323 | ||
| 2307 | 2324 | fn load_compare_outputs( |
| 2308 | 2325 | &self, |
| 2309 | 2326 | proc_res: &ProcRes, |
| ... | ... | @@ -2719,10 +2736,8 @@ impl<'test> TestCx<'test> { |
| 2719 | 2736 | (&tmp.0, &tmp.1) |
| 2720 | 2737 | } |
| 2721 | 2738 | } else if compare_output_by_lines { |
| 2722 | // Filter out padded empty code lines | |
| 2723 | let mut actual_lines: Vec<&str> = actual.lines().filter(|l| l.trim() != "|").collect(); | |
| 2724 | let mut expected_lines: Vec<&str> = | |
| 2725 | expected.lines().filter(|l| l.trim() != "|").collect(); | |
| 2739 | let mut actual_lines = self.lines_for_comparison(actual); | |
| 2740 | let mut expected_lines = self.lines_for_comparison(expected); | |
| 2726 | 2741 | actual_lines.sort_unstable(); |
| 2727 | 2742 | expected_lines.sort_unstable(); |
| 2728 | 2743 | if actual_lines == expected_lines { |
| ... | ... | @@ -2866,7 +2881,9 @@ impl<'test> TestCx<'test> { |
| 2866 | 2881 | } |
| 2867 | 2882 | |
| 2868 | 2883 | if show_diff_by_lines { |
| 2869 | write!(self.stderr, "{}", diff_by_lines(expected, actual)); | |
| 2884 | let expected_lines = self.lines_for_comparison(expected); | |
| 2885 | let actual_lines = self.lines_for_comparison(actual); | |
| 2886 | write!(self.stderr, "{}", diff_by_lines(&expected_lines, &actual_lines)); | |
| 2870 | 2887 | } |
| 2871 | 2888 | } |
| 2872 | 2889 |
src/tools/compiletest/src/runtest/compute_diff.rs+5-6| ... | ... | @@ -105,19 +105,18 @@ pub(crate) fn write_diff(expected: &str, actual: &str, context_size: usize) -> S |
| 105 | 105 | output |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | pub(crate) fn diff_by_lines(expected: &str, actual: &str) -> String { | |
| 108 | pub(crate) fn diff_by_lines(expected: &[String], actual: &[String]) -> String { | |
| 109 | 109 | use std::collections::HashMap; |
| 110 | 110 | use std::fmt::Write; |
| 111 | 111 | let mut output = String::new(); |
| 112 | 112 | let mut expected_counts: HashMap<&str, usize> = HashMap::new(); |
| 113 | 113 | let mut actual_counts: HashMap<&str, usize> = HashMap::new(); |
| 114 | 114 | |
| 115 | // Filter out padded empty code lines | |
| 116 | for line in expected.lines().filter(|l| l.trim() != "|") { | |
| 117 | *expected_counts.entry(line).or_insert(0) += 1; | |
| 115 | for line in expected { | |
| 116 | *expected_counts.entry(line.as_str()).or_insert(0) += 1; | |
| 118 | 117 | } |
| 119 | for line in actual.lines().filter(|l| l.trim() != "|") { | |
| 120 | *actual_counts.entry(line).or_insert(0) += 1; | |
| 118 | for line in actual { | |
| 119 | *actual_counts.entry(line.as_str()).or_insert(0) += 1; | |
| 121 | 120 | } |
| 122 | 121 | |
| 123 | 122 | fn write_expected_only_lines( |
src/tools/unicode-table-generator/src/main.rs+40-8| ... | ... | @@ -71,7 +71,7 @@ |
| 71 | 71 | //! index of that offset is utilized as the answer to whether we're in the set |
| 72 | 72 | //! or not. |
| 73 | 73 | |
| 74 | use std::collections::BTreeMap; | |
| 74 | use std::collections::{BTreeMap, BTreeSet}; | |
| 75 | 75 | use std::fmt::Write; |
| 76 | 76 | use std::ops::Range; |
| 77 | 77 | |
| ... | ... | @@ -89,14 +89,19 @@ use fmt_helpers::CharEscape; |
| 89 | 89 | use raw_emitter::{RawEmitter, emit_codepoints, emit_whitespace}; |
| 90 | 90 | |
| 91 | 91 | static PROPERTIES: &[&str] = &[ |
| 92 | // tidy-alphabetical-start | |
| 92 | 93 | "Alphabetic", |
| 93 | "Lowercase", | |
| 94 | "Uppercase", | |
| 95 | 94 | "Case_Ignorable", |
| 95 | "Cf", | |
| 96 | "Cn_Planes_0_3", | |
| 97 | "Default_Ignorable_Code_Point", | |
| 96 | 98 | "Grapheme_Extend", |
| 97 | "White_Space", | |
| 98 | "N", | |
| 99 | "Lowercase", | |
| 99 | 100 | "Lt", |
| 101 | "N", | |
| 102 | "Uppercase", | |
| 103 | "White_Space", | |
| 104 | // tidy-alphabetical-end | |
| 100 | 105 | ]; |
| 101 | 106 | |
| 102 | 107 | struct UnicodeData { |
| ... | ... | @@ -142,6 +147,9 @@ fn load_data() -> UnicodeData { |
| 142 | 147 | } |
| 143 | 148 | } |
| 144 | 149 | |
| 150 | // Unassigned characters are not listed in `UnicodeData.txt`, | |
| 151 | // so get a list of all the assigned ones | |
| 152 | let mut assigned_chars = BTreeSet::new(); | |
| 145 | 153 | let [mut to_lower, mut to_upper, mut to_title, mut to_casefold] = |
| 146 | 154 | [const { BTreeMap::new() }; 4]; |
| 147 | 155 | for row in ucd_parse::UnicodeDataExpander::new( |
| ... | ... | @@ -152,6 +160,11 @@ fn load_data() -> UnicodeData { |
| 152 | 160 | } else { |
| 153 | 161 | row.general_category.as_str() |
| 154 | 162 | }; |
| 163 | ||
| 164 | if !matches!(general_category, "Cs" | "Cn") { | |
| 165 | assigned_chars.insert(row.codepoint.value()); | |
| 166 | } | |
| 167 | ||
| 155 | 168 | if let Some(name) = PROPERTIES.iter().find(|prop| **prop == general_category) { |
| 156 | 169 | properties |
| 157 | 170 | .entry(*name) |
| ... | ... | @@ -176,6 +189,25 @@ fn load_data() -> UnicodeData { |
| 176 | 189 | } |
| 177 | 190 | } |
| 178 | 191 | |
| 192 | // Find all unassigned chars in the first 4 planes | |
| 193 | for c in '\0'..='\u{3FFFD}' { | |
| 194 | let cp = Codepoint::from_u32(c.into()).unwrap(); | |
| 195 | if !assigned_chars.contains(&cp.value()) { | |
| 196 | properties.entry("Cn_Planes_0_3").or_insert_with(Vec::new).push(Codepoints::Single(cp)); | |
| 197 | } | |
| 198 | } | |
| 199 | ||
| 200 | // For now, we hardcode the assigned/unassigned status of characters | |
| 201 | // U+3FFFE and above. The assertion below must be kept in sync | |
| 202 | // with the `is_unassigned()` method in `library/core/char/methods.rs`. | |
| 203 | for c in '\u{3FFFE}'..=char::MAX { | |
| 204 | assert_eq!( | |
| 205 | assigned_chars.contains(&u32::from(c)), | |
| 206 | matches!(c, '\u{E0001}' | '\u{E0020}'..='\u{E007F}' | '\u{E0100}'..='\u{E01EF}' | '\u{F0000}'..='\u{FFFFD}' | '\u{100000}'..='\u{10FFFD}'), | |
| 207 | "{c:?}", | |
| 208 | ); | |
| 209 | } | |
| 210 | ||
| 179 | 211 | for row in ucd_parse::parse::<_, ucd_parse::SpecialCaseMapping>(&UNICODE_DIRECTORY).unwrap() { |
| 180 | 212 | if !row.conditions.is_empty() { |
| 181 | 213 | // Skip conditional case mappings |
| ... | ... | @@ -324,7 +356,7 @@ fn main() { |
| 324 | 356 | |
| 325 | 357 | modules.push((property.to_lowercase().to_string(), emitter.file)); |
| 326 | 358 | table_file.push_str(&format!( |
| 327 | "// {:16}: {:5} bytes, {:6} codepoints in {:3} ranges (U+{:06X} - U+{:06X}) using {}\n", | |
| 359 | "// {:28}: {:5} bytes, {:6} codepoints in {:3} ranges (U+{:06X} - U+{:06X}) using {}\n", | |
| 328 | 360 | property, |
| 329 | 361 | emitter.bytes_used, |
| 330 | 362 | datapoints, |
| ... | ... | @@ -339,10 +371,10 @@ fn main() { |
| 339 | 371 | for (name, (desc, size)) in |
| 340 | 372 | ["to_lower", "to_upper", "to_title", "to_casefold"].iter().zip(sizes) |
| 341 | 373 | { |
| 342 | table_file.push_str(&format!("// {:16}: {:5} bytes, {desc}\n", name, size,)); | |
| 374 | table_file.push_str(&format!("// {:28}: {:5} bytes, {desc}\n", name, size,)); | |
| 343 | 375 | total_bytes += size; |
| 344 | 376 | } |
| 345 | table_file.push_str(&format!("// {:16}: {:5} bytes\n", "Total", total_bytes)); | |
| 377 | table_file.push_str(&format!("// {:28}: {:5} bytes\n", "Total", total_bytes)); | |
| 346 | 378 | |
| 347 | 379 | // Include the range search function |
| 348 | 380 | table_file.push('\n'); |
tests/run-make/dynamic-loading-cdylib/load_and_unload.rs+12-2| ... | ... | @@ -88,6 +88,9 @@ mod libloading { |
| 88 | 88 | type ExternFn = unsafe extern "C" fn(u32, u32) -> u32; |
| 89 | 89 | |
| 90 | 90 | fn main() { |
| 91 | let args: Vec<String> = std::env::args().collect(); | |
| 92 | assert_eq!(args.len(), 2, "This program should be run with one argument"); | |
| 93 | ||
| 91 | 94 | let foo = libloading::load("foo").expect("Failed to load library"); |
| 92 | 95 | println!("loaded library"); |
| 93 | 96 | |
| ... | ... | @@ -110,6 +113,13 @@ fn main() { |
| 110 | 113 | .expect("Thread panicked"); |
| 111 | 114 | println!("thread joined"); |
| 112 | 115 | |
| 113 | libloading::unload(foo); | |
| 114 | println!("unloaded library"); | |
| 116 | match args[1].as_str() { | |
| 117 | "unload" => { | |
| 118 | println!("unloading library"); | |
| 119 | libloading::unload(foo); | |
| 120 | println!("unloaded library"); | |
| 121 | } | |
| 122 | "load_only" => println!("dropping library handle without unloading"), | |
| 123 | arg => panic!("unexpected argument: {}", arg), | |
| 124 | } | |
| 115 | 125 | } |
tests/run-make/dynamic-loading-cdylib/output_load_only_unix.txt created+12| ... | ... | @@ -0,0 +1,12 @@ |
| 1 | loaded library | |
| 2 | extern_fn_1 | |
| 3 | result of extern_fn_1(2, 3): 5 | |
| 4 | extern_fn_2(2, 3) | |
| 5 | result of extern_fn_2(2, 3): 6 | |
| 6 | spawning thread | |
| 7 | extern_fn_2(4, 5) | |
| 8 | result of extern_fn_2(4, 5) in other thread: 20 | |
| 9 | dropping, last result: 20 | |
| 10 | thread joined | |
| 11 | dropping library handle without unloading | |
| 12 | dropping, last result: 6 |
tests/run-make/dynamic-loading-cdylib/output_load_only_windows.txt created+12| ... | ... | @@ -0,0 +1,12 @@ |
| 1 | loaded library | |
| 2 | extern_fn_1 | |
| 3 | result of extern_fn_1(2, 3): 5 | |
| 4 | extern_fn_2(2, 3) | |
| 5 | result of extern_fn_2(2, 3): 6 | |
| 6 | spawning thread | |
| 7 | extern_fn_2(4, 5) | |
| 8 | result of extern_fn_2(4, 5) in other thread: 20 | |
| 9 | dropping, last result: 20 | |
| 10 | thread joined | |
| 11 | dropping library handle without unloading | |
| 12 | dropping, last result: 6 |
tests/run-make/dynamic-loading-cdylib/output_unix.txt deleted-12| ... | ... | @@ -1,12 +0,0 @@ |
| 1 | loaded library | |
| 2 | extern_fn_1 | |
| 3 | result of extern_fn_1(2, 3): 5 | |
| 4 | extern_fn_2(2, 3) | |
| 5 | result of extern_fn_2(2, 3): 6 | |
| 6 | spawning thread | |
| 7 | extern_fn_2(4, 5) | |
| 8 | result of extern_fn_2(4, 5) in other thread: 20 | |
| 9 | dropping, last result: 20 | |
| 10 | thread joined | |
| 11 | unloaded library | |
| 12 | dropping, last result: 6 |
tests/run-make/dynamic-loading-cdylib/output_unload_unix.txt created+13| ... | ... | @@ -0,0 +1,13 @@ |
| 1 | loaded library | |
| 2 | extern_fn_1 | |
| 3 | result of extern_fn_1(2, 3): 5 | |
| 4 | extern_fn_2(2, 3) | |
| 5 | result of extern_fn_2(2, 3): 6 | |
| 6 | spawning thread | |
| 7 | extern_fn_2(4, 5) | |
| 8 | result of extern_fn_2(4, 5) in other thread: 20 | |
| 9 | dropping, last result: 20 | |
| 10 | thread joined | |
| 11 | unloading library | |
| 12 | unloaded library | |
| 13 | dropping, last result: 6 |
tests/run-make/dynamic-loading-cdylib/output_unload_windows.txt created+13| ... | ... | @@ -0,0 +1,13 @@ |
| 1 | loaded library | |
| 2 | extern_fn_1 | |
| 3 | result of extern_fn_1(2, 3): 5 | |
| 4 | extern_fn_2(2, 3) | |
| 5 | result of extern_fn_2(2, 3): 6 | |
| 6 | spawning thread | |
| 7 | extern_fn_2(4, 5) | |
| 8 | result of extern_fn_2(4, 5) in other thread: 20 | |
| 9 | dropping, last result: 20 | |
| 10 | thread joined | |
| 11 | unloading library | |
| 12 | dropping, last result: 6 | |
| 13 | unloaded library |
tests/run-make/dynamic-loading-cdylib/output_windows.txt deleted-12| ... | ... | @@ -1,12 +0,0 @@ |
| 1 | loaded library | |
| 2 | extern_fn_1 | |
| 3 | result of extern_fn_1(2, 3): 5 | |
| 4 | extern_fn_2(2, 3) | |
| 5 | result of extern_fn_2(2, 3): 6 | |
| 6 | spawning thread | |
| 7 | extern_fn_2(4, 5) | |
| 8 | result of extern_fn_2(4, 5) in other thread: 20 | |
| 9 | dropping, last result: 20 | |
| 10 | thread joined | |
| 11 | dropping, last result: 6 | |
| 12 | unloaded library |
tests/run-make/dynamic-loading-cdylib/rmake.rs+13-11| ... | ... | @@ -7,23 +7,25 @@ |
| 7 | 7 | |
| 8 | 8 | //@ ignore-cross-compile |
| 9 | 9 | |
| 10 | use run_make_support::{diff, run, rustc}; | |
| 10 | use run_make_support::{diff, run_with_args, rustc}; | |
| 11 | 11 | |
| 12 | 12 | fn main() { |
| 13 | 13 | rustc().input("foo.rs").run(); |
| 14 | 14 | |
| 15 | 15 | rustc().crate_type("bin").crate_name("load_and_unload_bin").input("load_and_unload.rs").run(); |
| 16 | 16 | |
| 17 | let out_raw = run("load_and_unload_bin").stdout_utf8(); | |
| 17 | for command_arg in ["unload", "load_only"] { | |
| 18 | let out_raw = run_with_args("load_and_unload_bin", &[command_arg]).stdout_utf8(); | |
| 18 | 19 | |
| 19 | #[cfg(windows)] | |
| 20 | let output_filename = "output_windows.txt"; | |
| 21 | #[cfg(unix)] | |
| 22 | let output_filename = "output_unix.txt"; | |
| 20 | #[cfg(windows)] | |
| 21 | let output_filename = format!("output_{}_windows.txt", command_arg); | |
| 22 | #[cfg(unix)] | |
| 23 | let output_filename = format!("output_{}_unix.txt", command_arg); | |
| 23 | 24 | |
| 24 | diff() | |
| 25 | .expected_file(output_filename) | |
| 26 | .actual_text("actual", out_raw) | |
| 27 | .normalize(r#"\r"#, "") | |
| 28 | .run(); | |
| 25 | diff() | |
| 26 | .expected_file(output_filename) | |
| 27 | .actual_text("actual", out_raw) | |
| 28 | .normalize(r#"\r"#, "") | |
| 29 | .run(); | |
| 30 | } | |
| 29 | 31 | } |
tests/ui/abi/simd-abi-checks-avx.rs+1-1| ... | ... | @@ -1,7 +1,7 @@ |
| 1 | 1 | //@ only-x86_64 |
| 2 | 2 | //@ build-fail |
| 3 | 3 | //@ compile-flags: -C target-feature=-avx |
| 4 | //@ ignore-parallel-frontend post-monomorphization errors | |
| 4 | ||
| 5 | 5 | #![feature(portable_simd)] |
| 6 | 6 | #![feature(simd_ffi)] |
| 7 | 7 | #![allow(improper_ctypes_definitions)] |
tests/ui/borrowck/borrowck-describe-field-generic-param-owned-box.rs created+56| ... | ... | @@ -0,0 +1,56 @@ |
| 1 | // Regression test for #155344. | |
| 2 | // Borrowck diagnostics should not ICE when describing a field access on a generic parameter. | |
| 3 | ||
| 4 | //@ edition: 2024 | |
| 5 | ||
| 6 | #![crate_type = "lib"] | |
| 7 | #![feature(no_core, lang_items)] | |
| 8 | #![no_core] | |
| 9 | ||
| 10 | #[lang = "pointee_sized"] | |
| 11 | pub trait PointeeSized {} | |
| 12 | ||
| 13 | #[lang = "meta_sized"] | |
| 14 | pub trait MetaSized: PointeeSized {} | |
| 15 | ||
| 16 | #[lang = "sized"] | |
| 17 | pub trait Sized: MetaSized {} | |
| 18 | ||
| 19 | #[lang = "legacy_receiver"] | |
| 20 | pub trait LegacyReceiver {} | |
| 21 | ||
| 22 | impl<T: PointeeSized> LegacyReceiver for &T {} | |
| 23 | impl<T: PointeeSized> LegacyReceiver for &mut T {} | |
| 24 | ||
| 25 | #[lang = "copy"] | |
| 26 | pub trait Copy {} | |
| 27 | ||
| 28 | impl Copy for *mut () {} | |
| 29 | ||
| 30 | #[lang = "drop"] | |
| 31 | pub trait Drop { | |
| 32 | fn drop(&mut self); | |
| 33 | } | |
| 34 | ||
| 35 | unsafe extern "C" { | |
| 36 | fn free(_: *mut ()); | |
| 37 | } | |
| 38 | ||
| 39 | unsafe fn transmute<T, U>(_: T) -> U { | |
| 40 | loop {} | |
| 41 | } | |
| 42 | ||
| 43 | #[repr(transparent)] | |
| 44 | pub struct NonNull<T: ?Sized>(pub *const T); | |
| 45 | ||
| 46 | #[lang = "owned_box"] | |
| 47 | pub struct Box<T: ?Sized, A = ()>(NonNull<T>, A); | |
| 48 | ||
| 49 | impl<T: ?Sized, A> Drop for Box<T, A> { | |
| 50 | fn drop(&mut self) { | |
| 51 | unsafe { | |
| 52 | free(transmute::<NonNull<T>, *mut _>(self.0)); | |
| 53 | //~^ ERROR cannot move out of `self.0` which is behind a mutable reference | |
| 54 | } | |
| 55 | } | |
| 56 | } |
tests/ui/borrowck/borrowck-describe-field-generic-param-owned-box.stderr created+9| ... | ... | @@ -0,0 +1,9 @@ |
| 1 | error[E0507]: cannot move out of `self.0` which is behind a mutable reference | |
| 2 | --> $DIR/borrowck-describe-field-generic-param-owned-box.rs:52:50 | |
| 3 | | | |
| 4 | LL | free(transmute::<NonNull<T>, *mut _>(self.0)); | |
| 5 | | ^^^^^^ move occurs because `self.0` has type `NonNull<T>`, which does not implement the `Copy` trait | |
| 6 | ||
| 7 | error: aborting due to 1 previous error | |
| 8 | ||
| 9 | For more information about this error, try `rustc --explain E0507`. |
tests/ui/borrowck/fn-closure-move-capture-no-reborrow-sugg.rs created+46| ... | ... | @@ -0,0 +1,46 @@ |
| 1 | //@ edition: 2021 | |
| 2 | //@ compile-flags: --crate-type=lib | |
| 3 | ||
| 4 | // Regression test for https://github.com/rust-lang/rust/issues/150175. | |
| 5 | // | |
| 6 | // Moving a `&mut`-typed captured variable out of a closure (here through the | |
| 7 | // implicit `into_iter` of a `for` loop) is an E0507. The "consider creating a | |
| 8 | // fresh reborrow" suggestion rewrites the move site to `&mut *foos`, but that | |
| 9 | // only compiles when the capture can be borrowed mutably there: | |
| 10 | // | |
| 11 | // * an `Fn` closure holds its captures through `&self`, so `&mut *foos` | |
| 12 | // cannot be borrowed (E0596). The suggestion is `MachineApplicable`, so | |
| 13 | // offering it here produces code that does not compile -- it must be | |
| 14 | // suppressed (this is the bug). | |
| 15 | // * an `FnMut` closure holds its captures through `&mut self`, so the | |
| 16 | // reborrow is valid and the suggestion must still be offered. | |
| 17 | ||
| 18 | pub struct Foo; | |
| 19 | ||
| 20 | pub fn in_fn<F: Fn() -> Result<(), ()>>(f: F) -> Result<(), ()> { | |
| 21 | f() | |
| 22 | } | |
| 23 | ||
| 24 | pub fn in_fn_mut<F: FnMut() -> Result<(), ()>>(mut f: F) -> Result<(), ()> { | |
| 25 | f() | |
| 26 | } | |
| 27 | ||
| 28 | // `Fn` closure: a mutable reborrow is impossible, so no suggestion is offered. | |
| 29 | pub fn fn_closure(foos: &mut [&mut Foo]) -> Result<(), ()> { | |
| 30 | in_fn(|| { | |
| 31 | for _ in foos { | |
| 32 | //~^ ERROR cannot move out of `foos`, a captured variable in an `Fn` closure | |
| 33 | } | |
| 34 | Ok(()) | |
| 35 | }) | |
| 36 | } | |
| 37 | ||
| 38 | // `FnMut` closure: a mutable reborrow is valid, so the suggestion is offered. | |
| 39 | pub fn fn_mut_closure(foos: &mut [&mut Foo]) -> Result<(), ()> { | |
| 40 | in_fn_mut(|| { | |
| 41 | for _ in foos { | |
| 42 | //~^ ERROR cannot move out of `foos`, a captured variable in an `FnMut` closure | |
| 43 | } | |
| 44 | Ok(()) | |
| 45 | }) | |
| 46 | } |
tests/ui/borrowck/fn-closure-move-capture-no-reborrow-sugg.stderr created+53| ... | ... | @@ -0,0 +1,53 @@ |
| 1 | error[E0507]: cannot move out of `foos`, a captured variable in an `Fn` closure | |
| 2 | --> $DIR/fn-closure-move-capture-no-reborrow-sugg.rs:31:18 | |
| 3 | | | |
| 4 | LL | pub fn fn_closure(foos: &mut [&mut Foo]) -> Result<(), ()> { | |
| 5 | | ---- --------------- move occurs because `foos` has type `&mut [&mut Foo]`, which does not implement the `Copy` trait | |
| 6 | | | | |
| 7 | | captured outer variable | |
| 8 | LL | in_fn(|| { | |
| 9 | | -- captured by this `Fn` closure | |
| 10 | LL | for _ in foos { | |
| 11 | | ^^^^ | |
| 12 | | | | |
| 13 | | `foos` moved due to this implicit call to `.into_iter()` | |
| 14 | | `foos` is moved here | |
| 15 | | | |
| 16 | help: `Fn` and `FnMut` closures require captured values to be able to be consumed multiple times, but `FnOnce` closures may consume them only once | |
| 17 | --> $DIR/fn-closure-move-capture-no-reborrow-sugg.rs:20:17 | |
| 18 | | | |
| 19 | LL | pub fn in_fn<F: Fn() -> Result<(), ()>>(f: F) -> Result<(), ()> { | |
| 20 | | ^^^^^^^^^^^^^^^^^^^^^^ | |
| 21 | note: `into_iter` takes ownership of the receiver `self`, which moves `foos` | |
| 22 | --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL | |
| 23 | ||
| 24 | error[E0507]: cannot move out of `foos`, a captured variable in an `FnMut` closure | |
| 25 | --> $DIR/fn-closure-move-capture-no-reborrow-sugg.rs:41:18 | |
| 26 | | | |
| 27 | LL | pub fn fn_mut_closure(foos: &mut [&mut Foo]) -> Result<(), ()> { | |
| 28 | | ---- --------------- move occurs because `foos` has type `&mut [&mut Foo]`, which does not implement the `Copy` trait | |
| 29 | | | | |
| 30 | | captured outer variable | |
| 31 | LL | in_fn_mut(|| { | |
| 32 | | -- captured by this `FnMut` closure | |
| 33 | LL | for _ in foos { | |
| 34 | | ^^^^ | |
| 35 | | | | |
| 36 | | `foos` moved due to this implicit call to `.into_iter()` | |
| 37 | | `foos` is moved here | |
| 38 | | | |
| 39 | help: `Fn` and `FnMut` closures require captured values to be able to be consumed multiple times, but `FnOnce` closures may consume them only once | |
| 40 | --> $DIR/fn-closure-move-capture-no-reborrow-sugg.rs:24:21 | |
| 41 | | | |
| 42 | LL | pub fn in_fn_mut<F: FnMut() -> Result<(), ()>>(mut f: F) -> Result<(), ()> { | |
| 43 | | ^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 44 | note: `into_iter` takes ownership of the receiver `self`, which moves `foos` | |
| 45 | --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL | |
| 46 | help: consider creating a fresh reborrow of `foos` here | |
| 47 | | | |
| 48 | LL | for _ in &mut *foos { | |
| 49 | | ++++++ | |
| 50 | ||
| 51 | error: aborting due to 2 previous errors | |
| 52 | ||
| 53 | For more information about this error, try `rustc --explain E0507`. |
tests/ui/const-generics/mgca/generic-args-on-enum-variant-segments-fail.rs created+19| ... | ... | @@ -0,0 +1,19 @@ |
| 1 | #![feature(min_generic_const_args)] | |
| 2 | #![feature(adt_const_params, unsized_const_params)] | |
| 3 | #[derive(PartialEq, Eq, std::marker::ConstParamTy)] | |
| 4 | pub enum Enum<T> { | |
| 5 | Unit, | |
| 6 | Tuple(), | |
| 7 | Store(T), | |
| 8 | } | |
| 9 | pub mod module { | |
| 10 | pub use super::Enum::Store; | |
| 11 | } | |
| 12 | fn main() { | |
| 13 | type const _: Enum<()> = Enum::<()>::Unit::<()>; | |
| 14 | //~^ ERROR: type arguments are not allowed on unit variant `Unit` [E0109] | |
| 15 | type const _: Enum<()> = Enum::<()>::Tuple::<()>(); | |
| 16 | //~^ ERROR: type arguments are not allowed on tuple variant `Tuple` [E0109] | |
| 17 | type const _: Enum<()> = self::<i32>::Enum::<()>::Store; | |
| 18 | //~^ ERROR: type arguments are not allowed on module `generic_args_on_enum_variant_segments_fail` [E0109] | |
| 19 | } |
tests/ui/const-generics/mgca/generic-args-on-enum-variant-segments-fail.stderr created+41| ... | ... | @@ -0,0 +1,41 @@ |
| 1 | error[E0109]: type arguments are not allowed on unit variant `Unit` | |
| 2 | --> $DIR/generic-args-on-enum-variant-segments-fail.rs:13:49 | |
| 3 | | | |
| 4 | LL | type const _: Enum<()> = Enum::<()>::Unit::<()>; | |
| 5 | | ---- ^^ type argument not allowed | |
| 6 | | | | |
| 7 | | not allowed on unit variant `Unit` | |
| 8 | | | |
| 9 | = note: generic arguments are not allowed on both an enum and its variant's path segments simultaneously; they are only valid in one place or the other | |
| 10 | help: remove the generics arguments from one of the path segments | |
| 11 | | | |
| 12 | LL - type const _: Enum<()> = Enum::<()>::Unit::<()>; | |
| 13 | LL + type const _: Enum<()> = Enum::<()>::Unit; | |
| 14 | | | |
| 15 | ||
| 16 | error[E0109]: type arguments are not allowed on tuple variant `Tuple` | |
| 17 | --> $DIR/generic-args-on-enum-variant-segments-fail.rs:15:50 | |
| 18 | | | |
| 19 | LL | type const _: Enum<()> = Enum::<()>::Tuple::<()>(); | |
| 20 | | ----- ^^ type argument not allowed | |
| 21 | | | | |
| 22 | | not allowed on tuple variant `Tuple` | |
| 23 | | | |
| 24 | = note: generic arguments are not allowed on both an enum and its variant's path segments simultaneously; they are only valid in one place or the other | |
| 25 | help: remove the generics arguments from one of the path segments | |
| 26 | | | |
| 27 | LL - type const _: Enum<()> = Enum::<()>::Tuple::<()>(); | |
| 28 | LL + type const _: Enum<()> = Enum::<()>::Tuple(); | |
| 29 | | | |
| 30 | ||
| 31 | error[E0109]: type arguments are not allowed on module `generic_args_on_enum_variant_segments_fail` | |
| 32 | --> $DIR/generic-args-on-enum-variant-segments-fail.rs:17:37 | |
| 33 | | | |
| 34 | LL | type const _: Enum<()> = self::<i32>::Enum::<()>::Store; | |
| 35 | | ---- ^^^ type argument not allowed | |
| 36 | | | | |
| 37 | | not allowed on module `generic_args_on_enum_variant_segments_fail` | |
| 38 | ||
| 39 | error: aborting due to 3 previous errors | |
| 40 | ||
| 41 | For more information about this error, try `rustc --explain E0109`. |
tests/ui/const-generics/mgca/generic-args-on-enum-variant-segments.rs created+16| ... | ... | @@ -0,0 +1,16 @@ |
| 1 | //@ check-pass | |
| 2 | ||
| 3 | #![feature(min_generic_const_args)] | |
| 4 | #![feature(adt_const_params, unsized_const_params)] | |
| 5 | ||
| 6 | #[derive(PartialEq, Eq, std::marker::ConstParamTy)] | |
| 7 | enum Enum<T> { | |
| 8 | Unit, | |
| 9 | Tuple(), | |
| 10 | Store(T), | |
| 11 | } | |
| 12 | ||
| 13 | type const _: Enum<()> = Enum::<()>::Unit; | |
| 14 | type const _: Enum<()> = Enum::<()>::Tuple(); | |
| 15 | ||
| 16 | fn main() {} |
tests/ui/const-generics/mgca/type-const-free-anon-const-mismatch.rs created+11| ... | ... | @@ -0,0 +1,11 @@ |
| 1 | //@ compile-flags: -Zvalidate-mir -Znext-solver | |
| 2 | ||
| 3 | #![feature(min_generic_const_args)] | |
| 4 | ||
| 5 | type const X: usize = const { N }; | |
| 6 | //~^ ERROR type annotations needed | |
| 7 | ||
| 8 | type const N: usize = "this isn't a usize"; | |
| 9 | //~^ ERROR the constant `"this isn't a usize"` is not of type `usize` | |
| 10 | ||
| 11 | fn main() {} |
tests/ui/const-generics/mgca/type-const-free-anon-const-mismatch.stderr created+15| ... | ... | @@ -0,0 +1,15 @@ |
| 1 | error[E0284]: type annotations needed: cannot normalize `X::{constant#0}` | |
| 2 | --> $DIR/type-const-free-anon-const-mismatch.rs:5:1 | |
| 3 | | | |
| 4 | LL | type const X: usize = const { N }; | |
| 5 | | ^^^^^^^^^^^^^^^^^^^ cannot normalize `X::{constant#0}` | |
| 6 | ||
| 7 | error: the constant `"this isn't a usize"` is not of type `usize` | |
| 8 | --> $DIR/type-const-free-anon-const-mismatch.rs:8:1 | |
| 9 | | | |
| 10 | LL | type const N: usize = "this isn't a usize"; | |
| 11 | | ^^^^^^^^^^^^^^^^^^^ expected `usize`, found `&'static str` | |
| 12 | ||
| 13 | error: aborting due to 2 previous errors | |
| 14 | ||
| 15 | For more information about this error, try `rustc --explain E0284`. |
tests/ui/const-generics/mgca/type-const-free-value-type-mismatch.current.stderr created+17| ... | ... | @@ -0,0 +1,17 @@ |
| 1 | error: the constant `"this isn't a usize"` is not of type `usize` | |
| 2 | --> $DIR/type-const-free-value-type-mismatch.rs:8:1 | |
| 3 | | | |
| 4 | LL | type const N: usize = "this isn't a usize"; | |
| 5 | | ^^^^^^^^^^^^^^^^^^^ expected `usize`, found `&'static str` | |
| 6 | ||
| 7 | error[E0308]: mismatched types | |
| 8 | --> $DIR/type-const-free-value-type-mismatch.rs:11:11 | |
| 9 | | | |
| 10 | LL | fn f() -> [u8; const { N }] {} | |
| 11 | | - ^^^^^^^^^^^^^^^^^ expected `[u8; const { N }]`, found `()` | |
| 12 | | | | |
| 13 | | implicitly returns `()` as its body has no tail or `return` expression | |
| 14 | ||
| 15 | error: aborting due to 2 previous errors | |
| 16 | ||
| 17 | For more information about this error, try `rustc --explain E0308`. |
tests/ui/const-generics/mgca/type-const-free-value-type-mismatch.next.stderr created+24| ... | ... | @@ -0,0 +1,24 @@ |
| 1 | error: the constant `"this isn't a usize"` is not of type `usize` | |
| 2 | --> $DIR/type-const-free-value-type-mismatch.rs:8:1 | |
| 3 | | | |
| 4 | LL | type const N: usize = "this isn't a usize"; | |
| 5 | | ^^^^^^^^^^^^^^^^^^^ expected `usize`, found `&'static str` | |
| 6 | ||
| 7 | error[E0284]: type annotations needed: cannot normalize `f::{constant#0}` | |
| 8 | --> $DIR/type-const-free-value-type-mismatch.rs:11:11 | |
| 9 | | | |
| 10 | LL | fn f() -> [u8; const { N }] {} | |
| 11 | | ^^^^^^^^^^^^^^^^^ cannot normalize `f::{constant#0}` | |
| 12 | ||
| 13 | error[E0308]: mismatched types | |
| 14 | --> $DIR/type-const-free-value-type-mismatch.rs:11:11 | |
| 15 | | | |
| 16 | LL | fn f() -> [u8; const { N }] {} | |
| 17 | | - ^^^^^^^^^^^^^^^^^ expected `[u8; _]`, found `()` | |
| 18 | | | | |
| 19 | | implicitly returns `()` as its body has no tail or `return` expression | |
| 20 | ||
| 21 | error: aborting due to 3 previous errors | |
| 22 | ||
| 23 | Some errors have detailed explanations: E0284, E0308. | |
| 24 | For more information about an error, try `rustc --explain E0284`. |
tests/ui/const-generics/mgca/type-const-free-value-type-mismatch.rs created+16| ... | ... | @@ -0,0 +1,16 @@ |
| 1 | #![feature(min_generic_const_args)] | |
| 2 | ||
| 3 | //@ revisions: current next | |
| 4 | //@ ignore-compare-mode-next-solver (explicit revisions) | |
| 5 | //@[next] compile-flags: -Znext-solver | |
| 6 | //@ compile-flags: -Zvalidate-mir | |
| 7 | ||
| 8 | type const N: usize = "this isn't a usize"; | |
| 9 | //~^ ERROR the constant `"this isn't a usize"` is not of type `usize` | |
| 10 | ||
| 11 | fn f() -> [u8; const { N }] {} | |
| 12 | //[current]~^ ERROR mismatched types [E0308] | |
| 13 | //[next]~^^ ERROR type annotations needed | |
| 14 | //[next]~| ERROR mismatched types [E0308] | |
| 15 | ||
| 16 | fn main() {} |
tests/ui/const-generics/mgca/type-const-free-value-used-in-body.rs created+16| ... | ... | @@ -0,0 +1,16 @@ |
| 1 | // Regression test for https://github.com/rust-lang/rust/issues/154748 and https://github.com/rust-lang/rust/issues/154750 | |
| 2 | ||
| 3 | #![feature(min_generic_const_args)] | |
| 4 | ||
| 5 | //@ compile-flags: --emit=mir | |
| 6 | ||
| 7 | type const CONST: usize = 1u32; | |
| 8 | //~^ ERROR the constant `1` is not of type `usize` | |
| 9 | ||
| 10 | type const S: bool = 1i32; | |
| 11 | //~^ ERROR the constant `1` is not of type `bool` | |
| 12 | ||
| 13 | fn main() { | |
| 14 | CONST; | |
| 15 | S; | |
| 16 | } |
tests/ui/const-generics/mgca/type-const-free-value-used-in-body.stderr created+14| ... | ... | @@ -0,0 +1,14 @@ |
| 1 | error: the constant `1` is not of type `usize` | |
| 2 | --> $DIR/type-const-free-value-used-in-body.rs:7:1 | |
| 3 | | | |
| 4 | LL | type const CONST: usize = 1u32; | |
| 5 | | ^^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `u32` | |
| 6 | ||
| 7 | error: the constant `1` is not of type `bool` | |
| 8 | --> $DIR/type-const-free-value-used-in-body.rs:10:1 | |
| 9 | | | |
| 10 | LL | type const S: bool = 1i32; | |
| 11 | | ^^^^^^^^^^^^^^^^^^ expected `bool`, found `i32` | |
| 12 | ||
| 13 | error: aborting due to 2 previous errors | |
| 14 |
tests/ui/const-generics/mgca/type-const-inherent-value-type-mismatch.current.stderr created+17| ... | ... | @@ -0,0 +1,17 @@ |
| 1 | error: the constant `"this isn't a usize"` is not of type `usize` | |
| 2 | --> $DIR/type-const-inherent-value-type-mismatch.rs:13:5 | |
| 3 | | | |
| 4 | LL | type const N: usize = "this isn't a usize"; | |
| 5 | | ^^^^^^^^^^^^^^^^^^^ expected `usize`, found `&'static str` | |
| 6 | ||
| 7 | error[E0308]: mismatched types | |
| 8 | --> $DIR/type-const-inherent-value-type-mismatch.rs:17:11 | |
| 9 | | | |
| 10 | LL | fn f() -> [u8; const { Struct::N }] {} | |
| 11 | | - ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `[u8; const { Struct::N }]`, found `()` | |
| 12 | | | | |
| 13 | | implicitly returns `()` as its body has no tail or `return` expression | |
| 14 | ||
| 15 | error: aborting due to 2 previous errors | |
| 16 | ||
| 17 | For more information about this error, try `rustc --explain E0308`. |
tests/ui/const-generics/mgca/type-const-inherent-value-type-mismatch.next.stderr created+24| ... | ... | @@ -0,0 +1,24 @@ |
| 1 | error[E0284]: type annotations needed: cannot normalize `f::{constant#0}` | |
| 2 | --> $DIR/type-const-inherent-value-type-mismatch.rs:17:11 | |
| 3 | | | |
| 4 | LL | fn f() -> [u8; const { Struct::N }] {} | |
| 5 | | ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot normalize `f::{constant#0}` | |
| 6 | ||
| 7 | error: the constant `"this isn't a usize"` is not of type `usize` | |
| 8 | --> $DIR/type-const-inherent-value-type-mismatch.rs:13:5 | |
| 9 | | | |
| 10 | LL | type const N: usize = "this isn't a usize"; | |
| 11 | | ^^^^^^^^^^^^^^^^^^^ expected `usize`, found `&'static str` | |
| 12 | ||
| 13 | error[E0308]: mismatched types | |
| 14 | --> $DIR/type-const-inherent-value-type-mismatch.rs:17:11 | |
| 15 | | | |
| 16 | LL | fn f() -> [u8; const { Struct::N }] {} | |
| 17 | | - ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `[u8; _]`, found `()` | |
| 18 | | | | |
| 19 | | implicitly returns `()` as its body has no tail or `return` expression | |
| 20 | ||
| 21 | error: aborting due to 3 previous errors | |
| 22 | ||
| 23 | Some errors have detailed explanations: E0284, E0308. | |
| 24 | For more information about an error, try `rustc --explain E0284`. |
tests/ui/const-generics/mgca/type-const-inherent-value-type-mismatch.rs created+21| ... | ... | @@ -0,0 +1,21 @@ |
| 1 | // Regression test for https://github.com/rust-lang/rust/issues/152962 | |
| 2 | ||
| 3 | //@ revisions: current next | |
| 4 | //@ ignore-compare-mode-next-solver (explicit revisions) | |
| 5 | //@[next] compile-flags: -Znext-solver | |
| 6 | //@ compile-flags: -Zvalidate-mir | |
| 7 | ||
| 8 | #![feature(min_generic_const_args)] | |
| 9 | ||
| 10 | struct Struct; | |
| 11 | ||
| 12 | impl Struct { | |
| 13 | type const N: usize = "this isn't a usize"; | |
| 14 | //~^ ERROR the constant `"this isn't a usize"` is not of type `usize` | |
| 15 | } | |
| 16 | ||
| 17 | fn f() -> [u8; const { Struct::N }] {} | |
| 18 | //~^ ERROR mismatched types [E0308] | |
| 19 | //[next]~| ERROR type annotations needed | |
| 20 | ||
| 21 | fn main() {} |
tests/ui/const-generics/mgca/type-const-value-type-mismatch.current.stderr created+32| ... | ... | @@ -0,0 +1,32 @@ |
| 1 | error[E0053]: method `arr` has an incompatible type for trait | |
| 2 | --> $DIR/type-const-value-type-mismatch.rs:21:5 | |
| 3 | | | |
| 4 | LL | fn arr() -> [u8; const { Self::LEN }] {} | |
| 5 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected an array with a size of 0, found one with a size of const { Self::LEN } | |
| 6 | | | |
| 7 | note: type in trait | |
| 8 | --> $DIR/type-const-value-type-mismatch.rs:14:5 | |
| 9 | | | |
| 10 | LL | fn arr() -> [u8; Self::LEN]; | |
| 11 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 12 | = note: expected signature `fn() -> [u8; 0]` | |
| 13 | found signature `fn() -> [u8; const { Self::LEN }]` | |
| 14 | ||
| 15 | error: the constant `0` is not of type `usize` | |
| 16 | --> $DIR/type-const-value-type-mismatch.rs:18:5 | |
| 17 | | | |
| 18 | LL | type const LEN: usize = 0u8; | |
| 19 | | ^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `u8` | |
| 20 | ||
| 21 | error[E0308]: mismatched types | |
| 22 | --> $DIR/type-const-value-type-mismatch.rs:21:17 | |
| 23 | | | |
| 24 | LL | fn arr() -> [u8; const { Self::LEN }] {} | |
| 25 | | --- ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `[u8; const { Self::LEN }]`, found `()` | |
| 26 | | | | |
| 27 | | implicitly returns `()` as its body has no tail or `return` expression | |
| 28 | ||
| 29 | error: aborting due to 3 previous errors | |
| 30 | ||
| 31 | Some errors have detailed explanations: E0053, E0308. | |
| 32 | For more information about an error, try `rustc --explain E0053`. |
tests/ui/const-generics/mgca/type-const-value-type-mismatch.next.stderr created+30| ... | ... | @@ -0,0 +1,30 @@ |
| 1 | error[E0271]: type mismatch resolving `<A as Array>::LEN normalizes-to 0` | |
| 2 | --> $DIR/type-const-value-type-mismatch.rs:21:5 | |
| 3 | | | |
| 4 | LL | fn arr() -> [u8; const { Self::LEN }] {} | |
| 5 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ | |
| 6 | ||
| 7 | error: the constant `0` is not of type `usize` | |
| 8 | --> $DIR/type-const-value-type-mismatch.rs:18:5 | |
| 9 | | | |
| 10 | LL | type const LEN: usize = 0u8; | |
| 11 | | ^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `u8` | |
| 12 | ||
| 13 | error[E0284]: type annotations needed: cannot normalize `<A as Array>::arr::{constant#0}` | |
| 14 | --> $DIR/type-const-value-type-mismatch.rs:21:17 | |
| 15 | | | |
| 16 | LL | fn arr() -> [u8; const { Self::LEN }] {} | |
| 17 | | ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot normalize `<A as Array>::arr::{constant#0}` | |
| 18 | ||
| 19 | error[E0308]: mismatched types | |
| 20 | --> $DIR/type-const-value-type-mismatch.rs:21:17 | |
| 21 | | | |
| 22 | LL | fn arr() -> [u8; const { Self::LEN }] {} | |
| 23 | | --- ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `[u8; _]`, found `()` | |
| 24 | | | | |
| 25 | | implicitly returns `()` as its body has no tail or `return` expression | |
| 26 | ||
| 27 | error: aborting due to 4 previous errors | |
| 28 | ||
| 29 | Some errors have detailed explanations: E0271, E0284, E0308. | |
| 30 | For more information about an error, try `rustc --explain E0271`. |
tests/ui/const-generics/mgca/type-const-value-type-mismatch.rs created+28| ... | ... | @@ -0,0 +1,28 @@ |
| 1 | // Regression test for https://github.com/rust-lang/rust/issues/152962 | |
| 2 | ||
| 3 | //@ revisions: current next | |
| 4 | //@ ignore-compare-mode-next-solver (explicit revisions) | |
| 5 | //@[next] compile-flags: -Znext-solver | |
| 6 | //@ compile-flags: -Zvalidate-mir | |
| 7 | ||
| 8 | #![feature(min_generic_const_args)] | |
| 9 | ||
| 10 | pub struct A; | |
| 11 | ||
| 12 | pub trait Array { | |
| 13 | type const LEN: usize; | |
| 14 | fn arr() -> [u8; Self::LEN]; | |
| 15 | } | |
| 16 | ||
| 17 | impl Array for A { | |
| 18 | type const LEN: usize = 0u8; | |
| 19 | //~^ ERROR the constant `0` is not of type `usize` | |
| 20 | ||
| 21 | fn arr() -> [u8; const { Self::LEN }] {} | |
| 22 | //~^ ERROR mismatched types [E0308] | |
| 23 | //[current]~| ERROR method `arr` has an incompatible type for trait [E0053] | |
| 24 | //[next]~| ERROR type annotations needed | |
| 25 | //[next]~| ERROR type mismatch resolving `<A as Array>::LEN normalizes-to 0` [E0271] | |
| 26 | } | |
| 27 | ||
| 28 | fn main() {} |
tests/ui/const-generics/mgca/type_const-mismatched-types.rs+2-1| ... | ... | @@ -5,7 +5,8 @@ type const FREE: u32 = 5_usize; |
| 5 | 5 | //~^ ERROR the constant `5` is not of type `u32` |
| 6 | 6 | |
| 7 | 7 | type const FREE2: isize = FREE; |
| 8 | //~^ ERROR the constant `5` is not of type `isize` | |
| 8 | //~^ ERROR the constant `5` is not of type `u32` | |
| 9 | //~| ERROR the constant `5` is not of type `isize` | |
| 9 | 10 | |
| 10 | 11 | trait Tr { |
| 11 | 12 | type const N: usize; |
tests/ui/const-generics/mgca/type_const-mismatched-types.stderr+8-2| ... | ... | @@ -4,6 +4,12 @@ error: the constant `5` is not of type `u32` |
| 4 | 4 | LL | type const FREE: u32 = 5_usize; |
| 5 | 5 | | ^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `usize` |
| 6 | 6 | |
| 7 | error: the constant `5` is not of type `u32` | |
| 8 | --> $DIR/type_const-mismatched-types.rs:7:1 | |
| 9 | | | |
| 10 | LL | type const FREE2: isize = FREE; | |
| 11 | | ^^^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `usize` | |
| 12 | ||
| 7 | 13 | error: the constant `5` is not of type `isize` |
| 8 | 14 | --> $DIR/type_const-mismatched-types.rs:7:1 |
| 9 | 15 | | |
| ... | ... | @@ -11,10 +17,10 @@ LL | type const FREE2: isize = FREE; |
| 11 | 17 | | ^^^^^^^^^^^^^^^^^^^^^^^ expected `isize`, found `usize` |
| 12 | 18 | |
| 13 | 19 | error: the constant `false` is not of type `usize` |
| 14 | --> $DIR/type_const-mismatched-types.rs:15:5 | |
| 20 | --> $DIR/type_const-mismatched-types.rs:16:5 | |
| 15 | 21 | | |
| 16 | 22 | LL | type const N: usize = false; |
| 17 | 23 | | ^^^^^^^^^^^^^^^^^^^ expected `usize`, found `bool` |
| 18 | 24 | |
| 19 | error: aborting due to 3 previous errors | |
| 25 | error: aborting due to 4 previous errors | |
| 20 | 26 |
tests/ui/consts/const-eval/index-out-of-bounds-never-type.rs+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | //@ build-fail |
| 2 | //@ ignore-parallel-frontend post-monomorphization errors | |
| 2 | ||
| 3 | 3 | // Regression test for #66975 |
| 4 | 4 | #![warn(unconditional_panic)] |
| 5 | 5 | #![feature(never_type)] |
tests/ui/consts/const-eval/issue-50814-2.rs+1-1| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | //@ revisions: normal mir-opt |
| 3 | 3 | //@ [mir-opt]compile-flags: -Zmir-opt-level=4 |
| 4 | 4 | //@ dont-require-annotations: NOTE |
| 5 | //@ ignore-parallel-frontend post-monomorphization errors | |
| 5 | ||
| 6 | 6 | trait C { |
| 7 | 7 | const BOO: usize; |
| 8 | 8 | } |
tests/ui/consts/const-eval/issue-50814.rs+1-1| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | //@ build-fail |
| 2 | 2 | //@ dont-require-annotations: NOTE |
| 3 | //@ ignore-parallel-frontend post-monomorphization errors | |
| 3 | ||
| 4 | 4 | trait Unsigned { |
| 5 | 5 | const MAX: u8; |
| 6 | 6 | } |
tests/ui/consts/mono-reachable-invalid-const.rs+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | //@ build-fail |
| 2 | //@ ignore-parallel-frontend post-monomorphization errors | |
| 2 | ||
| 3 | 3 | struct Bar<const BITS: usize>; |
| 4 | 4 | |
| 5 | 5 | impl<const BITS: usize> Bar<BITS> { |
tests/ui/consts/required-consts/collect-in-called-fn.rs+1-1| ... | ... | @@ -4,7 +4,7 @@ |
| 4 | 4 | //@[opt] compile-flags: -O |
| 5 | 5 | //! Make sure we detect erroneous constants post-monomorphization even when they are unused. This is |
| 6 | 6 | //! crucial, people rely on it for soundness. (https://github.com/rust-lang/rust/issues/112090) |
| 7 | //@ ignore-parallel-frontend post-monomorphization errors | |
| 7 | ||
| 8 | 8 | struct Fail<T>(T); |
| 9 | 9 | impl<T> Fail<T> { |
| 10 | 10 | const C: () = panic!(); //~ERROR evaluation panicked: explicit panic |
tests/ui/consts/required-consts/collect-in-dead-closure.rs+1-1| ... | ... | @@ -3,7 +3,7 @@ |
| 3 | 3 | //@[noopt] compile-flags: -Copt-level=0 |
| 4 | 4 | //@[opt] compile-flags: -O |
| 5 | 5 | //! This fails without optimizations, so it should also fail with optimizations. |
| 6 | //@ ignore-parallel-frontend post-monomorphization errors | |
| 6 | ||
| 7 | 7 | struct Fail<T>(T); |
| 8 | 8 | impl<T> Fail<T> { |
| 9 | 9 | const C: () = panic!(); //~ERROR evaluation panicked: explicit panic |
tests/ui/consts/required-consts/collect-in-dead-drop.rs+1-1| ... | ... | @@ -3,7 +3,7 @@ |
| 3 | 3 | //@[noopt] compile-flags: -Copt-level=0 |
| 4 | 4 | //@[opt] compile-flags: -O |
| 5 | 5 | //! This fails without optimizations, so it should also fail with optimizations. |
| 6 | //@ ignore-parallel-frontend post-monomorphization errors | |
| 6 | ||
| 7 | 7 | struct Fail<T>(T); |
| 8 | 8 | impl<T> Fail<T> { |
| 9 | 9 | const C: () = panic!(); //~ERROR evaluation panicked: explicit panic |
tests/ui/consts/required-consts/collect-in-dead-fn-behind-assoc-type.rs+1-1| ... | ... | @@ -4,7 +4,7 @@ |
| 4 | 4 | //@[noopt] compile-flags: -Copt-level=0 |
| 5 | 5 | //@[opt] compile-flags: -O |
| 6 | 6 | //! This fails without optimizations, so it should also fail with optimizations. |
| 7 | //@ ignore-parallel-frontend post-monomorphization errors | |
| 7 | ||
| 8 | 8 | struct Fail<T>(T); |
| 9 | 9 | impl<T> Fail<T> { |
| 10 | 10 | const C: () = panic!(); //~ERROR evaluation panicked: explicit panic |
tests/ui/consts/required-consts/collect-in-dead-fn-behind-generic.rs+1-1| ... | ... | @@ -3,7 +3,7 @@ |
| 3 | 3 | //@[noopt] compile-flags: -Copt-level=0 |
| 4 | 4 | //@[opt] compile-flags: -O |
| 5 | 5 | //! This fails without optimizations, so it should also fail with optimizations. |
| 6 | //@ ignore-parallel-frontend post-monomorphization errors | |
| 6 | ||
| 7 | 7 | struct Fail<T>(T); |
| 8 | 8 | impl<T> Fail<T> { |
| 9 | 9 | const C: () = panic!(); //~ERROR evaluation panicked: explicit panic |
tests/ui/consts/required-consts/collect-in-dead-fn-behind-opaque-type.rs+1-1| ... | ... | @@ -4,7 +4,7 @@ |
| 4 | 4 | //@[opt] compile-flags: -O |
| 5 | 5 | //! This fails without optimizations, so it should also fail with optimizations. |
| 6 | 6 | #![feature(type_alias_impl_trait)] |
| 7 | //@ ignore-parallel-frontend post-monomorphization errors | |
| 7 | ||
| 8 | 8 | mod m { |
| 9 | 9 | struct Fail<T>(T); |
| 10 | 10 | impl<T> Fail<T> { |
tests/ui/consts/required-consts/collect-in-dead-fn.rs+1-1| ... | ... | @@ -3,7 +3,7 @@ |
| 3 | 3 | //@[noopt] compile-flags: -Copt-level=0 |
| 4 | 4 | //@[opt] compile-flags: -O |
| 5 | 5 | //! This fails without optimizations, so it should also fail with optimizations. |
| 6 | //@ ignore-parallel-frontend post-monomorphization errors | |
| 6 | ||
| 7 | 7 | struct Fail<T>(T); |
| 8 | 8 | impl<T> Fail<T> { |
| 9 | 9 | const C: () = panic!(); //~ERROR evaluation panicked: explicit panic |
tests/ui/consts/required-consts/collect-in-dead-fnptr-in-const.rs+1-1| ... | ... | @@ -3,7 +3,7 @@ |
| 3 | 3 | //@[noopt] compile-flags: -Copt-level=0 |
| 4 | 4 | //@[opt] compile-flags: -O |
| 5 | 5 | //! This fails without optimizations, so it should also fail with optimizations. |
| 6 | //@ ignore-parallel-frontend post-monomorphization errors | |
| 6 | ||
| 7 | 7 | struct Late<T>(T); |
| 8 | 8 | impl<T> Late<T> { |
| 9 | 9 | const FAIL: () = panic!(); //~ERROR evaluation panicked: explicit panic |
tests/ui/consts/required-consts/collect-in-dead-fnptr.rs+1-1| ... | ... | @@ -3,7 +3,7 @@ |
| 3 | 3 | //@[noopt] compile-flags: -Copt-level=0 |
| 4 | 4 | //@[opt] compile-flags: -O |
| 5 | 5 | //! This fails without optimizations, so it should also fail with optimizations. |
| 6 | //@ ignore-parallel-frontend post-monomorphization errors | |
| 6 | ||
| 7 | 7 | struct Fail<T>(T); |
| 8 | 8 | impl<T> Fail<T> { |
| 9 | 9 | const C: () = panic!(); //~ERROR evaluation panicked: explicit panic |
tests/ui/consts/required-consts/collect-in-dead-forget.rs+1-1| ... | ... | @@ -3,7 +3,7 @@ |
| 3 | 3 | //@[noopt] compile-flags: -Copt-level=0 |
| 4 | 4 | //@[opt] compile-flags: -O |
| 5 | 5 | //! This passes without optimizations, so it can (and should) also pass with optimizations. |
| 6 | //@ ignore-parallel-frontend post-monomorphization errors | |
| 6 | ||
| 7 | 7 | struct Fail<T>(T); |
| 8 | 8 | impl<T> Fail<T> { |
| 9 | 9 | const C: () = panic!(); |
tests/ui/consts/required-consts/collect-in-dead-move.rs+1-1| ... | ... | @@ -3,7 +3,7 @@ |
| 3 | 3 | //@[noopt] compile-flags: -Copt-level=0 |
| 4 | 4 | //@[opt] compile-flags: -O |
| 5 | 5 | //! This fails without optimizations, so it should also fail with optimizations. |
| 6 | //@ ignore-parallel-frontend post-monomorphization errors | |
| 6 | ||
| 7 | 7 | struct Fail<T>(T); |
| 8 | 8 | impl<T> Fail<T> { |
| 9 | 9 | const C: () = panic!(); //~ERROR evaluation panicked: explicit panic |
tests/ui/consts/required-consts/collect-in-dead-vtable.rs+1-1| ... | ... | @@ -3,7 +3,7 @@ |
| 3 | 3 | //@[noopt] compile-flags: -Copt-level=0 |
| 4 | 4 | //@[opt] compile-flags: -O |
| 5 | 5 | //! This fails without optimizations, so it should also fail with optimizations. |
| 6 | //@ ignore-parallel-frontend post-monomorphization errors | |
| 6 | ||
| 7 | 7 | struct Fail<T>(T); |
| 8 | 8 | impl<T> Fail<T> { |
| 9 | 9 | const C: () = panic!(); //~ERROR evaluation panicked: explicit panic |
tests/ui/consts/required-consts/collect-in-promoted-const.rs+1-1| ... | ... | @@ -3,7 +3,7 @@ |
| 3 | 3 | //@[noopt] compile-flags: -Copt-level=0 |
| 4 | 4 | //@[opt] compile-flags: -O |
| 5 | 5 | //! Make sure we error on erroneous consts even if they get promoted. |
| 6 | //@ ignore-parallel-frontend post-monomorphization errors | |
| 6 | ||
| 7 | 7 | struct Fail<T>(T); |
| 8 | 8 | impl<T> Fail<T> { |
| 9 | 9 | const C: () = panic!(); //~ERROR evaluation panicked: explicit panic |
tests/ui/consts/required-consts/interpret-in-const-called-fn.rs+1-1| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | //@[noopt] compile-flags: -Copt-level=0 |
| 3 | 3 | //@[opt] compile-flags: -O |
| 4 | 4 | //! Make sure we error on erroneous consts even if they are unused. |
| 5 | //@ ignore-parallel-frontend post-monomorphization errors | |
| 5 | ||
| 6 | 6 | struct Fail<T>(T); |
| 7 | 7 | impl<T> Fail<T> { |
| 8 | 8 | const C: () = panic!(); //~ERROR explicit panic |
tests/ui/consts/required-consts/interpret-in-promoted.rs+1-1| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | //@[noopt] compile-flags: -Copt-level=0 |
| 3 | 3 | //@[opt] compile-flags: -O |
| 4 | 4 | //@ dont-require-annotations: NOTE |
| 5 | //@ ignore-parallel-frontend post-monomorphization errors | |
| 5 | ||
| 6 | 6 | //! Make sure we evaluate const fn calls even if they get promoted and their result ignored. |
| 7 | 7 | |
| 8 | 8 | const unsafe fn ub() { |
tests/ui/consts/required-consts/interpret-in-static.rs+1-1| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | //@[noopt] compile-flags: -Copt-level=0 |
| 3 | 3 | //@[opt] compile-flags: -O |
| 4 | 4 | //! Make sure we error on erroneous consts even if they are unused. |
| 5 | //@ ignore-parallel-frontend post-monomorphization errors | |
| 5 | ||
| 6 | 6 | struct Fail<T>(T); |
| 7 | 7 | impl<T> Fail<T> { |
| 8 | 8 | const C: () = panic!(); //~ERROR explicit panic |
tests/ui/delegation/self-coercion-static-free.rs+2| ... | ... | @@ -23,6 +23,7 @@ impl Trait for S { |
| 23 | 23 | //~^ ERROR: mismatched types |
| 24 | 24 | //~| ERROR: mismatched types |
| 25 | 25 | //~| ERROR: mismatched types |
| 26 | //~| ERROR: unused target expression is specified for glob or list delegation | |
| 26 | 27 | let _ = self; |
| 27 | 28 | S::static_self() |
| 28 | 29 | } |
| ... | ... | @@ -35,6 +36,7 @@ impl Trait for S1 { |
| 35 | 36 | //~^ ERROR: mismatched types |
| 36 | 37 | //~| ERROR: mismatched types |
| 37 | 38 | //~| ERROR: mismatched types |
| 39 | //~| ERROR: unused target expression is specified for glob or list delegation | |
| 38 | 40 | let _ = self; |
| 39 | 41 | S1::static_self() |
| 40 | 42 | } |
tests/ui/delegation/self-coercion-static-free.stderr+20-8| ... | ... | @@ -1,3 +1,15 @@ |
| 1 | error: unused target expression is specified for glob or list delegation | |
| 2 | --> $DIR/self-coercion-static-free.rs:22:26 | |
| 3 | | | |
| 4 | LL | reuse <F as Trait>::{static_value, static_mut_ref, static_ref} { | |
| 5 | | ^^^^^^^^^^^^ | |
| 6 | ||
| 7 | error: unused target expression is specified for glob or list delegation | |
| 8 | --> $DIR/self-coercion-static-free.rs:35:26 | |
| 9 | | | |
| 10 | LL | reuse <F as Trait>::{static_value, static_mut_ref, static_ref} { | |
| 11 | | ^^^^^^^^^^^^ | |
| 12 | ||
| 1 | 13 | error[E0308]: mismatched types |
| 2 | 14 | --> $DIR/self-coercion-static-free.rs:22:26 |
| 3 | 15 | | |
| ... | ... | @@ -48,7 +60,7 @@ LL | fn static_ref(_: &Self) -> i32 { 3 } |
| 48 | 60 | | ^^^^^^^^^^ -------- |
| 49 | 61 | |
| 50 | 62 | error[E0308]: mismatched types |
| 51 | --> $DIR/self-coercion-static-free.rs:34:26 | |
| 63 | --> $DIR/self-coercion-static-free.rs:35:26 | |
| 52 | 64 | | |
| 53 | 65 | LL | reuse <F as Trait>::{static_value, static_mut_ref, static_ref} { |
| 54 | 66 | | ^^^^^^^^^^^^ |
| ... | ... | @@ -63,7 +75,7 @@ LL | fn static_value(_: Self) -> i32 { 1 } |
| 63 | 75 | | ^^^^^^^^^^^^ ------- |
| 64 | 76 | |
| 65 | 77 | error[E0308]: mismatched types |
| 66 | --> $DIR/self-coercion-static-free.rs:34:40 | |
| 78 | --> $DIR/self-coercion-static-free.rs:35:40 | |
| 67 | 79 | | |
| 68 | 80 | LL | reuse <F as Trait>::{static_value, static_mut_ref, static_ref} { |
| 69 | 81 | | ^^^^^^^^^^^^^^ |
| ... | ... | @@ -80,7 +92,7 @@ LL | fn static_mut_ref(_: &mut Self) -> i32 { 2 } |
| 80 | 92 | | ^^^^^^^^^^^^^^ ------------ |
| 81 | 93 | |
| 82 | 94 | error[E0308]: mismatched types |
| 83 | --> $DIR/self-coercion-static-free.rs:34:56 | |
| 95 | --> $DIR/self-coercion-static-free.rs:35:56 | |
| 84 | 96 | | |
| 85 | 97 | LL | reuse <F as Trait>::{static_value, static_mut_ref, static_ref} { |
| 86 | 98 | | ^^^^^^^^^^ |
| ... | ... | @@ -97,7 +109,7 @@ LL | fn static_ref(_: &Self) -> i32 { 3 } |
| 97 | 109 | | ^^^^^^^^^^ -------- |
| 98 | 110 | |
| 99 | 111 | error[E0308]: mismatched types |
| 100 | --> $DIR/self-coercion-static-free.rs:50:43 | |
| 112 | --> $DIR/self-coercion-static-free.rs:52:43 | |
| 101 | 113 | | |
| 102 | 114 | LL | reuse to_reuse::{value, mut_ref, r#ref} { F } |
| 103 | 115 | | ------- ^ expected `&mut _`, found `F` |
| ... | ... | @@ -107,7 +119,7 @@ LL | reuse to_reuse::{value, mut_ref, r#ref} { F } |
| 107 | 119 | = note: expected mutable reference `&mut _` |
| 108 | 120 | found struct `F` |
| 109 | 121 | note: function defined here |
| 110 | --> $DIR/self-coercion-static-free.rs:46:12 | |
| 122 | --> $DIR/self-coercion-static-free.rs:48:12 | |
| 111 | 123 | | |
| 112 | 124 | LL | pub fn mut_ref(_: &mut impl Trait) -> i32 { 2 } |
| 113 | 125 | | ^^^^^^^ ------------------ |
| ... | ... | @@ -117,7 +129,7 @@ LL | reuse to_reuse::{value, mut_ref, r#ref} { &mut F } |
| 117 | 129 | | ++++ |
| 118 | 130 | |
| 119 | 131 | error[E0308]: mismatched types |
| 120 | --> $DIR/self-coercion-static-free.rs:50:43 | |
| 132 | --> $DIR/self-coercion-static-free.rs:52:43 | |
| 121 | 133 | | |
| 122 | 134 | LL | reuse to_reuse::{value, mut_ref, r#ref} { F } |
| 123 | 135 | | ----- ^ expected `&_`, found `F` |
| ... | ... | @@ -127,7 +139,7 @@ LL | reuse to_reuse::{value, mut_ref, r#ref} { F } |
| 127 | 139 | = note: expected reference `&_` |
| 128 | 140 | found struct `F` |
| 129 | 141 | note: function defined here |
| 130 | --> $DIR/self-coercion-static-free.rs:47:12 | |
| 142 | --> $DIR/self-coercion-static-free.rs:49:12 | |
| 131 | 143 | | |
| 132 | 144 | LL | pub fn r#ref(_: &impl Trait) -> i32 { 3 } |
| 133 | 145 | | ^^^^^ -------------- |
| ... | ... | @@ -136,6 +148,6 @@ help: consider borrowing here |
| 136 | 148 | LL | reuse to_reuse::{value, mut_ref, r#ref} { &F } |
| 137 | 149 | | + |
| 138 | 150 | |
| 139 | error: aborting due to 8 previous errors | |
| 151 | error: aborting due to 10 previous errors | |
| 140 | 152 | |
| 141 | 153 | For more information about this error, try `rustc --explain E0308`. |
tests/ui/delegation/unused-target-expr-in-glob-or-list.rs created+208| ... | ... | @@ -0,0 +1,208 @@ |
| 1 | #![feature(fn_delegation)] | |
| 2 | ||
| 3 | pub trait Trait: Sized { | |
| 4 | fn static_self() -> F { F } | |
| 5 | fn static_self2() -> F { F } | |
| 6 | ||
| 7 | fn static_value(_: F) -> i32 { 1 } | |
| 8 | fn static_mut_ref(_: &mut F) -> i32 { 2 } | |
| 9 | fn static_ref(_: &F) -> i32 { 3 } | |
| 10 | } | |
| 11 | ||
| 12 | #[derive(Default, Eq, PartialEq, Debug)] | |
| 13 | pub struct F; | |
| 14 | impl Trait for F {} | |
| 15 | ||
| 16 | struct S(F); | |
| 17 | impl Trait for S { | |
| 18 | reuse <F as Trait>::* { self.0 } | |
| 19 | //~^ ERROR: unused target expression is specified for glob or list delegation | |
| 20 | } | |
| 21 | ||
| 22 | struct S1(F); | |
| 23 | impl S1 { | |
| 24 | reuse <F as Trait>::* { self.0 } | |
| 25 | //~^ ERROR: unused target expression is specified for glob or list delegation | |
| 26 | } | |
| 27 | ||
| 28 | struct S2(F); | |
| 29 | impl Trait for S2 { | |
| 30 | reuse <F as Trait>::{static_self} { self.0 } | |
| 31 | //~^ ERROR: unused target expression is specified for glob or list delegation | |
| 32 | } | |
| 33 | ||
| 34 | struct S3(F); | |
| 35 | impl Trait for S3 { | |
| 36 | reuse <F as Trait>::{static_self, static_value} { self.0 } | |
| 37 | //~^ ERROR: unused target expression is specified for glob or list delegation | |
| 38 | } | |
| 39 | ||
| 40 | struct S4(F); | |
| 41 | impl Trait for S4 { | |
| 42 | reuse <F as Trait>::{static_self, static_value, static_mut_ref, static_ref} { self.0 } | |
| 43 | //~^ ERROR: unused target expression is specified for glob or list delegation | |
| 44 | } | |
| 45 | ||
| 46 | struct S5(F); | |
| 47 | impl Trait for S5 { | |
| 48 | reuse <F as Trait>::{static_self, static_value, static_mut_ref, static_ref} { } | |
| 49 | //~^ ERROR: unused target expression is specified for glob or list delegation | |
| 50 | } | |
| 51 | ||
| 52 | struct S6(F); | |
| 53 | impl Trait for S6 { | |
| 54 | // Error about unused target expression is not emitted when error delegation is generated. | |
| 55 | reuse UnresolvedTrait::* { self.0 } | |
| 56 | //~^ ERROR: cannot find type `UnresolvedTrait` in this scope | |
| 57 | } | |
| 58 | ||
| 59 | struct S7(F); | |
| 60 | impl Trait for S7 { | |
| 61 | reuse <F as Trait>::*; | |
| 62 | } | |
| 63 | ||
| 64 | struct S8(F); | |
| 65 | impl Trait for S8 { | |
| 66 | reuse <F as Trait>::{static_self, static_self2} { { F } } | |
| 67 | //~^ ERROR: unused target expression is specified for glob or list delegation | |
| 68 | } | |
| 69 | ||
| 70 | struct S9; | |
| 71 | impl S9 { | |
| 72 | reuse <F as Trait>::{static_self, static_self2} { { F } } | |
| 73 | //~^ ERROR: unused target expression is specified for glob or list delegation | |
| 74 | ||
| 75 | reuse <F as Trait>::{static_value, static_mut_ref, static_ref} { } | |
| 76 | //~^ ERROR: unused target expression is specified for glob or list delegation | |
| 77 | } | |
| 78 | ||
| 79 | trait Trait2 { | |
| 80 | reuse <F as Trait>::{static_self, static_self2} { { F } } | |
| 81 | //~^ ERROR: unused target expression is specified for glob or list delegation | |
| 82 | ||
| 83 | reuse <F as Trait>::{static_value, static_mut_ref} { } | |
| 84 | //~^ ERROR: unused target expression is specified for glob or list delegation | |
| 85 | ||
| 86 | reuse <F as Trait>::{static_ref}; | |
| 87 | } | |
| 88 | ||
| 89 | mod free_to_trait1 { | |
| 90 | use super::{F, Trait}; | |
| 91 | ||
| 92 | reuse <F as Trait>::{static_self, static_self2} { { F } } | |
| 93 | //~^ ERROR: unused target expression is specified for glob or list delegation | |
| 94 | ||
| 95 | reuse <F as Trait>::{static_value, static_mut_ref} { } | |
| 96 | //~^ ERROR: unused target expression is specified for glob or list delegation | |
| 97 | ||
| 98 | reuse <F as Trait>::{static_ref}; | |
| 99 | } | |
| 100 | ||
| 101 | mod macros { | |
| 102 | use super::*; | |
| 103 | ||
| 104 | macro_rules! delegation { | |
| 105 | () => { | |
| 106 | impl Trait for S { | |
| 107 | reuse <F as Trait>::static_self { self.0 } | |
| 108 | //~^ ERROR: delegation's target expression is specified for function with no params | |
| 109 | //~| ERROR: mismatched types | |
| 110 | //~| ERROR: this function takes 0 arguments but 1 argument was supplied | |
| 111 | //~| ERROR: method `static_self` has an incompatible type for trait | |
| 112 | reuse <F as Trait>::static_value { self.0 } | |
| 113 | //~^ ERROR: no field `0` on type `F` | |
| 114 | reuse <F as Trait>::static_mut_ref { self.0 } | |
| 115 | //~^ ERROR: no field `0` on type `&mut F` | |
| 116 | reuse <F as Trait>::static_ref { self.0 } | |
| 117 | //~^ ERROR: no field `0` on type `&F` | |
| 118 | } | |
| 119 | }; | |
| 120 | } | |
| 121 | ||
| 122 | struct S(F); | |
| 123 | delegation!(); | |
| 124 | ||
| 125 | macro_rules! delegation2 { | |
| 126 | () => { | |
| 127 | reuse <F as Trait>::static_self { self.0 } | |
| 128 | //~^ ERROR: delegation's target expression is specified for function with no params | |
| 129 | //~| ERROR: mismatched types | |
| 130 | //~| ERROR: this function takes 0 arguments but 1 argument was supplied | |
| 131 | //~| ERROR: method `static_self` has an incompatible type for trait | |
| 132 | reuse <F as Trait>::static_value { self.0 } | |
| 133 | //~^ ERROR: no field `0` on type `F` | |
| 134 | reuse <F as Trait>::static_mut_ref { self.0 } | |
| 135 | //~^ ERROR: no field `0` on type `&mut F` | |
| 136 | reuse <F as Trait>::static_ref { self.0 } | |
| 137 | //~^ ERROR: no field `0` on type `&F` | |
| 138 | }; | |
| 139 | } | |
| 140 | ||
| 141 | struct S1(F); | |
| 142 | impl Trait for S1 { | |
| 143 | delegation2!(); | |
| 144 | } | |
| 145 | } | |
| 146 | ||
| 147 | mod free_list { | |
| 148 | mod to_reuse { | |
| 149 | pub fn value() -> i32 { 1 } | |
| 150 | pub fn mut_ref() -> i32 { 2 } | |
| 151 | pub fn r#ref() -> i32 { 3 } | |
| 152 | } | |
| 153 | ||
| 154 | reuse to_reuse::{value, mut_ref, r#ref} { () } | |
| 155 | //~^ ERROR: this function takes 0 arguments but 1 argument was supplied | |
| 156 | //~| ERROR: this function takes 0 arguments but 1 argument was supplied | |
| 157 | //~| ERROR: this function takes 0 arguments but 1 argument was supplied | |
| 158 | //~| ERROR: mismatched types | |
| 159 | //~| ERROR: mismatched types | |
| 160 | //~| ERROR: mismatched types | |
| 161 | //~| ERROR: delegation's target expression is specified for function with no params | |
| 162 | //~| ERROR: delegation's target expression is specified for function with no params | |
| 163 | //~| ERROR: delegation's target expression is specified for function with no params | |
| 164 | ||
| 165 | reuse to_reuse::{value as value2} { } | |
| 166 | //~^ ERROR: this function takes 0 arguments but 1 argument was supplied | |
| 167 | //~| ERROR: mismatched types | |
| 168 | //~| ERROR: delegation's target expression is specified for function with no params | |
| 169 | } | |
| 170 | ||
| 171 | mod to_free { | |
| 172 | trait Trait { | |
| 173 | fn value() -> i32 { 1 } | |
| 174 | fn mut_ref() -> i32 { 2 } | |
| 175 | fn r#ref() -> i32 { 3 } | |
| 176 | } | |
| 177 | ||
| 178 | mod to_reuse { | |
| 179 | pub fn value() -> i32 { 1 } | |
| 180 | pub fn mut_ref() -> i32 { 2 } | |
| 181 | pub fn r#ref() -> i32 { 3 } | |
| 182 | } | |
| 183 | ||
| 184 | struct F; | |
| 185 | impl Trait for F {} | |
| 186 | ||
| 187 | struct S(F); | |
| 188 | impl Trait for S { | |
| 189 | reuse to_reuse::{value, mut_ref, r#ref} { () } | |
| 190 | //~^ ERROR: unused target expression is specified for glob or list delegation | |
| 191 | } | |
| 192 | ||
| 193 | struct S2; | |
| 194 | impl S2 { | |
| 195 | reuse to_reuse::{value, mut_ref, r#ref} { 1 + 1 } | |
| 196 | //~^ ERROR: this function takes 0 arguments but 1 argument was supplied | |
| 197 | //~| ERROR: this function takes 0 arguments but 1 argument was supplied | |
| 198 | //~| ERROR: this function takes 0 arguments but 1 argument was supplied | |
| 199 | //~| ERROR: mismatched types | |
| 200 | //~| ERROR: mismatched types | |
| 201 | //~| ERROR: mismatched types | |
| 202 | //~| ERROR: delegation's target expression is specified for function with no params | |
| 203 | //~| ERROR: delegation's target expression is specified for function with no params | |
| 204 | //~| ERROR: delegation's target expression is specified for function with no params | |
| 205 | } | |
| 206 | } | |
| 207 | ||
| 208 | fn main() {} |
tests/ui/delegation/unused-target-expr-in-glob-or-list.stderr created+569| ... | ... | @@ -0,0 +1,569 @@ |
| 1 | error[E0433]: cannot find type `UnresolvedTrait` in this scope | |
| 2 | --> $DIR/unused-target-expr-in-glob-or-list.rs:55:11 | |
| 3 | | | |
| 4 | LL | reuse UnresolvedTrait::* { self.0 } | |
| 5 | | ^^^^^^^^^^^^^^^ use of undeclared type `UnresolvedTrait` | |
| 6 | ||
| 7 | error: delegation's target expression is specified for function with no params | |
| 8 | --> $DIR/unused-target-expr-in-glob-or-list.rs:154:45 | |
| 9 | | | |
| 10 | LL | reuse to_reuse::{value, mut_ref, r#ref} { () } | |
| 11 | | ^^^^^^ | |
| 12 | ||
| 13 | error: delegation's target expression is specified for function with no params | |
| 14 | --> $DIR/unused-target-expr-in-glob-or-list.rs:154:45 | |
| 15 | | | |
| 16 | LL | reuse to_reuse::{value, mut_ref, r#ref} { () } | |
| 17 | | ^^^^^^ | |
| 18 | | | |
| 19 | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` | |
| 20 | ||
| 21 | error: delegation's target expression is specified for function with no params | |
| 22 | --> $DIR/unused-target-expr-in-glob-or-list.rs:154:45 | |
| 23 | | | |
| 24 | LL | reuse to_reuse::{value, mut_ref, r#ref} { () } | |
| 25 | | ^^^^^^ | |
| 26 | | | |
| 27 | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` | |
| 28 | ||
| 29 | error: delegation's target expression is specified for function with no params | |
| 30 | --> $DIR/unused-target-expr-in-glob-or-list.rs:165:39 | |
| 31 | | | |
| 32 | LL | reuse to_reuse::{value as value2} { } | |
| 33 | | ^^^ | |
| 34 | ||
| 35 | error: delegation's target expression is specified for function with no params | |
| 36 | --> $DIR/unused-target-expr-in-glob-or-list.rs:195:49 | |
| 37 | | | |
| 38 | LL | reuse to_reuse::{value, mut_ref, r#ref} { 1 + 1 } | |
| 39 | | ^^^^^^^^^ | |
| 40 | ||
| 41 | error: delegation's target expression is specified for function with no params | |
| 42 | --> $DIR/unused-target-expr-in-glob-or-list.rs:195:49 | |
| 43 | | | |
| 44 | LL | reuse to_reuse::{value, mut_ref, r#ref} { 1 + 1 } | |
| 45 | | ^^^^^^^^^ | |
| 46 | | | |
| 47 | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` | |
| 48 | ||
| 49 | error: delegation's target expression is specified for function with no params | |
| 50 | --> $DIR/unused-target-expr-in-glob-or-list.rs:195:49 | |
| 51 | | | |
| 52 | LL | reuse to_reuse::{value, mut_ref, r#ref} { 1 + 1 } | |
| 53 | | ^^^^^^^^^ | |
| 54 | | | |
| 55 | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` | |
| 56 | ||
| 57 | error: delegation's target expression is specified for function with no params | |
| 58 | --> $DIR/unused-target-expr-in-glob-or-list.rs:107:49 | |
| 59 | | | |
| 60 | LL | reuse <F as Trait>::static_self { self.0 } | |
| 61 | | ^^^^^^^^^^ | |
| 62 | ... | |
| 63 | LL | delegation!(); | |
| 64 | | ------------- in this macro invocation | |
| 65 | | | |
| 66 | = note: this error originates in the macro `delegation` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 67 | ||
| 68 | error: delegation's target expression is specified for function with no params | |
| 69 | --> $DIR/unused-target-expr-in-glob-or-list.rs:127:45 | |
| 70 | | | |
| 71 | LL | reuse <F as Trait>::static_self { self.0 } | |
| 72 | | ^^^^^^^^^^ | |
| 73 | ... | |
| 74 | LL | delegation2!(); | |
| 75 | | -------------- in this macro invocation | |
| 76 | | | |
| 77 | = note: this error originates in the macro `delegation2` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 78 | ||
| 79 | error: unused target expression is specified for glob or list delegation | |
| 80 | --> $DIR/unused-target-expr-in-glob-or-list.rs:18:25 | |
| 81 | | | |
| 82 | LL | reuse <F as Trait>::* { self.0 } | |
| 83 | | ^ | |
| 84 | ||
| 85 | error: unused target expression is specified for glob or list delegation | |
| 86 | --> $DIR/unused-target-expr-in-glob-or-list.rs:24:25 | |
| 87 | | | |
| 88 | LL | reuse <F as Trait>::* { self.0 } | |
| 89 | | ^ | |
| 90 | ||
| 91 | error: unused target expression is specified for glob or list delegation | |
| 92 | --> $DIR/unused-target-expr-in-glob-or-list.rs:30:26 | |
| 93 | | | |
| 94 | LL | reuse <F as Trait>::{static_self} { self.0 } | |
| 95 | | ^^^^^^^^^^^ | |
| 96 | ||
| 97 | error: unused target expression is specified for glob or list delegation | |
| 98 | --> $DIR/unused-target-expr-in-glob-or-list.rs:36:26 | |
| 99 | | | |
| 100 | LL | reuse <F as Trait>::{static_self, static_value} { self.0 } | |
| 101 | | ^^^^^^^^^^^ | |
| 102 | ||
| 103 | error: unused target expression is specified for glob or list delegation | |
| 104 | --> $DIR/unused-target-expr-in-glob-or-list.rs:42:26 | |
| 105 | | | |
| 106 | LL | reuse <F as Trait>::{static_self, static_value, static_mut_ref, static_ref} { self.0 } | |
| 107 | | ^^^^^^^^^^^ | |
| 108 | ||
| 109 | error: unused target expression is specified for glob or list delegation | |
| 110 | --> $DIR/unused-target-expr-in-glob-or-list.rs:48:26 | |
| 111 | | | |
| 112 | LL | reuse <F as Trait>::{static_self, static_value, static_mut_ref, static_ref} { } | |
| 113 | | ^^^^^^^^^^^ | |
| 114 | ||
| 115 | error: unused target expression is specified for glob or list delegation | |
| 116 | --> $DIR/unused-target-expr-in-glob-or-list.rs:66:26 | |
| 117 | | | |
| 118 | LL | reuse <F as Trait>::{static_self, static_self2} { { F } } | |
| 119 | | ^^^^^^^^^^^ | |
| 120 | ||
| 121 | error: unused target expression is specified for glob or list delegation | |
| 122 | --> $DIR/unused-target-expr-in-glob-or-list.rs:72:26 | |
| 123 | | | |
| 124 | LL | reuse <F as Trait>::{static_self, static_self2} { { F } } | |
| 125 | | ^^^^^^^^^^^ | |
| 126 | ||
| 127 | error: unused target expression is specified for glob or list delegation | |
| 128 | --> $DIR/unused-target-expr-in-glob-or-list.rs:75:26 | |
| 129 | | | |
| 130 | LL | reuse <F as Trait>::{static_value, static_mut_ref, static_ref} { } | |
| 131 | | ^^^^^^^^^^^^ | |
| 132 | ||
| 133 | error: unused target expression is specified for glob or list delegation | |
| 134 | --> $DIR/unused-target-expr-in-glob-or-list.rs:80:26 | |
| 135 | | | |
| 136 | LL | reuse <F as Trait>::{static_self, static_self2} { { F } } | |
| 137 | | ^^^^^^^^^^^ | |
| 138 | ||
| 139 | error: unused target expression is specified for glob or list delegation | |
| 140 | --> $DIR/unused-target-expr-in-glob-or-list.rs:83:26 | |
| 141 | | | |
| 142 | LL | reuse <F as Trait>::{static_value, static_mut_ref} { } | |
| 143 | | ^^^^^^^^^^^^ | |
| 144 | ||
| 145 | error: unused target expression is specified for glob or list delegation | |
| 146 | --> $DIR/unused-target-expr-in-glob-or-list.rs:92:26 | |
| 147 | | | |
| 148 | LL | reuse <F as Trait>::{static_self, static_self2} { { F } } | |
| 149 | | ^^^^^^^^^^^ | |
| 150 | ||
| 151 | error: unused target expression is specified for glob or list delegation | |
| 152 | --> $DIR/unused-target-expr-in-glob-or-list.rs:95:26 | |
| 153 | | | |
| 154 | LL | reuse <F as Trait>::{static_value, static_mut_ref} { } | |
| 155 | | ^^^^^^^^^^^^ | |
| 156 | ||
| 157 | error: unused target expression is specified for glob or list delegation | |
| 158 | --> $DIR/unused-target-expr-in-glob-or-list.rs:189:26 | |
| 159 | | | |
| 160 | LL | reuse to_reuse::{value, mut_ref, r#ref} { () } | |
| 161 | | ^^^^^ | |
| 162 | ||
| 163 | error[E0053]: method `static_self` has an incompatible type for trait | |
| 164 | --> $DIR/unused-target-expr-in-glob-or-list.rs:107:37 | |
| 165 | | | |
| 166 | LL | reuse <F as Trait>::static_self { self.0 } | |
| 167 | | ^^^^^^^^^^^ expected `F`, found `()` | |
| 168 | ... | |
| 169 | LL | delegation!(); | |
| 170 | | ------------- in this macro invocation | |
| 171 | | | |
| 172 | note: type in trait | |
| 173 | --> $DIR/unused-target-expr-in-glob-or-list.rs:4:25 | |
| 174 | | | |
| 175 | LL | fn static_self() -> F { F } | |
| 176 | | ^ | |
| 177 | = note: expected signature `fn() -> F` | |
| 178 | found signature `fn() -> ()` | |
| 179 | = note: this error originates in the macro `delegation` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 180 | help: change the output type to match the trait | |
| 181 | | | |
| 182 | LL - reuse <F as Trait>::static_self { self.0 } | |
| 183 | LL + reuse <F as Trait>:: -> F { self.0 } | |
| 184 | | | |
| 185 | ||
| 186 | error[E0053]: method `static_self` has an incompatible type for trait | |
| 187 | --> $DIR/unused-target-expr-in-glob-or-list.rs:127:33 | |
| 188 | | | |
| 189 | LL | reuse <F as Trait>::static_self { self.0 } | |
| 190 | | ^^^^^^^^^^^ expected `F`, found `()` | |
| 191 | ... | |
| 192 | LL | delegation2!(); | |
| 193 | | -------------- in this macro invocation | |
| 194 | | | |
| 195 | note: type in trait | |
| 196 | --> $DIR/unused-target-expr-in-glob-or-list.rs:4:25 | |
| 197 | | | |
| 198 | LL | fn static_self() -> F { F } | |
| 199 | | ^ | |
| 200 | = note: expected signature `fn() -> F` | |
| 201 | found signature `fn() -> ()` | |
| 202 | = note: this error originates in the macro `delegation2` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 203 | help: change the output type to match the trait | |
| 204 | | | |
| 205 | LL - reuse <F as Trait>::static_self { self.0 } | |
| 206 | LL + reuse <F as Trait>:: -> F { self.0 } | |
| 207 | | | |
| 208 | ||
| 209 | error[E0061]: this function takes 0 arguments but 1 argument was supplied | |
| 210 | --> $DIR/unused-target-expr-in-glob-or-list.rs:107:37 | |
| 211 | | | |
| 212 | LL | reuse <F as Trait>::static_self { self.0 } | |
| 213 | | ^^^^^^^^^^^ ---------- unexpected argument | |
| 214 | ... | |
| 215 | LL | delegation!(); | |
| 216 | | ------------- in this macro invocation | |
| 217 | | | |
| 218 | note: associated function defined here | |
| 219 | --> $DIR/unused-target-expr-in-glob-or-list.rs:4:8 | |
| 220 | | | |
| 221 | LL | fn static_self() -> F { F } | |
| 222 | | ^^^^^^^^^^^ | |
| 223 | = note: this error originates in the macro `delegation` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 224 | ||
| 225 | error[E0308]: mismatched types | |
| 226 | --> $DIR/unused-target-expr-in-glob-or-list.rs:107:37 | |
| 227 | | | |
| 228 | LL | reuse <F as Trait>::static_self { self.0 } | |
| 229 | | ^^^^^^^^^^^- help: consider using a semicolon here: `;` | |
| 230 | | | | |
| 231 | | expected `()`, found `F` | |
| 232 | | expected `()` because of default return type | |
| 233 | ... | |
| 234 | LL | delegation!(); | |
| 235 | | ------------- in this macro invocation | |
| 236 | | | |
| 237 | = note: this error originates in the macro `delegation` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 238 | ||
| 239 | error[E0609]: no field `0` on type `F` | |
| 240 | --> $DIR/unused-target-expr-in-glob-or-list.rs:112:57 | |
| 241 | | | |
| 242 | LL | reuse <F as Trait>::static_value { self.0 } | |
| 243 | | ^ unknown field | |
| 244 | ... | |
| 245 | LL | delegation!(); | |
| 246 | | ------------- in this macro invocation | |
| 247 | | | |
| 248 | = note: this error originates in the macro `delegation` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 249 | ||
| 250 | error[E0609]: no field `0` on type `&mut F` | |
| 251 | --> $DIR/unused-target-expr-in-glob-or-list.rs:114:59 | |
| 252 | | | |
| 253 | LL | reuse <F as Trait>::static_mut_ref { self.0 } | |
| 254 | | ^ unknown field | |
| 255 | ... | |
| 256 | LL | delegation!(); | |
| 257 | | ------------- in this macro invocation | |
| 258 | | | |
| 259 | = note: this error originates in the macro `delegation` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 260 | ||
| 261 | error[E0609]: no field `0` on type `&F` | |
| 262 | --> $DIR/unused-target-expr-in-glob-or-list.rs:116:55 | |
| 263 | | | |
| 264 | LL | reuse <F as Trait>::static_ref { self.0 } | |
| 265 | | ^ unknown field | |
| 266 | ... | |
| 267 | LL | delegation!(); | |
| 268 | | ------------- in this macro invocation | |
| 269 | | | |
| 270 | = note: this error originates in the macro `delegation` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 271 | ||
| 272 | error[E0061]: this function takes 0 arguments but 1 argument was supplied | |
| 273 | --> $DIR/unused-target-expr-in-glob-or-list.rs:127:33 | |
| 274 | | | |
| 275 | LL | reuse <F as Trait>::static_self { self.0 } | |
| 276 | | ^^^^^^^^^^^ ---------- unexpected argument | |
| 277 | ... | |
| 278 | LL | delegation2!(); | |
| 279 | | -------------- in this macro invocation | |
| 280 | | | |
| 281 | note: associated function defined here | |
| 282 | --> $DIR/unused-target-expr-in-glob-or-list.rs:4:8 | |
| 283 | | | |
| 284 | LL | fn static_self() -> F { F } | |
| 285 | | ^^^^^^^^^^^ | |
| 286 | = note: this error originates in the macro `delegation2` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 287 | ||
| 288 | error[E0308]: mismatched types | |
| 289 | --> $DIR/unused-target-expr-in-glob-or-list.rs:127:33 | |
| 290 | | | |
| 291 | LL | reuse <F as Trait>::static_self { self.0 } | |
| 292 | | ^^^^^^^^^^^- help: consider using a semicolon here: `;` | |
| 293 | | | | |
| 294 | | expected `()`, found `F` | |
| 295 | | expected `()` because of default return type | |
| 296 | ... | |
| 297 | LL | delegation2!(); | |
| 298 | | -------------- in this macro invocation | |
| 299 | | | |
| 300 | = note: this error originates in the macro `delegation2` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 301 | ||
| 302 | error[E0609]: no field `0` on type `F` | |
| 303 | --> $DIR/unused-target-expr-in-glob-or-list.rs:132:53 | |
| 304 | | | |
| 305 | LL | reuse <F as Trait>::static_value { self.0 } | |
| 306 | | ^ unknown field | |
| 307 | ... | |
| 308 | LL | delegation2!(); | |
| 309 | | -------------- in this macro invocation | |
| 310 | | | |
| 311 | = note: this error originates in the macro `delegation2` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 312 | ||
| 313 | error[E0609]: no field `0` on type `&mut F` | |
| 314 | --> $DIR/unused-target-expr-in-glob-or-list.rs:134:55 | |
| 315 | | | |
| 316 | LL | reuse <F as Trait>::static_mut_ref { self.0 } | |
| 317 | | ^ unknown field | |
| 318 | ... | |
| 319 | LL | delegation2!(); | |
| 320 | | -------------- in this macro invocation | |
| 321 | | | |
| 322 | = note: this error originates in the macro `delegation2` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 323 | ||
| 324 | error[E0609]: no field `0` on type `&F` | |
| 325 | --> $DIR/unused-target-expr-in-glob-or-list.rs:136:51 | |
| 326 | | | |
| 327 | LL | reuse <F as Trait>::static_ref { self.0 } | |
| 328 | | ^ unknown field | |
| 329 | ... | |
| 330 | LL | delegation2!(); | |
| 331 | | -------------- in this macro invocation | |
| 332 | | | |
| 333 | = note: this error originates in the macro `delegation2` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 334 | ||
| 335 | error[E0061]: this function takes 0 arguments but 1 argument was supplied | |
| 336 | --> $DIR/unused-target-expr-in-glob-or-list.rs:154:22 | |
| 337 | | | |
| 338 | LL | reuse to_reuse::{value, mut_ref, r#ref} { () } | |
| 339 | | ^^^^^ ------ unexpected argument of type `()` | |
| 340 | | | |
| 341 | note: function defined here | |
| 342 | --> $DIR/unused-target-expr-in-glob-or-list.rs:149:16 | |
| 343 | | | |
| 344 | LL | pub fn value() -> i32 { 1 } | |
| 345 | | ^^^^^ | |
| 346 | help: remove the extra argument | |
| 347 | | | |
| 348 | LL - reuse to_reuse::{value, mut_ref, r#ref} { () } | |
| 349 | LL + reuse to_reuse::{valu{ () } | |
| 350 | | | |
| 351 | ||
| 352 | error[E0308]: mismatched types | |
| 353 | --> $DIR/unused-target-expr-in-glob-or-list.rs:154:22 | |
| 354 | | | |
| 355 | LL | reuse to_reuse::{value, mut_ref, r#ref} { () } | |
| 356 | | ^^^^^ expected `()`, found `i32` | |
| 357 | | | |
| 358 | help: consider using a semicolon here | |
| 359 | | | |
| 360 | LL | reuse to_reuse::{value;, mut_ref, r#ref} { () } | |
| 361 | | + | |
| 362 | help: try adding a return type | |
| 363 | | | |
| 364 | LL - reuse to_reuse::{value, mut_ref, r#ref} { () } | |
| 365 | LL + reuse to_reuse::{ -> i32, mut_ref, r#ref} { () } | |
| 366 | | | |
| 367 | ||
| 368 | error[E0061]: this function takes 0 arguments but 1 argument was supplied | |
| 369 | --> $DIR/unused-target-expr-in-glob-or-list.rs:154:29 | |
| 370 | | | |
| 371 | LL | reuse to_reuse::{value, mut_ref, r#ref} { () } | |
| 372 | | ^^^^^^^ ------ unexpected argument of type `()` | |
| 373 | | | |
| 374 | note: function defined here | |
| 375 | --> $DIR/unused-target-expr-in-glob-or-list.rs:150:16 | |
| 376 | | | |
| 377 | LL | pub fn mut_ref() -> i32 { 2 } | |
| 378 | | ^^^^^^^ | |
| 379 | help: remove the extra argument | |
| 380 | | | |
| 381 | LL - reuse to_reuse::{value, mut_ref, r#ref} { () } | |
| 382 | LL + reuse to_reuse::{value, mut_re{ () } | |
| 383 | | | |
| 384 | ||
| 385 | error[E0308]: mismatched types | |
| 386 | --> $DIR/unused-target-expr-in-glob-or-list.rs:154:29 | |
| 387 | | | |
| 388 | LL | reuse to_reuse::{value, mut_ref, r#ref} { () } | |
| 389 | | ^^^^^^^ expected `()`, found `i32` | |
| 390 | | | |
| 391 | help: consider using a semicolon here | |
| 392 | | | |
| 393 | LL | reuse to_reuse::{value, mut_ref;, r#ref} { () } | |
| 394 | | + | |
| 395 | help: try adding a return type | |
| 396 | | | |
| 397 | LL - reuse to_reuse::{value, mut_ref, r#ref} { () } | |
| 398 | LL + reuse to_reuse::{value, -> i32, r#ref} { () } | |
| 399 | | | |
| 400 | ||
| 401 | error[E0061]: this function takes 0 arguments but 1 argument was supplied | |
| 402 | --> $DIR/unused-target-expr-in-glob-or-list.rs:154:38 | |
| 403 | | | |
| 404 | LL | reuse to_reuse::{value, mut_ref, r#ref} { () } | |
| 405 | | ^^^^^ ------ unexpected argument of type `()` | |
| 406 | | | |
| 407 | note: function defined here | |
| 408 | --> $DIR/unused-target-expr-in-glob-or-list.rs:151:16 | |
| 409 | | | |
| 410 | LL | pub fn r#ref() -> i32 { 3 } | |
| 411 | | ^^^^^ | |
| 412 | help: remove the extra argument | |
| 413 | | | |
| 414 | LL - reuse to_reuse::{value, mut_ref, r#ref} { () } | |
| 415 | LL + reuse to_reuse::{value, mut_ref, r#re{ () } | |
| 416 | | | |
| 417 | ||
| 418 | error[E0308]: mismatched types | |
| 419 | --> $DIR/unused-target-expr-in-glob-or-list.rs:154:38 | |
| 420 | | | |
| 421 | LL | reuse to_reuse::{value, mut_ref, r#ref} { () } | |
| 422 | | ^^^^^ expected `()`, found `i32` | |
| 423 | | | |
| 424 | help: consider using a semicolon here | |
| 425 | | | |
| 426 | LL | reuse to_reuse::{value, mut_ref, r#ref;} { () } | |
| 427 | | + | |
| 428 | help: try adding a return type | |
| 429 | | | |
| 430 | LL - reuse to_reuse::{value, mut_ref, r#ref} { () } | |
| 431 | LL + reuse to_reuse::{value, mut_ref, -> i32} { () } | |
| 432 | | | |
| 433 | ||
| 434 | error[E0061]: this function takes 0 arguments but 1 argument was supplied | |
| 435 | --> $DIR/unused-target-expr-in-glob-or-list.rs:165:22 | |
| 436 | | | |
| 437 | LL | reuse to_reuse::{value as value2} { } | |
| 438 | | ^^^^^ --- unexpected argument of type `()` | |
| 439 | | | |
| 440 | note: function defined here | |
| 441 | --> $DIR/unused-target-expr-in-glob-or-list.rs:149:16 | |
| 442 | | | |
| 443 | LL | pub fn value() -> i32 { 1 } | |
| 444 | | ^^^^^ | |
| 445 | help: remove the extra argument | |
| 446 | | | |
| 447 | LL - reuse to_reuse::{value as value2} { } | |
| 448 | LL + reuse to_reuse::{valu{ } | |
| 449 | | | |
| 450 | ||
| 451 | error[E0308]: mismatched types | |
| 452 | --> $DIR/unused-target-expr-in-glob-or-list.rs:165:22 | |
| 453 | | | |
| 454 | LL | reuse to_reuse::{value as value2} { } | |
| 455 | | ^^^^^ expected `()`, found `i32` | |
| 456 | | | |
| 457 | help: consider using a semicolon here | |
| 458 | | | |
| 459 | LL | reuse to_reuse::{value; as value2} { } | |
| 460 | | + | |
| 461 | help: try adding a return type | |
| 462 | | | |
| 463 | LL - reuse to_reuse::{value as value2} { } | |
| 464 | LL + reuse to_reuse::{ -> i32 as value2} { } | |
| 465 | | | |
| 466 | ||
| 467 | error[E0061]: this function takes 0 arguments but 1 argument was supplied | |
| 468 | --> $DIR/unused-target-expr-in-glob-or-list.rs:195:26 | |
| 469 | | | |
| 470 | LL | reuse to_reuse::{value, mut_ref, r#ref} { 1 + 1 } | |
| 471 | | ^^^^^ --------- unexpected argument of type `{integer}` | |
| 472 | | | |
| 473 | note: function defined here | |
| 474 | --> $DIR/unused-target-expr-in-glob-or-list.rs:179:16 | |
| 475 | | | |
| 476 | LL | pub fn value() -> i32 { 1 } | |
| 477 | | ^^^^^ | |
| 478 | help: remove the extra argument | |
| 479 | | | |
| 480 | LL - reuse to_reuse::{value, mut_ref, r#ref} { 1 + 1 } | |
| 481 | LL + reuse to_reuse::{valu{ 1 + 1 } | |
| 482 | | | |
| 483 | ||
| 484 | error[E0308]: mismatched types | |
| 485 | --> $DIR/unused-target-expr-in-glob-or-list.rs:195:26 | |
| 486 | | | |
| 487 | LL | reuse to_reuse::{value, mut_ref, r#ref} { 1 + 1 } | |
| 488 | | ^^^^^ expected `()`, found `i32` | |
| 489 | | | |
| 490 | help: consider using a semicolon here | |
| 491 | | | |
| 492 | LL | reuse to_reuse::{value;, mut_ref, r#ref} { 1 + 1 } | |
| 493 | | + | |
| 494 | help: try adding a return type | |
| 495 | | | |
| 496 | LL - reuse to_reuse::{value, mut_ref, r#ref} { 1 + 1 } | |
| 497 | LL + reuse to_reuse::{ -> i32, mut_ref, r#ref} { 1 + 1 } | |
| 498 | | | |
| 499 | ||
| 500 | error[E0061]: this function takes 0 arguments but 1 argument was supplied | |
| 501 | --> $DIR/unused-target-expr-in-glob-or-list.rs:195:33 | |
| 502 | | | |
| 503 | LL | reuse to_reuse::{value, mut_ref, r#ref} { 1 + 1 } | |
| 504 | | ^^^^^^^ --------- unexpected argument of type `{integer}` | |
| 505 | | | |
| 506 | note: function defined here | |
| 507 | --> $DIR/unused-target-expr-in-glob-or-list.rs:180:16 | |
| 508 | | | |
| 509 | LL | pub fn mut_ref() -> i32 { 2 } | |
| 510 | | ^^^^^^^ | |
| 511 | help: remove the extra argument | |
| 512 | | | |
| 513 | LL - reuse to_reuse::{value, mut_ref, r#ref} { 1 + 1 } | |
| 514 | LL + reuse to_reuse::{value, mut_re{ 1 + 1 } | |
| 515 | | | |
| 516 | ||
| 517 | error[E0308]: mismatched types | |
| 518 | --> $DIR/unused-target-expr-in-glob-or-list.rs:195:33 | |
| 519 | | | |
| 520 | LL | reuse to_reuse::{value, mut_ref, r#ref} { 1 + 1 } | |
| 521 | | ^^^^^^^ expected `()`, found `i32` | |
| 522 | | | |
| 523 | help: consider using a semicolon here | |
| 524 | | | |
| 525 | LL | reuse to_reuse::{value, mut_ref;, r#ref} { 1 + 1 } | |
| 526 | | + | |
| 527 | help: try adding a return type | |
| 528 | | | |
| 529 | LL - reuse to_reuse::{value, mut_ref, r#ref} { 1 + 1 } | |
| 530 | LL + reuse to_reuse::{value, -> i32, r#ref} { 1 + 1 } | |
| 531 | | | |
| 532 | ||
| 533 | error[E0061]: this function takes 0 arguments but 1 argument was supplied | |
| 534 | --> $DIR/unused-target-expr-in-glob-or-list.rs:195:42 | |
| 535 | | | |
| 536 | LL | reuse to_reuse::{value, mut_ref, r#ref} { 1 + 1 } | |
| 537 | | ^^^^^ --------- unexpected argument of type `{integer}` | |
| 538 | | | |
| 539 | note: function defined here | |
| 540 | --> $DIR/unused-target-expr-in-glob-or-list.rs:181:16 | |
| 541 | | | |
| 542 | LL | pub fn r#ref() -> i32 { 3 } | |
| 543 | | ^^^^^ | |
| 544 | help: remove the extra argument | |
| 545 | | | |
| 546 | LL - reuse to_reuse::{value, mut_ref, r#ref} { 1 + 1 } | |
| 547 | LL + reuse to_reuse::{value, mut_ref, r#re{ 1 + 1 } | |
| 548 | | | |
| 549 | ||
| 550 | error[E0308]: mismatched types | |
| 551 | --> $DIR/unused-target-expr-in-glob-or-list.rs:195:42 | |
| 552 | | | |
| 553 | LL | reuse to_reuse::{value, mut_ref, r#ref} { 1 + 1 } | |
| 554 | | ^^^^^ expected `()`, found `i32` | |
| 555 | | | |
| 556 | help: consider using a semicolon here | |
| 557 | | | |
| 558 | LL | reuse to_reuse::{value, mut_ref, r#ref;} { 1 + 1 } | |
| 559 | | + | |
| 560 | help: try adding a return type | |
| 561 | | | |
| 562 | LL - reuse to_reuse::{value, mut_ref, r#ref} { 1 + 1 } | |
| 563 | LL + reuse to_reuse::{value, mut_ref, -> i32} { 1 + 1 } | |
| 564 | | | |
| 565 | ||
| 566 | error: aborting due to 50 previous errors | |
| 567 | ||
| 568 | Some errors have detailed explanations: E0053, E0061, E0308, E0433, E0609. | |
| 569 | For more information about an error, try `rustc --explain E0053`. |
tests/ui/dep-graph/dep-graph-assoc-type-codegen.rs+1-1| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | // Test that when a trait impl changes, fns whose body uses that trait |
| 2 | 2 | // must also be recompiled. |
| 3 | //@ ignore-parallel-frontend dep graph | |
| 3 | ||
| 4 | 4 | //@ incremental |
| 5 | 5 | //@ compile-flags: -Z query-dep-graph |
| 6 | 6 |
tests/ui/dep-graph/dep-graph-caller-callee.rs+1-1| ... | ... | @@ -3,7 +3,7 @@ |
| 3 | 3 | |
| 4 | 4 | //@ incremental |
| 5 | 5 | //@ compile-flags: -Z query-dep-graph |
| 6 | //@ ignore-parallel-frontend dep graph | |
| 6 | ||
| 7 | 7 | #![feature(rustc_attrs)] |
| 8 | 8 | #![allow(dead_code)] |
| 9 | 9 |
tests/ui/dep-graph/dep-graph-struct-signature.rs+1-1| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | // Test cases where a changing struct appears in the signature of fns |
| 2 | 2 | // and methods. |
| 3 | //@ ignore-parallel-frontend dep graph | |
| 3 | ||
| 4 | 4 | //@ incremental |
| 5 | 5 | //@ compile-flags: -Z query-dep-graph |
| 6 | 6 |
tests/ui/dep-graph/dep-graph-trait-impl-two-traits-same-method.rs+1-1| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | // Test that adding an impl to a trait `Foo` DOES affect functions |
| 2 | 2 | // that only use `Bar` if they have methods in common. |
| 3 | //@ ignore-parallel-frontend dep graph | |
| 3 | ||
| 4 | 4 | //@ incremental |
| 5 | 5 | //@ compile-flags: -Z query-dep-graph |
| 6 | 6 |
tests/ui/dep-graph/dep-graph-trait-impl.rs+1-1| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | // Test that when a trait impl changes, fns whose body uses that trait |
| 2 | 2 | // must also be recompiled. |
| 3 | //@ ignore-parallel-frontend dep graph | |
| 3 | ||
| 4 | 4 | //@ incremental |
| 5 | 5 | //@ compile-flags: -Z query-dep-graph |
| 6 | 6 |
tests/ui/dep-graph/dep-graph-type-alias.rs+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | // Test that changing what a `type` points to does not go unnoticed. |
| 2 | //@ ignore-parallel-frontend dep graph | |
| 2 | ||
| 3 | 3 | //@ incremental |
| 4 | 4 | //@ compile-flags: -Z query-dep-graph |
| 5 | 5 |
tests/ui/dep-graph/dep-graph-variance-alias.rs+1-1| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | // Test that changing what a `type` points to does not go unnoticed |
| 2 | 2 | // by the variance analysis. |
| 3 | //@ ignore-parallel-frontend dep graph | |
| 3 | ||
| 4 | 4 | //@ incremental |
| 5 | 5 | //@ compile-flags: -Z query-dep-graph |
| 6 | 6 |
tests/ui/destructuring-assignment/dont-suggest-wrong-expect-suggestion.rs created+19| ... | ... | @@ -0,0 +1,19 @@ |
| 1 | //! regression test for <https://github.com/rust-lang/rust/issues/155516> | |
| 2 | ||
| 3 | struct NamedStruct { | |
| 4 | opt_field: Option<usize>, | |
| 5 | res_field: Result<usize, ()>, | |
| 6 | } | |
| 7 | ||
| 8 | fn main() { | |
| 9 | let a: usize; | |
| 10 | let b: usize; | |
| 11 | ||
| 12 | NamedStruct { | |
| 13 | opt_field: a, //~ ERROR mismatched types | |
| 14 | res_field: b, //~ ERROR mismatched types | |
| 15 | } = NamedStruct { | |
| 16 | opt_field: Some(0), | |
| 17 | res_field: Ok(42_usize), | |
| 18 | }; | |
| 19 | } |
tests/ui/destructuring-assignment/dont-suggest-wrong-expect-suggestion.stderr created+27| ... | ... | @@ -0,0 +1,27 @@ |
| 1 | error[E0308]: mismatched types | |
| 2 | --> $DIR/dont-suggest-wrong-expect-suggestion.rs:13:20 | |
| 3 | | | |
| 4 | LL | let a: usize; | |
| 5 | | ----- expected due to this type | |
| 6 | ... | |
| 7 | LL | opt_field: a, | |
| 8 | | ^ expected `usize`, found `Option<usize>` | |
| 9 | | | |
| 10 | = note: expected type `usize` | |
| 11 | found enum `Option<usize>` | |
| 12 | ||
| 13 | error[E0308]: mismatched types | |
| 14 | --> $DIR/dont-suggest-wrong-expect-suggestion.rs:14:20 | |
| 15 | | | |
| 16 | LL | let b: usize; | |
| 17 | | ----- expected due to this type | |
| 18 | ... | |
| 19 | LL | res_field: b, | |
| 20 | | ^ expected `usize`, found `Result<usize, ()>` | |
| 21 | | | |
| 22 | = note: expected type `usize` | |
| 23 | found enum `Result<usize, ()>` | |
| 24 | ||
| 25 | error: aborting due to 2 previous errors | |
| 26 | ||
| 27 | For more information about this error, try `rustc --explain E0308`. |
tests/ui/did_you_mean/sugg-stable-import-first-issue-140240.stderr+2-2| ... | ... | @@ -10,10 +10,10 @@ LL + use std::collections::btree_map::Range; |
| 10 | 10 | | |
| 11 | 11 | LL + use std::collections::btree_set::Range; |
| 12 | 12 | | |
| 13 | LL + use std::ops::Range; | |
| 14 | | | |
| 15 | 13 | LL + use std::range::Range; |
| 16 | 14 | | |
| 15 | LL + use std::range::legacy::Range; | |
| 16 | | | |
| 17 | 17 | |
| 18 | 18 | error: aborting due to 1 previous error |
| 19 | 19 |
tests/ui/eii/static/auxiliary/decl_with_default.rs created+6| ... | ... | @@ -0,0 +1,6 @@ |
| 1 | //@ no-prefer-dynamic | |
| 2 | #![crate_type = "rlib"] | |
| 3 | #![feature(extern_item_impls)] | |
| 4 | ||
| 5 | #[eii(eii1)] | |
| 6 | pub static DECL1: u64 = 5; |
tests/ui/eii/static/auxiliary/impl_default_override.rs created+9| ... | ... | @@ -0,0 +1,9 @@ |
| 1 | //@ no-prefer-dynamic | |
| 2 | //@ aux-build: decl_with_default.rs | |
| 3 | #![crate_type = "rlib"] | |
| 4 | #![feature(extern_item_impls)] | |
| 5 | ||
| 6 | extern crate decl_with_default as decl; | |
| 7 | ||
| 8 | #[decl::eii1] | |
| 9 | pub static EII1_IMPL: u64 = 10; |
tests/ui/eii/static/default.rs created+17| ... | ... | @@ -0,0 +1,17 @@ |
| 1 | //@ run-pass | |
| 2 | //@ check-run-results | |
| 3 | //@ ignore-backends: gcc | |
| 4 | // FIXME: linking on windows (specifically mingw) not yet supported, see tracking issue #125418 | |
| 5 | //@ ignore-windows | |
| 6 | // FIXME(#157649): static EII defaults currently fail to link on Apple targets. | |
| 7 | //@ ignore-apple | |
| 8 | // Tests static EIIs with default implementations. | |
| 9 | ||
| 10 | #![feature(extern_item_impls)] | |
| 11 | ||
| 12 | #[eii(eii1)] | |
| 13 | pub static DECL1: u64 = 5; | |
| 14 | ||
| 15 | fn main() { | |
| 16 | println!("{DECL1}"); | |
| 17 | } |
tests/ui/eii/static/default.run.stdout created+1| ... | ... | @@ -0,0 +1 @@ |
| 1 | 5 |
tests/ui/eii/static/default_apple.rs created+8| ... | ... | @@ -0,0 +1,8 @@ |
| 1 | //@ only-apple | |
| 2 | //@ ignore-backends: gcc | |
| 3 | ||
| 4 | #![feature(extern_item_impls)] | |
| 5 | #![crate_type = "lib"] | |
| 6 | #[eii(eii1)] | |
| 7 | pub static DECL1: u64 = 5; | |
| 8 | //~^ ERROR `#[eii]` cannot be used on statics with a value on Apple targets |
tests/ui/eii/static/default_apple.stderr created+10| ... | ... | @@ -0,0 +1,10 @@ |
| 1 | error: `#[eii]` cannot be used on statics with a value on Apple targets | |
| 2 | --> $DIR/default_apple.rs:7:25 | |
| 3 | | | |
| 4 | LL | pub static DECL1: u64 = 5; | |
| 5 | | ^ | |
| 6 | | | |
| 7 | = note: see issue #157649 <https://github.com/rust-lang/rust/issues/157649> for more information | |
| 8 | ||
| 9 | error: aborting due to 1 previous error | |
| 10 |
tests/ui/eii/static/default_cross_crate.rs created+15| ... | ... | @@ -0,0 +1,15 @@ |
| 1 | //@ aux-build: decl_with_default.rs | |
| 2 | //@ run-pass | |
| 3 | //@ check-run-results | |
| 4 | //@ ignore-backends: gcc | |
| 5 | // FIXME: linking on windows (specifically mingw) not yet supported, see tracking issue #125418 | |
| 6 | //@ ignore-windows | |
| 7 | // FIXME(#157649): static EII defaults currently fail to link on Apple targets. | |
| 8 | //@ ignore-apple | |
| 9 | // Tests that a static EII default can be used from another crate. | |
| 10 | ||
| 11 | extern crate decl_with_default; | |
| 12 | ||
| 13 | fn main() { | |
| 14 | println!("{}", decl_with_default::DECL1); | |
| 15 | } |
tests/ui/eii/static/default_cross_crate.run.stdout created+1| ... | ... | @@ -0,0 +1 @@ |
| 1 | 5 |
tests/ui/eii/static/default_cross_crate_explicit.rs created+17| ... | ... | @@ -0,0 +1,17 @@ |
| 1 | //@ aux-build: decl_with_default.rs | |
| 2 | //@ aux-build: impl_default_override.rs | |
| 3 | //@ run-pass | |
| 4 | //@ check-run-results | |
| 5 | //@ ignore-backends: gcc | |
| 6 | // FIXME: linking on windows (specifically mingw) not yet supported, see tracking issue #125418 | |
| 7 | //@ ignore-windows | |
| 8 | // FIXME(#157649): static EII defaults currently fail to link on Apple targets. | |
| 9 | //@ ignore-apple | |
| 10 | // Tests that an explicit static EII implementation overrides a cross-crate default. | |
| 11 | ||
| 12 | extern crate decl_with_default; | |
| 13 | extern crate impl_default_override; | |
| 14 | ||
| 15 | fn main() { | |
| 16 | println!("{}", decl_with_default::DECL1); | |
| 17 | } |
tests/ui/eii/static/default_cross_crate_explicit.run.stdout created+1| ... | ... | @@ -0,0 +1 @@ |
| 1 | 10 |
tests/ui/eii/static/default_explicit.rs created+21| ... | ... | @@ -0,0 +1,21 @@ |
| 1 | //@ run-pass | |
| 2 | //@ check-run-results | |
| 3 | //@ ignore-backends: gcc | |
| 4 | // FIXME: linking on windows (specifically mingw) not yet supported, see tracking issue #125418 | |
| 5 | //@ ignore-windows | |
| 6 | // FIXME(#157649): static EII defaults currently fail to link on Apple targets. | |
| 7 | //@ ignore-apple | |
| 8 | // Tests that an explicit static EII implementation overrides a local default. | |
| 9 | ||
| 10 | #![feature(extern_item_impls)] | |
| 11 | #![allow(dead_code)] | |
| 12 | ||
| 13 | #[eii(eii1)] | |
| 14 | pub static DECL1: u64 = 5; | |
| 15 | ||
| 16 | #[eii1] | |
| 17 | pub static EII1_IMPL: u64 = 10; | |
| 18 | ||
| 19 | fn main() { | |
| 20 | println!("{DECL1}"); | |
| 21 | } |
tests/ui/eii/static/default_explicit.run.stdout created+1| ... | ... | @@ -0,0 +1 @@ |
| 1 | 10 |
tests/ui/error-emitter/multiline-removal-suggestion.rs-1| ... | ... | @@ -56,4 +56,3 @@ fn bay() -> Vec<(bool, HashSet<u8>)> { |
| 56 | 56 | 		.collect() |
| 57 | 57 | } |
| 58 | 58 | fn main() {} |
| 59 | //@ ignore-parallel-frontend invalid svg(multiple threads trying to write to the same file) |
tests/ui/imports/auxiliary/dummy-import-ice-macro.rs created+15| ... | ... | @@ -0,0 +1,15 @@ |
| 1 | extern crate proc_macro; | |
| 2 | use proc_macro::TokenStream; | |
| 3 | ||
| 4 | #[proc_macro] | |
| 5 | pub fn my_macro(_: proc_macro::TokenStream) -> proc_macro::TokenStream { | |
| 6 | r" | |
| 7 | use own::*; | |
| 8 | mod own { | |
| 9 | pub use super::submodule::*; | |
| 10 | pub use super::ambiguous; | |
| 11 | } | |
| 12 | " | |
| 13 | .parse() | |
| 14 | .unwrap() | |
| 15 | } |
tests/ui/imports/dummy-import-ice.rs created+20| ... | ... | @@ -0,0 +1,20 @@ |
| 1 | // Regression test for issue #157406. | |
| 2 | ||
| 3 | //@ check-pass | |
| 4 | //@ proc-macro: dummy-import-ice-macro.rs | |
| 5 | ||
| 6 | extern crate dummy_import_ice_macro; | |
| 7 | ||
| 8 | pub fn foo() { | |
| 9 | ambiguous(); | |
| 10 | } | |
| 11 | ||
| 12 | mod submodule { | |
| 13 | pub fn ambiguous() {} | |
| 14 | } | |
| 15 | ||
| 16 | pub mod ambiguous {} | |
| 17 | ||
| 18 | dummy_import_ice_macro::my_macro!(); | |
| 19 | ||
| 20 | fn main() {} |
tests/ui/imports/issue-56125.rs+1-1| ... | ... | @@ -15,7 +15,7 @@ mod m2 { |
| 15 | 15 | mod m3 { |
| 16 | 16 | mod empty {} |
| 17 | 17 | use empty::issue_56125; //~ ERROR unresolved import `empty::issue_56125` |
| 18 | use issue_56125::*; | |
| 18 | use issue_56125::*; //~ ERROR `issue_56125` is ambiguous | |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | fn main() {} |
tests/ui/imports/issue-56125.stderr+18-1| ... | ... | @@ -56,7 +56,24 @@ LL | use issue_56125::non_last_segment::non_last_segment::*; |
| 56 | 56 | = help: consider adding an explicit import of `issue_56125` to disambiguate |
| 57 | 57 | = help: or use `self::issue_56125` to refer to this module unambiguously |
| 58 | 58 | |
| 59 | error: aborting due to 3 previous errors | |
| 59 | error[E0659]: `issue_56125` is ambiguous | |
| 60 | --> $DIR/issue-56125.rs:18:9 | |
| 61 | | | |
| 62 | LL | use issue_56125::*; | |
| 63 | | ^^^^^^^^^^^ ambiguous name | |
| 64 | | | |
| 65 | = note: ambiguous because of a conflict between a name from a glob import and an outer scope during import or macro resolution | |
| 66 | = note: `issue_56125` could refer to a crate passed with `--extern` | |
| 67 | = help: use `::issue_56125` to refer to this crate unambiguously | |
| 68 | note: `issue_56125` could also refer to the module imported here | |
| 69 | --> $DIR/issue-56125.rs:18:9 | |
| 70 | | | |
| 71 | LL | use issue_56125::*; | |
| 72 | | ^^^^^^^^^^^^^^ | |
| 73 | = help: consider adding an explicit import of `issue_56125` to disambiguate | |
| 74 | = help: or use `self::issue_56125` to refer to this module unambiguously | |
| 75 | ||
| 76 | error: aborting due to 4 previous errors | |
| 60 | 77 | |
| 61 | 78 | Some errors have detailed explanations: E0432, E0659. |
| 62 | 79 | For more information about an error, try `rustc --explain E0432`. |
tests/ui/imports/shadow-glob-module-resolution-2.rs+2| ... | ... | @@ -14,5 +14,7 @@ use a::*; |
| 14 | 14 | use e as b; |
| 15 | 15 | //~^ ERROR: unresolved import `e` |
| 16 | 16 | use b::c::D as e; |
| 17 | //~^ ERROR: cannot determine resolution for the import | |
| 18 | //~| ERROR: cannot determine resolution for the import | |
| 17 | 19 | |
| 18 | 20 | fn main() { } |
tests/ui/imports/shadow-glob-module-resolution-2.stderr+15-1| ... | ... | @@ -1,3 +1,17 @@ |
| 1 | error: cannot determine resolution for the import | |
| 2 | --> $DIR/shadow-glob-module-resolution-2.rs:16:5 | |
| 3 | | | |
| 4 | LL | use b::c::D as e; | |
| 5 | | ^^^^^^^^^^^^ | |
| 6 | ||
| 7 | error: cannot determine resolution for the import | |
| 8 | --> $DIR/shadow-glob-module-resolution-2.rs:16:5 | |
| 9 | | | |
| 10 | LL | use b::c::D as e; | |
| 11 | | ^^^^^^^^^^^^ | |
| 12 | | | |
| 13 | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` | |
| 14 | ||
| 1 | 15 | error[E0432]: unresolved import `e` |
| 2 | 16 | --> $DIR/shadow-glob-module-resolution-2.rs:14:5 |
| 3 | 17 | | |
| ... | ... | @@ -12,6 +26,6 @@ LL - use e as b; |
| 12 | 26 | LL + use a as b; |
| 13 | 27 | | |
| 14 | 28 | |
| 15 | error: aborting due to 1 previous error | |
| 29 | error: aborting due to 3 previous errors | |
| 16 | 30 | |
| 17 | 31 | For more information about this error, try `rustc --explain E0432`. |
tests/ui/imports/shadow-glob-module-resolution-4.rs+2| ... | ... | @@ -12,6 +12,8 @@ use e as b; |
| 12 | 12 | |
| 13 | 13 | use b::C as e; |
| 14 | 14 | //~^ ERROR: unresolved import `b::C` |
| 15 | //~| ERROR: cannot determine resolution for the import | |
| 16 | //~| ERROR: cannot determine resolution for the import | |
| 15 | 17 | |
| 16 | 18 | fn e() {} |
| 17 | 19 |
tests/ui/imports/shadow-glob-module-resolution-4.stderr+15-1| ... | ... | @@ -1,9 +1,23 @@ |
| 1 | error: cannot determine resolution for the import | |
| 2 | --> $DIR/shadow-glob-module-resolution-4.rs:13:5 | |
| 3 | | | |
| 4 | LL | use b::C as e; | |
| 5 | | ^^^^^^^^^ | |
| 6 | ||
| 7 | error: cannot determine resolution for the import | |
| 8 | --> $DIR/shadow-glob-module-resolution-4.rs:13:5 | |
| 9 | | | |
| 10 | LL | use b::C as e; | |
| 11 | | ^^^^^^^^^ | |
| 12 | | | |
| 13 | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` | |
| 14 | ||
| 1 | 15 | error[E0432]: unresolved import `b::C` |
| 2 | 16 | --> $DIR/shadow-glob-module-resolution-4.rs:13:5 |
| 3 | 17 | | |
| 4 | 18 | LL | use b::C as e; |
| 5 | 19 | | ^^^^^^^^^ |
| 6 | 20 | |
| 7 | error: aborting due to 1 previous error | |
| 21 | error: aborting due to 3 previous errors | |
| 8 | 22 | |
| 9 | 23 | For more information about this error, try `rustc --explain E0432`. |
tests/ui/inline-const/required-const.rs+1-1| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | //@ build-fail |
| 2 | 2 | //@ compile-flags: -Zmir-opt-level=3 |
| 3 | //@ ignore-parallel-frontend post-monomorphization errors | |
| 3 | ||
| 4 | 4 | fn foo<T>() { |
| 5 | 5 | if false { |
| 6 | 6 | const { panic!() } //~ ERROR E0080 |
tests/ui/lazy-type-alias/def-site-body-wf.rs created+19| ... | ... | @@ -0,0 +1,19 @@ |
| 1 | // Test that we check the body at the definition site for well-formedness. | |
| 2 | // Compare with `tests/ui/type-alias/lack-of-wfcheck.rs`. | |
| 3 | ||
| 4 | #![feature(lazy_type_alias)] | |
| 5 | ||
| 6 | // unsatisified trait bounds | |
| 7 | type _A<T> = <T as std::ops::Mul>::Output; //~ ERROR cannot multiply `T` by `T` | |
| 8 | type _B = Vec<str>; //~ ERROR the size for values of type `str` cannot be known at compilation time | |
| 9 | ||
| 10 | // unsatisfied outlives-bounds | |
| 11 | type _C<'a> = &'static &'a (); //~ ERROR reference has a longer lifetime than the data it references | |
| 12 | ||
| 13 | // diverging const exprs | |
| 14 | type _D = [(); panic!()]; //~ ERROR evaluation panicked | |
| 15 | ||
| 16 | // dyn incompatibility | |
| 17 | type _E = dyn Sized; //~ ERROR the trait `Sized` is not dyn compatible | |
| 18 | ||
| 19 | fn main() {} |
tests/ui/lazy-type-alias/def-site-body-wf.stderr created+54| ... | ... | @@ -0,0 +1,54 @@ |
| 1 | error[E0277]: cannot multiply `T` by `T` | |
| 2 | --> $DIR/def-site-body-wf.rs:7:14 | |
| 3 | | | |
| 4 | LL | type _A<T> = <T as std::ops::Mul>::Output; | |
| 5 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `T * T` | |
| 6 | | | |
| 7 | help: consider restricting type parameter `T` with trait `Mul` | |
| 8 | | | |
| 9 | LL | type _A<T: std::ops::Mul> = <T as std::ops::Mul>::Output; | |
| 10 | | +++++++++++++++ | |
| 11 | ||
| 12 | error[E0277]: the size for values of type `str` cannot be known at compilation time | |
| 13 | --> $DIR/def-site-body-wf.rs:8:11 | |
| 14 | | | |
| 15 | LL | type _B = Vec<str>; | |
| 16 | | ^^^^^^^^ doesn't have a size known at compile-time | |
| 17 | | | |
| 18 | = help: the trait `Sized` is not implemented for `str` | |
| 19 | note: required by an implicit `Sized` bound in `Vec` | |
| 20 | --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL | |
| 21 | ||
| 22 | error[E0491]: in type `&'static &'a ()`, reference has a longer lifetime than the data it references | |
| 23 | --> $DIR/def-site-body-wf.rs:11:1 | |
| 24 | | | |
| 25 | LL | type _C<'a> = &'static &'a (); | |
| 26 | | ^^^^^^^^^^^ | |
| 27 | | | |
| 28 | = note: the pointer is valid for the static lifetime | |
| 29 | note: but the referenced data is only valid for the lifetime `'a` as defined here | |
| 30 | --> $DIR/def-site-body-wf.rs:11:9 | |
| 31 | | | |
| 32 | LL | type _C<'a> = &'static &'a (); | |
| 33 | | ^^ | |
| 34 | ||
| 35 | error[E0080]: evaluation panicked: explicit panic | |
| 36 | --> $DIR/def-site-body-wf.rs:14:16 | |
| 37 | | | |
| 38 | LL | type _D = [(); panic!()]; | |
| 39 | | ^^^^^^^^ evaluation of `_D::{constant#0}` failed here | |
| 40 | ||
| 41 | error[E0038]: the trait `Sized` is not dyn compatible | |
| 42 | --> $DIR/def-site-body-wf.rs:17:11 | |
| 43 | | | |
| 44 | LL | type _E = dyn Sized; | |
| 45 | | ^^^^^^^^^ `Sized` is not dyn compatible | |
| 46 | | | |
| 47 | = note: the trait is not dyn compatible because it requires `Self: Sized` | |
| 48 | = note: for a trait to be dyn compatible it needs to allow building a vtable | |
| 49 | for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> | |
| 50 | ||
| 51 | error: aborting due to 5 previous errors | |
| 52 | ||
| 53 | Some errors have detailed explanations: E0038, E0080, E0277, E0491. | |
| 54 | For more information about an error, try `rustc --explain E0038`. |
tests/ui/lazy-type-alias/inherent-impls-overflow.current.stderr+2-2| ... | ... | @@ -23,7 +23,7 @@ LL | type Poly0<T> = Poly1<(T,)>; |
| 23 | 23 | = note: in case this is a recursive type alias, consider using a struct, enum, or union instead |
| 24 | 24 | |
| 25 | 25 | error[E0275]: overflow normalizing the type alias `Poly1<(((((((...,),),),),),),)>` |
| 26 | --> $DIR/inherent-impls-overflow.rs:21:1 | |
| 26 | --> $DIR/inherent-impls-overflow.rs:20:1 | |
| 27 | 27 | | |
| 28 | 28 | LL | type Poly1<T> = Poly0<(T,)>; |
| 29 | 29 | | ^^^^^^^^^^^^^ |
| ... | ... | @@ -31,7 +31,7 @@ LL | type Poly1<T> = Poly0<(T,)>; |
| 31 | 31 | = note: in case this is a recursive type alias, consider using a struct, enum, or union instead |
| 32 | 32 | |
| 33 | 33 | error[E0275]: overflow normalizing the type alias `Poly1<(((((((...,),),),),),),)>` |
| 34 | --> $DIR/inherent-impls-overflow.rs:26:1 | |
| 34 | --> $DIR/inherent-impls-overflow.rs:24:1 | |
| 35 | 35 | | |
| 36 | 36 | LL | impl Poly0<()> {} |
| 37 | 37 | | ^^^^^^^^^^^^^^^^^ |
tests/ui/lazy-type-alias/inherent-impls-overflow.next.stderr+4-26| ... | ... | @@ -24,38 +24,16 @@ LL | type Poly0<T> = Poly1<(T,)>; |
| 24 | 24 | | |
| 25 | 25 | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`inherent_impls_overflow`) |
| 26 | 26 | |
| 27 | error: type parameter `T` is only used recursively | |
| 28 | --> $DIR/inherent-impls-overflow.rs:17:24 | |
| 29 | | | |
| 30 | LL | type Poly0<T> = Poly1<(T,)>; | |
| 31 | | - ^ | |
| 32 | | | | |
| 33 | | type parameter must be used non-recursively in the definition | |
| 34 | | | |
| 35 | = help: consider removing `T` or referring to it in the body of the type alias | |
| 36 | = note: all type parameters must be used in a non-recursive way in order to constrain their variance | |
| 37 | ||
| 38 | 27 | error[E0275]: overflow evaluating the requirement `Poly0<(T,)> == _` |
| 39 | --> $DIR/inherent-impls-overflow.rs:21:1 | |
| 28 | --> $DIR/inherent-impls-overflow.rs:20:1 | |
| 40 | 29 | | |
| 41 | 30 | LL | type Poly1<T> = Poly0<(T,)>; |
| 42 | 31 | | ^^^^^^^^^^^^^ |
| 43 | 32 | | |
| 44 | 33 | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`inherent_impls_overflow`) |
| 45 | 34 | |
| 46 | error: type parameter `T` is only used recursively | |
| 47 | --> $DIR/inherent-impls-overflow.rs:21:24 | |
| 48 | | | |
| 49 | LL | type Poly1<T> = Poly0<(T,)>; | |
| 50 | | - ^ | |
| 51 | | | | |
| 52 | | type parameter must be used non-recursively in the definition | |
| 53 | | | |
| 54 | = help: consider removing `T` or referring to it in the body of the type alias | |
| 55 | = note: all type parameters must be used in a non-recursive way in order to constrain their variance | |
| 56 | ||
| 57 | 35 | error[E0275]: overflow evaluating the requirement `Poly0<()> == _` |
| 58 | --> $DIR/inherent-impls-overflow.rs:26:1 | |
| 36 | --> $DIR/inherent-impls-overflow.rs:24:1 | |
| 59 | 37 | | |
| 60 | 38 | LL | impl Poly0<()> {} |
| 61 | 39 | | ^^^^^^^^^^^^^^^^^ |
| ... | ... | @@ -63,14 +41,14 @@ LL | impl Poly0<()> {} |
| 63 | 41 | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`inherent_impls_overflow`) |
| 64 | 42 | |
| 65 | 43 | error[E0275]: overflow evaluating the requirement `Poly0<()> == _` |
| 66 | --> $DIR/inherent-impls-overflow.rs:26:6 | |
| 44 | --> $DIR/inherent-impls-overflow.rs:24:6 | |
| 67 | 45 | | |
| 68 | 46 | LL | impl Poly0<()> {} |
| 69 | 47 | | ^^^^^^^^^ |
| 70 | 48 | | |
| 71 | 49 | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`inherent_impls_overflow`) |
| 72 | 50 | |
| 73 | error: aborting due to 9 previous errors | |
| 51 | error: aborting due to 7 previous errors | |
| 74 | 52 | |
| 75 | 53 | Some errors have detailed explanations: E0271, E0275. |
| 76 | 54 | For more information about an error, try `rustc --explain E0271`. |
tests/ui/lazy-type-alias/inherent-impls-overflow.rs+2-4| ... | ... | @@ -16,12 +16,10 @@ impl Loop {} |
| 16 | 16 | |
| 17 | 17 | type Poly0<T> = Poly1<(T,)>; |
| 18 | 18 | //[current]~^ ERROR overflow normalizing the type alias `Poly0<(((((((...,),),),),),),)>` |
| 19 | //[next]~^^ ERROR type parameter `T` is only used recursively | |
| 20 | //[next]~| ERROR overflow evaluating the requirement | |
| 19 | //[next]~^^ ERROR overflow evaluating the requirement | |
| 21 | 20 | type Poly1<T> = Poly0<(T,)>; |
| 22 | 21 | //[current]~^ ERROR overflow normalizing the type alias `Poly1<(((((((...,),),),),),),)>` |
| 23 | //[next]~^^ ERROR type parameter `T` is only used recursively | |
| 24 | //[next]~| ERROR overflow evaluating the requirement | |
| 22 | //[next]~^^ ERROR overflow evaluating the requirement | |
| 25 | 23 | |
| 26 | 24 | impl Poly0<()> {} |
| 27 | 25 | //[current]~^ ERROR overflow normalizing the type alias `Poly1<(((((((...,),),),),),),)>` |
tests/ui/lazy-type-alias/unsatisfied-bounds-type-alias-body.rs deleted-8| ... | ... | @@ -1,8 +0,0 @@ |
| 1 | // Test that we check lazy type aliases for well-formedness. | |
| 2 | ||
| 3 | #![feature(lazy_type_alias)] | |
| 4 | #![allow(incomplete_features)] | |
| 5 | ||
| 6 | type Alias<T> = <T as std::ops::Mul>::Output; //~ ERROR cannot multiply `T` by `T` | |
| 7 | ||
| 8 | fn main() {} |
tests/ui/lazy-type-alias/unsatisfied-bounds-type-alias-body.stderr deleted-14| ... | ... | @@ -1,14 +0,0 @@ |
| 1 | error[E0277]: cannot multiply `T` by `T` | |
| 2 | --> $DIR/unsatisfied-bounds-type-alias-body.rs:6:17 | |
| 3 | | | |
| 4 | LL | type Alias<T> = <T as std::ops::Mul>::Output; | |
| 5 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `T * T` | |
| 6 | | | |
| 7 | help: consider restricting type parameter `T` with trait `Mul` | |
| 8 | | | |
| 9 | LL | type Alias<T: std::ops::Mul> = <T as std::ops::Mul>::Output; | |
| 10 | | +++++++++++++++ | |
| 11 | ||
| 12 | error: aborting due to 1 previous error | |
| 13 | ||
| 14 | For more information about this error, try `rustc --explain E0277`. |
tests/ui/lazy-type-alias/unused-generic-arguments-not-wfchecked.next-fixed.stderr created+9| ... | ... | @@ -0,0 +1,9 @@ |
| 1 | error[E0080]: evaluation panicked: explicit panic | |
| 2 | --> $DIR/unused-generic-arguments-not-wfchecked.rs:28:43 | |
| 3 | | | |
| 4 | LL | #[cfg(not(next_bugged))] type A2 = A<[(); panic!()]>; // FIXME: `panic!()` diverging | |
| 5 | | ^^^^^^^^ evaluation of `A2::{constant#0}` failed here | |
| 6 | ||
| 7 | error: aborting due to 1 previous error | |
| 8 | ||
| 9 | For more information about this error, try `rustc --explain E0080`. |
tests/ui/lazy-type-alias/unused-generic-arguments-not-wfchecked.rs created+33| ... | ... | @@ -0,0 +1,33 @@ |
| 1 | // We currently fail to wfcheck generic arguments that correspond to unused LTA generic parameters | |
| 2 | // since we generally normalize types before wfchecking them, so we accidentally "expand them away" | |
| 3 | // before we can check them. | |
| 4 | // | |
| 5 | // (We do still check predicates that reference unused parameters, of course.) | |
| 6 | // | |
| 7 | // FIXME(lazy_type_alias): I consider #100041 to be a stabilization-blocking concern for the checked | |
| 8 | // version of LTA! The *entire premise* of checked_LTA is wfchecking; | |
| 9 | // we can't have such obvious holes in it! | |
| 10 | // | |
| 11 | //@ revisions: current-bugged next-bugged next-fixed | |
| 12 | // | |
| 13 | //@[next-bugged] compile-flags: -Znext-solver | |
| 14 | //@[next-fixed] compile-flags: -Znext-solver | |
| 15 | //@ ignore-compare-mode-next-solver (explicit revisions) | |
| 16 | // | |
| 17 | //@[current-bugged] known-bug: #100041 | |
| 18 | //@[current-bugged] check-pass | |
| 19 | //@[next-bugged] known-bug: #100041 | |
| 20 | //@[next-bugged] check-pass | |
| 21 | ||
| 22 | #![feature(lazy_type_alias)] | |
| 23 | ||
| 24 | type A<T: ?Sized> = (); | |
| 25 | ||
| 26 | type A0 = A<[str]>; // FIXME: `str: Sized` unsatisfied | |
| 27 | type A1<'r> = A<&'static &'r ()>; // FIXME: `'r: 'static` unsatisfied | |
| 28 | #[cfg(not(next_bugged))] type A2 = A<[(); panic!()]>; // FIXME: `panic!()` diverging | |
| 29 | //[next-fixed]~^ ERROR evaluation panicked | |
| 30 | ||
| 31 | #[cfg(not(next_bugged))] const _: A<[str]> = (); // FIXME: `str: Sized` unsatisfied | |
| 32 | ||
| 33 | fn main() {} |
tests/ui/lazy-type-alias/unused-generic-parameters.fail.stderr created+50| ... | ... | @@ -0,0 +1,50 @@ |
| 1 | error[E0478]: lifetime bound not satisfied | |
| 2 | --> $DIR/unused-generic-parameters.rs:24:22 | |
| 3 | | | |
| 4 | LL | #[cfg(fail)] fn a(_: A<'_>) {} | |
| 5 | | ^^^^^ | |
| 6 | | | |
| 7 | note: lifetime parameter instantiated with the anonymous lifetime defined here | |
| 8 | --> $DIR/unused-generic-parameters.rs:24:22 | |
| 9 | | | |
| 10 | LL | #[cfg(fail)] fn a(_: A<'_>) {} | |
| 11 | | ^^^^^ | |
| 12 | = note: but lifetime parameter must outlive the static lifetime | |
| 13 | ||
| 14 | error[E0277]: the size for values of type `str` cannot be known at compilation time | |
| 15 | --> $DIR/unused-generic-parameters.rs:28:22 | |
| 16 | | | |
| 17 | LL | #[cfg(fail)] fn b(_: B<str>) {} | |
| 18 | | ^^^^^^ doesn't have a size known at compile-time | |
| 19 | | | |
| 20 | = help: the trait `Sized` is not implemented for `str` | |
| 21 | note: required by a bound on the type alias `B` | |
| 22 | --> $DIR/unused-generic-parameters.rs:26:8 | |
| 23 | | | |
| 24 | LL | type B<T> = (); | |
| 25 | | ^ required by this bound | |
| 26 | ||
| 27 | error[E0080]: evaluation panicked: explicit panic | |
| 28 | --> $DIR/unused-generic-parameters.rs:34:26 | |
| 29 | | | |
| 30 | LL | #[cfg(fail)] fn c(_: C<{ panic!() }>) {} | |
| 31 | | ^^^^^^^^ evaluation of `c::{constant#0}` failed here | |
| 32 | ||
| 33 | error[E0277]: the size for values of type `str` cannot be known at compilation time | |
| 34 | --> $DIR/unused-generic-parameters.rs:28:22 | |
| 35 | | | |
| 36 | LL | #[cfg(fail)] fn b(_: B<str>) {} | |
| 37 | | ^^^^^^ doesn't have a size known at compile-time | |
| 38 | | | |
| 39 | = help: the trait `Sized` is not implemented for `str` | |
| 40 | note: required by a bound on the type alias `B` | |
| 41 | --> $DIR/unused-generic-parameters.rs:26:8 | |
| 42 | | | |
| 43 | LL | type B<T> = (); | |
| 44 | | ^ required by this bound | |
| 45 | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` | |
| 46 | ||
| 47 | error: aborting due to 4 previous errors | |
| 48 | ||
| 49 | Some errors have detailed explanations: E0080, E0277, E0478. | |
| 50 | For more information about an error, try `rustc --explain E0080`. |
tests/ui/lazy-type-alias/unused-generic-parameters.rs+28-14| ... | ... | @@ -1,22 +1,36 @@ |
| 1 | // Check that we reject bivariant generic parameters as unused. | |
| 2 | // Furthermore, check that we only emit a single diagnostic for unused type parameters: | |
| 3 | // Previously, we would emit *two* errors, namely E0392 and E0091. | |
| 1 | // Check that we accept unused generic parameters on lazy type aliases (for context, we reject | |
| 2 | // unused type parameters on eager type aliases). | |
| 3 | // | |
| 4 | // As long as we check well-formedness before normalization there shouldn't be anything wrong with | |
| 5 | // such parameters since we know that the corresponding arguments will get wfchecked regardless. | |
| 6 | // | |
| 7 | // FIXME(lazy_type_alias, #100041): At the time of writing however, that's not the case. I consider | |
| 8 | // this to be stabilization-blocking concern for the strong / | |
| 9 | // checked version of LTA! | |
| 10 | // See also `unused-generic-arguments-not-wfchecked.rs`. | |
| 11 | // | |
| 12 | // (We *do* ofc still detect unsatisfied predicates even if they | |
| 13 | // reference unused parameters) | |
| 14 | // | |
| 15 | // issue: <https://github.com/rust-lang/rust/issues/140230> | |
| 16 | // | |
| 17 | //@ revisions: pass fail | |
| 18 | //@[pass] check-pass | |
| 4 | 19 | |
| 5 | 20 | #![feature(lazy_type_alias)] |
| 6 | #![allow(incomplete_features)] | |
| 7 | 21 | |
| 8 | type A<'a> = (); | |
| 9 | //~^ ERROR lifetime parameter `'a` is never used | |
| 10 | //~| HELP consider removing `'a` | |
| 22 | type A<'a: 'static> = (); | |
| 23 | const _: A<'static> = (); | |
| 24 | #[cfg(fail)] fn a(_: A<'_>) {} //[fail]~ ERROR lifetime bound not satisfied | |
| 11 | 25 | |
| 12 | 26 | type B<T> = (); |
| 13 | //~^ ERROR type parameter `T` is never used | |
| 14 | //~| HELP consider removing `T` | |
| 15 | //~| HELP if you intended `T` to be a const parameter | |
| 27 | const _: B<i32> = (); | |
| 28 | #[cfg(fail)] fn b(_: B<str>) {} | |
| 29 | //[fail]~^ ERROR the size for values of type `str` cannot be known at compilation time | |
| 30 | //[fail]~| ERROR the size for values of type `str` cannot be known at compilation time | |
| 16 | 31 | |
| 17 | // Check that we don't emit the const param help message here: | |
| 18 | type C<T: Copy> = (); | |
| 19 | //~^ ERROR type parameter `T` is never used | |
| 20 | //~| HELP consider removing `T` | |
| 32 | type C<const N: usize> = (); | |
| 33 | const _: C<{ 0 * 1 }> = (); | |
| 34 | #[cfg(fail)] fn c(_: C<{ panic!() }>) {} //[fail]~ ERROR evaluation panicked | |
| 21 | 35 | |
| 22 | 36 | fn main() {} |
tests/ui/lazy-type-alias/unused-generic-parameters.stderr deleted-28| ... | ... | @@ -1,28 +0,0 @@ |
| 1 | error[E0392]: lifetime parameter `'a` is never used | |
| 2 | --> $DIR/unused-generic-parameters.rs:8:8 | |
| 3 | | | |
| 4 | LL | type A<'a> = (); | |
| 5 | | ^^ unused lifetime parameter | |
| 6 | | | |
| 7 | = help: consider removing `'a` or referring to it in the body of the type alias | |
| 8 | ||
| 9 | error[E0392]: type parameter `T` is never used | |
| 10 | --> $DIR/unused-generic-parameters.rs:12:8 | |
| 11 | | | |
| 12 | LL | type B<T> = (); | |
| 13 | | ^ unused type parameter | |
| 14 | | | |
| 15 | = help: consider removing `T` or referring to it in the body of the type alias | |
| 16 | = help: if you intended `T` to be a const parameter, use `const T: /* Type */` instead | |
| 17 | ||
| 18 | error[E0392]: type parameter `T` is never used | |
| 19 | --> $DIR/unused-generic-parameters.rs:18:8 | |
| 20 | | | |
| 21 | LL | type C<T: Copy> = (); | |
| 22 | | ^ unused type parameter | |
| 23 | | | |
| 24 | = help: consider removing `T` or referring to it in the body of the type alias | |
| 25 | ||
| 26 | error: aborting due to 3 previous errors | |
| 27 | ||
| 28 | For more information about this error, try `rustc --explain E0392`. |
tests/ui/lazy-type-alias/use-site-wf.rs created+16| ... | ... | @@ -0,0 +1,16 @@ |
| 1 | // Test that we check usage sites of lazy type aliases, aka free alias types, for well-formedness. | |
| 2 | // We check trailing where-clauses separately in `trailing-where-clause.rs`. | |
| 3 | ||
| 4 | #![feature(lazy_type_alias)] | |
| 5 | ||
| 6 | type B<T: Copy> = T; | |
| 7 | ||
| 8 | fn b<X>(_: B<X>) {} | |
| 9 | //~^ ERROR the trait bound `X: Copy` is not satisfied | |
| 10 | //~| ERROR the trait bound `X: Copy` is not satisfied | |
| 11 | ||
| 12 | type A<'a: 'static> = &'a (); | |
| 13 | ||
| 14 | fn a<'r>(_: A<'r>) {} //~ ERROR lifetime bound not satisfied | |
| 15 | ||
| 16 | fn main() {} |
tests/ui/lazy-type-alias/use-site-wf.stderr created+50| ... | ... | @@ -0,0 +1,50 @@ |
| 1 | error[E0277]: the trait bound `X: Copy` is not satisfied | |
| 2 | --> $DIR/use-site-wf.rs:8:12 | |
| 3 | | | |
| 4 | LL | fn b<X>(_: B<X>) {} | |
| 5 | | ^^^^ the trait `Copy` is not implemented for `X` | |
| 6 | | | |
| 7 | note: required by a bound on the type alias `B` | |
| 8 | --> $DIR/use-site-wf.rs:6:11 | |
| 9 | | | |
| 10 | LL | type B<T: Copy> = T; | |
| 11 | | ^^^^ required by this bound | |
| 12 | help: consider restricting type parameter `X` with trait `Copy` | |
| 13 | | | |
| 14 | LL | fn b<X: std::marker::Copy>(_: B<X>) {} | |
| 15 | | +++++++++++++++++++ | |
| 16 | ||
| 17 | error[E0478]: lifetime bound not satisfied | |
| 18 | --> $DIR/use-site-wf.rs:14:13 | |
| 19 | | | |
| 20 | LL | fn a<'r>(_: A<'r>) {} | |
| 21 | | ^^^^^ | |
| 22 | | | |
| 23 | note: lifetime parameter instantiated with the lifetime `'r` as defined here | |
| 24 | --> $DIR/use-site-wf.rs:14:6 | |
| 25 | | | |
| 26 | LL | fn a<'r>(_: A<'r>) {} | |
| 27 | | ^^ | |
| 28 | = note: but lifetime parameter must outlive the static lifetime | |
| 29 | ||
| 30 | error[E0277]: the trait bound `X: Copy` is not satisfied | |
| 31 | --> $DIR/use-site-wf.rs:8:12 | |
| 32 | | | |
| 33 | LL | fn b<X>(_: B<X>) {} | |
| 34 | | ^^^^ the trait `Copy` is not implemented for `X` | |
| 35 | | | |
| 36 | note: required by a bound on the type alias `B` | |
| 37 | --> $DIR/use-site-wf.rs:6:11 | |
| 38 | | | |
| 39 | LL | type B<T: Copy> = T; | |
| 40 | | ^^^^ required by this bound | |
| 41 | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` | |
| 42 | help: consider restricting type parameter `X` with trait `Copy` | |
| 43 | | | |
| 44 | LL | fn b<X: std::marker::Copy>(_: B<X>) {} | |
| 45 | | +++++++++++++++++++ | |
| 46 | ||
| 47 | error: aborting due to 3 previous errors | |
| 48 | ||
| 49 | Some errors have detailed explanations: E0277, E0478. | |
| 50 | For more information about an error, try `rustc --explain E0277`. |
tests/ui/lazy-type-alias/variance-0.rs created+61| ... | ... | @@ -0,0 +1,61 @@ |
| 1 | // Ensure that we eagerly *expand* free alias types during variance computation. | |
| 2 | // | |
| 3 | // Since free alias types are always normalizable it's not unreasonable to expect that variance | |
| 4 | // information "propagates through" free aliases unlike projections for example which constrain | |
| 5 | // all of their generic arguments to be invariant[^1]. | |
| 6 | // | |
| 7 | // For context, we can't *normalize* types before trying to compute variances because we need | |
| 8 | // variances for normalization in the first place, more specifically type relating. | |
| 9 | // | |
| 10 | // [^1]: Parent args: Traits are invariant over their params. Own args: Projections can be rigid. | |
| 11 | // | |
| 12 | // issue: <https://github.com/rust-lang/rust/issues/114221> | |
| 13 | // | |
| 14 | //@ check-pass | |
| 15 | ||
| 16 | // FIXME(lazy_type_alias): Revisit this before stabilization (it's not blocking tho): | |
| 17 | // We might want to compute variances for free alias types again | |
| 18 | // with a special rule. See `variance-1.rs` for details. | |
| 19 | ||
| 20 | #![feature(lazy_type_alias)] | |
| 21 | ||
| 22 | // `Co` is covariant over `'a` since we expand `A` to `&'a ()`. | |
| 23 | struct Co<'a>(A<'a>); | |
| 24 | ||
| 25 | // `A` is *not* in a variance relation with its args since it's a type alias. | |
| 26 | type A<'a> = &'a (); | |
| 27 | ||
| 28 | fn co<'a>(x: Co<'static>) { | |
| 29 | let _: Co<'a> = x; // OK | |
| 30 | } | |
| 31 | ||
| 32 | // `Contra` is contravariant over `'a` since we expand `B` to `fn(&'a ())`. | |
| 33 | struct Contra<'a>(B<'a>); | |
| 34 | ||
| 35 | // (not in a variance relation) | |
| 36 | type B<'a> = fn(&'a ()); | |
| 37 | ||
| 38 | fn contra<'a>(x: Contra<'a>) { | |
| 39 | let _: Contra<'static> = x; // OK | |
| 40 | } | |
| 41 | ||
| 42 | // `CoContra` is covariant over `T` and contravariant over `U` since we expand `C`. | |
| 43 | struct CoContra<T, U>(C<T, U>); | |
| 44 | ||
| 45 | // (not in a variance relation) | |
| 46 | type C<T, U> = Option<(T, fn(U))>; | |
| 47 | ||
| 48 | fn co_contra<'a>(x: CoContra<&'static (), &'a ()>) -> CoContra<&'a (), &'static ()> { | |
| 49 | x // OK | |
| 50 | } | |
| 51 | ||
| 52 | // Check that we deeply expand: | |
| 53 | struct Co2<'a>(D0<'a>); | |
| 54 | type D0<'a> = D1<'a>; | |
| 55 | type D1<'a> = D2<'a>; | |
| 56 | type D2<'a> = D3<'a>; | |
| 57 | type D3<'a> = &'a (); | |
| 58 | ||
| 59 | fn co2<'a>(x: Co2<'static>) -> Co2<'a> { x } // OK | |
| 60 | ||
| 61 | fn main() {} |
tests/ui/lazy-type-alias/variance-1.rs created+42| ... | ... | @@ -0,0 +1,42 @@ |
| 1 | // Demonstrate that free alias types don't constrain their lifetime & type arguments if the corresp. | |
| 2 | // lifetime & type parameters are unused in the lazy type alias (before normalization) since we | |
| 3 | // eagerly expand them during variance computation unlike other alias types which constrain args to | |
| 4 | // be invariant. | |
| 5 | ||
| 6 | // FIXME(lazy_type_alias): Revisit this before stabilization (altho it's not blocking): | |
| 7 | // Do we want to compute variances for lazy type aliases & free alias types | |
| 8 | // again and "force bivariant parameters to be invariant" if they're not | |
| 9 | // constrained by a projection? | |
| 10 | // This would make `struct WrapDiscard` below compile. | |
| 11 | ||
| 12 | #![feature(lazy_type_alias)] | |
| 13 | ||
| 14 | type Discard<'a, T> = (); | |
| 15 | ||
| 16 | // `'a` and `T` are bivariant & unconstrained => rejection | |
| 17 | struct WrapDiscard<'a, T>(Discard<'a, T>); | |
| 18 | //~^ ERROR lifetime parameter `'a` is never used | |
| 19 | //~| ERROR type parameter `T` is never used | |
| 20 | ||
| 21 | type DiscardConstrained<'a, T, X> = X | |
| 22 | where | |
| 23 | X: Iterator<Item = (&'a (), T)>; | |
| 24 | ||
| 25 | // `'a` and `T` are bivariant & constrained => acceptance | |
| 26 | struct WrapDiscardConstrained<'a, T, X>(DiscardConstrained<'a, T, X>) | |
| 27 | where | |
| 28 | X: Iterator<Item = (&'a (), T)>; | |
| 29 | ||
| 30 | type Co<'a> = std::vec::IntoIter<(&'a (), &'a ())>; | |
| 31 | ||
| 32 | // NOTE: If we end up switching back to computing variances for free alias types with the special | |
| 33 | // rule explained in the FIXME above, then this function should still compile since | |
| 34 | // LTA `DiscardConstrained` should be bivariant over `'a` and `T`, not invariant due to them | |
| 35 | // being constrained by a projection. | |
| 36 | fn bi<'r>( | |
| 37 | x: WrapDiscardConstrained<'static, &'static (), Co<'static>>, | |
| 38 | ) -> WrapDiscardConstrained<'r, &'r (), Co<'r>> { | |
| 39 | x | |
| 40 | } | |
| 41 | ||
| 42 | fn main() {} |
tests/ui/lazy-type-alias/variance-1.stderr created+22| ... | ... | @@ -0,0 +1,22 @@ |
| 1 | error[E0392]: lifetime parameter `'a` is never used | |
| 2 | --> $DIR/variance-1.rs:17:20 | |
| 3 | | | |
| 4 | LL | struct WrapDiscard<'a, T>(Discard<'a, T>); | |
| 5 | | ^^ unused lifetime parameter | |
| 6 | | | |
| 7 | = help: consider removing `'a`, referring to it in a field, or using a marker such as `PhantomData` | |
| 8 | ||
| 9 | error[E0392]: type parameter `T` is never used | |
| 10 | --> $DIR/variance-1.rs:17:24 | |
| 11 | | | |
| 12 | LL | struct WrapDiscard<'a, T>(Discard<'a, T>); | |
| 13 | | ^ - `T` is named here, but is likely unused in the containing type | |
| 14 | | | | |
| 15 | | unused type parameter | |
| 16 | | | |
| 17 | = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData` | |
| 18 | = help: if you intended `T` to be a const parameter, use `const T: /* Type */` instead | |
| 19 | ||
| 20 | error: aborting due to 2 previous errors | |
| 21 | ||
| 22 | For more information about this error, try `rustc --explain E0392`. |
tests/ui/lazy-type-alias/variance-overflow.rs created+22| ... | ... | @@ -0,0 +1,22 @@ |
| 1 | // Ensure that we don't enter infinite recursion and trigger a stack overflow when computing the | |
| 2 | // variances of items that reference diverging free alias types. This once used to happen in a dev | |
| 3 | // version of PR #141030. | |
| 4 | // | |
| 5 | // This test demonstrates that we cannot rely on wfck bailing out early with a normalization error | |
| 6 | // for such free alias types before we reach variance computation. At least at the time of writing, | |
| 7 | // we wfck item `First` first which includes variance computation -- at which point item `Second` | |
| 8 | // hasn't been wfck'ed yet. | |
| 9 | // This means we can't use `type_of` to recurse into free alias types, we do have to use | |
| 10 | // `expand_free_alias_tys`. | |
| 11 | ||
| 12 | #![feature(lazy_type_alias)] | |
| 13 | ||
| 14 | // the (unused) type parameter is necessary to actually trigger variance computation for `First`. | |
| 15 | struct First<T>(Second); | |
| 16 | //~^ ERROR type parameter `T` is never used | |
| 17 | //~| ERROR overflow normalizing the type alias `Second` | |
| 18 | ||
| 19 | type Second = Second; // diverging free alias type | |
| 20 | //~^ ERROR overflow normalizing the type alias `Second` | |
| 21 | ||
| 22 | fn main() {} |
tests/ui/lazy-type-alias/variance-overflow.stderr created+29| ... | ... | @@ -0,0 +1,29 @@ |
| 1 | error[E0392]: type parameter `T` is never used | |
| 2 | --> $DIR/variance-overflow.rs:15:14 | |
| 3 | | | |
| 4 | LL | struct First<T>(Second); | |
| 5 | | ^ unused type parameter | |
| 6 | | | |
| 7 | = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData` | |
| 8 | = help: if you intended `T` to be a const parameter, use `const T: /* Type */` instead | |
| 9 | ||
| 10 | error[E0275]: overflow normalizing the type alias `Second` | |
| 11 | --> $DIR/variance-overflow.rs:15:17 | |
| 12 | | | |
| 13 | LL | struct First<T>(Second); | |
| 14 | | ^^^^^^ | |
| 15 | | | |
| 16 | = note: in case this is a recursive type alias, consider using a struct, enum, or union instead | |
| 17 | ||
| 18 | error[E0275]: overflow normalizing the type alias `Second` | |
| 19 | --> $DIR/variance-overflow.rs:19:1 | |
| 20 | | | |
| 21 | LL | type Second = Second; // diverging free alias type | |
| 22 | | ^^^^^^^^^^^ | |
| 23 | | | |
| 24 | = note: in case this is a recursive type alias, consider using a struct, enum, or union instead | |
| 25 | ||
| 26 | error: aborting due to 3 previous errors | |
| 27 | ||
| 28 | Some errors have detailed explanations: E0275, E0392. | |
| 29 | For more information about an error, try `rustc --explain E0275`. |
tests/ui/lazy-type-alias/variance.rs deleted-38| ... | ... | @@ -1,38 +0,0 @@ |
| 1 | // This is a regression test for issue #114221. | |
| 2 | // Check that we compute variances for lazy type aliases. | |
| 3 | ||
| 4 | //@ check-pass | |
| 5 | ||
| 6 | #![feature(lazy_type_alias)] | |
| 7 | #![allow(incomplete_features)] | |
| 8 | ||
| 9 | // [+] `A` is covariant over `'a`. | |
| 10 | struct A<'a>(Co<'a>); | |
| 11 | ||
| 12 | // [+] `Co` is covariant over `'a`. | |
| 13 | type Co<'a> = &'a (); | |
| 14 | ||
| 15 | fn co<'a>(x: A<'static>) { | |
| 16 | let _: A<'a> = x; | |
| 17 | } | |
| 18 | ||
| 19 | // [-] `B` is contravariant over `'a`. | |
| 20 | struct B<'a>(Contra<'a>); | |
| 21 | ||
| 22 | // [-] `Contra` is contravariant over `'a`. | |
| 23 | type Contra<'a> = fn(&'a ()); | |
| 24 | ||
| 25 | fn contra<'a>(x: B<'a>) { | |
| 26 | let _: B<'static> = x; | |
| 27 | } | |
| 28 | ||
| 29 | struct C<T, U>(CoContra<T, U>); | |
| 30 | ||
| 31 | // [+, -] `CoContra` is covariant over `T` and contravariant over `U`. | |
| 32 | type CoContra<T, U> = Option<(T, fn(U))>; | |
| 33 | ||
| 34 | fn co_contra<'a>(x: C<&'static (), &'a ()>) -> C<&'a (), &'static ()> { | |
| 35 | x | |
| 36 | } | |
| 37 | ||
| 38 | fn main() {} |
tests/ui/lint/dead-code/imported_main_dead_code_under_test.rs created+13| ... | ... | @@ -0,0 +1,13 @@ |
| 1 | //@ check-pass | |
| 2 | //@ compile-flags: --test | |
| 3 | ||
| 4 | // Regression test for https://github.com/rust-lang/rust/issues/157608: a function used | |
| 5 | // as `main` via a rename import was wrongly reported as dead code under `--test`. | |
| 6 | ||
| 7 | #![deny(dead_code)] | |
| 8 | ||
| 9 | fn different_main() { | |
| 10 | println!("Hello from different_main"); | |
| 11 | } | |
| 12 | ||
| 13 | use different_main as main; |
tests/ui/lint/dead-code/imported_main_glob_under_test.rs created+10| ... | ... | @@ -0,0 +1,10 @@ |
| 1 | //@ check-pass | |
| 2 | //@ compile-flags: --test | |
| 3 | ||
| 4 | #![deny(dead_code)] | |
| 5 | ||
| 6 | mod m { | |
| 7 | pub fn main() {} | |
| 8 | } | |
| 9 | ||
| 10 | use m::*; |
tests/ui/lint/dead-code/imported_main_path_under_test.rs created+10| ... | ... | @@ -0,0 +1,10 @@ |
| 1 | //@ check-pass | |
| 2 | //@ compile-flags: --test | |
| 3 | ||
| 4 | #![deny(dead_code)] | |
| 5 | ||
| 6 | mod m { | |
| 7 | pub fn main() {} | |
| 8 | } | |
| 9 | ||
| 10 | use m::main; |
tests/ui/lint/dead-code/imported_main_renamed_from_mod_under_test.rs created+11| ... | ... | @@ -0,0 +1,11 @@ |
| 1 | //@ check-pass | |
| 2 | //@ compile-flags: --test | |
| 3 | ||
| 4 | ||
| 5 | #![deny(dead_code)] | |
| 6 | ||
| 7 | mod m { | |
| 8 | pub fn other() {} | |
| 9 | } | |
| 10 | ||
| 11 | use m::other as main; |
tests/ui/lint/dead-code/lint-dead-code-2-under-test.rs created+22| ... | ... | @@ -0,0 +1,22 @@ |
| 1 | //@ compile-flags: --test | |
| 2 | ||
| 3 | // A `fn main` demoted by an explicit `#[rustc_main]` on another function is dead code and | |
| 4 | // must be flagged under `--test` just like in a normal build. | |
| 5 | ||
| 6 | #![allow(unused_variables)] | |
| 7 | #![deny(dead_code)] | |
| 8 | #![feature(rustc_attrs)] | |
| 9 | ||
| 10 | fn dead_fn() {} //~ ERROR: function `dead_fn` is never used | |
| 11 | ||
| 12 | fn used_fn() {} | |
| 13 | ||
| 14 | #[rustc_main] | |
| 15 | fn actual_main() { | |
| 16 | used_fn(); | |
| 17 | } | |
| 18 | ||
| 19 | // this is not main | |
| 20 | fn main() { //~ ERROR: function `main` is never used | |
| 21 | dead_fn(); | |
| 22 | } |
tests/ui/lint/dead-code/lint-dead-code-2-under-test.stderr created+20| ... | ... | @@ -0,0 +1,20 @@ |
| 1 | error: function `dead_fn` is never used | |
| 2 | --> $DIR/lint-dead-code-2-under-test.rs:10:4 | |
| 3 | | | |
| 4 | LL | fn dead_fn() {} | |
| 5 | | ^^^^^^^ | |
| 6 | | | |
| 7 | note: the lint level is defined here | |
| 8 | --> $DIR/lint-dead-code-2-under-test.rs:7:9 | |
| 9 | | | |
| 10 | LL | #![deny(dead_code)] | |
| 11 | | ^^^^^^^^^ | |
| 12 | ||
| 13 | error: function `main` is never used | |
| 14 | --> $DIR/lint-dead-code-2-under-test.rs:20:4 | |
| 15 | | | |
| 16 | LL | fn main() { | |
| 17 | | ^^^^ | |
| 18 | ||
| 19 | error: aborting due to 2 previous errors | |
| 20 |
tests/ui/lint/dead-code/submodule_main_not_entry_under_test.rs created+9| ... | ... | @@ -0,0 +1,9 @@ |
| 1 | //@ compile-flags: --test | |
| 2 | ||
| 3 | #![deny(dead_code)] | |
| 4 | ||
| 5 | fn main() {} | |
| 6 | ||
| 7 | mod m { | |
| 8 | pub fn main() {} //~ ERROR: function `main` is never used | |
| 9 | } |
tests/ui/lint/dead-code/submodule_main_not_entry_under_test.stderr created+14| ... | ... | @@ -0,0 +1,14 @@ |
| 1 | error: function `main` is never used | |
| 2 | --> $DIR/submodule_main_not_entry_under_test.rs:8:12 | |
| 3 | | | |
| 4 | LL | pub fn main() {} | |
| 5 | | ^^^^ | |
| 6 | | | |
| 7 | note: the lint level is defined here | |
| 8 | --> $DIR/submodule_main_not_entry_under_test.rs:3:9 | |
| 9 | | | |
| 10 | LL | #![deny(dead_code)] | |
| 11 | | ^^^^^^^^^ | |
| 12 | ||
| 13 | error: aborting due to 1 previous error | |
| 14 |
tests/ui/lint/large_assignments/copy_into_box_rc_arc.rs+1-1| ... | ... | @@ -3,7 +3,7 @@ |
| 3 | 3 | #![move_size_limit = "1000"] |
| 4 | 4 | //@ build-fail |
| 5 | 5 | //@ only-64bit |
| 6 | //@ ignore-parallel-frontend post-monomorphization errors | |
| 6 | ||
| 7 | 7 | //@ edition:2018 |
| 8 | 8 | //@ compile-flags: -Zmir-opt-level=1 |
| 9 | 9 |
tests/ui/lint/large_assignments/copy_into_fn.rs+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | //@ build-fail |
| 2 | //@ ignore-parallel-frontend post-monomorphization errors | |
| 2 | ||
| 3 | 3 | #![feature(large_assignments)] |
| 4 | 4 | #![move_size_limit = "1000"] |
| 5 | 5 | #![deny(large_assignments)] |
tests/ui/lint/large_assignments/inline_mir.rs+1-1| ... | ... | @@ -13,7 +13,7 @@ |
| 13 | 13 | //! ``` |
| 14 | 14 | //! |
| 15 | 15 | //! We want the diagnostics to point to the relevant user code. |
| 16 | //@ ignore-parallel-frontend post-monomorphization errors | |
| 16 | ||
| 17 | 17 | //@ build-fail |
| 18 | 18 | //@ compile-flags: -Zmir-opt-level=1 -Zinline-mir |
| 19 | 19 |
tests/ui/lint/large_assignments/large_future.rs+1-1| ... | ... | @@ -5,7 +5,7 @@ |
| 5 | 5 | //@ only-64bit |
| 6 | 6 | //@ revisions: attribute option |
| 7 | 7 | //@ [option]compile-flags: -Zmove-size-limit=1000 |
| 8 | //@ ignore-parallel-frontend post-monomorphization errors | |
| 8 | ||
| 9 | 9 | //@ edition:2018 |
| 10 | 10 | //@ compile-flags: -Zmir-opt-level=0 |
| 11 | 11 |
tests/ui/lint/large_assignments/move_into_fn.rs+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | //@ build-fail |
| 2 | //@ ignore-parallel-frontend post-monomorphization errors | |
| 2 | ||
| 3 | 3 | #![feature(large_assignments)] |
| 4 | 4 | #![move_size_limit = "1000"] |
| 5 | 5 | #![deny(large_assignments)] |
tests/ui/new-range/disabled.rs+3-5| ... | ... | @@ -1,15 +1,13 @@ |
| 1 | //! Without the `new_range` feature enabled, `..` syntax resolves to the legacy types. | |
| 1 | 2 | //@ check-pass |
| 2 | 3 | |
| 3 | #![feature(new_range_api_legacy)] | |
| 4 | ||
| 5 | 4 | fn main() { |
| 6 | 5 | // Unchanged |
| 7 | 6 | let a: core::ops::RangeFull = ..; |
| 8 | 7 | let b: core::ops::RangeTo<u8> = ..2; |
| 9 | 8 | |
| 10 | // FIXME(#125687): re-exports temporarily removed | |
| 11 | // let _: core::range::RangeFull = a; | |
| 12 | // let _: core::range::RangeTo<u8> = b; | |
| 9 | let _: core::range::RangeFull = a; | |
| 10 | let _: core::range::RangeTo<u8> = b; | |
| 13 | 11 | |
| 14 | 12 | // Changed |
| 15 | 13 | let a: core::range::legacy::RangeFrom<u8> = 1..; |
tests/ui/new-range/enabled.rs+3-3| ... | ... | @@ -1,3 +1,4 @@ |
| 1 | //! With the `new_range` feature enabled, `..` syntax resolves to the new range types. | |
| 1 | 2 | //@ check-pass |
| 2 | 3 | |
| 3 | 4 | #![feature(new_range)] |
| ... | ... | @@ -7,9 +8,8 @@ fn main() { |
| 7 | 8 | let a: core::ops::RangeFull = ..; |
| 8 | 9 | let b: core::ops::RangeTo<u8> = ..2; |
| 9 | 10 | |
| 10 | // FIXME(#125687): re-exports temporarily removed | |
| 11 | // let _: core::range::RangeFull = a; | |
| 12 | // let _: core::range::RangeTo<u8> = b; | |
| 11 | let _: core::range::RangeFull = a; | |
| 12 | let _: core::range::RangeTo<u8> = b; | |
| 13 | 13 | |
| 14 | 14 | // Changed |
| 15 | 15 | let a: core::range::RangeFrom<u8> = 1..; |
tests/ui/parser/dyn-2015-identifier.fail.stderr created+80| ... | ... | @@ -0,0 +1,80 @@ |
| 1 | error[E0425]: cannot find type `dyn` in this scope | |
| 2 | --> $DIR/dyn-2015-identifier.rs:7:11 | |
| 3 | | | |
| 4 | LL | type A0 = dyn; | |
| 5 | | ^^^ not found in this scope | |
| 6 | ||
| 7 | error[E0425]: cannot find type `dyn` in this scope | |
| 8 | --> $DIR/dyn-2015-identifier.rs:13:11 | |
| 9 | | | |
| 10 | LL | type A2 = dyn<dyn, dyn>; | |
| 11 | | ^^^ not found in this scope | |
| 12 | ||
| 13 | error[E0425]: cannot find type `dyn` in this scope | |
| 14 | --> $DIR/dyn-2015-identifier.rs:13:15 | |
| 15 | | | |
| 16 | LL | type A2 = dyn<dyn, dyn>; | |
| 17 | | ^^^ not found in this scope | |
| 18 | ||
| 19 | error[E0425]: cannot find type `dyn` in this scope | |
| 20 | --> $DIR/dyn-2015-identifier.rs:13:20 | |
| 21 | | | |
| 22 | LL | type A2 = dyn<dyn, dyn>; | |
| 23 | | ^^^ not found in this scope | |
| 24 | ||
| 25 | error[E0425]: cannot find type `dyn` in this scope | |
| 26 | --> $DIR/dyn-2015-identifier.rs:18:11 | |
| 27 | | | |
| 28 | LL | type A3 = dyn<<dyn as dyn>::dyn>; | |
| 29 | | ^^^ not found in this scope | |
| 30 | ||
| 31 | error[E0405]: cannot find trait `dyn` in this scope | |
| 32 | --> $DIR/dyn-2015-identifier.rs:18:23 | |
| 33 | | | |
| 34 | LL | type A3 = dyn<<dyn as dyn>::dyn>; | |
| 35 | | ^^^ not found in this scope | |
| 36 | ||
| 37 | error[E0425]: cannot find type `dyn` in this scope | |
| 38 | --> $DIR/dyn-2015-identifier.rs:18:16 | |
| 39 | | | |
| 40 | LL | type A3 = dyn<<dyn as dyn>::dyn>; | |
| 41 | | ^^^ not found in this scope | |
| 42 | ||
| 43 | error[E0405]: cannot find trait `dyn` in this scope | |
| 44 | --> $DIR/dyn-2015-identifier.rs:24:11 | |
| 45 | | | |
| 46 | LL | type A4 = dyn + dyn; | |
| 47 | | ^^^ not found in this scope | |
| 48 | ||
| 49 | error[E0405]: cannot find trait `dyn` in this scope | |
| 50 | --> $DIR/dyn-2015-identifier.rs:24:17 | |
| 51 | | | |
| 52 | LL | type A4 = dyn + dyn; | |
| 53 | | ^^^ not found in this scope | |
| 54 | ||
| 55 | warning: trait objects without an explicit `dyn` are deprecated | |
| 56 | --> $DIR/dyn-2015-identifier.rs:24:11 | |
| 57 | | | |
| 58 | LL | type A4 = dyn + dyn; | |
| 59 | | ^^^^^^^^^ | |
| 60 | | | |
| 61 | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! | |
| 62 | = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2021/warnings-promoted-to-error.html> | |
| 63 | = note: `#[warn(bare_trait_objects)]` (part of `#[warn(rust_2021_compatibility)]`) on by default | |
| 64 | help: if this is a dyn-compatible trait, use `dyn` | |
| 65 | | | |
| 66 | LL | type A4 = dyn dyn + dyn; | |
| 67 | | +++ | |
| 68 | ||
| 69 | error[E0433]: cannot find module or crate `dyn` in this scope | |
| 70 | --> $DIR/dyn-2015-identifier.rs:10:11 | |
| 71 | | | |
| 72 | LL | type A1 = dyn::dyn; | |
| 73 | | ^^^ use of unresolved module or unlinked crate `dyn` | |
| 74 | | | |
| 75 | = help: you might be missing a crate named `dyn` | |
| 76 | ||
| 77 | error: aborting due to 10 previous errors; 1 warning emitted | |
| 78 | ||
| 79 | Some errors have detailed explanations: E0405, E0425, E0433. | |
| 80 | For more information about an error, try `rustc --explain E0405`. |
tests/ui/parser/dyn-2015-identifier.rs created+28| ... | ... | @@ -0,0 +1,28 @@ |
| 1 | //@ edition: 2015 | |
| 2 | //@ compile-flags: --crate-type=lib | |
| 3 | //@ revisions: pass fail | |
| 4 | //@[pass] check-pass | |
| 5 | #![cfg(fail)] | |
| 6 | ||
| 7 | type A0 = dyn; | |
| 8 | //[fail]~^ ERROR cannot find type `dyn` in this scope | |
| 9 | ||
| 10 | type A1 = dyn::dyn; | |
| 11 | //[fail]~^ ERROR cannot find module or crate `dyn` in this scope | |
| 12 | ||
| 13 | type A2 = dyn<dyn, dyn>; | |
| 14 | //[fail]~^ ERROR cannot find type `dyn` in this scope | |
| 15 | //[fail]~| ERROR cannot find type `dyn` in this scope | |
| 16 | //[fail]~| ERROR cannot find type `dyn` in this scope | |
| 17 | ||
| 18 | type A3 = dyn<<dyn as dyn>::dyn>; | |
| 19 | //[fail]~^ ERROR cannot find type `dyn` in this scope | |
| 20 | //[fail]~| ERROR cannot find type `dyn` in this scope | |
| 21 | //[fail]~| ERROR cannot find trait `dyn` in this scope | |
| 22 | ||
| 23 | // issue: <https://github.com/rust-lang/rust/issues/157565> | |
| 24 | type A4 = dyn + dyn; | |
| 25 | //[fail]~^ ERROR cannot find trait `dyn` in this scope | |
| 26 | //[fail]~| ERROR cannot find trait `dyn` in this scope | |
| 27 | //[fail]~| WARN trait objects without an explicit `dyn` are deprecated | |
| 28 | //[fail]~| WARN this is accepted in the current edition |
tests/ui/parser/dyn-trait-compatibility.rs deleted-16| ... | ... | @@ -1,16 +0,0 @@ |
| 1 | //@ edition: 2015 | |
| 2 | ||
| 3 | type A0 = dyn; | |
| 4 | //~^ ERROR cannot find type `dyn` in this scope | |
| 5 | type A1 = dyn::dyn; | |
| 6 | //~^ ERROR cannot find module or crate `dyn` in this scope | |
| 7 | type A2 = dyn<dyn, dyn>; | |
| 8 | //~^ ERROR cannot find type `dyn` in this scope | |
| 9 | //~| ERROR cannot find type `dyn` in this scope | |
| 10 | //~| ERROR cannot find type `dyn` in this scope | |
| 11 | type A3 = dyn<<dyn as dyn>::dyn>; | |
| 12 | //~^ ERROR cannot find type `dyn` in this scope | |
| 13 | //~| ERROR cannot find type `dyn` in this scope | |
| 14 | //~| ERROR cannot find trait `dyn` in this scope | |
| 15 | ||
| 16 | fn main() {} |
tests/ui/parser/dyn-trait-compatibility.stderr deleted-54| ... | ... | @@ -1,54 +0,0 @@ |
| 1 | error[E0425]: cannot find type `dyn` in this scope | |
| 2 | --> $DIR/dyn-trait-compatibility.rs:3:11 | |
| 3 | | | |
| 4 | LL | type A0 = dyn; | |
| 5 | | ^^^ not found in this scope | |
| 6 | ||
| 7 | error[E0425]: cannot find type `dyn` in this scope | |
| 8 | --> $DIR/dyn-trait-compatibility.rs:7:11 | |
| 9 | | | |
| 10 | LL | type A2 = dyn<dyn, dyn>; | |
| 11 | | ^^^ not found in this scope | |
| 12 | ||
| 13 | error[E0425]: cannot find type `dyn` in this scope | |
| 14 | --> $DIR/dyn-trait-compatibility.rs:7:15 | |
| 15 | | | |
| 16 | LL | type A2 = dyn<dyn, dyn>; | |
| 17 | | ^^^ not found in this scope | |
| 18 | ||
| 19 | error[E0425]: cannot find type `dyn` in this scope | |
| 20 | --> $DIR/dyn-trait-compatibility.rs:7:20 | |
| 21 | | | |
| 22 | LL | type A2 = dyn<dyn, dyn>; | |
| 23 | | ^^^ not found in this scope | |
| 24 | ||
| 25 | error[E0425]: cannot find type `dyn` in this scope | |
| 26 | --> $DIR/dyn-trait-compatibility.rs:11:11 | |
| 27 | | | |
| 28 | LL | type A3 = dyn<<dyn as dyn>::dyn>; | |
| 29 | | ^^^ not found in this scope | |
| 30 | ||
| 31 | error[E0405]: cannot find trait `dyn` in this scope | |
| 32 | --> $DIR/dyn-trait-compatibility.rs:11:23 | |
| 33 | | | |
| 34 | LL | type A3 = dyn<<dyn as dyn>::dyn>; | |
| 35 | | ^^^ not found in this scope | |
| 36 | ||
| 37 | error[E0425]: cannot find type `dyn` in this scope | |
| 38 | --> $DIR/dyn-trait-compatibility.rs:11:16 | |
| 39 | | | |
| 40 | LL | type A3 = dyn<<dyn as dyn>::dyn>; | |
| 41 | | ^^^ not found in this scope | |
| 42 | ||
| 43 | error[E0433]: cannot find module or crate `dyn` in this scope | |
| 44 | --> $DIR/dyn-trait-compatibility.rs:5:11 | |
| 45 | | | |
| 46 | LL | type A1 = dyn::dyn; | |
| 47 | | ^^^ use of unresolved module or unlinked crate `dyn` | |
| 48 | | | |
| 49 | = help: you might be missing a crate named `dyn` | |
| 50 | ||
| 51 | error: aborting due to 8 previous errors | |
| 52 | ||
| 53 | Some errors have detailed explanations: E0405, E0425, E0433. | |
| 54 | For more information about an error, try `rustc --explain E0405`. |
tests/ui/range/new_range_stability.rs+1-4| ... | ... | @@ -7,6 +7,7 @@ use std::range::{ |
| 7 | 7 | RangeFrom, |
| 8 | 8 | RangeFromIter, |
| 9 | 9 | Range, |
| 10 | legacy, | |
| 10 | 11 | }; |
| 11 | 12 | |
| 12 | 13 | fn range_inclusive(mut r: RangeInclusive<usize>) { |
| ... | ... | @@ -60,8 +61,4 @@ fn range(mut r: Range<usize>) { |
| 60 | 61 | i.remainder(); //~ ERROR unstable |
| 61 | 62 | } |
| 62 | 63 | |
| 63 | // Unstable module | |
| 64 | ||
| 65 | use std::range::legacy; //~ ERROR unstable | |
| 66 | ||
| 67 | 64 | fn main() {} |
tests/ui/range/new_range_stability.stderr+4-14| ... | ... | @@ -1,15 +1,5 @@ |
| 1 | error[E0658]: use of unstable library feature `new_range_api_legacy` | |
| 2 | --> $DIR/new_range_stability.rs:65:5 | |
| 3 | | | |
| 4 | LL | use std::range::legacy; | |
| 5 | | ^^^^^^^^^^^^^^^^^^ | |
| 6 | | | |
| 7 | = note: see issue #125687 <https://github.com/rust-lang/rust/issues/125687> for more information | |
| 8 | = help: add `#![feature(new_range_api_legacy)]` to the crate attributes to enable | |
| 9 | = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date | |
| 10 | ||
| 11 | 1 | error[E0658]: use of unstable library feature `new_range_remainder` |
| 12 | --> $DIR/new_range_stability.rs:23:7 | |
| 2 | --> $DIR/new_range_stability.rs:24:7 | |
| 13 | 3 | | |
| 14 | 4 | LL | i.remainder(); |
| 15 | 5 | | ^^^^^^^^^ |
| ... | ... | @@ -19,7 +9,7 @@ LL | i.remainder(); |
| 19 | 9 | = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date |
| 20 | 10 | |
| 21 | 11 | error[E0658]: use of unstable library feature `new_range_remainder` |
| 22 | --> $DIR/new_range_stability.rs:44:7 | |
| 12 | --> $DIR/new_range_stability.rs:45:7 | |
| 23 | 13 | | |
| 24 | 14 | LL | i.remainder(); |
| 25 | 15 | | ^^^^^^^^^ |
| ... | ... | @@ -29,7 +19,7 @@ LL | i.remainder(); |
| 29 | 19 | = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date |
| 30 | 20 | |
| 31 | 21 | error[E0658]: use of unstable library feature `new_range_remainder` |
| 32 | --> $DIR/new_range_stability.rs:60:7 | |
| 22 | --> $DIR/new_range_stability.rs:61:7 | |
| 33 | 23 | | |
| 34 | 24 | LL | i.remainder(); |
| 35 | 25 | | ^^^^^^^^^ |
| ... | ... | @@ -38,6 +28,6 @@ LL | i.remainder(); |
| 38 | 28 | = help: add `#![feature(new_range_remainder)]` to the crate attributes to enable |
| 39 | 29 | = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date |
| 40 | 30 | |
| 41 | error: aborting due to 4 previous errors | |
| 31 | error: aborting due to 3 previous errors | |
| 42 | 32 | |
| 43 | 33 | For more information about this error, try `rustc --explain E0658`. |
tests/ui/reflection/reflection_methods_in_runtime_code.rs created+9| ... | ... | @@ -0,0 +1,9 @@ |
| 1 | #![feature(type_info)] | |
| 2 | ||
| 3 | trait Trait {} | |
| 4 | ||
| 5 | fn main() { | |
| 6 | // Test the (lack of) usability of comptime fns in runtime code. | |
| 7 | std::any::TypeId::of::<[u8; usize::MAX]>().trait_info_of::<dyn Trait>(); | |
| 8 | //~^ ERROR: comptime fns can only be called at compile time | |
| 9 | } |
tests/ui/reflection/reflection_methods_in_runtime_code.stderr created+8| ... | ... | @@ -0,0 +1,8 @@ |
| 1 | error: comptime fns can only be called at compile time | |
| 2 | --> $DIR/reflection_methods_in_runtime_code.rs:7:5 | |
| 3 | | | |
| 4 | LL | std::any::TypeId::of::<[u8; usize::MAX]>().trait_info_of::<dyn Trait>(); | |
| 5 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 6 | ||
| 7 | error: aborting due to 1 previous error | |
| 8 |
tests/ui/simd/const-err-trumps-simd-err.rs+1-1| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | //@build-fail |
| 2 | 2 | //@ dont-require-annotations: NOTE |
| 3 | //@ ignore-parallel-frontend post-monomorphization errors | |
| 3 | ||
| 4 | 4 | //! Make sure that monomorphization-time const errors from `static_assert` take priority over the |
| 5 | 5 | //! error from simd_extract. Basically this checks that if a const fails to evaluate in some |
| 6 | 6 | //! function, we don't bother codegen'ing the function. |
tests/ui/structs/default-field-values/post-mono.rs+1-1| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | //@ build-fail |
| 2 | 2 | //@ revisions: direct indirect |
| 3 | //@ ignore-parallel-frontend post-monomorphization errors | |
| 3 | ||
| 4 | 4 | #![feature(default_field_values)] |
| 5 | 5 | |
| 6 | 6 | struct Z<const X: usize> { |
tests/ui/wf/let-pat-inferred-non-wf.rs created+58| ... | ... | @@ -0,0 +1,58 @@ |
| 1 | // Regression test for https://github.com/rust-lang/rust/issues/150040 | |
| 2 | // When a `let PAT;` has no explicit type, later assignments can infer a non-well-formed | |
| 3 | // pattern type such as `[str; 2]` or `(str, i32)`. We must reject those array and tuple | |
| 4 | // patterns instead of accepting the invalid type or causing ICE. | |
| 5 | ||
| 6 | #![allow(unused)] | |
| 7 | ||
| 8 | struct S<T: ?Sized>(T); | |
| 9 | ||
| 10 | fn should_fail_1() { | |
| 11 | let ref y @ [ref x, _]; //~ ERROR E0277 | |
| 12 | x = ""; | |
| 13 | } | |
| 14 | ||
| 15 | fn should_fail_2() { | |
| 16 | let [ref x]; //~ ERROR E0277 | |
| 17 | x = ""; | |
| 18 | } | |
| 19 | ||
| 20 | fn should_fail_3() { | |
| 21 | let [[ref x], [_, y @ ..]]; //~ ERROR E0277 | |
| 22 | x = ""; | |
| 23 | y = []; | |
| 24 | } | |
| 25 | ||
| 26 | fn should_fail_4() { | |
| 27 | let [(ref a, b), x]; //~ ERROR E0277 | |
| 28 | a = ""; | |
| 29 | b = 5; | |
| 30 | } | |
| 31 | ||
| 32 | fn should_fail_5() { | |
| 33 | let (ref a, b); //~ ERROR E0277 | |
| 34 | a = ""; | |
| 35 | b = 5; | |
| 36 | } | |
| 37 | ||
| 38 | fn should_fail_6() { | |
| 39 | let [S(ref x)]; //~ ERROR E0277 | |
| 40 | x = ""; | |
| 41 | } | |
| 42 | ||
| 43 | fn should_pass_1() { | |
| 44 | let ref x; | |
| 45 | x = ""; | |
| 46 | } | |
| 47 | ||
| 48 | fn should_pass_2() { | |
| 49 | let ref y @ (ref x,); | |
| 50 | x = ""; | |
| 51 | } | |
| 52 | ||
| 53 | fn should_pass_3() { | |
| 54 | let S(ref x); | |
| 55 | x = ""; | |
| 56 | } | |
| 57 | ||
| 58 | fn main() {} |
tests/ui/wf/let-pat-inferred-non-wf.stderr created+62| ... | ... | @@ -0,0 +1,62 @@ |
| 1 | error[E0277]: the size for values of type `str` cannot be known at compilation time | |
| 2 | --> $DIR/let-pat-inferred-non-wf.rs:11:9 | |
| 3 | | | |
| 4 | LL | let ref y @ [ref x, _]; | |
| 5 | | ^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | |
| 6 | | | |
| 7 | = help: the trait `Sized` is not implemented for `str` | |
| 8 | = note: slice and array elements must have `Sized` type | |
| 9 | ||
| 10 | error[E0277]: the size for values of type `str` cannot be known at compilation time | |
| 11 | --> $DIR/let-pat-inferred-non-wf.rs:16:9 | |
| 12 | | | |
| 13 | LL | let [ref x]; | |
| 14 | | ^^^^^^^ doesn't have a size known at compile-time | |
| 15 | | | |
| 16 | = help: the trait `Sized` is not implemented for `str` | |
| 17 | = note: slice and array elements must have `Sized` type | |
| 18 | ||
| 19 | error[E0277]: the size for values of type `str` cannot be known at compilation time | |
| 20 | --> $DIR/let-pat-inferred-non-wf.rs:21:9 | |
| 21 | | | |
| 22 | LL | let [[ref x], [_, y @ ..]]; | |
| 23 | | ^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | |
| 24 | | | |
| 25 | = help: the trait `Sized` is not implemented for `str` | |
| 26 | = note: slice and array elements must have `Sized` type | |
| 27 | ||
| 28 | error[E0277]: the size for values of type `str` cannot be known at compilation time | |
| 29 | --> $DIR/let-pat-inferred-non-wf.rs:27:9 | |
| 30 | | | |
| 31 | LL | let [(ref a, b), x]; | |
| 32 | | ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | |
| 33 | | | |
| 34 | = help: the trait `Sized` is not implemented for `str` | |
| 35 | = note: only the last element of a tuple may have a dynamically sized type | |
| 36 | ||
| 37 | error[E0277]: the size for values of type `str` cannot be known at compilation time | |
| 38 | --> $DIR/let-pat-inferred-non-wf.rs:33:9 | |
| 39 | | | |
| 40 | LL | let (ref a, b); | |
| 41 | | ^^^^^^^^^^ doesn't have a size known at compile-time | |
| 42 | | | |
| 43 | = help: the trait `Sized` is not implemented for `str` | |
| 44 | = note: only the last element of a tuple may have a dynamically sized type | |
| 45 | ||
| 46 | error[E0277]: the size for values of type `str` cannot be known at compilation time | |
| 47 | --> $DIR/let-pat-inferred-non-wf.rs:39:9 | |
| 48 | | | |
| 49 | LL | let [S(ref x)]; | |
| 50 | | ^^^^^^^^^^ doesn't have a size known at compile-time | |
| 51 | | | |
| 52 | = help: within `S<str>`, the trait `Sized` is not implemented for `str` | |
| 53 | note: required because it appears within the type `S<str>` | |
| 54 | --> $DIR/let-pat-inferred-non-wf.rs:8:8 | |
| 55 | | | |
| 56 | LL | struct S<T: ?Sized>(T); | |
| 57 | | ^ | |
| 58 | = note: slice and array elements must have `Sized` type | |
| 59 | ||
| 60 | error: aborting due to 6 previous errors | |
| 61 | ||
| 62 | For more information about this error, try `rustc --explain E0277`. |
tests/ui/wf/wf-dyn-in-hrtb-bound-const-mismatch.rs created+19| ... | ... | @@ -0,0 +1,19 @@ |
| 1 | // Companion to #157122 / `wf-dyn-in-hrtb-bound-issue-157122.rs`. | |
| 2 | // | |
| 3 | // That test covers an ICE in `WfPredicates::visit_ty` where a `dyn Trait` nested | |
| 4 | // inside a `for<'a>` binder reached `ExistentialTraitRef::with_self_ty` with an | |
| 5 | // escaping self type. The fix removes the offending `debug_assert!` rather than | |
| 6 | // skipping the block. Skipping would have been a silent regression: the block | |
| 7 | // emits the `ConstArgHasType` obligation that type-checks a `dyn`'s const | |
| 8 | // argument, so dropping it makes an ill-typed const argument compile. | |
| 9 | // | |
| 10 | // Here `B` has type `bool` but `HasConst` expects `const N: usize`, and the | |
| 11 | // `dyn HasConst<'a, B>` carries the escaping late-bound `'a`. This must still be | |
| 12 | // rejected, exactly as it is without the surrounding `for<'a>` binder. | |
| 13 | ||
| 14 | trait HasConst<'a, const N: usize> {} | |
| 15 | ||
| 16 | fn nested<const B: bool>(_f: &dyn for<'a> Fn(&'a (), &'a dyn HasConst<'a, B>)) {} | |
| 17 | //~^ ERROR the constant `B` is not of type `usize` | |
| 18 | ||
| 19 | fn main() {} |
tests/ui/wf/wf-dyn-in-hrtb-bound-const-mismatch.stderr created+14| ... | ... | @@ -0,0 +1,14 @@ |
| 1 | error: the constant `B` is not of type `usize` | |
| 2 | --> $DIR/wf-dyn-in-hrtb-bound-const-mismatch.rs:16:30 | |
| 3 | | | |
| 4 | LL | fn nested<const B: bool>(_f: &dyn for<'a> Fn(&'a (), &'a dyn HasConst<'a, B>)) {} | |
| 5 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `bool` | |
| 6 | | | |
| 7 | note: required by a const generic parameter in `HasConst` | |
| 8 | --> $DIR/wf-dyn-in-hrtb-bound-const-mismatch.rs:14:20 | |
| 9 | | | |
| 10 | LL | trait HasConst<'a, const N: usize> {} | |
| 11 | | ^^^^^^^^^^^^^^ required by this const generic parameter in `HasConst` | |
| 12 | ||
| 13 | error: aborting due to 1 previous error | |
| 14 |
tests/ui/wf/wf-dyn-in-hrtb-bound-issue-157122.rs created+28| ... | ... | @@ -0,0 +1,28 @@ |
| 1 | //@ check-pass | |
| 2 | ||
| 3 | // Regression test for #157122. | |
| 4 | // | |
| 5 | // When WF-checking a type, the visitor recurses through higher-ranked binders | |
| 6 | // without instantiating them, so a `dyn Trait` nested inside a `for<'a>` binder | |
| 7 | // reaches the `ty::Dynamic` arm of `WfPredicates::visit_ty` while still carrying | |
| 8 | // escaping bound vars. Building the principal trait ref there via | |
| 9 | // `ExistentialTraitRef::with_self_ty` passed that escaping self type to a | |
| 10 | // `debug_assert!(!self_ty.has_escaping_bound_vars())`, which ICEs once the | |
| 11 | // assertion is enabled. Creating a trait ref with an escaping self type is fine | |
| 12 | // -- escaping bound vars are caught where they are actually used -- so the | |
| 13 | // assertion was removed rather than worked around. The `ConstArgHasType` check | |
| 14 | // this arm reads off still runs; see `wf-dyn-in-hrtb-bound-const-mismatch.rs`. | |
| 15 | // Distilled from `itertools`'s `FormatWith` `Display` impl. | |
| 16 | ||
| 17 | use std::fmt; | |
| 18 | ||
| 19 | fn call<F>(mut f: F) | |
| 20 | where | |
| 21 | F: FnMut(&mut dyn FnMut(&dyn fmt::Display) -> fmt::Result) -> fmt::Result, | |
| 22 | { | |
| 23 | let _ = f(&mut |_disp: &dyn fmt::Display| Ok(())); | |
| 24 | } | |
| 25 | ||
| 26 | fn main() { | |
| 27 | call(|cb| cb(&0i32)); | |
| 28 | } |
yarn.lock+217-887| ... | ... | @@ -2,49 +2,21 @@ |
| 2 | 2 | # yarn lockfile v1 |
| 3 | 3 | |
| 4 | 4 | |
| 5 | "@babel/code-frame@^7.0.0": | |
| 6 | version "7.27.1" | |
| 7 | resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.27.1.tgz#200f715e66d52a23b221a9435534a91cc13ad5be" | |
| 8 | integrity sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg== | |
| 9 | dependencies: | |
| 10 | "@babel/helper-validator-identifier" "^7.27.1" | |
| 11 | js-tokens "^4.0.0" | |
| 12 | picocolors "^1.1.1" | |
| 13 | ||
| 14 | "@babel/helper-validator-identifier@^7.27.1": | |
| 15 | version "7.28.5" | |
| 16 | resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.28.5.tgz#010b6938fab7cb7df74aa2bbc06aa503b8fe5fb4" | |
| 17 | integrity sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q== | |
| 18 | ||
| 19 | "@colors/colors@1.6.0", "@colors/colors@^1.6.0": | |
| 20 | version "1.6.0" | |
| 21 | resolved "https://registry.yarnpkg.com/@colors/colors/-/colors-1.6.0.tgz#ec6cd237440700bc23ca23087f513c75508958b0" | |
| 22 | integrity sha512-Ir+AOibqzrIsL6ajt3Rz3LskB7OiMVHqltZmspbW/TJuTVuyOMirVqAkjfY6JISiLHgyNqicAC8AyHHGzNd/dA== | |
| 23 | ||
| 24 | "@dabh/diagnostics@^2.0.2": | |
| 25 | version "2.0.8" | |
| 26 | resolved "https://registry.yarnpkg.com/@dabh/diagnostics/-/diagnostics-2.0.8.tgz#ead97e72ca312cf0e6dd7af0d300b58993a31a5e" | |
| 27 | integrity sha512-R4MSXTVnuMzGD7bzHdW2ZhhdPC/igELENcq5IjEverBvq5hn1SXCWcsi6eSsdWP0/Ur+SItRRjAktmdoX/8R/Q== | |
| 28 | dependencies: | |
| 29 | "@so-ric/colorspace" "^1.1.6" | |
| 30 | enabled "2.0.x" | |
| 31 | kuler "^2.0.0" | |
| 32 | ||
| 33 | 5 | "@eslint-community/eslint-utils@^4.2.0": |
| 34 | version "4.9.0" | |
| 35 | resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.9.0.tgz#7308df158e064f0dd8b8fdb58aa14fa2a7f913b3" | |
| 36 | integrity sha512-ayVFHdtZ+hsq1t2Dy24wCmGXGe4q9Gu3smhLYALJrr473ZH27MsnSL+LKUlimp4BWJqMDMLmPpx/Q9R3OAlL4g== | |
| 6 | version "4.9.1" | |
| 7 | resolved "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.9.1.tgz" | |
| 8 | integrity sha512-phrYmNiYppR7znFEdqgfWHXR6NCkZEK7hwWDHZUjit/2/U0r6XvkDl0SYnoM51Hq7FhCGdLDT6zxCCOY1hexsQ== | |
| 37 | 9 | dependencies: |
| 38 | 10 | eslint-visitor-keys "^3.4.3" |
| 39 | 11 | |
| 40 | 12 | "@eslint-community/regexpp@^4.6.1": |
| 41 | 13 | version "4.12.2" |
| 42 | resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.12.2.tgz#bccdf615bcf7b6e8db830ec0b8d21c9a25de597b" | |
| 14 | resolved "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.2.tgz" | |
| 43 | 15 | integrity sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew== |
| 44 | 16 | |
| 45 | 17 | "@eslint/eslintrc@^2.1.4": |
| 46 | 18 | version "2.1.4" |
| 47 | resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-2.1.4.tgz#388a269f0f25c1b6adc317b5a2c55714894c70ad" | |
| 19 | resolved "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.4.tgz" | |
| 48 | 20 | integrity sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ== |
| 49 | 21 | dependencies: |
| 50 | 22 | ajv "^6.12.4" |
| ... | ... | @@ -59,12 +31,12 @@ |
| 59 | 31 | |
| 60 | 32 | "@eslint/js@8.57.1": |
| 61 | 33 | version "8.57.1" |
| 62 | resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.57.1.tgz#de633db3ec2ef6a3c89e2f19038063e8a122e2c2" | |
| 34 | resolved "https://registry.npmjs.org/@eslint/js/-/js-8.57.1.tgz" | |
| 63 | 35 | integrity sha512-d9zaMRSTIKDLhctzH12MtXvJKSSUhaHcjV+2Z+GK+EEY7XKpP5yR4x+N3TAcHTcu963nIr+TMcCb4DBCYX1z6Q== |
| 64 | 36 | |
| 65 | 37 | "@humanwhocodes/config-array@^0.13.0": |
| 66 | 38 | version "0.13.0" |
| 67 | resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.13.0.tgz#fb907624df3256d04b9aa2df50d7aa97ec648748" | |
| 39 | resolved "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.13.0.tgz" | |
| 68 | 40 | integrity sha512-DZLEEqFWQFiyK6h5YIeynKx7JlvCYWL0cImfSRXZ9l4Sg2efkFGTuFf6vzXjK1cq6IYkU+Eg/JizXw+TD2vRNw== |
| 69 | 41 | dependencies: |
| 70 | 42 | "@humanwhocodes/object-schema" "^2.0.3" |
| ... | ... | @@ -73,17 +45,17 @@ |
| 73 | 45 | |
| 74 | 46 | "@humanwhocodes/module-importer@^1.0.1": |
| 75 | 47 | version "1.0.1" |
| 76 | resolved "https://registry.yarnpkg.com/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz#af5b2691a22b44be847b0ca81641c5fb6ad0172c" | |
| 48 | resolved "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz" | |
| 77 | 49 | integrity sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA== |
| 78 | 50 | |
| 79 | 51 | "@humanwhocodes/object-schema@^2.0.3": |
| 80 | 52 | version "2.0.3" |
| 81 | resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz#4a2868d75d6d6963e423bcf90b7fd1be343409d3" | |
| 53 | resolved "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz" | |
| 82 | 54 | integrity sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA== |
| 83 | 55 | |
| 84 | 56 | "@nodelib/fs.scandir@2.1.5": |
| 85 | 57 | version "2.1.5" |
| 86 | resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5" | |
| 58 | resolved "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz" | |
| 87 | 59 | integrity sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g== |
| 88 | 60 | dependencies: |
| 89 | 61 | "@nodelib/fs.stat" "2.0.5" |
| ... | ... | @@ -91,93 +63,44 @@ |
| 91 | 63 | |
| 92 | 64 | "@nodelib/fs.stat@2.0.5", "@nodelib/fs.stat@^2.0.2": |
| 93 | 65 | version "2.0.5" |
| 94 | resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz#5bd262af94e9d25bd1e71b05deed44876a222e8b" | |
| 66 | resolved "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz" | |
| 95 | 67 | integrity sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A== |
| 96 | 68 | |
| 97 | 69 | "@nodelib/fs.walk@^1.2.3", "@nodelib/fs.walk@^1.2.8": |
| 98 | 70 | version "1.2.8" |
| 99 | resolved "https://registry.yarnpkg.com/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz#e95737e8bb6746ddedf69c556953494f196fe69a" | |
| 71 | resolved "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz" | |
| 100 | 72 | integrity sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg== |
| 101 | 73 | dependencies: |
| 102 | 74 | "@nodelib/fs.scandir" "2.1.5" |
| 103 | 75 | fastq "^1.6.0" |
| 104 | 76 | |
| 105 | "@puppeteer/browsers@2.13.0": | |
| 106 | version "2.13.0" | |
| 107 | resolved "https://registry.yarnpkg.com/@puppeteer/browsers/-/browsers-2.13.0.tgz#10f980c6d65efeff77f8a3cac6e1a7ac10604500" | |
| 108 | integrity sha512-46BZJYJjc/WwmKjsvDFykHtXrtomsCIrwYQPOP7VfMJoZY2bsDF9oROBABR3paDjDcmkUye1Pb1BqdcdiipaWA== | |
| 77 | "@puppeteer/browsers@3.0.4": | |
| 78 | version "3.0.4" | |
| 79 | resolved "https://registry.npmjs.org/@puppeteer/browsers/-/browsers-3.0.4.tgz" | |
| 80 | integrity sha512-HGM8iAmGTf+Y7t0373szVbTmt3d7vPkYL/1bpOkOFO0YUYLgSeuYBCzESklogNPvOBnZ/MRD5f07OkpqH1trtA== | |
| 109 | 81 | dependencies: |
| 110 | debug "^4.4.3" | |
| 111 | extract-zip "^2.0.1" | |
| 112 | progress "^2.0.3" | |
| 113 | proxy-agent "^6.5.0" | |
| 114 | semver "^7.7.4" | |
| 115 | tar-fs "^3.1.1" | |
| 82 | modern-tar "^0.7.6" | |
| 116 | 83 | yargs "^17.7.2" |
| 117 | 84 | |
| 118 | "@so-ric/colorspace@^1.1.6": | |
| 119 | version "1.1.6" | |
| 120 | resolved "https://registry.yarnpkg.com/@so-ric/colorspace/-/colorspace-1.1.6.tgz#62515d8b9f27746b76950a83bde1af812d91923b" | |
| 121 | integrity sha512-/KiKkpHNOBgkFJwu9sh48LkHSMYGyuTcSFK/qMBdnOAlrRJzRSXAOFB5qwzaVQuDl8wAvHVMkaASQDReTahxuw== | |
| 122 | dependencies: | |
| 123 | color "^5.0.2" | |
| 124 | text-hex "1.0.x" | |
| 125 | ||
| 126 | "@tootallnate/quickjs-emscripten@^0.23.0": | |
| 127 | version "0.23.0" | |
| 128 | resolved "https://registry.yarnpkg.com/@tootallnate/quickjs-emscripten/-/quickjs-emscripten-0.23.0.tgz#db4ecfd499a9765ab24002c3b696d02e6d32a12c" | |
| 129 | integrity sha512-C5Mc6rdnsaJDjO3UpGW/CQTHtCKaYlScZTly4JIu97Jxo/odCiH0ITnDXSJPTOrEKk/ycSZ0AOgTmkDtkOsvIA== | |
| 130 | ||
| 131 | "@types/node@*": | |
| 132 | version "24.10.0" | |
| 133 | resolved "https://registry.yarnpkg.com/@types/node/-/node-24.10.0.tgz#6b79086b0dfc54e775a34ba8114dcc4e0221f31f" | |
| 134 | integrity sha512-qzQZRBqkFsYyaSWXuEHc2WR9c0a0CXwiE5FWUvn7ZM+vdy1uZLfCunD38UzhuB7YN/J11ndbDBcTmOdxJo9Q7A== | |
| 135 | dependencies: | |
| 136 | undici-types "~7.16.0" | |
| 137 | ||
| 138 | "@types/triple-beam@^1.3.2": | |
| 139 | version "1.3.5" | |
| 140 | resolved "https://registry.yarnpkg.com/@types/triple-beam/-/triple-beam-1.3.5.tgz#74fef9ffbaa198eb8b588be029f38b00299caa2c" | |
| 141 | integrity sha512-6WaYesThRMCl19iryMYP7/x2OVgCtbIVflDGFpWnb9irXI3UjYE4AzmYuiUKY1AJstGijoY+MgUszMgRxIYTYw== | |
| 142 | ||
| 143 | "@types/yauzl@^2.9.1": | |
| 144 | version "2.10.3" | |
| 145 | resolved "https://registry.yarnpkg.com/@types/yauzl/-/yauzl-2.10.3.tgz#e9b2808b4f109504a03cda958259876f61017999" | |
| 146 | integrity sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q== | |
| 147 | dependencies: | |
| 148 | "@types/node" "*" | |
| 149 | ||
| 150 | 85 | "@ungap/structured-clone@^1.2.0": |
| 151 | version "1.3.0" | |
| 152 | resolved "https://registry.yarnpkg.com/@ungap/structured-clone/-/structured-clone-1.3.0.tgz#d06bbb384ebcf6c505fde1c3d0ed4ddffe0aaff8" | |
| 153 | integrity sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g== | |
| 86 | version "1.3.1" | |
| 87 | resolved "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.1.tgz" | |
| 88 | integrity sha512-mUFwbeTqrVgDQxFveS+df2yfap6iuP20NAKAsBt5jDEoOTDew+zwLAOilHCeQJOVSvmgCX4ogqIrA0mnyr08yQ== | |
| 154 | 89 | |
| 155 | 90 | acorn-jsx@^5.3.2: |
| 156 | 91 | version "5.3.2" |
| 157 | resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" | |
| 92 | resolved "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz" | |
| 158 | 93 | integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ== |
| 159 | 94 | |
| 160 | acorn-walk@^8.3.4: | |
| 161 | version "8.3.4" | |
| 162 | resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.3.4.tgz#794dd169c3977edf4ba4ea47583587c5866236b7" | |
| 163 | integrity sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g== | |
| 164 | dependencies: | |
| 165 | acorn "^8.11.0" | |
| 166 | ||
| 167 | acorn@8.15.0, acorn@^8.11.0, acorn@^8.9.0: | |
| 168 | version "8.15.0" | |
| 169 | resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.15.0.tgz#a360898bc415edaac46c8241f6383975b930b816" | |
| 170 | integrity sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg== | |
| 171 | ||
| 172 | agent-base@^7.1.0, agent-base@^7.1.2: | |
| 173 | version "7.1.4" | |
| 174 | resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-7.1.4.tgz#e3cd76d4c548ee895d3c3fd8dc1f6c5b9032e7a8" | |
| 175 | integrity sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ== | |
| 95 | acorn@8.16.0, acorn@^8.9.0: | |
| 96 | version "8.16.0" | |
| 97 | resolved "https://registry.npmjs.org/acorn/-/acorn-8.16.0.tgz" | |
| 98 | integrity sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw== | |
| 176 | 99 | |
| 177 | 100 | ajv@^6.12.4: |
| 178 | version "6.12.6" | |
| 179 | resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" | |
| 180 | integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== | |
| 101 | version "6.15.0" | |
| 102 | resolved "https://registry.npmjs.org/ajv/-/ajv-6.15.0.tgz" | |
| 103 | integrity sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw== | |
| 181 | 104 | dependencies: |
| 182 | 105 | fast-deep-equal "^3.1.1" |
| 183 | 106 | fast-json-stable-stringify "^2.0.0" |
| ... | ... | @@ -186,165 +109,75 @@ ajv@^6.12.4: |
| 186 | 109 | |
| 187 | 110 | ansi-regex@^5.0.1: |
| 188 | 111 | version "5.0.1" |
| 189 | resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" | |
| 112 | resolved "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz" | |
| 190 | 113 | integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== |
| 191 | 114 | |
| 192 | 115 | ansi-styles@^4.0.0, ansi-styles@^4.1.0: |
| 193 | 116 | version "4.3.0" |
| 194 | resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" | |
| 117 | resolved "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz" | |
| 195 | 118 | integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== |
| 196 | 119 | dependencies: |
| 197 | 120 | color-convert "^2.0.1" |
| 198 | 121 | |
| 199 | 122 | argparse@^2.0.1: |
| 200 | 123 | version "2.0.1" |
| 201 | resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" | |
| 124 | resolved "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz" | |
| 202 | 125 | integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== |
| 203 | 126 | |
| 204 | ast-types@^0.13.4: | |
| 205 | version "0.13.4" | |
| 206 | resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.13.4.tgz#ee0d77b343263965ecc3fb62da16e7222b2b6782" | |
| 207 | integrity sha512-x1FCFnFifvYDDzTaLII71vG5uvDwgtmDTEVWAxrgeiR8VjMONcCXJx7E+USjDtHlwFmt9MysbqgF9b9Vjr6w+w== | |
| 208 | dependencies: | |
| 209 | tslib "^2.0.1" | |
| 210 | ||
| 211 | async@^3.2.3: | |
| 212 | version "3.2.6" | |
| 213 | resolved "https://registry.yarnpkg.com/async/-/async-3.2.6.tgz#1b0728e14929d51b85b449b7f06e27c1145e38ce" | |
| 214 | integrity sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA== | |
| 215 | ||
| 216 | b4a@^1.6.4: | |
| 217 | version "1.7.3" | |
| 218 | resolved "https://registry.yarnpkg.com/b4a/-/b4a-1.7.3.tgz#24cf7ccda28f5465b66aec2bac69e32809bf112f" | |
| 219 | integrity sha512-5Q2mfq2WfGuFp3uS//0s6baOJLMoVduPYVeNmDYxu5OUA1/cBfvr2RIS7vi62LdNj/urk1hfmj867I3qt6uZ7Q== | |
| 220 | ||
| 221 | 127 | balanced-match@^1.0.0: |
| 222 | 128 | version "1.0.2" |
| 223 | resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" | |
| 129 | resolved "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz" | |
| 224 | 130 | integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== |
| 225 | 131 | |
| 226 | bare-events@^2.5.4, bare-events@^2.7.0: | |
| 227 | version "2.8.2" | |
| 228 | resolved "https://registry.yarnpkg.com/bare-events/-/bare-events-2.8.2.tgz#7b3e10bd8e1fc80daf38bb516921678f566ab89f" | |
| 229 | integrity sha512-riJjyv1/mHLIPX4RwiK+oW9/4c3TEUeORHKefKAKnZ5kyslbN+HXowtbaVEqt4IMUB7OXlfixcs6gsFeo/jhiQ== | |
| 230 | ||
| 231 | bare-fs@^4.0.1: | |
| 232 | version "4.5.0" | |
| 233 | resolved "https://registry.yarnpkg.com/bare-fs/-/bare-fs-4.5.0.tgz#f3227b4bc79a65ca7e91a1c05be5919c7c7d8340" | |
| 234 | integrity sha512-GljgCjeupKZJNetTqxKaQArLK10vpmK28or0+RwWjEl5Rk+/xG3wkpmkv+WrcBm3q1BwHKlnhXzR8O37kcvkXQ== | |
| 235 | dependencies: | |
| 236 | bare-events "^2.5.4" | |
| 237 | bare-path "^3.0.0" | |
| 238 | bare-stream "^2.6.4" | |
| 239 | bare-url "^2.2.2" | |
| 240 | fast-fifo "^1.3.2" | |
| 241 | ||
| 242 | bare-os@^3.0.1: | |
| 243 | version "3.6.2" | |
| 244 | resolved "https://registry.yarnpkg.com/bare-os/-/bare-os-3.6.2.tgz#b3c4f5ad5e322c0fd0f3c29fc97d19009e2796e5" | |
| 245 | integrity sha512-T+V1+1srU2qYNBmJCXZkUY5vQ0B4FSlL3QDROnKQYOqeiQR8UbjNHlPa+TIbM4cuidiN9GaTaOZgSEgsvPbh5A== | |
| 246 | ||
| 247 | bare-path@^3.0.0: | |
| 248 | version "3.0.0" | |
| 249 | resolved "https://registry.yarnpkg.com/bare-path/-/bare-path-3.0.0.tgz#b59d18130ba52a6af9276db3e96a2e3d3ea52178" | |
| 250 | integrity sha512-tyfW2cQcB5NN8Saijrhqn0Zh7AnFNsnczRcuWODH0eYAXBsJ5gVxAUuNr7tsHSC6IZ77cA0SitzT+s47kot8Mw== | |
| 251 | dependencies: | |
| 252 | bare-os "^3.0.1" | |
| 253 | ||
| 254 | bare-stream@^2.6.4: | |
| 255 | version "2.7.0" | |
| 256 | resolved "https://registry.yarnpkg.com/bare-stream/-/bare-stream-2.7.0.tgz#5b9e7dd0a354d06e82d6460c426728536c35d789" | |
| 257 | integrity sha512-oyXQNicV1y8nc2aKffH+BUHFRXmx6VrPzlnaEvMhram0nPBrKcEdcyBg5r08D0i8VxngHFAiVyn1QKXpSG0B8A== | |
| 258 | dependencies: | |
| 259 | streamx "^2.21.0" | |
| 260 | ||
| 261 | bare-url@^2.2.2: | |
| 262 | version "2.3.2" | |
| 263 | resolved "https://registry.yarnpkg.com/bare-url/-/bare-url-2.3.2.tgz#4aef382efa662b2180a6fe4ca07a71b39bdf7ca3" | |
| 264 | integrity sha512-ZMq4gd9ngV5aTMa5p9+UfY0b3skwhHELaDkhEHetMdX0LRkW9kzaym4oo/Eh+Ghm0CCDuMTsRIGM/ytUc1ZYmw== | |
| 265 | dependencies: | |
| 266 | bare-path "^3.0.0" | |
| 267 | ||
| 268 | baseline-browser-mapping@^2.8.19: | |
| 269 | version "2.8.25" | |
| 270 | resolved "https://registry.yarnpkg.com/baseline-browser-mapping/-/baseline-browser-mapping-2.8.25.tgz#947dc6f81778e0fa0424a2ab9ea09a3033e71109" | |
| 271 | integrity sha512-2NovHVesVF5TXefsGX1yzx1xgr7+m9JQenvz6FQY3qd+YXkKkYiv+vTCc7OriP9mcDZpTC5mAOYN4ocd29+erA== | |
| 272 | ||
| 273 | basic-ftp@^5.0.2: | |
| 274 | version "5.0.5" | |
| 275 | resolved "https://registry.yarnpkg.com/basic-ftp/-/basic-ftp-5.0.5.tgz#14a474f5fffecca1f4f406f1c26b18f800225ac0" | |
| 276 | integrity sha512-4Bcg1P8xhUuqcii/S0Z9wiHIrQVPMermM1any+MX5GeGD7faD3/msQUDGLol9wOcz4/jbg/WJnGqoJF6LiBdtg== | |
| 277 | ||
| 278 | 132 | brace-expansion@^1.1.7: |
| 279 | version "1.1.12" | |
| 280 | resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.12.tgz#ab9b454466e5a8cc3a187beaad580412a9c5b843" | |
| 281 | integrity sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg== | |
| 133 | version "1.1.15" | |
| 134 | resolved "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.15.tgz" | |
| 135 | integrity sha512-EwOCDEex4quD37XhqM3omwtMoJjr//isUZz1JopUNWms+4Z2ViyM/k1YIRePpoVNnQhENnxtFjLaxNHrT7xIUg== | |
| 282 | 136 | dependencies: |
| 283 | 137 | balanced-match "^1.0.0" |
| 284 | 138 | concat-map "0.0.1" |
| 285 | 139 | |
| 286 | 140 | braces@^3.0.3: |
| 287 | 141 | version "3.0.3" |
| 288 | resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.3.tgz#490332f40919452272d55a8480adc0c441358789" | |
| 142 | resolved "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz" | |
| 289 | 143 | integrity sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA== |
| 290 | 144 | dependencies: |
| 291 | 145 | fill-range "^7.1.1" |
| 292 | 146 | |
| 293 | browser-ui-test@^0.23.5: | |
| 294 | version "0.23.5" | |
| 295 | resolved "https://registry.yarnpkg.com/browser-ui-test/-/browser-ui-test-0.23.5.tgz#f8fab778a1e00f339f53bb44e76ad14c5b57ce4f" | |
| 296 | integrity sha512-S4ztxfOa3vSqV86xS6huIrA8MKSrSqfZUFJfAgEN29U17eRtrYQt/ZGKYJBUP5sv5UYH6ZgnE05z8+Werm/8sw== | |
| 147 | browser-ui-test@^0.24.0: | |
| 148 | version "0.24.0" | |
| 149 | resolved "https://registry.npmjs.org/browser-ui-test/-/browser-ui-test-0.24.0.tgz" | |
| 150 | integrity sha512-jVpAdq/M1cCHG/2K6pAS8NUYJ6BcNSHune72JOheeoASk+oLuGcWcY1SalYAdkWet3dlyfUSyKKtq+DDjYgdVg== | |
| 297 | 151 | dependencies: |
| 298 | 152 | css-unit-converter "^1.1.2" |
| 299 | 153 | pngjs "^3.4.0" |
| 300 | puppeteer "^24.31.0" | |
| 154 | puppeteer "^25.1.0" | |
| 301 | 155 | readline-sync "^1.4.10" |
| 302 | 156 | |
| 303 | browserslist@^4.23.3: | |
| 304 | version "4.27.0" | |
| 305 | resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.27.0.tgz#755654744feae978fbb123718b2f139bc0fa6697" | |
| 306 | integrity sha512-AXVQwdhot1eqLihwasPElhX2tAZiBjWdJ9i/Zcj2S6QYIjkx62OKSfnobkriB81C3l4w0rVy3Nt4jaTBltYEpw== | |
| 307 | dependencies: | |
| 308 | baseline-browser-mapping "^2.8.19" | |
| 309 | caniuse-lite "^1.0.30001751" | |
| 310 | electron-to-chromium "^1.5.238" | |
| 311 | node-releases "^2.0.26" | |
| 312 | update-browserslist-db "^1.1.4" | |
| 313 | ||
| 314 | buffer-crc32@~0.2.3: | |
| 315 | version "0.2.13" | |
| 316 | resolved "https://registry.yarnpkg.com/buffer-crc32/-/buffer-crc32-0.2.13.tgz#0d333e3f00eac50aa1454abd30ef8c2a5d9a7242" | |
| 317 | integrity sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ== | |
| 318 | ||
| 319 | 157 | callsites@^3.0.0: |
| 320 | 158 | version "3.1.0" |
| 321 | resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" | |
| 159 | resolved "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz" | |
| 322 | 160 | integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== |
| 323 | 161 | |
| 324 | caniuse-lite@^1.0.30001751: | |
| 325 | version "1.0.30001754" | |
| 326 | resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001754.tgz#7758299d9a72cce4e6b038788a15b12b44002759" | |
| 327 | integrity sha512-x6OeBXueoAceOmotzx3PO4Zpt4rzpeIFsSr6AAePTZxSkXiYDUmpypEl7e2+8NCd9bD7bXjqyef8CJYPC1jfxg== | |
| 328 | ||
| 329 | 162 | chalk@^4.0.0: |
| 330 | 163 | version "4.1.2" |
| 331 | resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" | |
| 164 | resolved "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz" | |
| 332 | 165 | integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== |
| 333 | 166 | dependencies: |
| 334 | 167 | ansi-styles "^4.1.0" |
| 335 | 168 | supports-color "^7.1.0" |
| 336 | 169 | |
| 337 | chromium-bidi@14.0.0: | |
| 338 | version "14.0.0" | |
| 339 | resolved "https://registry.yarnpkg.com/chromium-bidi/-/chromium-bidi-14.0.0.tgz#15a12ab083ae519a49a724e94994ca0a9ced9c8e" | |
| 340 | integrity sha512-9gYlLtS6tStdRWzrtXaTMnqcM4dudNegMXJxkR0I/CXObHalYeYcAMPrL19eroNZHtJ8DQmu1E+ZNOYu/IXMXw== | |
| 170 | chromium-bidi@16.0.1: | |
| 171 | version "16.0.1" | |
| 172 | resolved "https://registry.npmjs.org/chromium-bidi/-/chromium-bidi-16.0.1.tgz" | |
| 173 | integrity sha512-J63PGu/9PpeCwLIcKYyzWP6yaVL5pxuBc0shlYCYM8BaAkmlwiQboXO1iNbOgSDbVklEyYFfNEcHD8oOAWacUA== | |
| 341 | 174 | dependencies: |
| 342 | 175 | mitt "^3.0.1" |
| 343 | 176 | zod "^3.24.1" |
| 344 | 177 | |
| 345 | 178 | cliui@^8.0.1: |
| 346 | 179 | version "8.0.1" |
| 347 | resolved "https://registry.yarnpkg.com/cliui/-/cliui-8.0.1.tgz#0c04b075db02cbfe60dc8e6cf2f5486b1a3608aa" | |
| 180 | resolved "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz" | |
| 348 | 181 | integrity sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ== |
| 349 | 182 | dependencies: |
| 350 | 183 | string-width "^4.2.0" |
| ... | ... | @@ -353,66 +186,24 @@ cliui@^8.0.1: |
| 353 | 186 | |
| 354 | 187 | color-convert@^2.0.1: |
| 355 | 188 | version "2.0.1" |
| 356 | resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" | |
| 189 | resolved "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz" | |
| 357 | 190 | integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== |
| 358 | 191 | dependencies: |
| 359 | 192 | color-name "~1.1.4" |
| 360 | 193 | |
| 361 | color-convert@^3.0.1: | |
| 362 | version "3.1.2" | |
| 363 | resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-3.1.2.tgz#cef9e0fd4cb90b07c14697b3fa70af9d7f4870f1" | |
| 364 | integrity sha512-UNqkvCDXstVck3kdowtOTWROIJQwafjOfXSmddoDrXo4cewMKmusCeF22Q24zvjR8nwWib/3S/dfyzPItPEiJg== | |
| 365 | dependencies: | |
| 366 | color-name "^2.0.0" | |
| 367 | ||
| 368 | color-name@^2.0.0: | |
| 369 | version "2.0.2" | |
| 370 | resolved "https://registry.yarnpkg.com/color-name/-/color-name-2.0.2.tgz#85054825a23e6d6f81d3503f660c4c4a2a15f04f" | |
| 371 | integrity sha512-9vEt7gE16EW7Eu7pvZnR0abW9z6ufzhXxGXZEVU9IqPdlsUiMwJeJfRtq0zePUmnbHGT9zajca7mX8zgoayo4A== | |
| 372 | ||
| 373 | 194 | color-name@~1.1.4: |
| 374 | 195 | version "1.1.4" |
| 375 | resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" | |
| 196 | resolved "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz" | |
| 376 | 197 | integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== |
| 377 | 198 | |
| 378 | color-string@^2.0.0: | |
| 379 | version "2.1.2" | |
| 380 | resolved "https://registry.yarnpkg.com/color-string/-/color-string-2.1.2.tgz#db1dd52414cc9037ada8fa7d936b8e9f6c3366c9" | |
| 381 | integrity sha512-RxmjYxbWemV9gKu4zPgiZagUxbH3RQpEIO77XoSSX0ivgABDZ+h8Zuash/EMFLTI4N9QgFPOJ6JQpPZKFxa+dA== | |
| 382 | dependencies: | |
| 383 | color-name "^2.0.0" | |
| 384 | ||
| 385 | color@^5.0.2: | |
| 386 | version "5.0.2" | |
| 387 | resolved "https://registry.yarnpkg.com/color/-/color-5.0.2.tgz#712ec894007ab27b37207732d182784e001b4a3d" | |
| 388 | integrity sha512-e2hz5BzbUPcYlIRHo8ieAhYgoajrJr+hWoceg6E345TPsATMUKqDgzt8fSXZJJbxfpiPzkWyphz8yn8At7q3fA== | |
| 389 | dependencies: | |
| 390 | color-convert "^3.0.1" | |
| 391 | color-string "^2.0.0" | |
| 392 | ||
| 393 | commander@14.0.1: | |
| 394 | version "14.0.1" | |
| 395 | resolved "https://registry.yarnpkg.com/commander/-/commander-14.0.1.tgz#2f9225c19e6ebd0dc4404dd45821b2caa17ea09b" | |
| 396 | integrity sha512-2JkV3gUZUVrbNA+1sjBOYLsMZ5cEEl8GTFP2a4AVz5hvasAMCQ1D2l2le/cX+pV4N6ZU17zjUahLpIXRrnWL8A== | |
| 397 | ||
| 398 | 199 | concat-map@0.0.1: |
| 399 | 200 | version "0.0.1" |
| 400 | resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" | |
| 201 | resolved "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz" | |
| 401 | 202 | integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== |
| 402 | 203 | |
| 403 | cosmiconfig@^9.0.0: | |
| 404 | version "9.0.0" | |
| 405 | resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-9.0.0.tgz#34c3fc58287b915f3ae905ab6dc3de258b55ad9d" | |
| 406 | integrity sha512-itvL5h8RETACmOTFc4UfIyB2RfEHi71Ax6E/PivVxq9NseKbOWpeyHEOIbmAw1rs8Ak0VursQNww7lf7YtUwzg== | |
| 407 | dependencies: | |
| 408 | env-paths "^2.2.1" | |
| 409 | import-fresh "^3.3.0" | |
| 410 | js-yaml "^4.1.0" | |
| 411 | parse-json "^5.2.0" | |
| 412 | ||
| 413 | 204 | cross-spawn@^7.0.2: |
| 414 | 205 | version "7.0.6" |
| 415 | resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.6.tgz#8a58fe78f00dcd70c370451759dfbfaf03e8ee9f" | |
| 206 | resolved "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz" | |
| 416 | 207 | integrity sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA== |
| 417 | 208 | dependencies: |
| 418 | 209 | path-key "^3.1.0" |
| ... | ... | @@ -421,121 +212,59 @@ cross-spawn@^7.0.2: |
| 421 | 212 | |
| 422 | 213 | css-unit-converter@^1.1.2: |
| 423 | 214 | version "1.1.2" |
| 424 | resolved "https://registry.yarnpkg.com/css-unit-converter/-/css-unit-converter-1.1.2.tgz#4c77f5a1954e6dbff60695ecb214e3270436ab21" | |
| 215 | resolved "https://registry.npmjs.org/css-unit-converter/-/css-unit-converter-1.1.2.tgz" | |
| 425 | 216 | integrity sha512-IiJwMC8rdZE0+xiEZHeru6YoONC4rfPMqGm2W85jMIbkFvv5nFTwJVFHam2eFrN6txmoUYFAFXiv8ICVeTO0MA== |
| 426 | 217 | |
| 427 | data-uri-to-buffer@^6.0.2: | |
| 428 | version "6.0.2" | |
| 429 | resolved "https://registry.yarnpkg.com/data-uri-to-buffer/-/data-uri-to-buffer-6.0.2.tgz#8a58bb67384b261a38ef18bea1810cb01badd28b" | |
| 430 | integrity sha512-7hvf7/GW8e86rW0ptuwS3OcBGDjIi6SZva7hCyWC0yYry2cOPmLIjXAUHI6DK2HsnwJd9ifmt57i8eV2n4YNpw== | |
| 431 | ||
| 432 | debug@4, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2, debug@^4.3.4, debug@^4.4.3: | |
| 218 | debug@^4.3.1, debug@^4.3.2: | |
| 433 | 219 | version "4.4.3" |
| 434 | resolved "https://registry.yarnpkg.com/debug/-/debug-4.4.3.tgz#c6ae432d9bd9662582fce08709b038c58e9e3d6a" | |
| 220 | resolved "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz" | |
| 435 | 221 | integrity sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA== |
| 436 | 222 | dependencies: |
| 437 | 223 | ms "^2.1.3" |
| 438 | 224 | |
| 439 | 225 | deep-is@^0.1.3: |
| 440 | 226 | version "0.1.4" |
| 441 | resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.4.tgz#a6f2dce612fadd2ef1f519b73551f17e85199831" | |
| 227 | resolved "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz" | |
| 442 | 228 | integrity sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ== |
| 443 | 229 | |
| 444 | degenerator@^5.0.0: | |
| 445 | version "5.0.1" | |
| 446 | resolved "https://registry.yarnpkg.com/degenerator/-/degenerator-5.0.1.tgz#9403bf297c6dad9a1ece409b37db27954f91f2f5" | |
| 447 | integrity sha512-TllpMR/t0M5sqCXfj85i4XaAzxmS5tVA16dqvdkMwGmzI+dXLXnw3J+3Vdv7VKw+ThlTMboK6i9rnZ6Nntj5CQ== | |
| 448 | dependencies: | |
| 449 | ast-types "^0.13.4" | |
| 450 | escodegen "^2.1.0" | |
| 451 | esprima "^4.0.1" | |
| 452 | ||
| 453 | devtools-protocol@0.0.1581282: | |
| 454 | version "0.0.1581282" | |
| 455 | resolved "https://registry.yarnpkg.com/devtools-protocol/-/devtools-protocol-0.0.1581282.tgz#7f289b837e052ad04eb16e9575877801c2b3716c" | |
| 456 | integrity sha512-nv7iKtNZQshSW2hKzYNr46nM/Cfh5SEvE2oV0/SEGgc9XupIY5ggf84Cz8eJIkBce7S3bmTAauFD6aysMpnqsQ== | |
| 230 | devtools-protocol@0.0.1624250: | |
| 231 | version "0.0.1624250" | |
| 232 | resolved "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1624250.tgz" | |
| 233 | integrity sha512-YFAat/lOiIk0ARmBweG+ygrEcbZrq5B9urRyUoeQKp53MlidHXE2TmTbxKcaXoQj7u/aX+jebDO4BW55rs0WwA== | |
| 457 | 234 | |
| 458 | 235 | doctrine@^3.0.0: |
| 459 | 236 | version "3.0.0" |
| 460 | resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-3.0.0.tgz#addebead72a6574db783639dc87a121773973961" | |
| 237 | resolved "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz" | |
| 461 | 238 | integrity sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w== |
| 462 | 239 | dependencies: |
| 463 | 240 | esutils "^2.0.2" |
| 464 | 241 | |
| 465 | electron-to-chromium@^1.5.238: | |
| 466 | version "1.5.249" | |
| 467 | resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.249.tgz#e4fc3a3e60bb347361e4e876bb31903a9132a447" | |
| 468 | integrity sha512-5vcfL3BBe++qZ5kuFhD/p8WOM1N9m3nwvJPULJx+4xf2usSlZFJ0qoNYO2fOX4hi3ocuDcmDobtA+5SFr4OmBg== | |
| 469 | ||
| 470 | 242 | emoji-regex@^8.0.0: |
| 471 | 243 | version "8.0.0" |
| 472 | resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" | |
| 244 | resolved "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz" | |
| 473 | 245 | integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== |
| 474 | 246 | |
| 475 | enabled@2.0.x: | |
| 476 | version "2.0.0" | |
| 477 | resolved "https://registry.yarnpkg.com/enabled/-/enabled-2.0.0.tgz#f9dd92ec2d6f4bbc0d5d1e64e21d61cd4665e7c2" | |
| 478 | integrity sha512-AKrN98kuwOzMIdAizXGI86UFBoo26CL21UM763y1h/GMSJ4/OHU9k2YlsmBpyScFo/wbLzWQJBMCW4+IO3/+OQ== | |
| 479 | ||
| 480 | end-of-stream@^1.1.0: | |
| 481 | version "1.4.5" | |
| 482 | resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.5.tgz#7344d711dea40e0b74abc2ed49778743ccedb08c" | |
| 483 | integrity sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg== | |
| 484 | dependencies: | |
| 485 | once "^1.4.0" | |
| 486 | ||
| 487 | env-paths@^2.2.1: | |
| 488 | version "2.2.1" | |
| 489 | resolved "https://registry.yarnpkg.com/env-paths/-/env-paths-2.2.1.tgz#420399d416ce1fbe9bc0a07c62fa68d67fd0f8f2" | |
| 490 | integrity sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A== | |
| 491 | ||
| 492 | error-ex@^1.3.1: | |
| 493 | version "1.3.4" | |
| 494 | resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.4.tgz#b3a8d8bb6f92eecc1629e3e27d3c8607a8a32414" | |
| 495 | integrity sha512-sqQamAnR14VgCr1A618A3sGrygcpK+HEbenA/HiEAkkUwcZIIB/tgWqHFxWgOyDh4nB4JCRimh79dR5Ywc9MDQ== | |
| 496 | dependencies: | |
| 497 | is-arrayish "^0.2.1" | |
| 498 | ||
| 499 | 247 | es-check@^9.4.4: |
| 500 | version "9.4.4" | |
| 501 | resolved "https://registry.yarnpkg.com/es-check/-/es-check-9.4.4.tgz#1dfbdf9f0bac746fee096ab1328841d11fa9a4f0" | |
| 502 | integrity sha512-Ppp6r1diw1jy0t5uQX47HN3JqvosoAymZshdimrwpxCY1GQfZvqTqb9tHiiDbkm+aqGLdVDCZoL9okue7tdXZw== | |
| 248 | version "9.6.4" | |
| 249 | resolved "https://registry.npmjs.org/es-check/-/es-check-9.6.4.tgz" | |
| 250 | integrity sha512-tZq2twJz5EVZk4THqPt9Nm+/EZbwYspus9bs86WLQ6cG08Du75dHB/1ZXyRVGRbeJoxKhsFXNWxCQrOISfuC3w== | |
| 503 | 251 | dependencies: |
| 504 | acorn "8.15.0" | |
| 505 | acorn-walk "^8.3.4" | |
| 506 | browserslist "^4.23.3" | |
| 507 | commander "14.0.1" | |
| 508 | fast-brake "^0.1.4" | |
| 252 | acorn "8.16.0" | |
| 509 | 253 | fast-glob "^3.3.3" |
| 510 | lilconfig "^3.1.3" | |
| 511 | source-map "^0.7.4" | |
| 512 | supports-color "8.1.1" | |
| 513 | winston "3.17.0" | |
| 514 | 254 | |
| 515 | escalade@^3.1.1, escalade@^3.2.0: | |
| 255 | escalade@^3.1.1: | |
| 516 | 256 | version "3.2.0" |
| 517 | resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.2.0.tgz#011a3f69856ba189dffa7dc8fcce99d2a87903e5" | |
| 257 | resolved "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz" | |
| 518 | 258 | integrity sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA== |
| 519 | 259 | |
| 520 | 260 | escape-string-regexp@^4.0.0: |
| 521 | 261 | version "4.0.0" |
| 522 | resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" | |
| 262 | resolved "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz" | |
| 523 | 263 | integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== |
| 524 | 264 | |
| 525 | escodegen@^2.1.0: | |
| 526 | version "2.1.0" | |
| 527 | resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-2.1.0.tgz#ba93bbb7a43986d29d6041f99f5262da773e2e17" | |
| 528 | integrity sha512-2NlIDTwUWJN0mRPQOdtQBzbUHvdGY2P1VXSyU83Q3xKxM7WHX2Ql8dKq782Q9TgQUNOLEzEYu9bzLNj1q88I5w== | |
| 529 | dependencies: | |
| 530 | esprima "^4.0.1" | |
| 531 | estraverse "^5.2.0" | |
| 532 | esutils "^2.0.2" | |
| 533 | optionalDependencies: | |
| 534 | source-map "~0.6.1" | |
| 535 | ||
| 536 | 265 | eslint-scope@^7.2.2: |
| 537 | 266 | version "7.2.2" |
| 538 | resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-7.2.2.tgz#deb4f92563390f32006894af62a22dba1c46423f" | |
| 267 | resolved "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz" | |
| 539 | 268 | integrity sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg== |
| 540 | 269 | dependencies: |
| 541 | 270 | esrecurse "^4.3.0" |
| ... | ... | @@ -543,12 +272,12 @@ eslint-scope@^7.2.2: |
| 543 | 272 | |
| 544 | 273 | eslint-visitor-keys@^3.4.1, eslint-visitor-keys@^3.4.3: |
| 545 | 274 | version "3.4.3" |
| 546 | resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz#0cd72fe8550e3c2eae156a96a4dddcd1c8ac5800" | |
| 275 | resolved "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz" | |
| 547 | 276 | integrity sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag== |
| 548 | 277 | |
| 549 | 278 | eslint@^8.57.1: |
| 550 | 279 | version "8.57.1" |
| 551 | resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.57.1.tgz#7df109654aba7e3bbe5c8eae533c5e461d3c6ca9" | |
| 280 | resolved "https://registry.npmjs.org/eslint/-/eslint-8.57.1.tgz" | |
| 552 | 281 | integrity sha512-ypowyDxpVSYpkXr9WPv2PAZCtNip1Mv5KTW0SCurXv/9iOpcrH9PaqUElksqEB6pChqHGDRCFTyrZlGhnLNGiA== |
| 553 | 282 | dependencies: |
| 554 | 283 | "@eslint-community/eslint-utils" "^4.2.0" |
| ... | ... | @@ -592,78 +321,45 @@ eslint@^8.57.1: |
| 592 | 321 | |
| 593 | 322 | espree@^9.6.0, espree@^9.6.1: |
| 594 | 323 | version "9.6.1" |
| 595 | resolved "https://registry.yarnpkg.com/espree/-/espree-9.6.1.tgz#a2a17b8e434690a5432f2f8018ce71d331a48c6f" | |
| 324 | resolved "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz" | |
| 596 | 325 | integrity sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ== |
| 597 | 326 | dependencies: |
| 598 | 327 | acorn "^8.9.0" |
| 599 | 328 | acorn-jsx "^5.3.2" |
| 600 | 329 | eslint-visitor-keys "^3.4.1" |
| 601 | 330 | |
| 602 | esprima@^4.0.1: | |
| 603 | version "4.0.1" | |
| 604 | resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" | |
| 605 | integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== | |
| 606 | ||
| 607 | 331 | esquery@^1.4.2: |
| 608 | version "1.6.0" | |
| 609 | resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.6.0.tgz#91419234f804d852a82dceec3e16cdc22cf9dae7" | |
| 610 | integrity sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg== | |
| 332 | version "1.7.0" | |
| 333 | resolved "https://registry.npmjs.org/esquery/-/esquery-1.7.0.tgz" | |
| 334 | integrity sha512-Ap6G0WQwcU/LHsvLwON1fAQX9Zp0A2Y6Y/cJBl9r/JbW90Zyg4/zbG6zzKa2OTALELarYHmKu0GhpM5EO+7T0g== | |
| 611 | 335 | dependencies: |
| 612 | 336 | estraverse "^5.1.0" |
| 613 | 337 | |
| 614 | 338 | esrecurse@^4.3.0: |
| 615 | 339 | version "4.3.0" |
| 616 | resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.3.0.tgz#7ad7964d679abb28bee72cec63758b1c5d2c9921" | |
| 340 | resolved "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz" | |
| 617 | 341 | integrity sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag== |
| 618 | 342 | dependencies: |
| 619 | 343 | estraverse "^5.2.0" |
| 620 | 344 | |
| 621 | 345 | estraverse@^5.1.0, estraverse@^5.2.0: |
| 622 | 346 | version "5.3.0" |
| 623 | resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.3.0.tgz#2eea5290702f26ab8fe5370370ff86c965d21123" | |
| 347 | resolved "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz" | |
| 624 | 348 | integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA== |
| 625 | 349 | |
| 626 | 350 | esutils@^2.0.2: |
| 627 | 351 | version "2.0.3" |
| 628 | resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" | |
| 352 | resolved "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz" | |
| 629 | 353 | integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== |
| 630 | 354 | |
| 631 | events-universal@^1.0.0: | |
| 632 | version "1.0.1" | |
| 633 | resolved "https://registry.yarnpkg.com/events-universal/-/events-universal-1.0.1.tgz#b56a84fd611b6610e0a2d0f09f80fdf931e2dfe6" | |
| 634 | integrity sha512-LUd5euvbMLpwOF8m6ivPCbhQeSiYVNb8Vs0fQ8QjXo0JTkEHpz8pxdQf0gStltaPpw0Cca8b39KxvK9cfKRiAw== | |
| 635 | dependencies: | |
| 636 | bare-events "^2.7.0" | |
| 637 | ||
| 638 | extract-zip@^2.0.1: | |
| 639 | version "2.0.1" | |
| 640 | resolved "https://registry.yarnpkg.com/extract-zip/-/extract-zip-2.0.1.tgz#663dca56fe46df890d5f131ef4a06d22bb8ba13a" | |
| 641 | integrity sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg== | |
| 642 | dependencies: | |
| 643 | debug "^4.1.1" | |
| 644 | get-stream "^5.1.0" | |
| 645 | yauzl "^2.10.0" | |
| 646 | optionalDependencies: | |
| 647 | "@types/yauzl" "^2.9.1" | |
| 648 | ||
| 649 | fast-brake@^0.1.4: | |
| 650 | version "0.1.6" | |
| 651 | resolved "https://registry.yarnpkg.com/fast-brake/-/fast-brake-0.1.6.tgz#9776e16ccd528a8bcf445b48b4b38f8fc522ae20" | |
| 652 | integrity sha512-V3j0HTIs70OOxRpbqT0bWVdrmP86s6N8TBPw/WyKJqdJ2Fwh3CuMmlO83uIIDpqik6m1Io9fT6qwNn69EqvXYA== | |
| 653 | ||
| 654 | 355 | fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: |
| 655 | 356 | version "3.1.3" |
| 656 | resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" | |
| 357 | resolved "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz" | |
| 657 | 358 | integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== |
| 658 | 359 | |
| 659 | fast-fifo@^1.2.0, fast-fifo@^1.3.2: | |
| 660 | version "1.3.2" | |
| 661 | resolved "https://registry.yarnpkg.com/fast-fifo/-/fast-fifo-1.3.2.tgz#286e31de96eb96d38a97899815740ba2a4f3640c" | |
| 662 | integrity sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ== | |
| 663 | ||
| 664 | 360 | fast-glob@^3.3.3: |
| 665 | 361 | version "3.3.3" |
| 666 | resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.3.tgz#d06d585ce8dba90a16b0505c543c3ccfb3aeb818" | |
| 362 | resolved "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz" | |
| 667 | 363 | integrity sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg== |
| 668 | 364 | dependencies: |
| 669 | 365 | "@nodelib/fs.stat" "^2.0.2" |
| ... | ... | @@ -674,50 +370,38 @@ fast-glob@^3.3.3: |
| 674 | 370 | |
| 675 | 371 | fast-json-stable-stringify@^2.0.0: |
| 676 | 372 | version "2.1.0" |
| 677 | resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" | |
| 373 | resolved "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz" | |
| 678 | 374 | integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== |
| 679 | 375 | |
| 680 | 376 | fast-levenshtein@^2.0.6: |
| 681 | 377 | version "2.0.6" |
| 682 | resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" | |
| 378 | resolved "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz" | |
| 683 | 379 | integrity sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw== |
| 684 | 380 | |
| 685 | 381 | fastq@^1.6.0: |
| 686 | version "1.19.1" | |
| 687 | resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.19.1.tgz#d50eaba803c8846a883c16492821ebcd2cda55f5" | |
| 688 | integrity sha512-GwLTyxkCXjXbxqIhTsMI2Nui8huMPtnxg7krajPJAjnEG/iiOS7i+zCtWGZR9G0NBKbXKh6X9m9UIsYX/N6vvQ== | |
| 382 | version "1.20.1" | |
| 383 | resolved "https://registry.npmjs.org/fastq/-/fastq-1.20.1.tgz" | |
| 384 | integrity sha512-GGToxJ/w1x32s/D2EKND7kTil4n8OVk/9mycTc4VDza13lOvpUZTGX3mFSCtV9ksdGBVzvsyAVLM6mHFThxXxw== | |
| 689 | 385 | dependencies: |
| 690 | 386 | reusify "^1.0.4" |
| 691 | 387 | |
| 692 | fd-slicer@~1.1.0: | |
| 693 | version "1.1.0" | |
| 694 | resolved "https://registry.yarnpkg.com/fd-slicer/-/fd-slicer-1.1.0.tgz#25c7c89cb1f9077f8891bbe61d8f390eae256f1e" | |
| 695 | integrity sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g== | |
| 696 | dependencies: | |
| 697 | pend "~1.2.0" | |
| 698 | ||
| 699 | fecha@^4.2.0: | |
| 700 | version "4.2.3" | |
| 701 | resolved "https://registry.yarnpkg.com/fecha/-/fecha-4.2.3.tgz#4d9ccdbc61e8629b259fdca67e65891448d569fd" | |
| 702 | integrity sha512-OP2IUU6HeYKJi3i0z4A19kHMQoLVs4Hc+DPqqxI2h/DPZHTm/vjsfC6P0b4jCMy14XizLBqvndQ+UilD7707Jw== | |
| 703 | ||
| 704 | 388 | file-entry-cache@^6.0.1: |
| 705 | 389 | version "6.0.1" |
| 706 | resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-6.0.1.tgz#211b2dd9659cb0394b073e7323ac3c933d522027" | |
| 390 | resolved "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz" | |
| 707 | 391 | integrity sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg== |
| 708 | 392 | dependencies: |
| 709 | 393 | flat-cache "^3.0.4" |
| 710 | 394 | |
| 711 | 395 | fill-range@^7.1.1: |
| 712 | 396 | version "7.1.1" |
| 713 | resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.1.1.tgz#44265d3cac07e3ea7dc247516380643754a05292" | |
| 397 | resolved "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz" | |
| 714 | 398 | integrity sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg== |
| 715 | 399 | dependencies: |
| 716 | 400 | to-regex-range "^5.0.1" |
| 717 | 401 | |
| 718 | 402 | find-up@^5.0.0: |
| 719 | 403 | version "5.0.0" |
| 720 | resolved "https://registry.yarnpkg.com/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc" | |
| 404 | resolved "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz" | |
| 721 | 405 | integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng== |
| 722 | 406 | dependencies: |
| 723 | 407 | locate-path "^6.0.0" |
| ... | ... | @@ -725,7 +409,7 @@ find-up@^5.0.0: |
| 725 | 409 | |
| 726 | 410 | flat-cache@^3.0.4: |
| 727 | 411 | version "3.2.0" |
| 728 | resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-3.2.0.tgz#2c0c2d5040c99b1632771a9d105725c0115363ee" | |
| 412 | resolved "https://registry.npmjs.org/flat-cache/-/flat-cache-3.2.0.tgz" | |
| 729 | 413 | integrity sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw== |
| 730 | 414 | dependencies: |
| 731 | 415 | flatted "^3.2.9" |
| ... | ... | @@ -733,58 +417,37 @@ flat-cache@^3.0.4: |
| 733 | 417 | rimraf "^3.0.2" |
| 734 | 418 | |
| 735 | 419 | flatted@^3.2.9: |
| 736 | version "3.3.3" | |
| 737 | resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.3.3.tgz#67c8fad95454a7c7abebf74bb78ee74a44023358" | |
| 738 | integrity sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg== | |
| 739 | ||
| 740 | fn.name@1.x.x: | |
| 741 | version "1.1.0" | |
| 742 | resolved "https://registry.yarnpkg.com/fn.name/-/fn.name-1.1.0.tgz#26cad8017967aea8731bc42961d04a3d5988accc" | |
| 743 | integrity sha512-GRnmB5gPyJpAhTQdSZTSp9uaPSvl09KoYcMQtsB9rQoOmzs9dH6ffeccH+Z+cv6P68Hu5bC6JjRh4Ah/mHSNRw== | |
| 420 | version "3.4.2" | |
| 421 | resolved "https://registry.npmjs.org/flatted/-/flatted-3.4.2.tgz" | |
| 422 | integrity sha512-PjDse7RzhcPkIJwy5t7KPWQSZ9cAbzQXcafsetQoD7sOJRQlGikNbx7yZp2OotDnJyrDcbyRq3Ttb18iYOqkxA== | |
| 744 | 423 | |
| 745 | 424 | fs.realpath@^1.0.0: |
| 746 | 425 | version "1.0.0" |
| 747 | resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" | |
| 426 | resolved "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz" | |
| 748 | 427 | integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== |
| 749 | 428 | |
| 750 | 429 | get-caller-file@^2.0.5: |
| 751 | 430 | version "2.0.5" |
| 752 | resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" | |
| 431 | resolved "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz" | |
| 753 | 432 | integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== |
| 754 | 433 | |
| 755 | get-stream@^5.1.0: | |
| 756 | version "5.2.0" | |
| 757 | resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-5.2.0.tgz#4966a1795ee5ace65e706c4b7beb71257d6e22d3" | |
| 758 | integrity sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA== | |
| 759 | dependencies: | |
| 760 | pump "^3.0.0" | |
| 761 | ||
| 762 | get-uri@^6.0.1: | |
| 763 | version "6.0.5" | |
| 764 | resolved "https://registry.yarnpkg.com/get-uri/-/get-uri-6.0.5.tgz#714892aa4a871db671abc5395e5e9447bc306a16" | |
| 765 | integrity sha512-b1O07XYq8eRuVzBNgJLstU6FYc1tS6wnMtF1I1D9lE8LxZSOGZ7LhxN54yPP6mGw5f2CkXY2BQUL9Fx41qvcIg== | |
| 766 | dependencies: | |
| 767 | basic-ftp "^5.0.2" | |
| 768 | data-uri-to-buffer "^6.0.2" | |
| 769 | debug "^4.3.4" | |
| 770 | ||
| 771 | 434 | glob-parent@^5.1.2: |
| 772 | 435 | version "5.1.2" |
| 773 | resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" | |
| 436 | resolved "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz" | |
| 774 | 437 | integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== |
| 775 | 438 | dependencies: |
| 776 | 439 | is-glob "^4.0.1" |
| 777 | 440 | |
| 778 | 441 | glob-parent@^6.0.2: |
| 779 | 442 | version "6.0.2" |
| 780 | resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-6.0.2.tgz#6d237d99083950c79290f24c7642a3de9a28f9e3" | |
| 443 | resolved "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz" | |
| 781 | 444 | integrity sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A== |
| 782 | 445 | dependencies: |
| 783 | 446 | is-glob "^4.0.3" |
| 784 | 447 | |
| 785 | 448 | glob@^7.1.3: |
| 786 | 449 | version "7.2.3" |
| 787 | resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" | |
| 450 | resolved "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz" | |
| 788 | 451 | integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q== |
| 789 | 452 | dependencies: |
| 790 | 453 | fs.realpath "^1.0.0" |
| ... | ... | @@ -796,45 +459,29 @@ glob@^7.1.3: |
| 796 | 459 | |
| 797 | 460 | globals@^13.19.0: |
| 798 | 461 | version "13.24.0" |
| 799 | resolved "https://registry.yarnpkg.com/globals/-/globals-13.24.0.tgz#8432a19d78ce0c1e833949c36adb345400bb1171" | |
| 462 | resolved "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz" | |
| 800 | 463 | integrity sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ== |
| 801 | 464 | dependencies: |
| 802 | 465 | type-fest "^0.20.2" |
| 803 | 466 | |
| 804 | 467 | graphemer@^1.4.0: |
| 805 | 468 | version "1.4.0" |
| 806 | resolved "https://registry.yarnpkg.com/graphemer/-/graphemer-1.4.0.tgz#fb2f1d55e0e3a1849aeffc90c4fa0dd53a0e66c6" | |
| 469 | resolved "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz" | |
| 807 | 470 | integrity sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag== |
| 808 | 471 | |
| 809 | 472 | has-flag@^4.0.0: |
| 810 | 473 | version "4.0.0" |
| 811 | resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" | |
| 474 | resolved "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz" | |
| 812 | 475 | integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== |
| 813 | 476 | |
| 814 | http-proxy-agent@^7.0.0, http-proxy-agent@^7.0.1: | |
| 815 | version "7.0.2" | |
| 816 | resolved "https://registry.yarnpkg.com/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz#9a8b1f246866c028509486585f62b8f2c18c270e" | |
| 817 | integrity sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig== | |
| 818 | dependencies: | |
| 819 | agent-base "^7.1.0" | |
| 820 | debug "^4.3.4" | |
| 821 | ||
| 822 | https-proxy-agent@^7.0.6: | |
| 823 | version "7.0.6" | |
| 824 | resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz#da8dfeac7da130b05c2ba4b59c9b6cd66611a6b9" | |
| 825 | integrity sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw== | |
| 826 | dependencies: | |
| 827 | agent-base "^7.1.2" | |
| 828 | debug "4" | |
| 829 | ||
| 830 | 477 | ignore@^5.2.0: |
| 831 | 478 | version "5.3.2" |
| 832 | resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.3.2.tgz#3cd40e729f3643fd87cb04e50bf0eb722bc596f5" | |
| 479 | resolved "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz" | |
| 833 | 480 | integrity sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g== |
| 834 | 481 | |
| 835 | import-fresh@^3.2.1, import-fresh@^3.3.0: | |
| 482 | import-fresh@^3.2.1: | |
| 836 | 483 | version "3.3.1" |
| 837 | resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.3.1.tgz#9cecb56503c0ada1f2741dbbd6546e4b13b57ccf" | |
| 484 | resolved "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz" | |
| 838 | 485 | integrity sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ== |
| 839 | 486 | dependencies: |
| 840 | 487 | parent-module "^1.0.0" |
| ... | ... | @@ -842,116 +489,86 @@ import-fresh@^3.2.1, import-fresh@^3.3.0: |
| 842 | 489 | |
| 843 | 490 | imurmurhash@^0.1.4: |
| 844 | 491 | version "0.1.4" |
| 845 | resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" | |
| 492 | resolved "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz" | |
| 846 | 493 | integrity sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA== |
| 847 | 494 | |
| 848 | 495 | inflight@^1.0.4: |
| 849 | 496 | version "1.0.6" |
| 850 | resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" | |
| 497 | resolved "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz" | |
| 851 | 498 | integrity sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA== |
| 852 | 499 | dependencies: |
| 853 | 500 | once "^1.3.0" |
| 854 | 501 | wrappy "1" |
| 855 | 502 | |
| 856 | inherits@2, inherits@^2.0.3: | |
| 503 | inherits@2: | |
| 857 | 504 | version "2.0.4" |
| 858 | resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" | |
| 505 | resolved "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz" | |
| 859 | 506 | integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== |
| 860 | 507 | |
| 861 | ip-address@^10.0.1: | |
| 862 | version "10.1.0" | |
| 863 | resolved "https://registry.yarnpkg.com/ip-address/-/ip-address-10.1.0.tgz#d8dcffb34d0e02eb241427444a6e23f5b0595aa4" | |
| 864 | integrity sha512-XXADHxXmvT9+CRxhXg56LJovE+bmWnEWB78LB83VZTprKTmaC5QfruXocxzTZ2Kl0DNwKuBdlIhjL8LeY8Sf8Q== | |
| 865 | ||
| 866 | is-arrayish@^0.2.1: | |
| 867 | version "0.2.1" | |
| 868 | resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" | |
| 869 | integrity sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg== | |
| 870 | ||
| 871 | 508 | is-extglob@^2.1.1: |
| 872 | 509 | version "2.1.1" |
| 873 | resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" | |
| 510 | resolved "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz" | |
| 874 | 511 | integrity sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ== |
| 875 | 512 | |
| 876 | 513 | is-fullwidth-code-point@^3.0.0: |
| 877 | 514 | version "3.0.0" |
| 878 | resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" | |
| 515 | resolved "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz" | |
| 879 | 516 | integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== |
| 880 | 517 | |
| 881 | 518 | is-glob@^4.0.0, is-glob@^4.0.1, is-glob@^4.0.3: |
| 882 | 519 | version "4.0.3" |
| 883 | resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084" | |
| 520 | resolved "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz" | |
| 884 | 521 | integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== |
| 885 | 522 | dependencies: |
| 886 | 523 | is-extglob "^2.1.1" |
| 887 | 524 | |
| 888 | 525 | is-number@^7.0.0: |
| 889 | 526 | version "7.0.0" |
| 890 | resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" | |
| 527 | resolved "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz" | |
| 891 | 528 | integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== |
| 892 | 529 | |
| 893 | 530 | is-path-inside@^3.0.3: |
| 894 | 531 | version "3.0.3" |
| 895 | resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-3.0.3.tgz#d231362e53a07ff2b0e0ea7fed049161ffd16283" | |
| 532 | resolved "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz" | |
| 896 | 533 | integrity sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ== |
| 897 | 534 | |
| 898 | is-stream@^2.0.0: | |
| 899 | version "2.0.1" | |
| 900 | resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.1.tgz#fac1e3d53b97ad5a9d0ae9cef2389f5810a5c077" | |
| 901 | integrity sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg== | |
| 902 | ||
| 903 | 535 | isexe@^2.0.0: |
| 904 | 536 | version "2.0.0" |
| 905 | resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" | |
| 537 | resolved "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz" | |
| 906 | 538 | integrity sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw== |
| 907 | 539 | |
| 908 | js-tokens@^4.0.0: | |
| 909 | version "4.0.0" | |
| 910 | resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" | |
| 911 | integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== | |
| 912 | ||
| 913 | 540 | js-yaml@^4.1.0: |
| 914 | version "4.1.0" | |
| 915 | resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602" | |
| 916 | integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA== | |
| 541 | version "4.2.0" | |
| 542 | resolved "https://registry.npmjs.org/js-yaml/-/js-yaml-4.2.0.tgz" | |
| 543 | integrity sha512-ePWsvanv0DWuDRsW8dnt+R4jQ31SCRCQ7hhNcPXZPsoBZiemuZNYGf7adZdqX2D86j6rvKp3RpCxVTSb8WQlOw== | |
| 917 | 544 | dependencies: |
| 918 | 545 | argparse "^2.0.1" |
| 919 | 546 | |
| 920 | 547 | json-buffer@3.0.1: |
| 921 | 548 | version "3.0.1" |
| 922 | resolved "https://registry.yarnpkg.com/json-buffer/-/json-buffer-3.0.1.tgz#9338802a30d3b6605fbe0613e094008ca8c05a13" | |
| 549 | resolved "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz" | |
| 923 | 550 | integrity sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ== |
| 924 | 551 | |
| 925 | json-parse-even-better-errors@^2.3.0: | |
| 926 | version "2.3.1" | |
| 927 | resolved "https://registry.yarnpkg.com/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz#7c47805a94319928e05777405dc12e1f7a4ee02d" | |
| 928 | integrity sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w== | |
| 929 | ||
| 930 | 552 | json-schema-traverse@^0.4.1: |
| 931 | 553 | version "0.4.1" |
| 932 | resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" | |
| 554 | resolved "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz" | |
| 933 | 555 | integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== |
| 934 | 556 | |
| 935 | 557 | json-stable-stringify-without-jsonify@^1.0.1: |
| 936 | 558 | version "1.0.1" |
| 937 | resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" | |
| 559 | resolved "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz" | |
| 938 | 560 | integrity sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw== |
| 939 | 561 | |
| 940 | 562 | keyv@^4.5.3: |
| 941 | 563 | version "4.5.4" |
| 942 | resolved "https://registry.yarnpkg.com/keyv/-/keyv-4.5.4.tgz#a879a99e29452f942439f2a405e3af8b31d4de93" | |
| 564 | resolved "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz" | |
| 943 | 565 | integrity sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw== |
| 944 | 566 | dependencies: |
| 945 | 567 | json-buffer "3.0.1" |
| 946 | 568 | |
| 947 | kuler@^2.0.0: | |
| 948 | version "2.0.0" | |
| 949 | resolved "https://registry.yarnpkg.com/kuler/-/kuler-2.0.0.tgz#e2c570a3800388fb44407e851531c1d670b061b3" | |
| 950 | integrity sha512-Xq9nH7KlWZmXAtodXDDRE7vs6DU1gTU8zYDHDiWLSip45Egwq3plLHzPn27NgvzL2r1LMPC1vdqh98sQxtqj4A== | |
| 951 | ||
| 952 | 569 | levn@^0.4.1: |
| 953 | 570 | version "0.4.1" |
| 954 | resolved "https://registry.yarnpkg.com/levn/-/levn-0.4.1.tgz#ae4562c007473b932a6200d403268dd2fffc6ade" | |
| 571 | resolved "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz" | |
| 955 | 572 | integrity sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ== |
| 956 | 573 | dependencies: |
| 957 | 574 | prelude-ls "^1.2.1" |
| ... | ... | @@ -959,105 +576,71 @@ levn@^0.4.1: |
| 959 | 576 | |
| 960 | 577 | lilconfig@^3.1.3: |
| 961 | 578 | version "3.1.3" |
| 962 | resolved "https://registry.yarnpkg.com/lilconfig/-/lilconfig-3.1.3.tgz#a1bcfd6257f9585bf5ae14ceeebb7b559025e4c4" | |
| 579 | resolved "https://registry.npmjs.org/lilconfig/-/lilconfig-3.1.3.tgz" | |
| 963 | 580 | integrity sha512-/vlFKAoH5Cgt3Ie+JLhRbwOsCQePABiU3tJ1egGvyQ+33R/vcwM2Zl2QR/LzjsBeItPt3oSVXapn+m4nQDvpzw== |
| 964 | 581 | |
| 965 | lines-and-columns@^1.1.6: | |
| 966 | version "1.2.4" | |
| 967 | resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632" | |
| 968 | integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg== | |
| 969 | ||
| 970 | 582 | locate-path@^6.0.0: |
| 971 | 583 | version "6.0.0" |
| 972 | resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-6.0.0.tgz#55321eb309febbc59c4801d931a72452a681d286" | |
| 584 | resolved "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz" | |
| 973 | 585 | integrity sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw== |
| 974 | 586 | dependencies: |
| 975 | 587 | p-locate "^5.0.0" |
| 976 | 588 | |
| 977 | 589 | lodash.merge@^4.6.2: |
| 978 | 590 | version "4.6.2" |
| 979 | resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" | |
| 591 | resolved "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz" | |
| 980 | 592 | integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== |
| 981 | 593 | |
| 982 | logform@^2.7.0: | |
| 983 | version "2.7.0" | |
| 984 | resolved "https://registry.yarnpkg.com/logform/-/logform-2.7.0.tgz#cfca97528ef290f2e125a08396805002b2d060d1" | |
| 985 | integrity sha512-TFYA4jnP7PVbmlBIfhlSe+WKxs9dklXMTEGcBCIvLhE/Tn3H6Gk1norupVW7m5Cnd4bLcr08AytbyV/xj7f/kQ== | |
| 986 | dependencies: | |
| 987 | "@colors/colors" "1.6.0" | |
| 988 | "@types/triple-beam" "^1.3.2" | |
| 989 | fecha "^4.2.0" | |
| 990 | ms "^2.1.1" | |
| 991 | safe-stable-stringify "^2.3.1" | |
| 992 | triple-beam "^1.3.0" | |
| 993 | ||
| 994 | lru-cache@^7.14.1: | |
| 995 | version "7.18.3" | |
| 996 | resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-7.18.3.tgz#f793896e0fd0e954a59dfdd82f0773808df6aa89" | |
| 997 | integrity sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA== | |
| 998 | ||
| 999 | 594 | merge2@^1.3.0: |
| 1000 | 595 | version "1.4.1" |
| 1001 | resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" | |
| 596 | resolved "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz" | |
| 1002 | 597 | integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== |
| 1003 | 598 | |
| 1004 | 599 | micromatch@^4.0.8: |
| 1005 | 600 | version "4.0.8" |
| 1006 | resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.8.tgz#d66fa18f3a47076789320b9b1af32bd86d9fa202" | |
| 601 | resolved "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz" | |
| 1007 | 602 | integrity sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA== |
| 1008 | 603 | dependencies: |
| 1009 | 604 | braces "^3.0.3" |
| 1010 | 605 | picomatch "^2.3.1" |
| 1011 | 606 | |
| 1012 | 607 | minimatch@^3.0.5, minimatch@^3.1.1, minimatch@^3.1.2: |
| 1013 | version "3.1.2" | |
| 1014 | resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" | |
| 1015 | integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== | |
| 608 | version "3.1.5" | |
| 609 | resolved "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz" | |
| 610 | integrity sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w== | |
| 1016 | 611 | dependencies: |
| 1017 | 612 | brace-expansion "^1.1.7" |
| 1018 | 613 | |
| 1019 | 614 | mitt@^3.0.1: |
| 1020 | 615 | version "3.0.1" |
| 1021 | resolved "https://registry.yarnpkg.com/mitt/-/mitt-3.0.1.tgz#ea36cf0cc30403601ae074c8f77b7092cdab36d1" | |
| 616 | resolved "https://registry.npmjs.org/mitt/-/mitt-3.0.1.tgz" | |
| 1022 | 617 | integrity sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw== |
| 1023 | 618 | |
| 1024 | ms@^2.1.1, ms@^2.1.3: | |
| 619 | modern-tar@^0.7.6: | |
| 620 | version "0.7.6" | |
| 621 | resolved "https://registry.npmjs.org/modern-tar/-/modern-tar-0.7.6.tgz" | |
| 622 | integrity sha512-sweCIVXzx1aIGTCdzcMlSZt1h8k5Tmk08VNAuRk3IU28XamGiOH5ypi11g6De2CH7PhYqSSnGy2A/EFhbWnVKg== | |
| 623 | ||
| 624 | ms@^2.1.3: | |
| 1025 | 625 | version "2.1.3" |
| 1026 | resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" | |
| 626 | resolved "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz" | |
| 1027 | 627 | integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== |
| 1028 | 628 | |
| 1029 | 629 | natural-compare@^1.4.0: |
| 1030 | 630 | version "1.4.0" |
| 1031 | resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" | |
| 631 | resolved "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz" | |
| 1032 | 632 | integrity sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw== |
| 1033 | 633 | |
| 1034 | netmask@^2.0.2: | |
| 1035 | version "2.0.2" | |
| 1036 | resolved "https://registry.yarnpkg.com/netmask/-/netmask-2.0.2.tgz#8b01a07644065d536383835823bc52004ebac5e7" | |
| 1037 | integrity sha512-dBpDMdxv9Irdq66304OLfEmQ9tbNRFnFTuZiLo+bD+r332bBmMJ8GBLXklIXXgxd3+v9+KUnZaUR5PJMa75Gsg== | |
| 1038 | ||
| 1039 | node-releases@^2.0.26: | |
| 1040 | version "2.0.27" | |
| 1041 | resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.27.tgz#eedca519205cf20f650f61d56b070db111231e4e" | |
| 1042 | integrity sha512-nmh3lCkYZ3grZvqcCH+fjmQ7X+H0OeZgP40OierEaAptX4XofMh5kwNbWh7lBduUzCcV/8kZ+NDLCwm2iorIlA== | |
| 1043 | ||
| 1044 | once@^1.3.0, once@^1.3.1, once@^1.4.0: | |
| 634 | once@^1.3.0: | |
| 1045 | 635 | version "1.4.0" |
| 1046 | resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" | |
| 636 | resolved "https://registry.npmjs.org/once/-/once-1.4.0.tgz" | |
| 1047 | 637 | integrity sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w== |
| 1048 | 638 | dependencies: |
| 1049 | 639 | wrappy "1" |
| 1050 | 640 | |
| 1051 | one-time@^1.0.0: | |
| 1052 | version "1.0.0" | |
| 1053 | resolved "https://registry.yarnpkg.com/one-time/-/one-time-1.0.0.tgz#e06bc174aed214ed58edede573b433bbf827cb45" | |
| 1054 | integrity sha512-5DXOiRKwuSEcQ/l0kGCF6Q3jcADFv5tSmRaJck/OqkVFcOzutB134KRSfF0xDrL39MNnqxbHBbUUcjZIhTgb2g== | |
| 1055 | dependencies: | |
| 1056 | fn.name "1.x.x" | |
| 1057 | ||
| 1058 | 641 | optionator@^0.9.3: |
| 1059 | 642 | version "0.9.4" |
| 1060 | resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.4.tgz#7ea1c1a5d91d764fb282139c88fe11e182a3a734" | |
| 643 | resolved "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz" | |
| 1061 | 644 | integrity sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g== |
| 1062 | 645 | dependencies: |
| 1063 | 646 | deep-is "^0.1.3" |
| ... | ... | @@ -1069,469 +652,224 @@ optionator@^0.9.3: |
| 1069 | 652 | |
| 1070 | 653 | p-limit@^3.0.2: |
| 1071 | 654 | version "3.1.0" |
| 1072 | resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-3.1.0.tgz#e1daccbe78d0d1388ca18c64fea38e3e57e3706b" | |
| 655 | resolved "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz" | |
| 1073 | 656 | integrity sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ== |
| 1074 | 657 | dependencies: |
| 1075 | 658 | yocto-queue "^0.1.0" |
| 1076 | 659 | |
| 1077 | 660 | p-locate@^5.0.0: |
| 1078 | 661 | version "5.0.0" |
| 1079 | resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-5.0.0.tgz#83c8315c6785005e3bd021839411c9e110e6d834" | |
| 662 | resolved "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz" | |
| 1080 | 663 | integrity sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw== |
| 1081 | 664 | dependencies: |
| 1082 | 665 | p-limit "^3.0.2" |
| 1083 | 666 | |
| 1084 | pac-proxy-agent@^7.1.0: | |
| 1085 | version "7.2.0" | |
| 1086 | resolved "https://registry.yarnpkg.com/pac-proxy-agent/-/pac-proxy-agent-7.2.0.tgz#9cfaf33ff25da36f6147a20844230ec92c06e5df" | |
| 1087 | integrity sha512-TEB8ESquiLMc0lV8vcd5Ql/JAKAoyzHFXaStwjkzpOpC5Yv+pIzLfHvjTSdf3vpa2bMiUQrg9i6276yn8666aA== | |
| 1088 | dependencies: | |
| 1089 | "@tootallnate/quickjs-emscripten" "^0.23.0" | |
| 1090 | agent-base "^7.1.2" | |
| 1091 | debug "^4.3.4" | |
| 1092 | get-uri "^6.0.1" | |
| 1093 | http-proxy-agent "^7.0.0" | |
| 1094 | https-proxy-agent "^7.0.6" | |
| 1095 | pac-resolver "^7.0.1" | |
| 1096 | socks-proxy-agent "^8.0.5" | |
| 1097 | ||
| 1098 | pac-resolver@^7.0.1: | |
| 1099 | version "7.0.1" | |
| 1100 | resolved "https://registry.yarnpkg.com/pac-resolver/-/pac-resolver-7.0.1.tgz#54675558ea368b64d210fd9c92a640b5f3b8abb6" | |
| 1101 | integrity sha512-5NPgf87AT2STgwa2ntRMr45jTKrYBGkVU36yT0ig/n/GMAa3oPqhZfIQ2kMEimReg0+t9kZViDVZ83qfVUlckg== | |
| 1102 | dependencies: | |
| 1103 | degenerator "^5.0.0" | |
| 1104 | netmask "^2.0.2" | |
| 1105 | ||
| 1106 | 667 | parent-module@^1.0.0: |
| 1107 | 668 | version "1.0.1" |
| 1108 | resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2" | |
| 669 | resolved "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz" | |
| 1109 | 670 | integrity sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g== |
| 1110 | 671 | dependencies: |
| 1111 | 672 | callsites "^3.0.0" |
| 1112 | 673 | |
| 1113 | parse-json@^5.2.0: | |
| 1114 | version "5.2.0" | |
| 1115 | resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-5.2.0.tgz#c76fc66dee54231c962b22bcc8a72cf2f99753cd" | |
| 1116 | integrity sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg== | |
| 1117 | dependencies: | |
| 1118 | "@babel/code-frame" "^7.0.0" | |
| 1119 | error-ex "^1.3.1" | |
| 1120 | json-parse-even-better-errors "^2.3.0" | |
| 1121 | lines-and-columns "^1.1.6" | |
| 1122 | ||
| 1123 | 674 | path-exists@^4.0.0: |
| 1124 | 675 | version "4.0.0" |
| 1125 | resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" | |
| 676 | resolved "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz" | |
| 1126 | 677 | integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w== |
| 1127 | 678 | |
| 1128 | 679 | path-is-absolute@^1.0.0: |
| 1129 | 680 | version "1.0.1" |
| 1130 | resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" | |
| 681 | resolved "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz" | |
| 1131 | 682 | integrity sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg== |
| 1132 | 683 | |
| 1133 | 684 | path-key@^3.1.0: |
| 1134 | 685 | version "3.1.1" |
| 1135 | resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" | |
| 686 | resolved "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz" | |
| 1136 | 687 | integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== |
| 1137 | 688 | |
| 1138 | pend@~1.2.0: | |
| 1139 | version "1.2.0" | |
| 1140 | resolved "https://registry.yarnpkg.com/pend/-/pend-1.2.0.tgz#7a57eb550a6783f9115331fcf4663d5c8e007a50" | |
| 1141 | integrity sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg== | |
| 1142 | ||
| 1143 | picocolors@^1.1.1: | |
| 1144 | version "1.1.1" | |
| 1145 | resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.1.1.tgz#3d321af3eab939b083c8f929a1d12cda81c26b6b" | |
| 1146 | integrity sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA== | |
| 1147 | ||
| 1148 | 689 | picomatch@^2.3.1: |
| 1149 | version "2.3.1" | |
| 1150 | resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" | |
| 1151 | integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== | |
| 690 | version "2.3.2" | |
| 691 | resolved "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz" | |
| 692 | integrity sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA== | |
| 1152 | 693 | |
| 1153 | 694 | pngjs@^3.4.0: |
| 1154 | 695 | version "3.4.0" |
| 1155 | resolved "https://registry.yarnpkg.com/pngjs/-/pngjs-3.4.0.tgz#99ca7d725965fb655814eaf65f38f12bbdbf555f" | |
| 696 | resolved "https://registry.npmjs.org/pngjs/-/pngjs-3.4.0.tgz" | |
| 1156 | 697 | integrity sha512-NCrCHhWmnQklfH4MtJMRjZ2a8c80qXeMlQMv2uVp9ISJMTt562SbGd6n2oq0PaPgKm7Z6pL9E2UlLIhC+SHL3w== |
| 1157 | 698 | |
| 1158 | 699 | prelude-ls@^1.2.1: |
| 1159 | 700 | version "1.2.1" |
| 1160 | resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" | |
| 701 | resolved "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz" | |
| 1161 | 702 | integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g== |
| 1162 | 703 | |
| 1163 | progress@^2.0.3: | |
| 1164 | version "2.0.3" | |
| 1165 | resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8" | |
| 1166 | integrity sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA== | |
| 1167 | ||
| 1168 | proxy-agent@^6.5.0: | |
| 1169 | version "6.5.0" | |
| 1170 | resolved "https://registry.yarnpkg.com/proxy-agent/-/proxy-agent-6.5.0.tgz#9e49acba8e4ee234aacb539f89ed9c23d02f232d" | |
| 1171 | integrity sha512-TmatMXdr2KlRiA2CyDu8GqR8EjahTG3aY3nXjdzFyoZbmB8hrBsTyMezhULIXKnC0jpfjlmiZ3+EaCzoInSu/A== | |
| 1172 | dependencies: | |
| 1173 | agent-base "^7.1.2" | |
| 1174 | debug "^4.3.4" | |
| 1175 | http-proxy-agent "^7.0.1" | |
| 1176 | https-proxy-agent "^7.0.6" | |
| 1177 | lru-cache "^7.14.1" | |
| 1178 | pac-proxy-agent "^7.1.0" | |
| 1179 | proxy-from-env "^1.1.0" | |
| 1180 | socks-proxy-agent "^8.0.5" | |
| 1181 | ||
| 1182 | proxy-from-env@^1.1.0: | |
| 1183 | version "1.1.0" | |
| 1184 | resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2" | |
| 1185 | integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg== | |
| 1186 | ||
| 1187 | pump@^3.0.0: | |
| 1188 | version "3.0.3" | |
| 1189 | resolved "https://registry.yarnpkg.com/pump/-/pump-3.0.3.tgz#151d979f1a29668dc0025ec589a455b53282268d" | |
| 1190 | integrity sha512-todwxLMY7/heScKmntwQG8CXVkWUOdYxIvY2s0VWAAMh/nd8SoYiRaKjlr7+iCs984f2P8zvrfWcDDYVb73NfA== | |
| 1191 | dependencies: | |
| 1192 | end-of-stream "^1.1.0" | |
| 1193 | once "^1.3.1" | |
| 1194 | ||
| 1195 | 704 | punycode@^2.1.0: |
| 1196 | 705 | version "2.3.1" |
| 1197 | resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.1.tgz#027422e2faec0b25e1549c3e1bd8309b9133b6e5" | |
| 706 | resolved "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz" | |
| 1198 | 707 | integrity sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg== |
| 1199 | 708 | |
| 1200 | puppeteer-core@24.40.0: | |
| 1201 | version "24.40.0" | |
| 1202 | resolved "https://registry.yarnpkg.com/puppeteer-core/-/puppeteer-core-24.40.0.tgz#1f389cd9432cb077f703ca2cb6758490cdccbc7e" | |
| 1203 | integrity sha512-MWL3XbUCfVgGR0gRsidzT6oKJT2QydPLhMITU6HoVWiiv4gkb6gJi3pcdAa8q4HwjBTbqISOWVP4aJiiyUJvag== | |
| 1204 | dependencies: | |
| 1205 | "@puppeteer/browsers" "2.13.0" | |
| 1206 | chromium-bidi "14.0.0" | |
| 1207 | debug "^4.4.3" | |
| 1208 | devtools-protocol "0.0.1581282" | |
| 1209 | typed-query-selector "^2.12.1" | |
| 1210 | webdriver-bidi-protocol "0.4.1" | |
| 1211 | ws "^8.19.0" | |
| 1212 | ||
| 1213 | puppeteer@^24.31.0: | |
| 1214 | version "24.40.0" | |
| 1215 | resolved "https://registry.yarnpkg.com/puppeteer/-/puppeteer-24.40.0.tgz#6df6aeee9dabf29bed3bb2be5c209d00518d4a79" | |
| 1216 | integrity sha512-IxQbDq93XHVVLWHrAkFP7F7iHvb9o0mgfsSIMlhHb+JM+JjM1V4v4MNSQfcRWJopx9dsNOr9adYv0U5fm9BJBQ== | |
| 1217 | dependencies: | |
| 1218 | "@puppeteer/browsers" "2.13.0" | |
| 1219 | chromium-bidi "14.0.0" | |
| 1220 | cosmiconfig "^9.0.0" | |
| 1221 | devtools-protocol "0.0.1581282" | |
| 1222 | puppeteer-core "24.40.0" | |
| 1223 | typed-query-selector "^2.12.1" | |
| 709 | puppeteer-core@25.1.0: | |
| 710 | version "25.1.0" | |
| 711 | resolved "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-25.1.0.tgz" | |
| 712 | integrity sha512-jKzy5y4WG6uNuFbTWgW1D7mqoT9o0nllc/6a1DGF775T1mPmgw3scdFEtEq67yVFikavQmbYq6NLfbTfxHSlqQ== | |
| 713 | dependencies: | |
| 714 | "@puppeteer/browsers" "3.0.4" | |
| 715 | chromium-bidi "16.0.1" | |
| 716 | devtools-protocol "0.0.1624250" | |
| 717 | typed-query-selector "^2.12.2" | |
| 718 | webdriver-bidi-protocol "0.4.2" | |
| 719 | ws "^8.21.0" | |
| 720 | ||
| 721 | puppeteer@^25.1.0: | |
| 722 | version "25.1.0" | |
| 723 | resolved "https://registry.npmjs.org/puppeteer/-/puppeteer-25.1.0.tgz" | |
| 724 | integrity sha512-7L6/0JM7XStK99lIL4xQySyNEXNfII6pk0BxkI5kKBTOhR7AsoQiv067YTsE/rIXxQiq9ajlO4WcqBjS/FWK1A== | |
| 725 | dependencies: | |
| 726 | "@puppeteer/browsers" "3.0.4" | |
| 727 | chromium-bidi "16.0.1" | |
| 728 | devtools-protocol "0.0.1624250" | |
| 729 | lilconfig "^3.1.3" | |
| 730 | puppeteer-core "25.1.0" | |
| 731 | typed-query-selector "^2.12.2" | |
| 1224 | 732 | |
| 1225 | 733 | queue-microtask@^1.2.2: |
| 1226 | 734 | version "1.2.3" |
| 1227 | resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243" | |
| 735 | resolved "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz" | |
| 1228 | 736 | integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A== |
| 1229 | 737 | |
| 1230 | readable-stream@^3.4.0, readable-stream@^3.6.2: | |
| 1231 | version "3.6.2" | |
| 1232 | resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.2.tgz#56a9b36ea965c00c5a93ef31eb111a0f11056967" | |
| 1233 | integrity sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA== | |
| 1234 | dependencies: | |
| 1235 | inherits "^2.0.3" | |
| 1236 | string_decoder "^1.1.1" | |
| 1237 | util-deprecate "^1.0.1" | |
| 1238 | ||
| 1239 | 738 | readline-sync@^1.4.10: |
| 1240 | 739 | version "1.4.10" |
| 1241 | resolved "https://registry.yarnpkg.com/readline-sync/-/readline-sync-1.4.10.tgz#41df7fbb4b6312d673011594145705bf56d8873b" | |
| 740 | resolved "https://registry.npmjs.org/readline-sync/-/readline-sync-1.4.10.tgz" | |
| 1242 | 741 | integrity sha512-gNva8/6UAe8QYepIQH/jQ2qn91Qj0B9sYjMBBs3QOB8F2CXcKgLxQaJRP76sWVRQt+QU+8fAkCbCvjjMFu7Ycw== |
| 1243 | 742 | |
| 1244 | 743 | require-directory@^2.1.1: |
| 1245 | 744 | version "2.1.1" |
| 1246 | resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" | |
| 745 | resolved "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz" | |
| 1247 | 746 | integrity sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q== |
| 1248 | 747 | |
| 1249 | 748 | resolve-from@^4.0.0: |
| 1250 | 749 | version "4.0.0" |
| 1251 | resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6" | |
| 750 | resolved "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz" | |
| 1252 | 751 | integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g== |
| 1253 | 752 | |
| 1254 | 753 | reusify@^1.0.4: |
| 1255 | 754 | version "1.1.0" |
| 1256 | resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.1.0.tgz#0fe13b9522e1473f51b558ee796e08f11f9b489f" | |
| 755 | resolved "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz" | |
| 1257 | 756 | integrity sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw== |
| 1258 | 757 | |
| 1259 | 758 | rimraf@^3.0.2: |
| 1260 | 759 | version "3.0.2" |
| 1261 | resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a" | |
| 760 | resolved "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz" | |
| 1262 | 761 | integrity sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA== |
| 1263 | 762 | dependencies: |
| 1264 | 763 | glob "^7.1.3" |
| 1265 | 764 | |
| 1266 | 765 | run-parallel@^1.1.9: |
| 1267 | 766 | version "1.2.0" |
| 1268 | resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.2.0.tgz#66d1368da7bdf921eb9d95bd1a9229e7f21a43ee" | |
| 767 | resolved "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz" | |
| 1269 | 768 | integrity sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA== |
| 1270 | 769 | dependencies: |
| 1271 | 770 | queue-microtask "^1.2.2" |
| 1272 | 771 | |
| 1273 | safe-buffer@~5.2.0: | |
| 1274 | version "5.2.1" | |
| 1275 | resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" | |
| 1276 | integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== | |
| 1277 | ||
| 1278 | safe-stable-stringify@^2.3.1: | |
| 1279 | version "2.5.0" | |
| 1280 | resolved "https://registry.yarnpkg.com/safe-stable-stringify/-/safe-stable-stringify-2.5.0.tgz#4ca2f8e385f2831c432a719b108a3bf7af42a1dd" | |
| 1281 | integrity sha512-b3rppTKm9T+PsVCBEOUR46GWI7fdOs00VKZ1+9c1EWDaDMvjQc6tUwuFyIprgGgTcWoVHSKrU8H31ZHA2e0RHA== | |
| 1282 | ||
| 1283 | semver@^7.7.4: | |
| 1284 | version "7.7.4" | |
| 1285 | resolved "https://registry.yarnpkg.com/semver/-/semver-7.7.4.tgz#28464e36060e991fa7a11d0279d2d3f3b57a7e8a" | |
| 1286 | integrity sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA== | |
| 1287 | ||
| 1288 | 772 | shebang-command@^2.0.0: |
| 1289 | 773 | version "2.0.0" |
| 1290 | resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" | |
| 774 | resolved "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz" | |
| 1291 | 775 | integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA== |
| 1292 | 776 | dependencies: |
| 1293 | 777 | shebang-regex "^3.0.0" |
| 1294 | 778 | |
| 1295 | 779 | shebang-regex@^3.0.0: |
| 1296 | 780 | version "3.0.0" |
| 1297 | resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" | |
| 781 | resolved "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz" | |
| 1298 | 782 | integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== |
| 1299 | 783 | |
| 1300 | smart-buffer@^4.2.0: | |
| 1301 | version "4.2.0" | |
| 1302 | resolved "https://registry.yarnpkg.com/smart-buffer/-/smart-buffer-4.2.0.tgz#6e1d71fa4f18c05f7d0ff216dd16a481d0e8d9ae" | |
| 1303 | integrity sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg== | |
| 1304 | ||
| 1305 | socks-proxy-agent@^8.0.5: | |
| 1306 | version "8.0.5" | |
| 1307 | resolved "https://registry.yarnpkg.com/socks-proxy-agent/-/socks-proxy-agent-8.0.5.tgz#b9cdb4e7e998509d7659d689ce7697ac21645bee" | |
| 1308 | integrity sha512-HehCEsotFqbPW9sJ8WVYB6UbmIMv7kUUORIF2Nncq4VQvBfNBLibW9YZR5dlYCSUhwcD628pRllm7n+E+YTzJw== | |
| 1309 | dependencies: | |
| 1310 | agent-base "^7.1.2" | |
| 1311 | debug "^4.3.4" | |
| 1312 | socks "^2.8.3" | |
| 1313 | ||
| 1314 | socks@^2.8.3: | |
| 1315 | version "2.8.7" | |
| 1316 | resolved "https://registry.yarnpkg.com/socks/-/socks-2.8.7.tgz#e2fb1d9a603add75050a2067db8c381a0b5669ea" | |
| 1317 | integrity sha512-HLpt+uLy/pxB+bum/9DzAgiKS8CX1EvbWxI4zlmgGCExImLdiad2iCwXT5Z4c9c3Eq8rP2318mPW2c+QbtjK8A== | |
| 1318 | dependencies: | |
| 1319 | ip-address "^10.0.1" | |
| 1320 | smart-buffer "^4.2.0" | |
| 1321 | ||
| 1322 | source-map@^0.7.4: | |
| 1323 | version "0.7.6" | |
| 1324 | resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.6.tgz#a3658ab87e5b6429c8a1f3ba0083d4c61ca3ef02" | |
| 1325 | integrity sha512-i5uvt8C3ikiWeNZSVZNWcfZPItFQOsYTUAOkcUPGd8DqDy1uOUikjt5dG+uRlwyvR108Fb9DOd4GvXfT0N2/uQ== | |
| 1326 | ||
| 1327 | source-map@~0.6.1: | |
| 1328 | version "0.6.1" | |
| 1329 | resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" | |
| 1330 | integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== | |
| 1331 | ||
| 1332 | stack-trace@0.0.x: | |
| 1333 | version "0.0.10" | |
| 1334 | resolved "https://registry.yarnpkg.com/stack-trace/-/stack-trace-0.0.10.tgz#547c70b347e8d32b4e108ea1a2a159e5fdde19c0" | |
| 1335 | integrity sha512-KGzahc7puUKkzyMt+IqAep+TVNbKP+k2Lmwhub39m1AsTSkaDutx56aDCo+HLDzf/D26BIHTJWNiTG1KAJiQCg== | |
| 1336 | ||
| 1337 | streamx@^2.15.0, streamx@^2.21.0: | |
| 1338 | version "2.23.0" | |
| 1339 | resolved "https://registry.yarnpkg.com/streamx/-/streamx-2.23.0.tgz#7d0f3d00d4a6c5de5728aecd6422b4008d66fd0b" | |
| 1340 | integrity sha512-kn+e44esVfn2Fa/O0CPFcex27fjIL6MkVae0Mm6q+E6f0hWv578YCERbv+4m02cjxvDsPKLnmxral/rR6lBMAg== | |
| 1341 | dependencies: | |
| 1342 | events-universal "^1.0.0" | |
| 1343 | fast-fifo "^1.3.2" | |
| 1344 | text-decoder "^1.1.0" | |
| 1345 | ||
| 1346 | 784 | string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: |
| 1347 | 785 | version "4.2.3" |
| 1348 | resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" | |
| 786 | resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz" | |
| 1349 | 787 | integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== |
| 1350 | 788 | dependencies: |
| 1351 | 789 | emoji-regex "^8.0.0" |
| 1352 | 790 | is-fullwidth-code-point "^3.0.0" |
| 1353 | 791 | strip-ansi "^6.0.1" |
| 1354 | 792 | |
| 1355 | string_decoder@^1.1.1: | |
| 1356 | version "1.3.0" | |
| 1357 | resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" | |
| 1358 | integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== | |
| 1359 | dependencies: | |
| 1360 | safe-buffer "~5.2.0" | |
| 1361 | ||
| 1362 | 793 | strip-ansi@^6.0.0, strip-ansi@^6.0.1: |
| 1363 | 794 | version "6.0.1" |
| 1364 | resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" | |
| 795 | resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz" | |
| 1365 | 796 | integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== |
| 1366 | 797 | dependencies: |
| 1367 | 798 | ansi-regex "^5.0.1" |
| 1368 | 799 | |
| 1369 | 800 | strip-json-comments@^3.1.1: |
| 1370 | 801 | version "3.1.1" |
| 1371 | resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" | |
| 802 | resolved "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz" | |
| 1372 | 803 | integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== |
| 1373 | 804 | |
| 1374 | supports-color@8.1.1: | |
| 1375 | version "8.1.1" | |
| 1376 | resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz#cd6fc17e28500cff56c1b86c0a7fd4a54a73005c" | |
| 1377 | integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q== | |
| 1378 | dependencies: | |
| 1379 | has-flag "^4.0.0" | |
| 1380 | ||
| 1381 | 805 | supports-color@^7.1.0: |
| 1382 | 806 | version "7.2.0" |
| 1383 | resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" | |
| 807 | resolved "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz" | |
| 1384 | 808 | integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== |
| 1385 | 809 | dependencies: |
| 1386 | 810 | has-flag "^4.0.0" |
| 1387 | 811 | |
| 1388 | tar-fs@^3.1.1: | |
| 1389 | version "3.1.2" | |
| 1390 | resolved "https://registry.yarnpkg.com/tar-fs/-/tar-fs-3.1.2.tgz#114b012f54796f31e62f3e57792820a80b83ae6e" | |
| 1391 | integrity sha512-QGxxTxxyleAdyM3kpFs14ymbYmNFrfY+pHj7Z8FgtbZ7w2//VAgLMac7sT6nRpIHjppXO2AwwEOg0bPFVRcmXw== | |
| 1392 | dependencies: | |
| 1393 | pump "^3.0.0" | |
| 1394 | tar-stream "^3.1.5" | |
| 1395 | optionalDependencies: | |
| 1396 | bare-fs "^4.0.1" | |
| 1397 | bare-path "^3.0.0" | |
| 1398 | ||
| 1399 | tar-stream@^3.1.5: | |
| 1400 | version "3.1.7" | |
| 1401 | resolved "https://registry.yarnpkg.com/tar-stream/-/tar-stream-3.1.7.tgz#24b3fb5eabada19fe7338ed6d26e5f7c482e792b" | |
| 1402 | integrity sha512-qJj60CXt7IU1Ffyc3NJMjh6EkuCFej46zUqJ4J7pqYlThyd9bO0XBTmcOIhSzZJVWfsLks0+nle/j538YAW9RQ== | |
| 1403 | dependencies: | |
| 1404 | b4a "^1.6.4" | |
| 1405 | fast-fifo "^1.2.0" | |
| 1406 | streamx "^2.15.0" | |
| 1407 | ||
| 1408 | text-decoder@^1.1.0: | |
| 1409 | version "1.2.3" | |
| 1410 | resolved "https://registry.yarnpkg.com/text-decoder/-/text-decoder-1.2.3.tgz#b19da364d981b2326d5f43099c310cc80d770c65" | |
| 1411 | integrity sha512-3/o9z3X0X0fTupwsYvR03pJ/DjWuqqrfwBgTQzdWDiQSm9KitAyz/9WqsT2JQW7KV2m+bC2ol/zqpW37NHxLaA== | |
| 1412 | dependencies: | |
| 1413 | b4a "^1.6.4" | |
| 1414 | ||
| 1415 | text-hex@1.0.x: | |
| 1416 | version "1.0.0" | |
| 1417 | resolved "https://registry.yarnpkg.com/text-hex/-/text-hex-1.0.0.tgz#69dc9c1b17446ee79a92bf5b884bb4b9127506f5" | |
| 1418 | integrity sha512-uuVGNWzgJ4yhRaNSiubPY7OjISw4sw4E5Uv0wbjp+OzcbmVU/rsT8ujgcXJhn9ypzsgr5vlzpPqP+MBBKcGvbg== | |
| 1419 | ||
| 1420 | 812 | text-table@^0.2.0: |
| 1421 | 813 | version "0.2.0" |
| 1422 | resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" | |
| 814 | resolved "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz" | |
| 1423 | 815 | integrity sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw== |
| 1424 | 816 | |
| 1425 | 817 | to-regex-range@^5.0.1: |
| 1426 | 818 | version "5.0.1" |
| 1427 | resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" | |
| 819 | resolved "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz" | |
| 1428 | 820 | integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== |
| 1429 | 821 | dependencies: |
| 1430 | 822 | is-number "^7.0.0" |
| 1431 | 823 | |
| 1432 | triple-beam@^1.3.0: | |
| 1433 | version "1.4.1" | |
| 1434 | resolved "https://registry.yarnpkg.com/triple-beam/-/triple-beam-1.4.1.tgz#6fde70271dc6e5d73ca0c3b24e2d92afb7441984" | |
| 1435 | integrity sha512-aZbgViZrg1QNcG+LULa7nhZpJTZSLm/mXnHXnbAbjmN5aSa0y7V+wvv6+4WaBtpISJzThKy+PIPxc1Nq1EJ9mg== | |
| 1436 | ||
| 1437 | tslib@^2.0.1: | |
| 1438 | version "2.8.1" | |
| 1439 | resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.8.1.tgz#612efe4ed235d567e8aba5f2a5fab70280ade83f" | |
| 1440 | integrity sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w== | |
| 1441 | ||
| 1442 | 824 | type-check@^0.4.0, type-check@~0.4.0: |
| 1443 | 825 | version "0.4.0" |
| 1444 | resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1" | |
| 826 | resolved "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz" | |
| 1445 | 827 | integrity sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew== |
| 1446 | 828 | dependencies: |
| 1447 | 829 | prelude-ls "^1.2.1" |
| 1448 | 830 | |
| 1449 | 831 | type-fest@^0.20.2: |
| 1450 | 832 | version "0.20.2" |
| 1451 | resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.20.2.tgz#1bf207f4b28f91583666cb5fbd327887301cd5f4" | |
| 833 | resolved "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz" | |
| 1452 | 834 | integrity sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ== |
| 1453 | 835 | |
| 1454 | typed-query-selector@^2.12.1: | |
| 1455 | version "2.12.1" | |
| 1456 | resolved "https://registry.yarnpkg.com/typed-query-selector/-/typed-query-selector-2.12.1.tgz#04423bfb71b8f3aee3df1c29598ed6c7c8f55284" | |
| 1457 | integrity sha512-uzR+FzI8qrUEIu96oaeBJmd9E7CFEiQ3goA5qCVgc4s5llSubcfGHq9yUstZx/k4s9dXHVKsE35YWoFyvEqEHA== | |
| 836 | typed-query-selector@^2.12.2: | |
| 837 | version "2.12.2" | |
| 838 | resolved "https://registry.npmjs.org/typed-query-selector/-/typed-query-selector-2.12.2.tgz" | |
| 839 | integrity sha512-EOPFbyIub4ngnEdqi2yOcNeDLaX/0jcE1JoAXQDDMIthap7FoN795lc/SHfIq2d416VufXpM8z/lD+WRm2gfOQ== | |
| 1458 | 840 | |
| 1459 | 841 | typescript@^5.8.3: |
| 1460 | 842 | version "5.9.3" |
| 1461 | resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.9.3.tgz#5b4f59e15310ab17a216f5d6cf53ee476ede670f" | |
| 843 | resolved "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz" | |
| 1462 | 844 | integrity sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw== |
| 1463 | 845 | |
| 1464 | undici-types@~7.16.0: | |
| 1465 | version "7.16.0" | |
| 1466 | resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-7.16.0.tgz#ffccdff36aea4884cbfce9a750a0580224f58a46" | |
| 1467 | integrity sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw== | |
| 1468 | ||
| 1469 | update-browserslist-db@^1.1.4: | |
| 1470 | version "1.1.4" | |
| 1471 | resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.1.4.tgz#7802aa2ae91477f255b86e0e46dbc787a206ad4a" | |
| 1472 | integrity sha512-q0SPT4xyU84saUX+tomz1WLkxUbuaJnR1xWt17M7fJtEJigJeWUNGUqrauFXsHnqev9y9JTRGwk13tFBuKby4A== | |
| 1473 | dependencies: | |
| 1474 | escalade "^3.2.0" | |
| 1475 | picocolors "^1.1.1" | |
| 1476 | ||
| 1477 | 846 | uri-js@^4.2.2: |
| 1478 | 847 | version "4.4.1" |
| 1479 | resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e" | |
| 848 | resolved "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz" | |
| 1480 | 849 | integrity sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg== |
| 1481 | 850 | dependencies: |
| 1482 | 851 | punycode "^2.1.0" |
| 1483 | 852 | |
| 1484 | util-deprecate@^1.0.1: | |
| 1485 | version "1.0.2" | |
| 1486 | resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" | |
| 1487 | integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw== | |
| 1488 | ||
| 1489 | webdriver-bidi-protocol@0.4.1: | |
| 1490 | version "0.4.1" | |
| 1491 | resolved "https://registry.yarnpkg.com/webdriver-bidi-protocol/-/webdriver-bidi-protocol-0.4.1.tgz#d411e7b8e158408d83bb166b0b4f1054fa3f077e" | |
| 1492 | integrity sha512-ARrjNjtWRRs2w4Tk7nqrf2gBI0QXWuOmMCx2hU+1jUt6d00MjMxURrhxhGbrsoiZKJrhTSTzbIrc554iKI10qw== | |
| 853 | webdriver-bidi-protocol@0.4.2: | |
| 854 | version "0.4.2" | |
| 855 | resolved "https://registry.npmjs.org/webdriver-bidi-protocol/-/webdriver-bidi-protocol-0.4.2.tgz" | |
| 856 | integrity sha512-VSV+fzfChirL3e7jay2yUC7B4HQCGtEWEg/MSSQbK+qWbqeGlRLlXTzPpYr3XGUvbpDHumWZBJxgesg4N7dbtA== | |
| 1493 | 857 | |
| 1494 | 858 | which@^2.0.1: |
| 1495 | 859 | version "2.0.2" |
| 1496 | resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" | |
| 860 | resolved "https://registry.npmjs.org/which/-/which-2.0.2.tgz" | |
| 1497 | 861 | integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== |
| 1498 | 862 | dependencies: |
| 1499 | 863 | isexe "^2.0.0" |
| 1500 | 864 | |
| 1501 | winston-transport@^4.9.0: | |
| 1502 | version "4.9.0" | |
| 1503 | resolved "https://registry.yarnpkg.com/winston-transport/-/winston-transport-4.9.0.tgz#3bba345de10297654ea6f33519424560003b3bf9" | |
| 1504 | integrity sha512-8drMJ4rkgaPo1Me4zD/3WLfI/zPdA9o2IipKODunnGDcuqbHwjsbB79ylv04LCGGzU0xQ6vTznOMpQGaLhhm6A== | |
| 1505 | dependencies: | |
| 1506 | logform "^2.7.0" | |
| 1507 | readable-stream "^3.6.2" | |
| 1508 | triple-beam "^1.3.0" | |
| 1509 | ||
| 1510 | winston@3.17.0: | |
| 1511 | version "3.17.0" | |
| 1512 | resolved "https://registry.yarnpkg.com/winston/-/winston-3.17.0.tgz#74b8665ce9b4ea7b29d0922cfccf852a08a11423" | |
| 1513 | integrity sha512-DLiFIXYC5fMPxaRg832S6F5mJYvePtmO5G9v9IgUFPhXm9/GkXarH/TUrBAVzhTCzAj9anE/+GjrgXp/54nOgw== | |
| 1514 | dependencies: | |
| 1515 | "@colors/colors" "^1.6.0" | |
| 1516 | "@dabh/diagnostics" "^2.0.2" | |
| 1517 | async "^3.2.3" | |
| 1518 | is-stream "^2.0.0" | |
| 1519 | logform "^2.7.0" | |
| 1520 | one-time "^1.0.0" | |
| 1521 | readable-stream "^3.4.0" | |
| 1522 | safe-stable-stringify "^2.3.1" | |
| 1523 | stack-trace "0.0.x" | |
| 1524 | triple-beam "^1.3.0" | |
| 1525 | winston-transport "^4.9.0" | |
| 1526 | ||
| 1527 | 865 | word-wrap@^1.2.5: |
| 1528 | 866 | version "1.2.5" |
| 1529 | resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.5.tgz#d2c45c6dd4fbce621a66f136cbe328afd0410b34" | |
| 867 | resolved "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz" | |
| 1530 | 868 | integrity sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA== |
| 1531 | 869 | |
| 1532 | 870 | wrap-ansi@^7.0.0: |
| 1533 | 871 | version "7.0.0" |
| 1534 | resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" | |
| 872 | resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz" | |
| 1535 | 873 | integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== |
| 1536 | 874 | dependencies: |
| 1537 | 875 | ansi-styles "^4.0.0" |
| ... | ... | @@ -1540,27 +878,27 @@ wrap-ansi@^7.0.0: |
| 1540 | 878 | |
| 1541 | 879 | wrappy@1: |
| 1542 | 880 | version "1.0.2" |
| 1543 | resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" | |
| 881 | resolved "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz" | |
| 1544 | 882 | integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== |
| 1545 | 883 | |
| 1546 | ws@^8.19.0: | |
| 1547 | version "8.20.0" | |
| 1548 | resolved "https://registry.yarnpkg.com/ws/-/ws-8.20.0.tgz#4cd9532358eba60bc863aad1623dfb045a4d4af8" | |
| 1549 | integrity sha512-sAt8BhgNbzCtgGbt2OxmpuryO63ZoDk/sqaB/znQm94T4fCEsy/yV+7CdC1kJhOU9lboAEU7R3kquuycDoibVA== | |
| 884 | ws@^8.21.0: | |
| 885 | version "8.21.0" | |
| 886 | resolved "https://registry.npmjs.org/ws/-/ws-8.21.0.tgz" | |
| 887 | integrity sha512-Vsp28b7DRcimFQvrqu2Wek3z1iYxDCWqHYB8Qsnk/S4RfaCQzPGPyBNuVjJV3cd6UiKtUtp6sNM77gWvzcCH+g== | |
| 1550 | 888 | |
| 1551 | 889 | y18n@^5.0.5: |
| 1552 | 890 | version "5.0.8" |
| 1553 | resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55" | |
| 891 | resolved "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz" | |
| 1554 | 892 | integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA== |
| 1555 | 893 | |
| 1556 | 894 | yargs-parser@^21.1.1: |
| 1557 | 895 | version "21.1.1" |
| 1558 | resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35" | |
| 896 | resolved "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz" | |
| 1559 | 897 | integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw== |
| 1560 | 898 | |
| 1561 | 899 | yargs@^17.7.2: |
| 1562 | 900 | version "17.7.2" |
| 1563 | resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.7.2.tgz#991df39aca675a192b816e1e0363f9d75d2aa269" | |
| 901 | resolved "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz" | |
| 1564 | 902 | integrity sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w== |
| 1565 | 903 | dependencies: |
| 1566 | 904 | cliui "^8.0.1" |
| ... | ... | @@ -1571,20 +909,12 @@ yargs@^17.7.2: |
| 1571 | 909 | y18n "^5.0.5" |
| 1572 | 910 | yargs-parser "^21.1.1" |
| 1573 | 911 | |
| 1574 | yauzl@^2.10.0: | |
| 1575 | version "2.10.0" | |
| 1576 | resolved "https://registry.yarnpkg.com/yauzl/-/yauzl-2.10.0.tgz#c7eb17c93e112cb1086fa6d8e51fb0667b79a5f9" | |
| 1577 | integrity sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g== | |
| 1578 | dependencies: | |
| 1579 | buffer-crc32 "~0.2.3" | |
| 1580 | fd-slicer "~1.1.0" | |
| 1581 | ||
| 1582 | 912 | yocto-queue@^0.1.0: |
| 1583 | 913 | version "0.1.0" |
| 1584 | resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" | |
| 914 | resolved "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz" | |
| 1585 | 915 | integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q== |
| 1586 | 916 | |
| 1587 | 917 | zod@^3.24.1: |
| 1588 | 918 | version "3.25.76" |
| 1589 | resolved "https://registry.yarnpkg.com/zod/-/zod-3.25.76.tgz#26841c3f6fd22a6a2760e7ccb719179768471e34" | |
| 919 | resolved "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz" | |
| 1590 | 920 | integrity sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ== |