authorbors <bors@rust-lang.org> 2026-06-11 07:18:20 UTC
committerbors <bors@rust-lang.org> 2026-06-11 07:18:20 UTC
log32cfe53009803b85afd40ff72768bb058e9936f0
tree1d5c091e67a68873b3dffa97bc8b98e3eb889811
parent485ec3fbcc12fa14ef6596dabb125ad710499c9e
parent8a1eb73ffb9fe155af8a8ed5913eac8e814d528c

Auto merge of #157739 - jhpratt:rollup-i0yIAZ9, r=jhpratt

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;
3131use rustc_macros::{Decodable, Encodable, StableHash, Walkable};
3232pub use rustc_span::AttrId;
3333use 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,
3536};
3637use thin_vec::{ThinVec, thin_vec};
3738
......@@ -3906,10 +3907,10 @@ pub struct EiiImpl {
39063907 pub is_default: bool,
39073908}
39083909
3909#[derive(Clone, Encodable, Decodable, Debug, Walkable, PartialEq, Eq)]
3910#[derive(Clone, Copy, Encodable, Decodable, Debug, PartialEq, Eq)]
39103911pub enum DelegationSource {
39113912 Single,
3912 List,
3913 List(LocalExpnId),
39133914 Glob,
39143915}
39153916
......@@ -3923,6 +3924,7 @@ pub struct Delegation {
39233924 pub rename: Option<Ident>,
39243925 pub body: Option<Box<Block>>,
39253926 /// The item was expanded from a glob delegation item.
3927 #[visitable(ignore)]
39263928 pub source: DelegationSource,
39273929}
39283930
compiler/rustc_ast/src/visit.rs-1
......@@ -431,7 +431,6 @@ macro_rules! common_visitor_and_walkers {
431431 Delegation,
432432 DelegationMac,
433433 DelegationSuffixes,
434 DelegationSource,
435434 DelimArgs,
436435 DelimSpan,
437436 EnumDef,
compiler/rustc_ast_lowering/src/delegation.rs+29-9
......@@ -62,7 +62,7 @@ use crate::diagnostics::{
6262};
6363use crate::{
6464 AllowReturnTypeNotation, ImplTraitContext, ImplTraitPosition, LoweringContext, ParamMode,
65 ResolverAstLoweringExt, index_crate,
65 index_crate,
6666};
6767
6868mod generics;
......@@ -126,7 +126,7 @@ pub(crate) fn delegations_resolutions(
126126 let delegation = ast_index[def_id].delegation().expect("processing delegations");
127127 let span = delegation.last_segment_span();
128128
129 if let Some(info) = resolver.delegation_info(def_id) {
129 if let Some(info) = tcx.resolutions(()).delegation_infos.get(&def_id) {
130130 let res = info.resolution_id.map(|id| check_for_cycles(tcx, id, span).map(|_| id));
131131 result.insert(def_id, res.flatten());
132132 } else {
......@@ -143,8 +143,6 @@ pub(crate) fn delegations_resolutions(
143143fn check_for_cycles(tcx: TyCtxt<'_>, mut def_id: DefId, span: Span) -> Result<(), ErrorGuaranteed> {
144144 let mut visited: FxHashSet<DefId> = Default::default();
145145
146 let (resolver, _) = &*tcx.hir_crate(()).delayed_resolver.borrow();
147
148146 loop {
149147 visited.insert(def_id);
150148
......@@ -152,7 +150,7 @@ fn check_for_cycles(tcx: TyCtxt<'_>, mut def_id: DefId, span: Span) -> Result<()
152150 // it means that we refer to another delegation as a callee, so in order to obtain
153151 // a signature DefId we obtain NodeId of the callee delegation and try to get signature from it.
154152 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)
156154 && let Ok(id) = info.resolution_id
157155 {
158156 def_id = id;
......@@ -209,10 +207,11 @@ impl<'hir> LoweringContext<'_, 'hir> {
209207
210208 let mut generics = self.uplift_delegation_generics(delegation, sig_id, is_method);
211209
212 let (body_id, call_expr_id) =
210 let (body_id, call_expr_id, unused_target_expr) =
213211 self.lower_delegation_body(delegation, sig_id, param_count, &mut generics, span);
214212
215213 let decl = self.lower_delegation_decl(
214 delegation.source,
216215 sig_id,
217216 param_count,
218217 c_variadic,
......@@ -220,6 +219,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
220219 &generics,
221220 delegation.id,
222221 call_expr_id,
222 unused_target_expr,
223223 );
224224
225225 let sig = self.lower_delegation_sig(sig_id, decl, span);
......@@ -375,6 +375,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
375375
376376 fn lower_delegation_decl(
377377 &mut self,
378 source: DelegationSource,
378379 sig_id: DefId,
379380 param_count: usize,
380381 c_variadic: bool,
......@@ -382,6 +383,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
382383 generics: &GenericsGenerationResults<'hir>,
383384 call_path_node_id: NodeId,
384385 call_expr_id: HirId,
386 unused_target_expr: bool,
385387 ) -> &'hir hir::FnDecl<'hir> {
386388 // The last parameter in C variadic functions is skipped in the signature,
387389 // like during regular lowering.
......@@ -406,6 +408,17 @@ impl<'hir> LoweringContext<'_, 'hir> {
406408 parent_args_segment_id: generics.parent.args_segment_id,
407409 self_ty_id: generics.self_ty_id,
408410 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 },
409422 })),
410423 )),
411424 span,
......@@ -504,9 +517,10 @@ impl<'hir> LoweringContext<'_, 'hir> {
504517 param_count: usize,
505518 generics: &mut GenericsGenerationResults<'hir>,
506519 span: Span,
507 ) -> (BodyId, HirId) {
520 ) -> (BodyId, HirId, bool) {
508521 let block = delegation.body.as_deref();
509522 let mut call_expr_id = HirId::INVALID;
523 let mut unused_target_expr = false;
510524
511525 let block_id = self.lower_body(|this| {
512526 let mut parameters: Vec<hir::Param<'_>> = Vec::with_capacity(param_count);
......@@ -514,6 +528,12 @@ impl<'hir> LoweringContext<'_, 'hir> {
514528 let mut stmts: &[hir::Stmt<'hir>] = &[];
515529
516530 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);
517537
518538 for idx in 0..param_count {
519539 let (param, pat_node_id) = this.generate_param(is_method, idx, span);
......@@ -524,7 +544,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
524544
525545 let arg = if let Some(block) = block
526546 && idx == 0
527 && this.should_generate_block(delegation, sig_id, is_method)
547 && should_generate_block
528548 {
529549 let mut self_resolver = SelfResolver {
530550 ctxt: this,
......@@ -565,7 +585,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
565585
566586 debug_assert_ne!(call_expr_id, HirId::INVALID);
567587
568 (block_id, call_expr_id)
588 (block_id, call_expr_id, unused_target_expr)
569589 }
570590
571591 fn finalize_body_lowering(
compiler/rustc_ast_lowering/src/item.rs+1-1
......@@ -1000,7 +1000,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
10001000 } else {
10011001 None
10021002 };
1003 hir::TraitItemKind::Const(ty, rhs, rhs_kind.is_type_const().into())
1003 hir::TraitItemKind::Const(ty, rhs)
10041004 },
10051005 );
10061006
compiler/rustc_ast_lowering/src/lib.rs+1-5
......@@ -63,7 +63,7 @@ use rustc_macros::extension;
6363use rustc_middle::hir::{self as mid_hir};
6464use rustc_middle::queries::Providers;
6565use rustc_middle::span_bug;
66use rustc_middle::ty::{DelegationInfo, PerOwnerResolverData, ResolverAstLowering, TyCtxt};
66use rustc_middle::ty::{PerOwnerResolverData, ResolverAstLowering, TyCtxt};
6767use rustc_session::errors::add_feature_diagnostics;
6868use rustc_span::symbol::{Ident, Symbol, kw, sym};
6969use rustc_span::{DUMMY_SP, DesugaringKind, Span};
......@@ -307,10 +307,6 @@ impl<'tcx> ResolverAstLowering<'tcx> {
307307 self.extra_lifetime_params_map.get(&id).map_or(&[], |v| &v[..])
308308 }
309309
310 fn delegation_info(&self, id: LocalDefId) -> Option<&DelegationInfo> {
311 self.delegation_infos.get(&id)
312 }
313
314310 fn owner_def_id(&self, id: NodeId) -> LocalDefId {
315311 self.owners[&id].def_id
316312 }
compiler/rustc_borrowck/src/diagnostics/mod.rs+13-4
......@@ -34,6 +34,7 @@ use tracing::debug;
3434
3535use super::MirBorrowckCtxt;
3636use super::borrow_set::BorrowData;
37use crate::LocalMutationIsAllowed;
3738use crate::constraints::OutlivesConstraint;
3839use crate::nll::ConstraintDescription;
3940use crate::session_diagnostics::{
......@@ -537,9 +538,9 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
537538 Some(self.infcx.tcx.hir_name(var_id).to_string())
538539 }
539540 _ => {
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())
543544 }
544545 }
545546 }
......@@ -1426,11 +1427,19 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
14261427 if let ty::Ref(_, _, hir::Mutability::Mut) =
14271428 moved_place.ty(self.body, self.infcx.tcx).ty.kind()
14281429 {
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();
14291438 // Suggest `reborrow` in other place for following situations:
14301439 // 1. If we are in a loop this will be suggested later.
14311440 // 2. If the moved value is a mut reference, it is used in a
14321441 // 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 {
14341443 self.suggest_reborrow(
14351444 err,
14361445 move_span.shrink_to_lo(),
compiler/rustc_builtin_macros/src/diagnostics.rs+3-2
......@@ -1135,8 +1135,9 @@ pub(crate) struct EiiStaticMultipleImplementations {
11351135}
11361136
11371137#[derive(Diagnostic)]
1138#[diag("`#[{$name}]` cannot be used on statics with a value")]
1139pub(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")]
1140pub(crate) struct EiiStaticDefaultApple {
11401141 #[primary_span]
11411142 pub span: Span,
11421143 pub name: String,
compiler/rustc_builtin_macros/src/eii.rs+55-31
......@@ -13,7 +13,7 @@ use crate::diagnostics::{
1313 EiiAttributeNotSupported, EiiExternTargetExpectedList, EiiExternTargetExpectedMacro,
1414 EiiExternTargetExpectedUnsafe, EiiMacroExpectedMaxOneArgument, EiiOnlyOnce,
1515 EiiSharedMacroInStatementPosition, EiiSharedMacroTarget, EiiStaticArgumentRequired,
16 EiiStaticDefault, EiiStaticMultipleImplementations, EiiStaticMutable,
16 EiiStaticDefaultApple, EiiStaticMultipleImplementations, EiiStaticMutable,
1717};
1818
1919/// ```rust
......@@ -86,14 +86,17 @@ fn eii_(
8686 let (item_span, foreign_item_name) = match kind {
8787 ItemKind::Fn(func) => (func.sig.span, func.ident),
8888 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,
9395 name: path_to_string(&meta_item.path),
9496 });
9597 return vec![];
9698 }
99
97100 // Statics must have an explicit name for the eii
98101 if meta_item.is_word() {
99102 ecx.dcx().emit_err(EiiStaticArgumentRequired {
......@@ -139,19 +142,17 @@ fn eii_(
139142
140143 let mut module_items = Vec::new();
141144
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);
155156 }
156157
157158 module_items.push(generate_foreign_item(
......@@ -266,18 +267,31 @@ fn filter_attrs_for_multiple_eii_attr(
266267 .collect()
267268}
268269
269fn generate_default_func_impl(
270fn generate_default_impl(
270271 ecx: &mut ExtCtxt<'_>,
271 func: &ast::Fn,
272 item_kind: &ItemKind,
272273 impl_unsafe: bool,
273274 macro_name: Ident,
274275 eii_attr_span: Span,
275276 item_span: Span,
276277 foreign_item_name: Ident,
277278 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 {
281295 node_id: DUMMY_NODE_ID,
282296 inner_span: macro_name.span,
283297 eii_macro_path: ast::Path::from_ident(macro_name),
......@@ -297,7 +311,18 @@ fn generate_default_func_impl(
297311 ),
298312 impl_unsafe,
299313 }),
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 };
301326
302327 let anon_mod = |span: Span, stmts: ThinVec<ast::Stmt>| {
303328 let unit = ecx.ty(item_span, ast::TyKind::Tup(ThinVec::new()));
......@@ -311,15 +336,12 @@ fn generate_default_func_impl(
311336 };
312337
313338 // const _: () = {
314 // <orig fn>
339 // <orig item>
315340 // }
316 anon_mod(
341 Some(anon_mod(
317342 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 ))
323345}
324346
325347/// Generates a foreign item, like
......@@ -405,6 +427,8 @@ fn generate_foreign_static(mut stat: Box<ast::StaticItem>) -> ast::ForeignItemKi
405427 stat.safety = ast::Safety::Safe(stat.ident.span);
406428 }
407429
430 stat.expr = None;
431
408432 ast::ForeignItemKind::Static(stat)
409433}
410434
compiler/rustc_builtin_macros/src/test_harness.rs+4-2
......@@ -1,6 +1,7 @@
11// Code that generates a test runner to run all the tests in a crate
22
33use std::mem;
4use std::sync::atomic::Ordering;
45
56use rustc_ast as ast;
67use rustc_ast::attr::contains_name;
......@@ -202,7 +203,7 @@ impl<'a> MutVisitor for EntryPointCleaner<'a> {
202203 // clash with the one we're going to add, but mark it as
203204 // #[allow(dead_code)] to avoid printing warnings.
204205 match entry_point_type(&item, self.depth == 0) {
205 EntryPointType::MainNamed | EntryPointType::RustcMainAttr => {
206 EntryPointType::RustcMainAttr => {
206207 let allow_dead_code = attr::mk_attr_nested_word(
207208 &self.sess.psess.attr_id_generator,
208209 ast::AttrStyle::Outer,
......@@ -213,8 +214,9 @@ impl<'a> MutVisitor for EntryPointCleaner<'a> {
213214 );
214215 item.attrs.retain(|attr| !attr.has_name(sym::rustc_main));
215216 item.attrs.push(allow_dead_code);
217 self.sess.removed_rustc_main_attr.store(true, Ordering::Relaxed);
216218 }
217 EntryPointType::None | EntryPointType::OtherMain => {}
219 EntryPointType::None | EntryPointType::MainNamed | EntryPointType::OtherMain => {}
218220 };
219221 }
220222}
compiler/rustc_codegen_ssa/src/back/archive.rs+3-154
......@@ -1,18 +1,16 @@
1use std::env;
12use std::error::Error;
23use std::ffi::OsString;
34use std::fs::{self, File};
45use std::io::{self, BufWriter, Write};
56use std::path::{Path, PathBuf};
6use std::{env, mem};
77
88use ar_archive_writer::{
99 ArchiveKind, COFFShortExport, MachineTypes, NewArchiveMember, write_archive_to_stream,
1010};
1111pub use ar_archive_writer::{DEFAULT_OBJECT_READER, ObjectReader};
1212use object::read::archive::{ArchiveFile, ArchiveKind as ObjectArchiveKind};
13use object::read::elf::Sym as _;
14use object::read::macho::{FatArch, Nlist};
15use object::{Endianness, elf, macho};
13use object::read::macho::FatArch;
1614use rustc_data_structures::fx::{FxHashSet, FxIndexSet};
1715use rustc_data_structures::memmap::Mmap;
1816use rustc_fs_util::TempDirBuilder;
......@@ -24,6 +22,7 @@ use tracing::trace;
2422
2523use super::metadata::{create_compressed_metadata_file, search_for_section};
2624use super::rmeta_link;
25use super::symbol_edit::apply_hide;
2726use crate::common;
2827// Public for ArchiveBuilderBuilder::extract_bundled_libs
2928pub use crate::errors::ExtractBundledLibsError;
......@@ -671,153 +670,3 @@ impl<'a> ArArchiveBuilder<'a> {
671670fn io_error_context(context: &str, err: io::Error) -> io::Error {
672671 io::Error::new(io::ErrorKind::Other, format!("{context}: {err}"))
673672}
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.
684struct Patch {
685 offset: usize,
686 value: u8,
687}
688
689/// Apply a list of byte patches to `data`, returning the (possibly modified) bytes.
690fn 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
702fn 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>>
707where
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
744fn 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
793fn 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
820fn 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;
1111pub mod metadata;
1212pub mod rmeta_link;
1313pub(crate) mod rpath;
14mod symbol_edit;
1415pub mod symbol_export;
1516pub mod write;
1617
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
9use std::mem;
10
11use object::read::elf::Sym as _;
12use object::read::macho::Nlist;
13use object::{Endianness, elf, macho};
14use rustc_data_structures::fx::FxHashSet;
15
16/// A byte-level patch collected in the read-only pass and applied in the write pass.
17struct Patch {
18 offset: usize,
19 value: u8,
20}
21
22/// Apply a list of byte patches to `data`, returning the (possibly modified) bytes.
23fn 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
35fn 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>>
40where
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
77fn 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
126fn 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
153pub(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;
4545/// This graph implementation predates the later [graph traits](crate::graph),
4646/// and does not implement those traits, so it has its own implementations of a
4747/// few basic graph algorithms.
48#[derive(Clone)]
4849pub struct LinkedGraph<N, E> {
4950 nodes: IndexVec<NodeIndex, Node<N>>,
5051 edges: Vec<Edge<E>>,
5152}
5253
54#[derive(Clone)]
5355pub struct Node<N> {
5456 first_edge: [EdgeIndex; 2], // see module comment
5557 pub data: Option<N>,
5658}
5759
58#[derive(Debug)]
60#[derive(Clone, Debug)]
5961pub struct Edge<E> {
6062 next_edge: [EdgeIndex; 2], // see module comment
6163 source: NodeIndex,
compiler/rustc_data_structures/src/marker.rs+1
......@@ -64,6 +64,7 @@ already_send!(
6464 [std::io::Error][std::fs::File][std::panic::Location<'_>][rustc_arena::DroplessArena]
6565 [jobserver_crate::Client][jobserver_crate::HelperThread][crate::memmap::Mmap]
6666 [crate::profiling::SelfProfiler][crate::owned_slice::OwnedSlice]
67 [rustc_serialize::opaque::FileEncoder<'_>]
6768);
6869
6970#[cfg(target_has_atomic = "64")]
compiler/rustc_errors/src/lib.rs+49-23
......@@ -24,6 +24,7 @@ use std::io::Write;
2424use std::num::NonZero;
2525use std::ops::DerefMut;
2626use std::path::{Path, PathBuf};
27use std::thread::ThreadId;
2728use std::{assert_matches, fmt, panic};
2829
2930use Level::*;
......@@ -297,11 +298,12 @@ impl<'a> std::ops::Deref for DiagCtxtHandle<'a> {
297298struct DiagCtxtInner {
298299 flags: DiagCtxtFlags,
299300
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)>,
305307 /// The delayed bugs and their error guarantees.
306308 delayed_bugs: Vec<(DelayedDiagInner, ErrorGuaranteed)>,
307309
......@@ -343,7 +345,7 @@ struct DiagCtxtInner {
343345 /// `emit_stashed_diagnostics` by the time the `DiagCtxtInner` is dropped,
344346 /// otherwise an assertion failure will occur.
345347 stashed_diagnostics:
346 FxIndexMap<StashKey, FxIndexMap<Span, (DiagInner, Option<ErrorGuaranteed>)>>,
348 FxIndexMap<StashKey, FxIndexMap<Span, (DiagInner, Option<ErrorGuaranteed>, ThreadId)>>,
347349
348350 future_breakage_diagnostics: Vec<DiagInner>,
349351
......@@ -613,7 +615,7 @@ impl<'a> DiagCtxtHandle<'a> {
613615 .stashed_diagnostics
614616 .entry(key)
615617 .or_default()
616 .insert(span.with_parent(None), (diag, guar));
618 .insert(span.with_parent(None), (diag, guar, std::thread::current().id()));
617619
618620 guar
619621 }
......@@ -623,7 +625,7 @@ impl<'a> DiagCtxtHandle<'a> {
623625 /// error.
624626 pub fn steal_non_err(self, span: Span, key: StashKey) -> Option<Diag<'a, ()>> {
625627 // 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(
627629 |stashed_diagnostics| stashed_diagnostics.swap_remove(&span.with_parent(None)),
628630 )?;
629631 assert!(!diag.is_error());
......@@ -648,7 +650,7 @@ impl<'a> DiagCtxtHandle<'a> {
648650 let err = self.inner.borrow_mut().stashed_diagnostics.get_mut(&key).and_then(
649651 |stashed_diagnostics| stashed_diagnostics.swap_remove(&span.with_parent(None)),
650652 );
651 err.map(|(err, guar)| {
653 err.map(|(err, guar, _)| {
652654 // The use of `::<ErrorGuaranteed>` is safe because level is `Level::Error`.
653655 assert_eq!(err.level, Error);
654656 assert!(guar.is_some());
......@@ -673,7 +675,7 @@ impl<'a> DiagCtxtHandle<'a> {
673675 |stashed_diagnostics| stashed_diagnostics.swap_remove(&span.with_parent(None)),
674676 );
675677 match old_err {
676 Some((old_err, guar)) => {
678 Some((old_err, guar, _)) => {
677679 assert_eq!(old_err.level, Error);
678680 assert!(guar.is_some());
679681 // Because `old_err` has already been counted, it can only be
......@@ -710,7 +712,27 @@ impl<'a> DiagCtxtHandle<'a> {
710712 + inner
711713 .stashed_diagnostics
712714 .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 })
714736 .sum::<usize>()
715737 }
716738
......@@ -879,7 +901,8 @@ impl<'a> DiagCtxtHandle<'a> {
879901 // This `unchecked_error_guaranteed` is valid. It is where the
880902 // `ErrorGuaranteed` for unused_extern errors originates.
881903 #[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()));
883906 inner.panic_if_treat_err_as_bug();
884907 }
885908
......@@ -1178,7 +1201,7 @@ impl DiagCtxtInner {
11781201 let mut guar = None;
11791202 let has_errors = !self.err_guars.is_empty();
11801203 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 {
11821205 if !diag.is_error() {
11831206 // Unless they're forced, don't flush stashed warnings when
11841207 // there are errors, to avoid causing warning overload. The
......@@ -1347,13 +1370,14 @@ impl DiagCtxtInner {
13471370 // `ErrorGuaranteed` for errors and lint errors originates.
13481371 #[allow(deprecated)]
13491372 let guar = ErrorGuaranteed::unchecked_error_guaranteed();
1373 let thread = std::thread::current().id();
13501374 if is_lint {
1351 self.lint_err_guars.push(guar);
1375 self.lint_err_guars.push((guar, thread));
13521376 } else {
13531377 if let Some(taint) = taint {
13541378 taint.set(Some(guar));
13551379 }
1356 self.err_guars.push(guar);
1380 self.err_guars.push((guar, thread));
13571381 }
13581382 self.panic_if_treat_err_as_bug();
13591383 Some(guar)
......@@ -1377,12 +1401,12 @@ impl DiagCtxtInner {
13771401 }
13781402
13791403 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
13821406 .stashed_diagnostics
13831407 .values()
13841408 .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())
13861410 {
13871411 *guar
13881412 } else {
......@@ -1392,13 +1416,15 @@ impl DiagCtxtInner {
13921416 }
13931417
13941418 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(|| {
13971424 self.stashed_diagnostics.values().find_map(|stashed_diagnostics| {
1398 stashed_diagnostics.values().find_map(|(_, guar)| *guar)
1425 stashed_diagnostics.values().find_map(|(_, guar, _)| *guar)
13991426 })
1400 },
1401 )
1427 })
14021428 }
14031429
14041430 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};
3232use smallvec::{SmallVec, smallvec};
3333use thin_vec::ThinVec;
3434
35use crate::errors;
35use crate::diagnostics;
3636use crate::expand::{self, AstFragment, Invocation};
3737use crate::mbe::macro_rules::ParserAnyMacro;
3838use crate::module::DirOwnership;
......@@ -954,7 +954,7 @@ impl SyntaxExtension {
954954 let stability = find_attr!(attrs, Stability { stability, .. } => *stability);
955955
956956 if let Some(sp) = find_attr!(attrs, RustcBodyStability{ span, .. } => *span) {
957 sess.dcx().emit_err(errors::MacroBodyStability {
957 sess.dcx().emit_err(diagnostics::MacroBodyStability {
958958 span: sp,
959959 head_span: sess.source_map().guess_head_span(span),
960960 });
......@@ -1358,7 +1358,7 @@ impl<'a> ExtCtxt<'a> {
13581358
13591359 pub fn trace_macros_diag(&mut self) {
13601360 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 });
13621362 for note in notes {
13631363 db.note(note.clone());
13641364 }
......@@ -1401,7 +1401,7 @@ pub fn resolve_path(sess: &Session, path: impl Into<PathBuf>, span: Span) -> PRe
14011401 let callsite = span.source_callsite();
14021402 let source_map = sess.source_map();
14031403 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 {
14051405 span,
14061406 path: source_map
14071407 .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;
3131use rustc_span::{STDLIB_STABLE_CRATES, Span, Symbol, sym};
3232use tracing::instrument;
3333
34use crate::errors::{
34use crate::diagnostics::{
3535 CrateNameInCfgAttr, CrateTypeInCfgAttr, FeatureNotAllowed, FeatureRemoved,
3636 FeatureRemovedReason, InvalidCfg, RemoveExprNotSupported,
3737};
......@@ -282,7 +282,7 @@ impl<'a> StripUnconfigured<'a> {
282282 rustc_lint_defs::builtin::UNUSED_ATTRIBUTES,
283283 cfg_attr.span,
284284 ast::CRATE_NODE_ID,
285 crate::errors::CfgAttrNoAttributes,
285 crate::diagnostics::CfgAttrNoAttributes,
286286 );
287287 }
288288
compiler/rustc_expand/src/diagnostics.rs created+665
......@@ -0,0 +1,665 @@
1use std::borrow::Cow;
2
3use rustc_errors::codes::*;
4use rustc_hir::limit::Limit;
5use rustc_macros::{Diagnostic, Subdiagnostic};
6use rustc_span::{Ident, MacroRulesNormalizedIdent, Span, Symbol};
7
8#[derive(Diagnostic)]
9#[diag("`#[cfg_attr]` does not expand to any attributes")]
10pub(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)]
16pub(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)]
37pub(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")]
45pub(crate) struct VarTypoSuggestionUnrepeatable {
46 #[primary_span]
47 pub span: Span,
48}
49
50#[derive(Subdiagnostic)]
51#[label("this similarly named macro metavariable is unrepeatable")]
52pub(crate) struct VarTypoSuggestionUnrepeatableLabel {
53 #[primary_span]
54 pub span: Span,
55}
56
57#[derive(Subdiagnostic)]
58#[label("expected a repeatable metavariable: {$msg}")]
59pub(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)]
69pub(crate) struct NoRepeatableVar {
70 #[primary_span]
71 pub span: Span,
72}
73
74#[derive(Diagnostic)]
75#[diag("this must repeat at least once")]
76pub(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")]
83pub(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")]
90pub(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")]
98pub(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")]
106pub(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}")]
115pub(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}`")]
123pub(crate) struct UnknownMacroVariable {
124 pub name: MacroRulesNormalizedIdent,
125}
126
127#[derive(Diagnostic)]
128#[diag("cannot resolve relative path in non-file source `{$path}`")]
129pub(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")]
137pub(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}")]
148pub(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}")]
160pub(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)]
166pub(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)]
177pub(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")]
187pub(crate) struct RemoveExprNotSupported {
188 #[primary_span]
189 pub span: Span,
190}
191
192#[derive(Diagnostic)]
193pub(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}")]
228pub(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")]
237pub(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")]
245pub(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")]
267pub(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}")]
275pub(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")]
284pub(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")]
293pub(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)]
305pub(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")]
316pub(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")]
326pub(crate) struct TraceMacro {
327 #[primary_span]
328 pub span: Span,
329}
330
331#[derive(Diagnostic)]
332#[diag("proc macro panicked")]
333pub(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}")]
342pub(crate) struct ProcMacroPanickedHelp {
343 pub message: String,
344}
345
346#[derive(Diagnostic)]
347#[diag("proc-macro derive panicked")]
348pub(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}")]
357pub(crate) struct ProcMacroDerivePanickedHelp {
358 pub message: String,
359}
360
361#[derive(Diagnostic)]
362#[diag("custom attribute panicked")]
363pub(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}")]
372pub(crate) struct CustomAttributePanickedHelp {
373 pub message: String,
374}
375
376#[derive(Diagnostic)]
377#[diag("proc-macro derive produced unparsable tokens")]
378pub(crate) struct ProcMacroDeriveTokens {
379 #[primary_span]
380 pub span: Span,
381}
382
383#[derive(Diagnostic)]
384#[diag("duplicate matcher binding")]
385pub(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")]
395pub(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}")]
406pub(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}")]
422pub(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}`")]
431pub(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")]
439pub(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")]
447pub(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")]
454pub(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")]
461pub(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")]
468pub(crate) struct GlobDelegationTraitlessQpath {
469 #[primary_span]
470 pub span: Span,
471}
472
473pub(crate) use metavar_exprs::*;
474mod 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")]
594pub(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)]
607pub(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)]
619pub(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)]
628pub(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")]
640pub(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}`")]
651pub(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 @@
1use std::borrow::Cow;
2
3use rustc_errors::codes::*;
4use rustc_hir::limit::Limit;
5use rustc_macros::{Diagnostic, Subdiagnostic};
6use rustc_span::{Ident, MacroRulesNormalizedIdent, Span, Symbol};
7
8#[derive(Diagnostic)]
9#[diag("`#[cfg_attr]` does not expand to any attributes")]
10pub(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)]
16pub(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)]
37pub(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")]
45pub(crate) struct VarTypoSuggestionUnrepeatable {
46 #[primary_span]
47 pub span: Span,
48}
49
50#[derive(Subdiagnostic)]
51#[label("this similarly named macro metavariable is unrepeatable")]
52pub(crate) struct VarTypoSuggestionUnrepeatableLabel {
53 #[primary_span]
54 pub span: Span,
55}
56
57#[derive(Subdiagnostic)]
58#[label("expected a repeatable metavariable: {$msg}")]
59pub(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)]
69pub(crate) struct NoRepeatableVar {
70 #[primary_span]
71 pub span: Span,
72}
73
74#[derive(Diagnostic)]
75#[diag("this must repeat at least once")]
76pub(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")]
83pub(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")]
90pub(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")]
98pub(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")]
106pub(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}")]
115pub(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}`")]
123pub(crate) struct UnknownMacroVariable {
124 pub name: MacroRulesNormalizedIdent,
125}
126
127#[derive(Diagnostic)]
128#[diag("cannot resolve relative path in non-file source `{$path}`")]
129pub(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")]
137pub(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}")]
148pub(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}")]
160pub(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)]
166pub(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)]
177pub(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")]
187pub(crate) struct RemoveExprNotSupported {
188 #[primary_span]
189 pub span: Span,
190}
191
192#[derive(Diagnostic)]
193pub(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}")]
228pub(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")]
237pub(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")]
245pub(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")]
267pub(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}")]
275pub(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")]
284pub(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")]
293pub(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)]
305pub(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")]
316pub(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")]
326pub(crate) struct TraceMacro {
327 #[primary_span]
328 pub span: Span,
329}
330
331#[derive(Diagnostic)]
332#[diag("proc macro panicked")]
333pub(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}")]
342pub(crate) struct ProcMacroPanickedHelp {
343 pub message: String,
344}
345
346#[derive(Diagnostic)]
347#[diag("proc-macro derive panicked")]
348pub(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}")]
357pub(crate) struct ProcMacroDerivePanickedHelp {
358 pub message: String,
359}
360
361#[derive(Diagnostic)]
362#[diag("custom attribute panicked")]
363pub(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}")]
372pub(crate) struct CustomAttributePanickedHelp {
373 pub message: String,
374}
375
376#[derive(Diagnostic)]
377#[diag("proc-macro derive produced unparsable tokens")]
378pub(crate) struct ProcMacroDeriveTokens {
379 #[primary_span]
380 pub span: Span,
381}
382
383#[derive(Diagnostic)]
384#[diag("duplicate matcher binding")]
385pub(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")]
395pub(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}")]
406pub(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}")]
422pub(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}`")]
431pub(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")]
439pub(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")]
447pub(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")]
454pub(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")]
461pub(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")]
468pub(crate) struct GlobDelegationTraitlessQpath {
469 #[primary_span]
470 pub span: Span,
471}
472
473pub(crate) use metavar_exprs::*;
474mod 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")]
594pub(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)]
607pub(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)]
619pub(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)]
628pub(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")]
640pub(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}`")]
651pub(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;
88use rustc_ast::visit::{self, AssocCtxt, Visitor, VisitorResult, try_visit, walk_list};
99use rustc_ast::{
1010 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,
1414};
1515use rustc_ast_pretty::pprust;
1616use rustc_attr_parsing::parser::AllowExprMetavar;
......@@ -38,7 +38,7 @@ use smallvec::SmallVec;
3838
3939use crate::base::*;
4040use crate::config::{StripUnconfigured, attr_into_trace};
41use crate::errors::{
41use crate::diagnostics::{
4242 EmptyDelegationMac, GlobDelegationOutsideImpls, GlobDelegationTraitlessQpath, IncompleteParse,
4343 RecursionLimitReached, RemoveExprNotSupported, RemoveNodeNotSupported, UnsupportedKeyValue,
4444 WrongFragmentKind,
......@@ -992,7 +992,12 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
992992
993993 type Node = AstNodeWrapper<Box<ast::AssocItem>, ImplItemTag>;
994994 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,
9961001 );
9971002 // `-Zmacro-stats` ignores these because they don't seem important.
9981003 fragment_kind.expect_from_annotatables(single_delegations.map(|item| {
......@@ -2041,8 +2046,12 @@ fn build_single_delegations<'a, Node: InvocationCollectorNode>(
20412046 item: &'a ast::Item<Node::ItemKind>,
20422047 suffixes: &'a [(Ident, Option<Ident>)],
20432048 item_span: Span,
2044 from_glob: bool,
2049 source: DelegationSource,
20452050) -> impl Iterator<Item = ast::Item<Node::ItemKind>> + 'a {
2051 debug_assert_ne!(source, DelegationSource::Single);
2052
2053 let from_glob = source == DelegationSource::Glob;
2054
20462055 if suffixes.is_empty() {
20472056 // Report an error for now, to avoid keeping stem for resolution and
20482057 // stability checks.
......@@ -2066,11 +2075,7 @@ fn build_single_delegations<'a, Node: InvocationCollectorNode>(
20662075 ident: rename.unwrap_or(ident),
20672076 rename,
20682077 body: deleg.body.clone(),
2069 source: if from_glob {
2070 ast::DelegationSource::Glob
2071 } else {
2072 ast::DelegationSource::List
2073 },
2078 source,
20742079 })),
20752080 tokens: None,
20762081 }
......@@ -2278,7 +2283,7 @@ impl<'a, 'b> InvocationCollector<'a, 'b> {
22782283 UNUSED_DOC_COMMENTS,
22792284 current_span,
22802285 self.cx.current_expansion.lint_node_id,
2281 crate::errors::MacroCallUnusedDocComment { span: attr.span },
2286 crate::diagnostics::MacroCallUnusedDocComment { span: attr.span },
22822287 );
22832288 } else if rustc_attr_parsing::is_builtin_attr(attr)
22842289 && !AttributeParser::is_parsed_attribute(&attr.path())
......@@ -2288,7 +2293,7 @@ impl<'a, 'b> InvocationCollector<'a, 'b> {
22882293 UNUSED_ATTRIBUTES,
22892294 attr.span,
22902295 self.cx.current_expansion.lint_node_id,
2291 crate::errors::UnusedBuiltinAttribute {
2296 crate::diagnostics::UnusedBuiltinAttribute {
22922297 attr_name,
22932298 macro_name: pprust::path_to_string(&call.path),
22942299 invoc_span: call.path.span,
......@@ -2414,7 +2419,12 @@ impl<'a, 'b> InvocationCollector<'a, 'b> {
24142419 };
24152420
24162421 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()),
24182428 );
24192429 Node::flatten_outputs(single_delegations.map(|item| {
24202430 let mut item = Node::from_item(item);
compiler/rustc_expand/src/lib.rs+1-1
......@@ -10,7 +10,7 @@
1010// tidy-alphabetical-end
1111
1212mod build;
13mod errors;
13mod diagnostics;
1414mod mbe;
1515mod placeholders;
1616mod proc_macro_server;
compiler/rustc_expand/src/mbe/macro_check.rs+10-10
......@@ -114,7 +114,7 @@ use rustc_session::parse::ParseSess;
114114use rustc_span::{ErrorGuaranteed, MacroRulesNormalizedIdent, Span, kw};
115115use smallvec::SmallVec;
116116
117use crate::errors;
117use crate::diagnostics;
118118use crate::mbe::{KleeneToken, TokenTree};
119119
120120/// Stack represented as linked list.
......@@ -247,7 +247,7 @@ fn check_binders(
247247 psess,
248248 span,
249249 node_id,
250 errors::DuplicateMatcherBindingLint { span, prev: prev_info.span },
250 diagnostics::DuplicateMatcherBindingLint { span, prev: prev_info.span },
251251 );
252252 } else if get_binder_info(macros, binders, name).is_none() {
253253 // 2. The meta-variable is free: This is a binder.
......@@ -266,11 +266,11 @@ fn check_binders(
266266 if let Some(prev_info) = get_binder_info(macros, binders, name) {
267267 // Duplicate binders at the top-level macro definition are errors. The lint is only
268268 // 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 }));
274274 } else {
275275 binders.insert(name, BinderInfo { span, ops: ops.into() });
276276 }
......@@ -578,7 +578,7 @@ fn check_ops_is_prefix(
578578 return;
579579 }
580580 }
581 buffer_lint(psess, span, node_id, errors::UnknownMacroVariable { name });
581 buffer_lint(psess, span, node_id, diagnostics::UnknownMacroVariable { name });
582582}
583583
584584/// Returns whether `binder_ops` is a prefix of `occurrence_ops`.
......@@ -613,7 +613,7 @@ fn ops_is_prefix(
613613 psess,
614614 span,
615615 node_id,
616 errors::MetaVarStillRepeatingLint { label: binder.span, ident },
616 diagnostics::MetaVarStillRepeatingLint { label: binder.span, ident },
617617 );
618618 return;
619619 }
......@@ -623,7 +623,7 @@ fn ops_is_prefix(
623623 psess,
624624 span,
625625 node_id,
626 errors::MetaVariableWrongOperator {
626 diagnostics::MetaVariableWrongOperator {
627627 binder: binder.span,
628628 occurrence: occurrence.span,
629629 },
compiler/rustc_expand/src/mbe/macro_rules.rs+7-7
......@@ -30,14 +30,14 @@ use rustc_span::hygiene::Transparency;
3030use rustc_span::{Ident, Span, Symbol, kw, sym};
3131use tracing::{debug, instrument, trace, trace_span};
3232
33use super::SequenceRepetition;
3334use super::diagnostics::{FailedMacro, failed_to_match_macro};
3435use super::macro_parser::{NamedMatches, NamedParseResult};
35use super::{SequenceRepetition, diagnostics};
3636use crate::base::{
3737 AttrProcMacro, BangProcMacro, DummyResult, ExpandResult, ExtCtxt, MacResult,
3838 MacroExpanderResult, SyntaxExtension, SyntaxExtensionKind, TTMacroExpander,
3939};
40use crate::errors;
40use crate::diagnostics;
4141use crate::expand::{AstFragment, AstFragmentKind, ensure_complete_parse, parse_ast_fragment};
4242use crate::mbe::macro_check::check_meta_variables;
4343use crate::mbe::macro_parser::{Error, ErrorReported, Failure, MatcherLoc, Success, TtParser};
......@@ -81,7 +81,7 @@ impl<'a, 'b> ParserAnyMacro<'a, 'b> {
8181 let fragment = match parse_ast_fragment(parser, kind) {
8282 Ok(f) => f,
8383 Err(err) => {
84 let guar = diagnostics::emit_frag_parse_err(
84 let guar = super::diagnostics::emit_frag_parse_err(
8585 err,
8686 parser,
8787 snapshot,
......@@ -104,7 +104,7 @@ impl<'a, 'b> ParserAnyMacro<'a, 'b> {
104104 SEMICOLON_IN_EXPRESSIONS_FROM_MACROS,
105105 parser.token.span,
106106 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 },
108108 );
109109 }
110110 parser.bump();
......@@ -903,9 +903,9 @@ fn check_args_parens(sess: &Session, rule_kw: Symbol, args: &tokenstream::TokenT
903903 if let tokenstream::TokenTree::Delimited(dspan, _, delim, _) = args
904904 && *delim != Delimiter::Parenthesis
905905 {
906 sess.dcx().emit_err(errors::MacroArgsBadDelim {
906 sess.dcx().emit_err(diagnostics::MacroArgsBadDelim {
907907 span: dspan.entire(),
908 sugg: errors::MacroArgsBadDelimSugg { open: dspan.open, close: dspan.close },
908 sugg: diagnostics::MacroArgsBadDelimSugg { open: dspan.open, close: dspan.close },
909909 rule_kw,
910910 });
911911 }
......@@ -1539,7 +1539,7 @@ fn check_matcher_core<'tt>(
15391539 RUST_2021_INCOMPATIBLE_OR_PATTERNS,
15401540 span,
15411541 ast::CRATE_NODE_ID,
1542 errors::OrPatternsBackCompat { span, suggestion },
1542 diagnostics::OrPatternsBackCompat { span, suggestion },
15431543 );
15441544 }
15451545 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};
77use rustc_session::parse::ParseSess;
88use rustc_span::{Ident, Span, Symbol, sym};
99
10use crate::errors;
10use crate::diagnostics;
1111
1212pub(crate) const RAW_IDENT_ERR: &str = "`${concat(..)}` currently does not support raw identifiers";
1313pub(crate) const UNSUPPORTED_CONCAT_ELEM_ERR: &str = "expected identifier or string literal";
......@@ -51,15 +51,18 @@ impl MetaVarExpr {
5151 Some(tt) => (Some(tt.span()), None),
5252 None => (None, Some(ident.span.shrink_to_hi())),
5353 };
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 };
5659 return Err(psess.dcx().create_err(err));
5760 };
5861
5962 // Ensure there are no trailing tokens in the braces, e.g. `${foo() extra}`
6063 if iter.peek().is_some() {
6164 let span = iter_span(&iter).expect("checked is_some above");
62 let err = errors::MveExtraTokens {
65 let err = diagnostics::MveExtraTokens {
6366 span,
6467 ident_span: ident.span,
6568 extra_count: iter.count(),
......@@ -79,7 +82,7 @@ impl MetaVarExpr {
7982 sym::index => MetaVarExpr::Index(parse_depth(&mut iter, psess, ident.span)?),
8083 sym::len => MetaVarExpr::Len(parse_depth(&mut iter, psess, ident.span)?),
8184 _ => {
82 let err = errors::MveUnrecognizedExpr {
85 let err = diagnostics::MveUnrecognizedExpr {
8386 span: ident.span,
8487 valid_expr_list: "`count`, `ignore`, `index`, `len`, and `concat`",
8588 };
......@@ -129,7 +132,7 @@ fn check_trailing_tokens<'psess>(
129132 other => unreachable!("unknown MVEs should be rejected earlier (got `{other}`)"),
130133 };
131134
132 let err = errors::MveExtraTokens {
135 let err = diagnostics::MveExtraTokens {
133136 span: iter_span(iter).expect("checked is_none above"),
134137 ident_span: ident.span,
135138 extra_count: iter.count(),
compiler/rustc_expand/src/mbe/quoted.rs+4-4
......@@ -9,7 +9,7 @@ use rustc_session::errors::feature_err;
99use rustc_span::edition::Edition;
1010use rustc_span::{Ident, Span, kw, sym};
1111
12use crate::errors;
12use crate::diagnostics;
1313use crate::mbe::macro_parser::count_metavar_decls;
1414use crate::mbe::{Delimited, KleeneOp, KleeneToken, MetaVarExpr, SequenceRepetition, TokenTree};
1515
......@@ -94,7 +94,7 @@ fn parse(
9494 // Emit a missing-fragment diagnostic and return a `TokenTree` fallback so parsing can
9595 // continue.
9696 let missing_fragment_specifier = |span, add_span| {
97 sess.dcx().emit_err(errors::MissingFragmentSpecifier {
97 sess.dcx().emit_err(diagnostics::MissingFragmentSpecifier {
9898 span,
9999 add_span,
100100 valid: VALID_FRAGMENT_NAMES_MSG,
......@@ -163,7 +163,7 @@ fn parse(
163163 if !span.from_expansion() { edition } else { span.edition() }
164164 };
165165 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 {
167167 span,
168168 fragment,
169169 help: VALID_FRAGMENT_NAMES_MSG,
......@@ -299,7 +299,7 @@ fn parse_tree<'a>(
299299 _ => {
300300 let token =
301301 pprust::token_kind_to_string(&delim.as_open_token_kind());
302 sess.dcx().emit_err(errors::ExpectedParenOrBrace {
302 sess.dcx().emit_err(diagnostics::ExpectedParenOrBrace {
303303 span: delim_span.entire(),
304304 token,
305305 });
compiler/rustc_expand/src/mbe/transcribe.rs+1-1
......@@ -17,7 +17,7 @@ use rustc_span::{
1717};
1818use smallvec::{SmallVec, smallvec};
1919
20use crate::errors::{
20use crate::diagnostics::{
2121 ConcatInvalidIdent, CountRepetitionMisplaced, InvalidIdentReason, MacroVarStillRepeating,
2222 MetaVarsDifSeqMatchers, MustRepeatOnce, MveUnrecognizedVar, NoRepeatableVar,
2323 NoSyntaxVarsExprRepeat, VarNoTypo, VarTypoSuggestionRepeatable, VarTypoSuggestionUnrepeatable,
compiler/rustc_expand/src/module.rs+1-1
......@@ -14,7 +14,7 @@ use rustc_span::{Ident, Span, sym};
1414use thin_vec::ThinVec;
1515
1616use crate::base::ModuleData;
17use crate::errors::{
17use crate::diagnostics::{
1818 ModuleCircular, ModuleFileNotFound, ModuleInBlock, ModuleInBlockName, ModuleMultipleCandidates,
1919};
2020
compiler/rustc_expand/src/proc_macro.rs+10-8
......@@ -11,7 +11,7 @@ use rustc_span::profiling::SpannedEventArgRecorder;
1111use rustc_span::{LocalExpnId, Span};
1212
1313use crate::base::{self, *};
14use crate::{errors, proc_macro_server};
14use crate::{diagnostics, proc_macro_server};
1515
1616fn exec_strategy(sess: &Session) -> impl pm::bridge::server::ExecutionStrategy + 'static {
1717 pm::bridge::server::MaybeCrossThread {
......@@ -47,9 +47,11 @@ impl base::BangProcMacro for BangProcMacro {
4747 let strategy = exec_strategy(ecx.sess);
4848 let server = proc_macro_server::Rustc::new(ecx);
4949 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 {
5151 span,
52 message: e.into_string().map(|message| errors::ProcMacroPanickedHelp { message }),
52 message: e
53 .into_string()
54 .map(|message| diagnostics::ProcMacroPanickedHelp { message }),
5355 })
5456 })
5557 }
......@@ -74,11 +76,11 @@ impl base::AttrProcMacro for AttrProcMacro {
7476 let server = proc_macro_server::Rustc::new(ecx);
7577 self.client.run2(&strategy, server, annotation, annotated, proc_macro_backtrace).map_err(
7678 |e| {
77 ecx.dcx().emit_err(errors::CustomAttributePanicked {
79 ecx.dcx().emit_err(diagnostics::CustomAttributePanicked {
7880 span,
7981 message: e
8082 .into_string()
81 .map(|message| errors::CustomAttributePanickedHelp { message }),
83 .map(|message| diagnostics::CustomAttributePanickedHelp { message }),
8284 })
8385 },
8486 )
......@@ -154,7 +156,7 @@ impl MultiItemModifier for DeriveProcMacro {
154156
155157 // fail if there have been errors emitted
156158 if ecx.dcx().err_count() > error_count_before {
157 ecx.dcx().emit_err(errors::ProcMacroDeriveTokens { span });
159 ecx.dcx().emit_err(diagnostics::ProcMacroDeriveTokens { span });
158160 }
159161
160162 ExpandResult::Ready(items)
......@@ -202,11 +204,11 @@ fn expand_derive_macro(
202204 let invoc_expn_data = invoc_id.expn_data();
203205 let span = invoc_expn_data.call_site;
204206 ecx.dcx().emit_err({
205 errors::ProcMacroDerivePanicked {
207 diagnostics::ProcMacroDerivePanicked {
206208 span,
207209 message: e
208210 .into_string()
209 .map(|message| errors::ProcMacroDerivePanickedHelp { message }),
211 .map(|message| diagnostics::ProcMacroDerivePanickedHelp { message }),
210212 }
211213 });
212214 Err(())
compiler/rustc_hir/src/hir.rs+8-27
......@@ -25,7 +25,8 @@ use rustc_index::IndexVec;
2525use rustc_macros::{Decodable, Encodable, StableHash};
2626use rustc_span::def_id::LocalDefId;
2727use 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,
2930};
3031use rustc_target::asm::InlineAsmRegOrRegClass;
3132use smallvec::SmallVec;
......@@ -3319,7 +3320,7 @@ impl<'hir> TraitItem<'hir> {
33193320
33203321 expect_methods_self_kind! {
33213322 expect_const, (&'hir Ty<'hir>, Option<ConstItemRhs<'hir>>),
3322 TraitItemKind::Const(ty, rhs, _), (ty, *rhs);
3323 TraitItemKind::Const(ty, rhs), (ty, *rhs);
33233324
33243325 expect_fn, (&FnSig<'hir>, &TraitFn<'hir>),
33253326 TraitItemKind::Fn(ty, trfn), (ty, trfn);
......@@ -3339,32 +3340,11 @@ pub enum TraitFn<'hir> {
33393340 Provided(BodyId),
33403341}
33413342
3342#[derive(Debug, Clone, Copy, PartialEq, Eq, StableHash)]
3343pub enum IsTypeConst {
3344 No,
3345 Yes,
3346}
3347
3348impl From<bool> for IsTypeConst {
3349 fn from(value: bool) -> Self {
3350 if value { Self::Yes } else { Self::No }
3351 }
3352}
3353
3354impl From<IsTypeConst> for bool {
3355 fn from(value: IsTypeConst) -> Self {
3356 matches!(value, IsTypeConst::Yes)
3357 }
3358}
3359
33603343/// Represents a trait method or associated constant or type
33613344#[derive(Debug, Clone, Copy, StableHash)]
33623345pub 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.
33663346 /// 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>>),
33683348 /// An associated function with an optional body.
33693349 Fn(FnSig<'hir>, TraitFn<'hir>),
33703350 /// An associated type with (possibly empty) bounds and optional concrete
......@@ -3877,6 +3857,7 @@ pub struct DelegationInfo {
38773857 pub child_args_segment_id: Option<HirId>,
38783858 pub self_ty_id: Option<HirId>,
38793859 pub propagate_self_ty: bool,
3860 pub group_id: Option<(LocalExpnId, bool /* unused_target_expr */)>,
38803861}
38813862
38823863#[derive(Debug, Clone, Copy, PartialEq, Eq, StableHash)]
......@@ -5009,7 +4990,7 @@ impl<'hir> OwnerNode<'hir> {
50094990 | OwnerNode::TraitItem(TraitItem {
50104991 kind:
50114992 TraitItemKind::Fn(_, TraitFn::Provided(body))
5012 | TraitItemKind::Const(_, Some(ConstItemRhs::Body(body)), _),
4993 | TraitItemKind::Const(_, Some(ConstItemRhs::Body(body))),
50134994 ..
50144995 })
50154996 | OwnerNode::ImplItem(ImplItem {
......@@ -5236,7 +5217,7 @@ impl<'hir> Node<'hir> {
52365217 _ => None,
52375218 },
52385219 Node::TraitItem(it) => match it.kind {
5239 TraitItemKind::Const(ty, _, _) => Some(ty),
5220 TraitItemKind::Const(ty, _) => Some(ty),
52405221 TraitItemKind::Type(_, ty) => ty,
52415222 _ => None,
52425223 },
......@@ -5280,7 +5261,7 @@ impl<'hir> Node<'hir> {
52805261 | Node::TraitItem(TraitItem {
52815262 owner_id,
52825263 kind:
5283 TraitItemKind::Const(_, Some(ConstItemRhs::Body(body)), _)
5264 TraitItemKind::Const(_, Some(ConstItemRhs::Body(body)))
52845265 | TraitItemKind::Fn(_, TraitFn::Provided(body)),
52855266 ..
52865267 })
compiler/rustc_hir/src/intravisit.rs+1-1
......@@ -1273,7 +1273,7 @@ pub fn walk_trait_item<'v, V: Visitor<'v>>(
12731273 try_visit!(visitor.visit_defaultness(&defaultness));
12741274 try_visit!(visitor.visit_id(hir_id));
12751275 match *kind {
1276 TraitItemKind::Const(ref ty, default, _) => {
1276 TraitItemKind::Const(ref ty, default) => {
12771277 try_visit!(visitor.visit_ty_unambig(ty));
12781278 visit_opt!(visitor, visit_const_item_rhs, default);
12791279 }
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<(),
974974 tcx.ensure_ok().generics_of(def_id);
975975 tcx.ensure_ok().type_of(def_id);
976976 tcx.ensure_ok().predicates_of(def_id);
977 check_type_alias_type_params_are_used(tcx, def_id);
978977 let ty = tcx.type_of(def_id).instantiate_identity();
979978 let span = tcx.def_span(def_id);
980979 if tcx.type_alias_is_lazy(def_id) {
......@@ -988,8 +987,8 @@ pub(crate) fn check_item_type(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Result<(),
988987 check_where_clauses(wfcx, def_id);
989988 Ok(())
990989 }));
991 check_variances_for_type_defn(tcx, def_id);
992990 } else {
991 check_type_alias_type_params_are_used(tcx, def_id);
993992 res = res.and(enter_wf_checking_ctxt(tcx, def_id, |wfcx| {
994993 // HACK: We sometimes incidentally check that const arguments have the correct
995994 // 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>)
20642063}
20652064
20662065fn 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
20732066 let generics = tcx.generics_of(def_id);
20742067 if generics.own_counts().types == 0 {
20752068 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
20492049 DefKind::Enum | DefKind::Struct | DefKind::Union => {
20502050 // Ok
20512051 }
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 }
20582052 kind => span_bug!(tcx.def_span(def_id), "cannot compute the variances of {kind:?}"),
20592053 }
20602054
......@@ -2206,7 +2200,6 @@ fn report_bivariance<'tcx>(
22062200 errors::UnusedGenericParameterHelp::AdtNoPhantomData { param_name }
22072201 }
22082202 }
2209 ItemKind::TyAlias(..) => errors::UnusedGenericParameterHelp::TyAlias { param_name },
22102203 item_kind => bug!("report_bivariance: unexpected item kind: {item_kind:?}"),
22112204 };
22122205
......@@ -2288,9 +2281,6 @@ impl<'tcx> IsProbablyCyclical<'tcx> {
22882281 .visit_with(self)
22892282 })
22902283 }
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 }
22942284 _ => ControlFlow::Continue(()),
22952285 }
22962286 }
......@@ -2300,17 +2290,12 @@ impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for IsProbablyCyclical<'tcx> {
23002290 type Result = ControlFlow<(), ()>;
23012291
23022292 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 {
23102295 return ControlFlow::Break(());
23112296 }
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())?;
23142299 }
23152300 }
23162301 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)
16731673 let (Node::Item(hir::Item { kind: hir::ItemKind::Const(_, _, _, ct_rhs), .. })
16741674 | Node::ImplItem(hir::ImplItem { kind: hir::ImplItemKind::Const(_, ct_rhs), .. })
16751675 | Node::TraitItem(hir::TraitItem {
1676 kind: hir::TraitItemKind::Const(_, Some(ct_rhs), _),
1677 ..
1676 kind: hir::TraitItemKind::Const(_, Some(ct_rhs)), ..
16781677 })) = grandparent_node
16791678 else {
16801679 return false;
......@@ -1718,9 +1717,9 @@ fn const_of_item<'tcx>(
17181717) -> ty::EarlyBinder<'tcx, Const<'tcx>> {
17191718 let ct_rhs = match tcx.hir_node_by_def_id(def_id) {
17201719 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 }
17241723 hir::Node::ImplItem(hir::ImplItem { kind: hir::ImplItemKind::Const(.., ct), .. }) => *ct,
17251724 _ => {
17261725 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> {
860860 }
861861 })
862862 }
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| {
864864 intravisit::walk_trait_item(this, trait_item)
865865 }),
866866 }
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<'_
6262 let args = ty::GenericArgs::identity_for_item(tcx, def_id);
6363 Ty::new_fn_def(tcx, def_id.to_def_id(), args)
6464 }
65 TraitItemKind::Const(ty, rhs, _) => rhs
65 TraitItemKind::Const(ty, rhs) => rhs
6666 .and_then(|rhs| {
6767 ty.is_suggestable_infer_ty().then(|| {
6868 infer_placeholder_type(
compiler/rustc_hir_analysis/src/delegation.rs+4-17
......@@ -5,9 +5,9 @@
55use std::debug_assert_matches;
66
77use rustc_data_structures::fx::FxHashMap;
8use rustc_hir::PathSegment;
89use rustc_hir::def::DefKind;
910use rustc_hir::def_id::{DefId, LocalDefId};
10use rustc_hir::{DelegationInfo, PathSegment};
1111use rustc_middle::ty::{
1212 self, EarlyBinder, Ty, TyCtxt, TypeFoldable, TypeFolder, TypeSuperFoldable, TypeVisitableExt,
1313};
......@@ -71,19 +71,6 @@ enum SelfPositionKind {
7171 None,
7272}
7373
74pub 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
83fn get_delegation_info(tcx: TyCtxt<'_>, delegation_id: LocalDefId) -> &DelegationInfo {
84 opt_get_delegation_info(tcx, delegation_id).expect("processing delegation")
85}
86
8774fn create_self_position_kind(
8875 tcx: TyCtxt<'_>,
8976 delegation_id: LocalDefId,
......@@ -96,7 +83,7 @@ fn create_self_position_kind(
9683 | (FnKind::AssocTrait, FnKind::Free) => SelfPositionKind::Zero,
9784
9885 (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;
10087 SelfPositionKind::AfterLifetimes(propagate_self_ty)
10188 }
10289
......@@ -282,7 +269,7 @@ fn get_parent_and_inheritance_kind<'tcx>(
282269}
283270
284271fn 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)
286273 .self_ty_id
287274 .map(|id| {
288275 let ctx = ItemCtxt::new(tcx, delegation_id);
......@@ -644,7 +631,7 @@ pub(crate) fn delegation_user_specified_args<'tcx>(
644631 tcx: TyCtxt<'tcx>,
645632 delegation_id: LocalDefId,
646633) -> (&'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);
648635
649636 let get_segment = |hir_id| -> Option<(&'tcx PathSegment<'tcx>, DefId)> {
650637 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 {
297297
298298#[derive(Debug, Clone, Copy)]
299299enum TypeRelativePath<'tcx> {
300 AssocItem(DefId, GenericArgsRef<'tcx>),
300 AssocItem(ty::AliasTerm<'tcx>),
301301 Variant { adt: Ty<'tcx>, variant_did: DefId },
302302 Ctor { ctor_def_id: DefId, args: GenericArgsRef<'tcx> },
303303}
......@@ -1356,15 +1356,10 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
13561356 span,
13571357 LowerTypeRelativePathMode::Type(permit_variants),
13581358 )? {
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);
13661361 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()))
13681363 }
13691364 TypeRelativePath::Variant { adt, variant_did } => {
13701365 let adt = self.check_param_uses_if_mcg(adt, span, false);
......@@ -1396,16 +1391,9 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
13961391 span,
13971392 LowerTypeRelativePathMode::Const,
13981393 )? {
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());
14091397 let ct = self.check_param_uses_if_mcg(ct, span, false);
14101398 Ok(ct)
14111399 }
......@@ -1487,7 +1475,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
14871475 }
14881476
14891477 // 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(
14911479 segment,
14921480 adt_def.did(),
14931481 self_ty,
......@@ -1495,7 +1483,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
14951483 span,
14961484 mode.assoc_tag(),
14971485 )? {
1498 return Ok(TypeRelativePath::AssocItem(did, args));
1486 return Ok(TypeRelativePath::AssocItem(alias_term));
14991487 }
15001488 }
15011489
......@@ -1529,7 +1517,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
15291517 );
15301518 }
15311519
1532 Ok(TypeRelativePath::AssocItem(item_def_id, args))
1520 Ok(TypeRelativePath::AssocItem(ty::AliasTerm::new_from_def_id(tcx, item_def_id, args)))
15331521 }
15341522
15351523 /// Resolve a [type-relative](hir::QPath::TypeRelative) (and type-level) path.
......@@ -1609,7 +1597,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
16091597 block: HirId,
16101598 span: Span,
16111599 assoc_tag: ty::AssocTag,
1612 ) -> Result<Option<(DefId, GenericArgsRef<'tcx>)>, ErrorGuaranteed> {
1600 ) -> Result<Option<ty::AliasTerm<'tcx>>, ErrorGuaranteed> {
16131601 let tcx = self.tcx();
16141602
16151603 if !tcx.features().inherent_associated_types() {
......@@ -1692,7 +1680,18 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
16921680 .chain(args.into_iter().skip(parent_args.len())),
16931681 );
16941682
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)))
16961695 }
16971696
16981697 /// 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> + '_ {
27132712 ),
27142713 )
27152714 }
2716 Res::Def(DefKind::Ctor(ctor_of, CtorKind::Const), did) => {
2715 Res::Def(kind @ DefKind::Ctor(ctor_of, CtorKind::Const), did) => {
27172716 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 );
27212727
27222728 let parent_did = tcx.parent(did);
27232729 let generics_did = match ctor_of {
27242730 CtorOf::Variant => tcx.parent(parent_did),
27252731 CtorOf::Struct => parent_did,
27262732 };
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 );
27292738 self.construct_const_ctor_value(did, ctor_of, args)
27302739 }
2731 Res::Def(DefKind::Ctor(_, CtorKind::Fn), did) => {
2740 Res::Def(DefKind::Ctor(ctor_of, CtorKind::Fn), did) => {
27322741 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
27362758 let parent_did = tcx.parent(did);
27372759 let generics_did = if let DefKind::Ctor(CtorOf::Variant, _) = tcx.def_kind(did) {
27382760 tcx.parent(parent_did)
27392761 } else {
27402762 parent_did
27412763 };
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
27432770 ty::Const::zero_sized(tcx, Ty::new_fn_def(tcx, did, args))
27442771 }
27452772 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>(
139139 },
140140 hir::Node::TraitItem(item) => match item.kind {
141141 hir::TraitItemKind::Type(_, ty) => ty.into_iter().collect(),
142 hir::TraitItemKind::Const(ty, _, _) => vec![ty],
142 hir::TraitItemKind::Const(ty, _) => vec![ty],
143143 ref item => bug!("Unexpected TraitItem {:?}", item),
144144 },
145145 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>(
7979 }
8080 }
8181 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 }
8582 _ => {}
8683 }
8784 }
......@@ -107,15 +104,6 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> {
107104 let current_item = &CurrentItem { inferred_start };
108105 let ty = tcx.type_of(def_id).instantiate_identity().skip_norm_wip();
109106
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
119107 match ty.kind() {
120108 ty::Adt(def, _) => {
121109 // Not entirely obvious: constraints on structs/enums do not
......@@ -216,14 +204,13 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> {
216204 /// Adds constraints appropriate for an instance of `ty` appearing
217205 /// in a context with the generics defined in `generics` and
218206 /// ambient variance `variance`
207 #[instrument(level = "debug", skip(self, current))]
219208 fn add_constraints_from_ty(
220209 &mut self,
221210 current: &CurrentItem,
222211 ty: Ty<'tcx>,
223212 variance: VarianceTermPtr<'a>,
224213 ) {
225 debug!("add_constraints_from_ty(ty={:?}, variance={:?})", ty, variance);
226
227214 match *ty.kind() {
228215 ty::Bool
229216 | ty::Char
......@@ -281,8 +268,9 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> {
281268 self.add_constraints_from_invariant_args(current, args, variance);
282269 }
283270
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);
286274 }
287275
288276 ty::Dynamic(data, r) => {
compiler/rustc_hir_analysis/src/variance/dump.rs+3-5
......@@ -38,18 +38,16 @@ pub(crate) fn variances(tcx: TyCtxt<'_>) {
3838 }
3939
4040 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 }
4344 kind => {
4445 let message = format!(
4546 "attr parsing didn't report an error for `#[{}]` on {kind:?}",
4647 rustc_span::sym::rustc_dump_variances,
4748 );
4849 tcx.dcx().span_delayed_bug(tcx.def_span(id), message);
49 continue;
5050 }
5151 }
52
53 tcx.dcx().span_err(tcx.def_span(id), format_variances(tcx, id.def_id));
5452 }
5553}
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
5252 let crate_map = tcx.crate_variances(());
5353 return crate_map.variances.get(&item_def_id.to_def_id()).copied().unwrap_or(&[]);
5454 }
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 }
6055 DefKind::AssocTy => match tcx.opt_rpitit_info(item_def_id.to_def_id()) {
6156 Some(ty::ImplTraitInTraitData::Trait { opaque_def_id, .. }) => {
6257 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>(
9999 }
100100 }
101101 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 }
105102 _ => {}
106103 }
107104 }
compiler/rustc_hir_pretty/src/lib.rs+1-1
......@@ -951,7 +951,7 @@ impl<'a> State<'a> {
951951 self.maybe_print_comment(ti.span.lo());
952952 self.print_attrs(self.attrs(ti.hir_id()));
953953 match ti.kind {
954 hir::TraitItemKind::Const(ty, default, _) => {
954 hir::TraitItemKind::Const(ty, default) => {
955955 self.print_associated_const(ti.ident, ti.generics, ty, default);
956956 }
957957 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};
77use rustc_hir::def_id::DefId;
88use rustc_hir::{self as hir, HirId, LangItem, find_attr};
99use rustc_hir_analysis::autoderef::Autoderef;
10use rustc_hir_analysis::delegation::opt_get_delegation_info;
1110use rustc_infer::infer::BoundRegionConversionTime;
1211use rustc_infer::traits::{Obligation, ObligationCause, ObligationCauseCode};
1312use rustc_middle::ty::adjustment::{
......@@ -701,7 +700,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
701700 // by comparing their hir ids (otherwise we will encounter errors in nested delegations,
702701 // see tests\ui\delegation\impl-reuse-pass.rs:237).
703702 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 };
705706
706707 if call_expr.hir_id != info.call_expr_id {
707708 return None;
compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs+13-2
......@@ -13,7 +13,6 @@ use rustc_hir::def_id::DefId;
1313use rustc_hir::intravisit::Visitor;
1414use rustc_hir::{Expr, ExprKind, FnRetTy, HirId, LangItem, Node, QPath, is_range_literal};
1515use rustc_hir_analysis::check::potentially_plural_count;
16use rustc_hir_analysis::delegation::opt_get_delegation_info;
1716use rustc_hir_analysis::hir_ty_lowering::{HirTyLowerer, ResolvedStructPath};
1817use rustc_index::IndexVec;
1918use rustc_infer::infer::{BoundRegionConversionTime, DefineOpaqueTypes, InferOk, TypeTrace};
......@@ -341,7 +340,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
341340
342341 // If we are processing first arg of delegation then we could have adjusted it
343342 // 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)
345346 .and_then(|_| self.typeck_results.borrow().node_type_opt(provided_arg.hir_id))
346347 .unwrap_or_else(|| self.check_expr_with_expectation(provided_arg, expectation));
347348
......@@ -902,6 +903,16 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
902903
903904 // Type check the pattern. Override if necessary to avoid knock-on errors.
904905 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 }
905916 let pat_ty = self.node_ty(decl.pat.hir_id);
906917 self.overwrite_local_ty_if_err(decl.hir_id, decl.pat, pat_ty);
907918
compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs+13
......@@ -2272,6 +2272,19 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
22722272 expected: Ty<'tcx>,
22732273 found: Ty<'tcx>,
22742274 ) -> 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
22752288 let ty::Adt(adt, args) = found.kind() else {
22762289 return false;
22772290 };
compiler/rustc_hir_typeck/src/lib.rs+1-3
......@@ -286,9 +286,7 @@ fn extend_err_with_const_context(
286286) {
287287 match node {
288288 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, _), .. }) => {
292290 // Point at the `Type` in `const NAME: Type = value;`.
293291 err.span_label(ty.span, "expected because of the type of the associated constant");
294292 }
compiler/rustc_incremental/src/assert_dep_graph.rs+27-18
......@@ -57,8 +57,14 @@ use crate::errors;
5757#[allow(missing_docs)]
5858pub(crate) fn assert_dep_graph(tcx: TyCtxt<'_>) {
5959 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
6064 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 }
6268 }
6369
6470 if !tcx.sess.opts.unstable_opts.query_dep_graph {
......@@ -92,7 +98,7 @@ pub(crate) fn assert_dep_graph(tcx: TyCtxt<'_>) {
9298 }
9399
94100 // 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);
96102 })
97103}
98104
......@@ -172,30 +178,33 @@ impl<'tcx> Visitor<'tcx> for IfThisChanged<'tcx> {
172178 }
173179}
174180
175fn 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.
181fn 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) {
177187 if if_this_changed.is_empty() {
178188 for &(target_span, _, _, _) in then_this_would_need {
179189 tcx.dcx().emit_err(errors::MissingIfThisChanged { span: target_span });
180190 }
181191 return;
182192 }
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 });
196205 }
197206 }
198 });
207 }
199208}
200209
201210fn dump_graph(graph: &RetainedDepGraph) {
compiler/rustc_incremental/src/persist/file_format.rs+2-2
......@@ -28,7 +28,7 @@ const FILE_MAGIC: &[u8] = b"RSIC";
2828/// Change this if the header format changes.
2929const HEADER_FORMAT_VERSION: u16 = 0;
3030
31pub(crate) fn write_file_header(stream: &mut FileEncoder, sess: &Session) {
31pub(crate) fn write_file_header(stream: &mut FileEncoder<'_>, sess: &Session) {
3232 stream.emit_raw_bytes(FILE_MAGIC);
3333 stream.emit_raw_bytes(&u16::to_le_bytes(HEADER_FORMAT_VERSION));
3434
......@@ -41,7 +41,7 @@ pub(crate) fn write_file_header(stream: &mut FileEncoder, sess: &Session) {
4141
4242pub(crate) fn save_in<F>(sess: &Session, path_buf: PathBuf, name: &str, encode: F)
4343where
44 F: FnOnce(FileEncoder) -> FileEncodeResult,
44 F: FnOnce(FileEncoder<'static>) -> FileEncodeResult,
4545{
4646 debug!("save: storing data in {}", path_buf.display());
4747
compiler/rustc_incremental/src/persist/save.rs+1-1
......@@ -131,7 +131,7 @@ pub fn save_work_product_index(
131131 });
132132}
133133
134fn encode_work_product_index(work_products: &WorkProductMap, encoder: &mut FileEncoder) {
134fn encode_work_product_index(work_products: &WorkProductMap, encoder: &mut FileEncoder<'_>) {
135135 let serialized_products: Vec<_> = work_products
136136 .to_sorted_stable_ord()
137137 .into_iter()
compiler/rustc_interface/src/passes.rs+2
......@@ -1083,6 +1083,8 @@ fn run_required_analyses(tcx: TyCtxt<'_>) {
10831083 // to use `hir_crate_items`.
10841084 tcx.ensure_done().hir_crate_items(());
10851085
1086 rustc_passes::delegation::check_glob_and_list_delegations_target_expr(tcx);
1087
10861088 let sess = tcx.sess;
10871089 sess.time("misc_checking_1", || {
10881090 par_fns(&mut [
compiler/rustc_metadata/src/creader.rs+27-21
......@@ -39,7 +39,7 @@ use rustc_span::{DUMMY_SP, Ident, Span, Symbol, sym};
3939use rustc_target::spec::{PanicStrategy, Target};
4040use tracing::{debug, info, trace};
4141
42use crate::errors;
42use crate::diagnostics;
4343use crate::locator::{CrateError, CrateLocator, CratePaths, CrateRejections};
4444use crate::rmeta::{
4545 CrateDep, CrateMetadata, CrateNumMap, CrateRoot, MetadataBlob, TargetModifiers,
......@@ -365,7 +365,7 @@ impl CStore {
365365
366366 match (flag_local_value, flag_extern_value) {
367367 (Some(local_value), Some(extern_value)) => {
368 tcx.dcx().emit_err(errors::IncompatibleTargetModifiers {
368 tcx.dcx().emit_err(diagnostics::IncompatibleTargetModifiers {
369369 span,
370370 extern_crate,
371371 local_crate,
......@@ -376,7 +376,7 @@ impl CStore {
376376 })
377377 }
378378 (None, Some(extern_value)) => {
379 tcx.dcx().emit_err(errors::IncompatibleTargetModifiersLMissed {
379 tcx.dcx().emit_err(diagnostics::IncompatibleTargetModifiersLMissed {
380380 span,
381381 extern_crate,
382382 local_crate,
......@@ -386,7 +386,7 @@ impl CStore {
386386 })
387387 }
388388 (Some(local_value), None) => {
389 tcx.dcx().emit_err(errors::IncompatibleTargetModifiersRMissed {
389 tcx.dcx().emit_err(diagnostics::IncompatibleTargetModifiersRMissed {
390390 span,
391391 extern_crate,
392392 local_crate,
......@@ -458,7 +458,7 @@ impl CStore {
458458 pub fn report_incompatible_target_modifiers(&self, tcx: TyCtxt<'_>, krate: &Crate) {
459459 for flag_name in &tcx.sess.opts.cg.unsafe_allow_abi_mismatch {
460460 if !OptionsTargetModifiers::is_target_modifier(flag_name) {
461 tcx.dcx().emit_err(errors::UnknownTargetModifierUnsafeAllowed {
461 tcx.dcx().emit_err(diagnostics::UnknownTargetModifierUnsafeAllowed {
462462 span: krate.spans.inner_span.shrink_to_lo(),
463463 flag_name: flag_name.clone(),
464464 });
......@@ -502,7 +502,7 @@ impl CStore {
502502 }
503503 *errors += 1;
504504
505 tcx.dcx().emit_err(errors::MitigationLessStrictInDependency {
505 tcx.dcx().emit_err(diagnostics::MitigationLessStrictInDependency {
506506 span: krate.spans.inner_span.shrink_to_lo(),
507507 mitigation_name: my_mitigation.kind.to_string(),
508508 mitigation_level: my_mitigation.level.level_str().to_string(),
......@@ -525,7 +525,7 @@ impl CStore {
525525 if data.has_async_drops() {
526526 let extern_crate = data.name();
527527 let local_crate = tcx.crate_name(LOCAL_CRATE);
528 tcx.dcx().emit_warn(errors::AsyncDropTypesInDependency {
528 tcx.dcx().emit_warn(diagnostics::AsyncDropTypesInDependency {
529529 span: krate.spans.inner_span.shrink_to_lo(),
530530 extern_crate,
531531 local_crate,
......@@ -1034,11 +1034,13 @@ impl CStore {
10341034 // Sanity check the loaded crate to ensure it is indeed a panic runtime
10351035 // and the panic strategy is indeed what we thought it was.
10361036 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 });
10381038 }
10391039 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 });
10421044 }
10431045
10441046 self.injected_panic_runtime = Some(cnum);
......@@ -1074,7 +1076,7 @@ impl CStore {
10741076
10751077 // Sanity check the loaded crate to ensure it is indeed a profiler runtime
10761078 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 });
10781080 }
10791081 }
10801082
......@@ -1082,8 +1084,10 @@ impl CStore {
10821084 self.has_global_allocator =
10831085 match &*fn_spans(krate, Symbol::intern(&global_fn_name(sym::alloc))) {
10841086 [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 });
10871091 true
10881092 }
10891093 spans => !spans.is_empty(),
......@@ -1091,8 +1095,10 @@ impl CStore {
10911095 let alloc_error_handler = Symbol::intern(&global_fn_name(ALLOC_ERROR_HANDLER));
10921096 self.has_alloc_error_handler = match &*fn_spans(krate, alloc_error_handler) {
10931097 [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 });
10961102 true
10971103 }
10981104 spans => !spans.is_empty(),
......@@ -1130,7 +1136,7 @@ impl CStore {
11301136 if data.has_global_allocator() {
11311137 match global_allocator {
11321138 Some(other_crate) => {
1133 tcx.dcx().emit_err(errors::ConflictingGlobalAlloc {
1139 tcx.dcx().emit_err(diagnostics::ConflictingGlobalAlloc {
11341140 crate_name: data.name(),
11351141 other_crate_name: other_crate,
11361142 });
......@@ -1144,7 +1150,7 @@ impl CStore {
11441150 if data.has_alloc_error_handler() {
11451151 match alloc_error_handler {
11461152 Some(other_crate) => {
1147 tcx.dcx().emit_err(errors::ConflictingAllocErrorHandler {
1153 tcx.dcx().emit_err(diagnostics::ConflictingAllocErrorHandler {
11481154 crate_name: data.name(),
11491155 other_crate_name: other_crate,
11501156 });
......@@ -1164,7 +1170,7 @@ impl CStore {
11641170 if !attr::contains_name(&krate.attrs, sym::default_lib_allocator)
11651171 && !self.iter_crate_data().any(|(_, data)| data.has_default_lib_allocator())
11661172 {
1167 tcx.dcx().emit_err(errors::GlobalAllocRequired);
1173 tcx.dcx().emit_err(diagnostics::GlobalAllocRequired);
11681174 }
11691175 self.allocator_kind = Some(AllocatorKind::Default);
11701176 }
......@@ -1229,7 +1235,7 @@ impl CStore {
12291235 // Sanity check that the loaded crate is `#![compiler_builtins]`
12301236 let cdata = self.get_crate_data(cnum);
12311237 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() });
12331239 }
12341240 }
12351241
......@@ -1261,7 +1267,7 @@ impl CStore {
12611267 lint::builtin::UNUSED_CRATE_DEPENDENCIES,
12621268 span,
12631269 ast::CRATE_NODE_ID,
1264 errors::UnusedCrateDependency {
1270 diagnostics::UnusedCrateDependency {
12651271 extern_crate: name_interned,
12661272 local_crate: tcx.crate_name(LOCAL_CRATE),
12671273 },
......@@ -1298,7 +1304,7 @@ impl CStore {
12981304 // Make a point span rather than covering the whole file
12991305 let span = krate.spans.inner_span.shrink_to_lo();
13001306
1301 tcx.sess.dcx().emit_err(errors::WasmCAbi { span });
1307 tcx.sess.dcx().emit_err(diagnostics::WasmCAbi { span });
13021308 }
13031309 }
13041310
compiler/rustc_metadata/src/dependency_format.rs+1-1
......@@ -65,7 +65,7 @@ use rustc_target::spec::PanicStrategy;
6565use tracing::info;
6666
6767use crate::creader::CStore;
68use crate::errors::{
68use crate::diagnostics::{
6969 BadPanicStrategy, CrateDepMultiple, IncompatiblePanicInDropStrategy,
7070 IncompatibleWithImmediateAbort, IncompatibleWithImmediateAbortCore, LibRequired,
7171 NonStaticCrateDep, RequiredPanicStrategy, RlibRequired, RustcLibRequired, TwoPanicRuntimes,
compiler/rustc_metadata/src/diagnostics.rs created+706
......@@ -0,0 +1,706 @@
1use std::io::Error;
2use std::path::{Path, PathBuf};
3
4use rustc_errors::codes::*;
5use rustc_errors::{Diag, DiagCtxtHandle, Diagnostic, EmissionGuarantee, Level, msg};
6use rustc_macros::{Diagnostic, Subdiagnostic};
7use rustc_span::{Span, Symbol, sym};
8use rustc_target::spec::{PanicStrategy, TargetTuple};
9
10use 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)]
16pub(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)]
24pub(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")]
34pub(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")]
42pub(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")]
52pub(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}")]
59pub(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)]
68pub(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)]
77pub(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)]
87pub(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)]
95pub(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)]
101pub(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`")]
109pub(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")]
116pub(crate) struct LibFrameworkApple;
117
118#[derive(Diagnostic)]
119#[diag("an empty renaming target was specified for library `{$lib_name}`")]
120pub(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)]
128pub(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}`")]
134pub(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")]
140pub(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")]
147pub(crate) struct RawDylibUnsupportedAbi {
148 #[primary_span]
149 pub span: Span,
150}
151
152#[derive(Diagnostic)]
153#[diag("failed to create file encoder: {$err}")]
154pub(crate) struct FailCreateFileEncoder {
155 pub err: Error,
156}
157
158#[derive(Diagnostic)]
159#[diag("failed to write to `{$path}`: {$err}")]
160pub(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")]
167pub(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)]
175pub(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}`")]
181pub(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")]
188pub(crate) struct NotProfilerRuntime {
189 pub crate_name: Symbol,
190}
191
192#[derive(Diagnostic)]
193#[diag("cannot define multiple global allocators")]
194pub(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")]
204pub(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)]
216pub(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)]
225pub(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)]
234pub(crate) struct GlobalAllocRequired;
235
236#[derive(Diagnostic)]
237#[diag("failed to write {$filename}: {$err}")]
238pub(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}")]
245pub(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)]
254pub(crate) struct BinaryOutputToTty;
255
256#[derive(Diagnostic)]
257#[diag("could not find native static library `{$libname}`, perhaps an -L flag is missing?")]
258pub(crate) struct MissingNativeLibrary<'a> {
259 libname: &'a str,
260 #[subdiagnostic]
261 suggest_name: Option<SuggestLibraryName<'a>>,
262}
263
264impl<'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")]
292pub(crate) struct SuggestLibraryName<'a> {
293 suggested_name: &'a str,
294}
295
296#[derive(Diagnostic)]
297#[diag("couldn't create a temp dir: {$err}")]
298pub(crate) struct FailedCreateTempdir {
299 pub err: Error,
300}
301
302#[derive(Diagnostic)]
303#[diag("failed to create the file {$filename}: {$err}")]
304pub(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}")]
311pub(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}`")]
317pub(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}")]
325pub(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}")]
334pub(crate) struct ExternLocationNotFile<'a> {
335 #[primary_span]
336 pub span: Span,
337 pub crate_name: Symbol,
338 pub location: &'a Path,
339}
340
341pub(crate) struct MultipleCandidates {
342 pub span: Span,
343 pub flavor: CrateFlavor,
344 pub crate_name: Symbol,
345 pub candidates: Vec<PathBuf>,
346}
347
348impl<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)]
370pub(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)]
379pub(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")]
387pub(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}")]
396pub(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}")]
407pub(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}")]
418pub(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")]
431pub(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)]
445pub(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
454pub(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
461impl<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
480pub(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
493impl<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}")]
553pub(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}")]
562pub(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)]
573pub(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)]
592pub(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)]
617pub(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)]
641pub(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)]
655pub(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)]
668pub(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`")]
677pub(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")]
685pub(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)]
700pub(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 @@
1use std::io::Error;
2use std::path::{Path, PathBuf};
3
4use rustc_errors::codes::*;
5use rustc_errors::{Diag, DiagCtxtHandle, Diagnostic, EmissionGuarantee, Level, msg};
6use rustc_macros::{Diagnostic, Subdiagnostic};
7use rustc_span::{Span, Symbol, sym};
8use rustc_target::spec::{PanicStrategy, TargetTuple};
9
10use 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)]
16pub(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)]
24pub(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")]
34pub(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")]
42pub(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")]
52pub(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}")]
59pub(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)]
68pub(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)]
77pub(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)]
87pub(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)]
95pub(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)]
101pub(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`")]
109pub(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")]
116pub(crate) struct LibFrameworkApple;
117
118#[derive(Diagnostic)]
119#[diag("an empty renaming target was specified for library `{$lib_name}`")]
120pub(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)]
128pub(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}`")]
134pub(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")]
140pub(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")]
147pub(crate) struct RawDylibUnsupportedAbi {
148 #[primary_span]
149 pub span: Span,
150}
151
152#[derive(Diagnostic)]
153#[diag("failed to create file encoder: {$err}")]
154pub(crate) struct FailCreateFileEncoder {
155 pub err: Error,
156}
157
158#[derive(Diagnostic)]
159#[diag("failed to write to `{$path}`: {$err}")]
160pub(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")]
167pub(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)]
175pub(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}`")]
181pub(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")]
188pub(crate) struct NotProfilerRuntime {
189 pub crate_name: Symbol,
190}
191
192#[derive(Diagnostic)]
193#[diag("cannot define multiple global allocators")]
194pub(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")]
204pub(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)]
216pub(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)]
225pub(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)]
234pub(crate) struct GlobalAllocRequired;
235
236#[derive(Diagnostic)]
237#[diag("failed to write {$filename}: {$err}")]
238pub(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}")]
245pub(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)]
254pub(crate) struct BinaryOutputToTty;
255
256#[derive(Diagnostic)]
257#[diag("could not find native static library `{$libname}`, perhaps an -L flag is missing?")]
258pub(crate) struct MissingNativeLibrary<'a> {
259 libname: &'a str,
260 #[subdiagnostic]
261 suggest_name: Option<SuggestLibraryName<'a>>,
262}
263
264impl<'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")]
292pub(crate) struct SuggestLibraryName<'a> {
293 suggested_name: &'a str,
294}
295
296#[derive(Diagnostic)]
297#[diag("couldn't create a temp dir: {$err}")]
298pub(crate) struct FailedCreateTempdir {
299 pub err: Error,
300}
301
302#[derive(Diagnostic)]
303#[diag("failed to create the file {$filename}: {$err}")]
304pub(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}")]
311pub(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}`")]
317pub(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}")]
325pub(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}")]
334pub(crate) struct ExternLocationNotFile<'a> {
335 #[primary_span]
336 pub span: Span,
337 pub crate_name: Symbol,
338 pub location: &'a Path,
339}
340
341pub(crate) struct MultipleCandidates {
342 pub span: Span,
343 pub flavor: CrateFlavor,
344 pub crate_name: Symbol,
345 pub candidates: Vec<PathBuf>,
346}
347
348impl<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)]
370pub(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)]
379pub(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")]
387pub(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}")]
396pub(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}")]
407pub(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}")]
418pub(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")]
431pub(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)]
445pub(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
454pub(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
461impl<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
480pub(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
493impl<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}")]
553pub(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}")]
562pub(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)]
573pub(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)]
592pub(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)]
617pub(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)]
641pub(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)]
655pub(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)]
668pub(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`")]
677pub(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")]
685pub(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)]
700pub(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;
88use rustc_session::config::{CrateType, OutFileName, OutputType};
99use rustc_session::output::filename_for_metadata;
1010
11use crate::errors::{
11use crate::diagnostics::{
1212 BinaryOutputToTty, FailedCopyToStdout, FailedCreateEncodedMetadata, FailedCreateFile,
1313 FailedCreateTempdir, FailedWriteError,
1414};
compiler/rustc_metadata/src/lib.rs+1-1
......@@ -21,7 +21,7 @@ mod native_libs;
2121mod rmeta;
2222
2323pub mod creader;
24pub mod errors;
24pub mod diagnostics;
2525pub mod fs;
2626pub mod locator;
2727
compiler/rustc_metadata/src/locator.rs+39-18
......@@ -235,7 +235,7 @@ use tempfile::Builder as TempFileBuilder;
235235use tracing::{debug, info};
236236
237237use crate::creader::{Library, MetadataLoader};
238use crate::errors;
238use crate::diagnostics;
239239use crate::rmeta::{METADATA_HEADER, MetadataBlob, ProcMacroKind, rustc_version};
240240
241241#[derive(Clone)]
......@@ -1070,28 +1070,45 @@ impl CrateError {
10701070 let dcx = sess.dcx();
10711071 match self {
10721072 CrateError::NonAsciiName(crate_name) => {
1073 dcx.emit_err(errors::NonAsciiName { span, crate_name });
1073 dcx.emit_err(diagnostics::NonAsciiName { span, crate_name });
10741074 }
10751075 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 });
10771081 }
10781082 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 });
10801088 }
10811089 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 });
10831096 }
10841097 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 });
10861099 }
10871100 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 });
10891102 }
10901103 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 });
10921109 }
10931110 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 });
10951112 }
10961113 CrateError::LocatorCombined(locator) => {
10971114 let crate_name = locator.crate_name;
......@@ -1102,8 +1119,12 @@ impl CrateError {
11021119 if !locator.crate_rejections.via_filename.is_empty() {
11031120 let mismatches = locator.crate_rejections.via_filename.iter();
11041121 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 {
11071128 span,
11081129 dll_prefix: &locator.dll_prefix,
11091130 dll_suffix: &locator.dll_suffix,
......@@ -1129,7 +1150,7 @@ impl CrateError {
11291150 ));
11301151 }
11311152 }
1132 dcx.emit_err(errors::NewerCrateVersion {
1153 dcx.emit_err(diagnostics::NewerCrateVersion {
11331154 span,
11341155 crate_name,
11351156 add_info,
......@@ -1145,7 +1166,7 @@ impl CrateError {
11451166 path.display(),
11461167 ));
11471168 }
1148 dcx.emit_err(errors::NoCrateWithTriple {
1169 dcx.emit_err(diagnostics::NoCrateWithTriple {
11491170 span,
11501171 crate_name,
11511172 locator_triple: locator.triple.tuple(),
......@@ -1161,7 +1182,7 @@ impl CrateError {
11611182 path.display()
11621183 ));
11631184 }
1164 dcx.emit_err(errors::FoundStaticlib {
1185 dcx.emit_err(diagnostics::FoundStaticlib {
11651186 span,
11661187 crate_name,
11671188 add_info,
......@@ -1177,7 +1198,7 @@ impl CrateError {
11771198 path.display(),
11781199 ));
11791200 }
1180 dcx.emit_err(errors::IncompatibleRustc {
1201 dcx.emit_err(diagnostics::IncompatibleRustc {
11811202 span,
11821203 crate_name,
11831204 add_info,
......@@ -1189,14 +1210,14 @@ impl CrateError {
11891210 for CrateMismatch { path: _, got } in locator.crate_rejections.via_invalid {
11901211 crate_rejections.push(got);
11911212 }
1192 dcx.emit_err(errors::InvalidMetadataFiles {
1213 dcx.emit_err(diagnostics::InvalidMetadataFiles {
11931214 span,
11941215 crate_name,
11951216 add_info,
11961217 crate_rejections,
11971218 });
11981219 } else {
1199 let error = errors::CannotFindCrate {
1220 let error = diagnostics::CannotFindCrate {
12001221 span,
12011222 crate_name,
12021223 add_info,
......@@ -1222,7 +1243,7 @@ impl CrateError {
12221243 }
12231244 }
12241245 CrateError::NotFound(crate_name) => {
1225 let error = errors::CannotFindCrate {
1246 let error = diagnostics::CannotFindCrate {
12261247 span,
12271248 crate_name,
12281249 add_info: String::new(),
compiler/rustc_metadata/src/native_libs.rs+17-14
......@@ -21,7 +21,7 @@ use rustc_span::Symbol;
2121use rustc_span::def_id::{DefId, LOCAL_CRATE};
2222use rustc_target::spec::{Arch, BinaryFormat, CfgAbi, Env, LinkSelfContainedComponents, Os};
2323
24use crate::errors;
24use crate::diagnostics;
2525
2626/// The fallback directories are passed to linker, but not used when rustc does the search,
2727/// 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(
163163}
164164
165165pub 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 })
168169}
169170
170171fn find_bundled_library(
......@@ -241,7 +242,7 @@ impl<'tcx> Collector<'tcx> {
241242 if let Some(span) =
242243 find_attr!(self.tcx, child_item, LinkOrdinal {span, ..} => *span)
243244 {
244 sess.dcx().emit_err(errors::LinkOrdinalRawDylib { span });
245 sess.dcx().emit_err(diagnostics::LinkOrdinalRawDylib { span });
245246 }
246247 }
247248
......@@ -277,16 +278,18 @@ impl<'tcx> Collector<'tcx> {
277278 && !self.tcx.sess.target.is_like_darwin
278279 {
279280 // 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);
281282 }
282283 if let Some(ref new_name) = lib.new_name {
283284 let any_duplicate = self.libs.iter().any(|n| n.name.as_str() == lib.name);
284285 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 });
286289 } 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 });
288291 } 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 });
290293 }
291294 }
292295 }
......@@ -312,14 +315,14 @@ impl<'tcx> Collector<'tcx> {
312315 if lib.has_modifiers() || passed_lib.has_modifiers() {
313316 match lib.foreign_module {
314317 Some(def_id) => {
315 self.tcx.dcx().emit_err(errors::NoLinkModOverride {
318 self.tcx.dcx().emit_err(diagnostics::NoLinkModOverride {
316319 span: Some(self.tcx.def_span(def_id)),
317320 })
318321 }
319322 None => self
320323 .tcx
321324 .dcx()
322 .emit_err(errors::NoLinkModOverride { span: None }),
325 .emit_err(diagnostics::NoLinkModOverride { span: None }),
323326 };
324327 }
325328 if passed_lib.kind != NativeLibKind::Unspecified {
......@@ -434,7 +437,7 @@ impl<'tcx> Collector<'tcx> {
434437 DllCallingConvention::Vectorcall(self.i686_arg_list_size(item))
435438 }
436439 _ => {
437 self.tcx.dcx().emit_fatal(errors::RawDylibUnsupportedAbi { span });
440 self.tcx.dcx().emit_fatal(diagnostics::RawDylibUnsupportedAbi { span });
438441 }
439442 }
440443 } else {
......@@ -443,7 +446,7 @@ impl<'tcx> Collector<'tcx> {
443446 DllCallingConvention::C
444447 }
445448 _ => {
446 self.tcx.dcx().emit_fatal(errors::RawDylibUnsupportedAbi { span });
449 self.tcx.dcx().emit_fatal(diagnostics::RawDylibUnsupportedAbi { span });
447450 }
448451 }
449452 };
......@@ -458,11 +461,11 @@ impl<'tcx> Collector<'tcx> {
458461 if self.tcx.sess.target.binary_format == BinaryFormat::Elf {
459462 let name = name.as_str();
460463 if name.contains('\0') {
461 self.tcx.dcx().emit_err(errors::RawDylibMalformed { span });
464 self.tcx.dcx().emit_err(diagnostics::RawDylibMalformed { span });
462465 } else if let Some((left, right)) = name.split_once('@')
463466 && (left.is_empty() || right.is_empty() || right.contains('@'))
464467 {
465 self.tcx.dcx().emit_err(errors::RawDylibMalformed { span });
468 self.tcx.dcx().emit_err(diagnostics::RawDylibMalformed { span });
466469 }
467470 }
468471
compiler/rustc_metadata/src/rmeta/encoder.rs+6-3
......@@ -35,12 +35,12 @@ use rustc_span::{
3535};
3636use tracing::{debug, instrument, trace};
3737
38use crate::diagnostics::{FailCreateFileEncoder, FailWriteFile};
3839use crate::eii::EiiMapEncodedKeyValue;
39use crate::errors::{FailCreateFileEncoder, FailWriteFile};
4040use crate::rmeta::*;
4141
4242pub(super) struct EncodeContext<'a, 'tcx> {
43 opaque: opaque::FileEncoder,
43 opaque: opaque::FileEncoder<'a>,
4444 tcx: TyCtxt<'tcx>,
4545 feat: &'tcx rustc_feature::Features,
4646 tables: TableBuilders,
......@@ -1122,6 +1122,9 @@ fn should_encode_mir(
11221122 && reachable_set.contains(&def_id)
11231123 && (tcx.generics_of(def_id).requires_monomorphization(tcx)
11241124 || 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 });
11251128 // The function has a `const` modifier or is in a `const trait`.
11261129 let is_const_fn = tcx.is_const_fn(def_id.to_def_id());
11271130 (is_const_fn, opt)
......@@ -1153,6 +1156,7 @@ fn should_encode_variances<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId, def_kind: Def
11531156 | DefKind::Static { .. }
11541157 | DefKind::Const { .. }
11551158 | DefKind::ForeignMod
1159 | DefKind::TyAlias
11561160 | DefKind::Impl { .. }
11571161 | DefKind::Trait
11581162 | DefKind::TraitAlias
......@@ -1166,7 +1170,6 @@ fn should_encode_variances<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId, def_kind: Def
11661170 | DefKind::Closure
11671171 | DefKind::ExternCrate
11681172 | DefKind::SyntheticCoroutineBody => false,
1169 DefKind::TyAlias => tcx.type_alias_is_lazy(def_id),
11701173 }
11711174}
11721175
compiler/rustc_metadata/src/rmeta/mod.rs+1-1
......@@ -371,7 +371,7 @@ macro_rules! define_tables {
371371 }
372372
373373 impl TableBuilders {
374 fn encode(&self, buf: &mut FileEncoder) -> LazyTables {
374 fn encode(&self, buf: &mut FileEncoder<'_>) -> LazyTables {
375375 LazyTables {
376376 $($name1: self.$name1.encode(buf),)+
377377 $($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
487487 }
488488 }
489489
490 pub(crate) fn encode(&self, buf: &mut FileEncoder) -> LazyTable<I, T> {
490 pub(crate) fn encode(&self, buf: &mut FileEncoder<'_>) -> LazyTable<I, T> {
491491 let pos = buf.position();
492492
493493 let width = self.width;
compiler/rustc_middle/src/dep_graph/graph.rs+8-6
......@@ -135,7 +135,7 @@ impl DepGraph {
135135 session: &Session,
136136 prev_graph: Arc<SerializedDepGraph>,
137137 prev_work_products: WorkProductMap,
138 encoder: FileEncoder,
138 encoder: FileEncoder<'static>,
139139 ) -> DepGraph {
140140 let prev_graph_node_count = prev_graph.node_count();
141141
......@@ -195,10 +195,12 @@ impl DepGraph {
195195 self.data.is_some()
196196 }
197197
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())
202204 }
203205
204206 pub fn assert_ignored(&self) {
......@@ -1135,7 +1137,7 @@ impl CurrentDepGraph {
11351137 fn new(
11361138 session: &Session,
11371139 prev_graph_node_count: usize,
1138 encoder: FileEncoder,
1140 encoder: FileEncoder<'static>,
11391141 previous: Arc<SerializedDepGraph>,
11401142 ) -> Self {
11411143 let mut stable_hasher = StableHasher::new();
compiler/rustc_middle/src/dep_graph/retained.rs+1
......@@ -9,6 +9,7 @@ use super::{DepNode, DepNodeIndex};
99/// Normally, dependencies recorded during the current session are written to
1010/// disk and then forgotten, to avoid wasting memory on information that is
1111/// not needed when the compiler is working correctly.
12#[derive(Clone)]
1213pub struct RetainedDepGraph {
1314 pub inner: LinkedGraph<DepNode, ()>,
1415 pub indices: FxHashMap<DepNode, NodeIndex>,
compiler/rustc_middle/src/dep_graph/serialized.rs+15-11
......@@ -564,13 +564,17 @@ struct LocalEncoderResult {
564564struct EncoderState {
565565 next_node_index: AtomicU64,
566566 previous: Arc<SerializedDepGraph>,
567 file: Lock<Option<FileEncoder>>,
567 file: Lock<Option<FileEncoder<'static>>>,
568568 local: WorkerLocal<RefCell<LocalEncoderState>>,
569569 stats: Option<Lock<FxHashMap<DepKind, Stat>>>,
570570}
571571
572572impl 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 {
574578 Self {
575579 previous,
576580 next_node_index: AtomicU64::new(0),
......@@ -636,10 +640,12 @@ impl EncoderState {
636640
637641 // Outline the build of the full dep graph as it's typically disabled and cold.
638642 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);
643649 });
644650 }
645651
......@@ -861,7 +867,7 @@ pub(crate) struct GraphEncoder {
861867impl GraphEncoder {
862868 pub(crate) fn new(
863869 sess: &Session,
864 encoder: FileEncoder,
870 encoder: FileEncoder<'static>,
865871 prev_node_count: usize,
866872 previous: Arc<SerializedDepGraph>,
867873 ) -> Self {
......@@ -874,10 +880,8 @@ impl GraphEncoder {
874880 GraphEncoder { status, retained_graph, profiler: sess.prof.clone() }
875881 }
876882
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())
881885 }
882886
883887 /// 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> {
871871 self.opt_hir_owner_node(def_id)?.fn_decl()?.opt_delegation_sig_id()
872872 }
873873
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
874882 #[inline]
875883 fn hir_opt_ident(self, id: HirId) -> Option<Ident> {
876884 match self.hir_node(id) {
compiler/rustc_middle/src/query/on_disk_cache.rs+2-2
......@@ -201,7 +201,7 @@ impl OnDiskCache {
201201
202202 /// Serialize the current-session data that will be loaded by [`OnDiskCache`]
203203 /// 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 {
205205 // Serializing the `DepGraph` should not modify it.
206206 tcx.dep_graph.with_ignore(|| {
207207 // Allocate `SourceFileIndex`es.
......@@ -779,7 +779,7 @@ impl_ref_decoder! {<'tcx>
779779/// An encoder that can write to the incremental compilation cache.
780780pub struct CacheEncoder<'a, 'tcx> {
781781 tcx: TyCtxt<'tcx>,
782 encoder: FileEncoder,
782 encoder: FileEncoder<'static>,
783783 type_shorthands: FxHashMap<Ty<'tcx>, usize>,
784784 predicate_shorthands: FxHashMap<ty::PredicateKind<'tcx>, usize>,
785785 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> {
208208 self.adt_def(adt_def_id)
209209 }
210210
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
226211 fn unevaluated_const_kind_from_def_id(
227212 self,
228213 def_id: Self::DefId,
compiler/rustc_middle/src/ty/mod.rs+12-4
......@@ -201,6 +201,9 @@ pub struct ResolverGlobalCtxt {
201201 pub doc_link_traits_in_scope: FxIndexMap<LocalDefId, Vec<DefId>>,
202202 pub all_macro_rules: UnordSet<Symbol>,
203203 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>,
204207}
205208
206209#[derive(Debug)]
......@@ -257,13 +260,10 @@ pub struct ResolverAstLowering<'tcx> {
257260 /// Lints that were emitted by the resolver and early lints.
258261 pub lint_buffer: Steal<LintBuffer>,
259262
260 // Information about delegations which is used when handling recursive delegations
261 pub delegation_infos: LocalDefIdMap<DelegationInfo>,
262
263263 pub disambiguators: LocalDefIdMap<Steal<PerParentDisambiguatorState>>,
264264}
265265
266#[derive(Debug)]
266#[derive(Debug, StableHash)]
267267pub struct DelegationInfo {
268268 // `DefId` (either the resolution at delegation.id or item_id in case of a trait impl) for signature resolution,
269269 // for details see https://github.com/rust-lang/rust/issues/118212#issuecomment-2160686914
......@@ -1789,6 +1789,14 @@ impl<'tcx> TyCtxt<'tcx> {
17891789 | DefKind::Ctor(..)
17901790 | DefKind::AnonConst
17911791 | 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 }
17921800 // If the caller wants `mir_for_ctfe` of a function they should not be using
17931801 // `instance_mir`, so we'll assume const fn also wants the optimized version.
17941802 _ => self.optimized_mir(def),
compiler/rustc_middle/src/ty/util.rs+7-3
......@@ -905,7 +905,7 @@ impl<'tcx> TyCtxt<'tcx> {
905905 return Ty::new_error(self, guar);
906906 }
907907
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();
909909 depth += 1;
910910 }
911911
......@@ -967,7 +967,7 @@ impl<'tcx> OpaqueTypeExpander<'tcx> {
967967 Some(expanded_ty) => *expanded_ty,
968968 None => {
969969 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();
971971 let expanded_ty = self.fold_ty(concrete_ty);
972972 self.expanded_cache.insert((def_id, args), expanded_ty);
973973 expanded_ty
......@@ -1047,7 +1047,11 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for FreeAliasTypeExpander<'tcx> {
10471047
10481048 self.depth += 1;
10491049 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)
10511055 });
10521056 self.depth -= 1;
10531057 ty
compiler/rustc_mir_build/src/builder/expr/into.rs+1-1
......@@ -18,7 +18,7 @@ use crate::builder::expr::category::{Category, RvalueFunc};
1818use crate::builder::matches::{DeclareLetBindings, Exhaustive, HasMatchGuard};
1919use crate::builder::scope::LintLevel;
2020use crate::builder::{BlockAnd, BlockAndExtension, BlockFrame, Builder, NeedsTemporary};
21use crate::errors::{LoopMatchArmWithGuard, LoopMatchUnsupportedType};
21use crate::diagnostics::{LoopMatchArmWithGuard, LoopMatchUnsupportedType};
2222
2323impl<'a, 'tcx> Builder<'a, 'tcx> {
2424 /// 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};
4444
4545use crate::builder::expr::as_place::PlaceBuilder;
4646use crate::builder::scope::{DropKind, LintLevel};
47use crate::errors;
47use crate::diagnostics;
4848
4949pub(crate) fn closure_saved_names_of_captured_variables<'tcx>(
5050 tcx: TyCtxt<'tcx>,
......@@ -577,7 +577,7 @@ fn construct_const<'a, 'tcx>(
577577 })
578578 | Node::ImplItem(hir::ImplItem { kind: hir::ImplItemKind::Const(ty, _), span, .. })
579579 | Node::TraitItem(hir::TraitItem {
580 kind: hir::TraitItemKind::Const(ty, Some(_), _),
580 kind: hir::TraitItemKind::Const(ty, Some(_)),
581581 span,
582582 ..
583583 }) => (*span, ty.span),
......@@ -931,7 +931,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
931931 lint::builtin::UNREACHABLE_CODE,
932932 lint_root,
933933 target_loc.span,
934 errors::UnreachableDueToUninhabited {
934 diagnostics::UnreachableDueToUninhabited {
935935 expr: target_loc.span,
936936 orig: orig_span,
937937 descr,
compiler/rustc_mir_build/src/builder/scope.rs+2-2
......@@ -99,7 +99,7 @@ use tracing::{debug, instrument};
9999
100100use super::matches::BuiltMatchTree;
101101use crate::builder::{BlockAnd, BlockAndExtension, BlockFrame, Builder, CFG};
102use crate::errors::{
102use crate::diagnostics::{
103103 ConstContinueBadConst, ConstContinueNotMonomorphicConst, ConstContinueUnknownJumpTarget,
104104};
105105
......@@ -924,7 +924,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
924924 | ExprKind::NamedConst { .. } => self.as_constant(&self.thir[value]),
925925
926926 other => {
927 use crate::errors::ConstContinueNotMonomorphicConstReason as Reason;
927 use crate::diagnostics::ConstContinueNotMonomorphicConstReason as Reason;
928928
929929 let span = expr.span;
930930 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,
1616use rustc_span::def_id::{DefId, LocalDefId};
1717use rustc_span::{Span, Symbol};
1818
19use crate::errors::*;
19use crate::diagnostics::*;
2020
2121struct UnsafetyVisitor<'a, 'tcx> {
2222 tcx: TyCtxt<'tcx>,
compiler/rustc_mir_build/src/diagnostics.rs created+1449
......@@ -0,0 +1,1449 @@
1use rustc_errors::codes::*;
2use rustc_errors::{
3 Applicability, Diag, DiagArgValue, DiagCtxtHandle, Diagnostic, EmissionGuarantee, Level,
4 MultiSpan, Subdiagnostic, msg,
5};
6use rustc_macros::{Diagnostic, Subdiagnostic};
7use rustc_middle::ty::{self, Ty};
8use rustc_pattern_analysis::errors::Uncovered;
9use rustc_pattern_analysis::rustc::RustcPatCtxt;
10use rustc_span::{Ident, Span, Symbol};
11
12#[derive(Diagnostic)]
13#[diag("call to deprecated safe function `{$function}` is unsafe and requires unsafe block")]
14pub(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)]
27pub(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")]
41pub(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")]
52pub(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")]
62pub(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")]
72pub(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)]
84pub(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)]
96pub(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")]
106pub(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)]
118pub(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)]
130pub(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")]
143pub(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)]
155pub(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)]
167pub(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)]
182pub(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")]
205pub(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")]
217pub(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")]
228pub(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")]
243pub(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")]
254pub(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")]
265pub(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")]
276pub(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")]
290pub(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)]
303pub(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)]
316pub(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)]
329pub(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)]
342pub(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")]
353pub(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")]
364pub(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)]
377pub(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)]
390pub(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)]
403pub(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)]
416pub(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")]
427pub(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")]
441pub(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)]
454pub(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)]
470pub(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)]
486pub(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)]
518pub(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)]
544pub(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)]
557pub(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)]
567pub(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")]
577pub(crate) struct UnsafeNotInheritedNote {
578 #[primary_span]
579 pub(crate) span: Span,
580}
581
582pub(crate) struct UnsafeNotInheritedLintNote {
583 pub(crate) signature_span: Span,
584 pub(crate) body_span: Span,
585}
586
587impl 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")]
605pub(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)]
613pub(crate) enum UnusedUnsafeEnclosing {
614 #[label("because it's nested under this `unsafe` block")]
615 Block {
616 #[primary_span]
617 span: Span,
618 },
619}
620
621pub(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
628impl<'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")]
697pub(crate) struct NonExhaustiveMatchAllArmsGuarded;
698
699#[derive(Diagnostic)]
700#[diag("statics cannot be referenced in patterns", code = E0158)]
701pub(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)]
711pub(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)]
721pub(crate) struct NonConstPath {
722 #[primary_span]
723 #[label("references a runtime value")]
724 pub(crate) span: Span,
725}
726
727pub(crate) struct UnreachablePattern<'tcx> {
728 pub(crate) covered_by_many_n_more_count: Option<usize>,
729 pub(crate) inner: UnreachablePatternInner<'tcx>,
730}
731
732impl<'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")]
745pub(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)]
788pub(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}")]
798pub(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)]
810pub(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")]
818pub(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)]
826pub(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}`")]
838pub(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)]
849pub(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)]
856pub(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)]
863pub(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`")]
888pub(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")]
906pub(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")]
913pub(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)]
924pub(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")]
945pub(crate) struct IrrefutableLetPatternsWhileLet {
946 pub(crate) count: usize,
947}
948
949#[derive(Diagnostic)]
950#[diag("borrow of moved value")]
951pub(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")]
972pub(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")]
981pub(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")]
990pub(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")]
999pub(crate) struct MovedWhileBorrowed {
1000 #[primary_span]
1001 pub(crate) span: Span,
1002 #[subdiagnostic]
1003 pub(crate) occurrences: Vec<Conflict>,
1004}
1005
1006#[derive(Subdiagnostic)]
1007pub(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")]
1030pub(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")]
1038pub(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)]
1065pub(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)]
1158pub(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")]
1167pub(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")]
1177pub(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")]
1187pub(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")]
1198pub(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}`")]
1207pub(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)]
1216pub(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")]
1249pub(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)]
1257pub(crate) struct InterpretedAsConst {
1258 #[primary_span]
1259 pub(crate) span: Span,
1260 pub(crate) variable: String,
1261}
1262
1263pub(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
1269pub(crate) struct Variant {
1270 pub(crate) span: Span,
1271}
1272
1273impl<'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)]
1293pub(crate) struct InterpretedAsConstSugg {
1294 #[primary_span]
1295 pub(crate) span: Span,
1296 pub(crate) variable: String,
1297}
1298
1299#[derive(Subdiagnostic)]
1300pub(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)]
1331pub(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")]
1345pub(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]`")]
1355pub(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")]
1363pub(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]`")]
1371pub(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")]
1378pub(crate) struct LoopMatchBadRhs {
1379 #[primary_span]
1380 pub span: Span,
1381}
1382
1383#[derive(Diagnostic)]
1384#[diag("expected a single assignment expression")]
1385pub(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")]
1392pub(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")]
1400pub(crate) struct ConstContinueNotMonomorphicConst {
1401 #[primary_span]
1402 pub span: Span,
1403
1404 #[subdiagnostic]
1405 pub reason: ConstContinueNotMonomorphicConstReason,
1406}
1407
1408#[derive(Subdiagnostic)]
1409pub(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]`")]
1431pub(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")]
1439pub(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")]
1446pub(crate) struct ConstContinueUnknownJumpTarget {
1447 #[primary_span]
1448 pub span: Span,
1449}
compiler/rustc_mir_build/src/errors.rs deleted-1449
......@@ -1,1449 +0,0 @@
1use rustc_errors::codes::*;
2use rustc_errors::{
3 Applicability, Diag, DiagArgValue, DiagCtxtHandle, Diagnostic, EmissionGuarantee, Level,
4 MultiSpan, Subdiagnostic, msg,
5};
6use rustc_macros::{Diagnostic, Subdiagnostic};
7use rustc_middle::ty::{self, Ty};
8use rustc_pattern_analysis::errors::Uncovered;
9use rustc_pattern_analysis::rustc::RustcPatCtxt;
10use rustc_span::{Ident, Span, Symbol};
11
12#[derive(Diagnostic)]
13#[diag("call to deprecated safe function `{$function}` is unsafe and requires unsafe block")]
14pub(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)]
27pub(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")]
41pub(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")]
52pub(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")]
62pub(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")]
72pub(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)]
84pub(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)]
96pub(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")]
106pub(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)]
118pub(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)]
130pub(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")]
143pub(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)]
155pub(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)]
167pub(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)]
182pub(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")]
205pub(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")]
217pub(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")]
228pub(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")]
243pub(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")]
254pub(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")]
265pub(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")]
276pub(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")]
290pub(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)]
303pub(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)]
316pub(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)]
329pub(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)]
342pub(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")]
353pub(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")]
364pub(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)]
377pub(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)]
390pub(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)]
403pub(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)]
416pub(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")]
427pub(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")]
441pub(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)]
454pub(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)]
470pub(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)]
486pub(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)]
518pub(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)]
544pub(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)]
557pub(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)]
567pub(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")]
577pub(crate) struct UnsafeNotInheritedNote {
578 #[primary_span]
579 pub(crate) span: Span,
580}
581
582pub(crate) struct UnsafeNotInheritedLintNote {
583 pub(crate) signature_span: Span,
584 pub(crate) body_span: Span,
585}
586
587impl 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")]
605pub(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)]
613pub(crate) enum UnusedUnsafeEnclosing {
614 #[label("because it's nested under this `unsafe` block")]
615 Block {
616 #[primary_span]
617 span: Span,
618 },
619}
620
621pub(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
628impl<'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")]
697pub(crate) struct NonExhaustiveMatchAllArmsGuarded;
698
699#[derive(Diagnostic)]
700#[diag("statics cannot be referenced in patterns", code = E0158)]
701pub(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)]
711pub(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)]
721pub(crate) struct NonConstPath {
722 #[primary_span]
723 #[label("references a runtime value")]
724 pub(crate) span: Span,
725}
726
727pub(crate) struct UnreachablePattern<'tcx> {
728 pub(crate) covered_by_many_n_more_count: Option<usize>,
729 pub(crate) inner: UnreachablePatternInner<'tcx>,
730}
731
732impl<'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")]
745pub(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)]
788pub(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}")]
798pub(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)]
810pub(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")]
818pub(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)]
826pub(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}`")]
838pub(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)]
849pub(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)]
856pub(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)]
863pub(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`")]
888pub(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")]
906pub(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")]
913pub(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)]
924pub(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")]
945pub(crate) struct IrrefutableLetPatternsWhileLet {
946 pub(crate) count: usize,
947}
948
949#[derive(Diagnostic)]
950#[diag("borrow of moved value")]
951pub(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")]
972pub(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")]
981pub(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")]
990pub(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")]
999pub(crate) struct MovedWhileBorrowed {
1000 #[primary_span]
1001 pub(crate) span: Span,
1002 #[subdiagnostic]
1003 pub(crate) occurrences: Vec<Conflict>,
1004}
1005
1006#[derive(Subdiagnostic)]
1007pub(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")]
1030pub(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")]
1038pub(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)]
1065pub(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)]
1158pub(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")]
1167pub(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")]
1177pub(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")]
1187pub(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")]
1198pub(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}`")]
1207pub(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)]
1216pub(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")]
1249pub(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)]
1257pub(crate) struct InterpretedAsConst {
1258 #[primary_span]
1259 pub(crate) span: Span,
1260 pub(crate) variable: String,
1261}
1262
1263pub(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
1269pub(crate) struct Variant {
1270 pub(crate) span: Span,
1271}
1272
1273impl<'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)]
1293pub(crate) struct InterpretedAsConstSugg {
1294 #[primary_span]
1295 pub(crate) span: Span,
1296 pub(crate) variable: String,
1297}
1298
1299#[derive(Subdiagnostic)]
1300pub(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)]
1331pub(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")]
1345pub(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]`")]
1355pub(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")]
1363pub(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]`")]
1371pub(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")]
1378pub(crate) struct LoopMatchBadRhs {
1379 #[primary_span]
1380 pub span: Span,
1381}
1382
1383#[derive(Diagnostic)]
1384#[diag("expected a single assignment expression")]
1385pub(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")]
1392pub(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")]
1400pub(crate) struct ConstContinueNotMonomorphicConst {
1401 #[primary_span]
1402 pub span: Span,
1403
1404 #[subdiagnostic]
1405 pub reason: ConstContinueNotMonomorphicConstReason,
1406}
1407
1408#[derive(Subdiagnostic)]
1409pub(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]`")]
1431pub(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")]
1439pub(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")]
1446pub(crate) struct ConstContinueUnknownJumpTarget {
1447 #[primary_span]
1448 pub span: Span,
1449}
compiler/rustc_mir_build/src/lib.rs+1-1
......@@ -11,7 +11,7 @@
1111mod builder;
1212mod check_tail_calls;
1313mod check_unsafety;
14mod errors;
14mod diagnostics;
1515pub mod thir;
1616
1717use 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};
2222use rustc_span::Span;
2323use tracing::{debug, info, instrument, trace};
2424
25use crate::errors::*;
25use crate::diagnostics::*;
2626use crate::thir::cx::ThirBuildCx;
2727
2828impl<'tcx> ThirBuildCx<'tcx> {
compiler/rustc_mir_build/src/thir/pattern/check_match.rs+1-1
......@@ -27,7 +27,7 @@ use rustc_span::{Ident, Span};
2727use rustc_trait_selection::infer::InferCtxtExt;
2828use tracing::instrument;
2929
30use crate::errors::*;
30use crate::diagnostics::*;
3131
3232pub(crate) fn check_match(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Result<(), ErrorGuaranteed> {
3333 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;
2020use tracing::{debug, instrument, trace};
2121
2222use super::PatCtxt;
23use crate::errors::{
23use crate::diagnostics::{
2424 ConstPatternDependsOnGenericParameter, CouldNotEvalConstPattern, InvalidPattern, NaNPattern,
2525 PointerPattern, SuggestEq, TypeNotPartialEq, TypeNotStructural, UnionPattern, UnsizedPattern,
2626};
compiler/rustc_mir_build/src/thir/pattern/mod.rs+1-1
......@@ -29,7 +29,7 @@ use tracing::{debug, instrument};
2929
3030pub(crate) use self::check_match::check_match;
3131use self::migration::PatMigration;
32use crate::errors::*;
32use crate::diagnostics::*;
3333use crate::thir::cx::ThirBuildCx;
3434
3535/// Context for lowering HIR patterns to THIR patterns.
compiler/rustc_mir_dataflow/src/diagnostics.rs created+41
......@@ -0,0 +1,41 @@
1use rustc_macros::Diagnostic;
2use rustc_span::Span;
3
4#[derive(Diagnostic)]
5#[diag("stop_after_dataflow ended compilation")]
6pub(crate) struct StopAfterDataFlowEndedCompilation;
7
8#[derive(Diagnostic)]
9#[diag("rustc_peek: argument expression must be either `place` or `&place`")]
10pub(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")]
17pub(crate) struct PeekMustBeNotTemporary {
18 #[primary_span]
19 pub span: Span,
20}
21
22#[derive(Diagnostic)]
23#[diag("rustc_peek: bit not set")]
24pub(crate) struct PeekBitNotSet {
25 #[primary_span]
26 pub span: Span,
27}
28
29#[derive(Diagnostic)]
30#[diag("rustc_peek: argument was not a local")]
31pub(crate) struct PeekArgumentNotALocal {
32 #[primary_span]
33 pub span: Span,
34}
35
36#[derive(Diagnostic)]
37#[diag("rustc_peek: argument untracked")]
38pub(crate) struct PeekArgumentUntracked {
39 #[primary_span]
40 pub span: Span,
41}
compiler/rustc_mir_dataflow/src/errors.rs deleted-41
......@@ -1,41 +0,0 @@
1use rustc_macros::Diagnostic;
2use rustc_span::Span;
3
4#[derive(Diagnostic)]
5#[diag("stop_after_dataflow ended compilation")]
6pub(crate) struct StopAfterDataFlowEndedCompilation;
7
8#[derive(Diagnostic)]
9#[diag("rustc_peek: argument expression must be either `place` or `&place`")]
10pub(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")]
17pub(crate) struct PeekMustBeNotTemporary {
18 #[primary_span]
19 pub span: Span,
20}
21
22#[derive(Diagnostic)]
23#[diag("rustc_peek: bit not set")]
24pub(crate) struct PeekBitNotSet {
25 #[primary_span]
26 pub span: Span,
27}
28
29#[derive(Diagnostic)]
30#[diag("rustc_peek: argument was not a local")]
31pub(crate) struct PeekArgumentNotALocal {
32 #[primary_span]
33 pub span: Span,
34}
35
36#[derive(Diagnostic)]
37#[diag("rustc_peek: argument untracked")]
38pub(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::{
2323use self::move_paths::MoveData;
2424
2525pub mod debuginfo;
26mod diagnostics;
2627mod drop_flag_effects;
27mod errors;
2828mod framework;
2929pub mod impls;
3030pub mod move_paths;
compiler/rustc_mir_dataflow/src/rustc_peek.rs+1-1
......@@ -5,7 +5,7 @@ use rustc_middle::ty::{self, Ty, TyCtxt};
55use rustc_span::{Span, sym};
66use tracing::{debug, info};
77
8use crate::errors::{
8use crate::diagnostics::{
99 PeekArgumentNotALocal, PeekArgumentUntracked, PeekBitNotSet, PeekMustBeNotTemporary,
1010 PeekMustBePlaceOrRefPlace, StopAfterDataFlowEndedCompilation,
1111};
compiler/rustc_mir_transform/src/cross_crate_inline.rs+7-1
......@@ -1,7 +1,7 @@
11use rustc_hir::attrs::InlineAttr;
22use rustc_hir::def::DefKind;
33use rustc_hir::def_id::LocalDefId;
4use rustc_hir::find_attr;
4use rustc_hir::{self as hir, find_attr};
55use rustc_middle::bug;
66use rustc_middle::mir::visit::Visitor;
77use rustc_middle::mir::*;
......@@ -43,6 +43,12 @@ fn cross_crate_inlinable(tcx: TyCtxt<'_>, def_id: LocalDefId) -> bool {
4343 return true;
4444 }
4545
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
4652 // Obey source annotations first; this is important because it means we can use
4753 // #[inline(never)] to force code generation.
4854 match codegen_fn_attrs.inline {
compiler/rustc_mir_transform/src/deduce_param_attrs.rs+7
......@@ -9,6 +9,7 @@
99//! after `optimized_mir`! We check for things that are *not* guaranteed to be preserved by MIR
1010//! transforms, such as which local variables happen to be mutated.
1111
12use rustc_hir as hir;
1213use rustc_hir::def_id::LocalDefId;
1314use rustc_index::IndexVec;
1415use rustc_middle::middle::deduced_param_attrs::{DeducedParamAttrs, UsageSummary};
......@@ -205,6 +206,12 @@ pub(super) fn deduced_param_attrs<'tcx>(
205206 return &[];
206207 }
207208
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
208215 // Grab the optimized MIR. Analyze it to determine which arguments have been mutated.
209216 let body: &Body<'tcx> = tcx.optimized_mir(def_id);
210217 // 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<'_> {
511511 };
512512
513513 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);
515526
516527 body
517528}
compiler/rustc_monomorphize/src/collector.rs+2-2
......@@ -413,7 +413,7 @@ fn collect_items_rec<'tcx>(
413413 // current step of mono items collection.
414414 //
415415 // 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();
417417
418418 // In `mentioned_items` we collect items that were mentioned in this MIR but possibly do not
419419 // 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>(
538538
539539 // Check for PMEs and emit a diagnostic if one happened. To try to show relevant edges of the
540540 // mono item graph.
541 if tcx.dcx().err_count() > error_count
541 if tcx.dcx().err_count_on_current_thread() > error_count
542542 && starting_item.node.is_generic_fn()
543543 && starting_item.node.is_user_defined()
544544 {
compiler/rustc_next_trait_solver/src/solve/normalizes_to/inherent.rs+2-1
......@@ -54,7 +54,7 @@ where
5454 .map(|pred| goal.with(cx, pred)),
5555 );
5656
57 let normalized = match inherent.kind {
57 let normalized: I::Term = match inherent.kind {
5858 ty::AliasTermKind::InherentTy { def_id } => {
5959 cx.type_of(def_id.into()).instantiate(cx, inherent_args).skip_norm_wip().into()
6060 }
......@@ -74,6 +74,7 @@ where
7474 }
7575 kind => panic!("expected inherent alias, found {kind:?}"),
7676 };
77
7778 self.instantiate_normalizes_to_term(goal, normalized);
7879 self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
7980 }
compiler/rustc_next_trait_solver/src/solve/normalizes_to/mod.rs+31
......@@ -121,11 +121,42 @@ where
121121 /// We know `term` to always be a fully unconstrained inference variable, so
122122 /// `eq` should never fail here. However, in case `term` contains aliases, we
123123 /// 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.
124145 pub fn instantiate_normalizes_to_term(
125146 &mut self,
126147 goal: Goal<I, NormalizesTo<I>>,
127148 term: I::Term,
128149 ) {
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 }
129160 self.eq(goal.param_env, goal.predicate.term, term)
130161 .expect("expected goal term to be fully unconstrained");
131162 }
compiler/rustc_parse/src/parser/ty.rs+1-1
......@@ -1092,7 +1092,7 @@ impl<'a> Parser<'a> {
10921092 && (self.token.can_begin_type()
10931093 || (self.token.is_reserved_ident() && !self.token.is_keyword(kw::Where))))
10941094 {
1095 if self.token.is_keyword(kw::Dyn) {
1095 if self.token.is_keyword(kw::Dyn) && self.token.span.edition().at_least_rust_2018() {
10961096 // Account for `&dyn Trait + dyn Other`.
10971097 self.bump();
10981098 self.dcx().emit_err(InvalidDynKeyword {
compiler/rustc_passes/src/dead.rs+16
......@@ -5,6 +5,7 @@
55
66use std::mem;
77use std::ops::ControlFlow;
8use std::sync::atomic::Ordering;
89
910use hir::def_id::{LocalDefIdMap, LocalDefIdSet};
1011use rustc_abi::FieldIdx;
......@@ -930,6 +931,21 @@ fn create_and_seed_worklist(tcx: TyCtxt<'_>) -> SeedWorklists {
930931 });
931932 }
932933
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
933949 for (id, effective_vis) in tcx.effective_visibilities(()).iter() {
934950 if effective_vis.is_public_at_level(Level::Reachable) {
935951 deferred_seeds.push(WorkItem {
compiler/rustc_passes/src/delegation.rs created+32
......@@ -0,0 +1,32 @@
1use rustc_data_structures::fx::FxIndexMap;
2use rustc_macros::Diagnostic;
3use rustc_middle::ty::TyCtxt;
4use rustc_span::Span;
5
6pub 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")]
29struct DelegationTargetExprDeletedEverywhere {
30 #[primary_span]
31 pub span: Span,
32}
compiler/rustc_passes/src/lib.rs+1
......@@ -11,6 +11,7 @@ mod check_attr;
1111mod check_export;
1212pub mod dead;
1313mod debugger_visualizer;
14pub mod delegation;
1415mod diagnostic_items;
1516mod eii;
1617pub mod entry;
compiler/rustc_passes/src/reachable.rs+3-3
......@@ -145,7 +145,7 @@ impl<'tcx> ReachableContext<'tcx> {
145145 _ => false,
146146 },
147147 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(),
149149 hir::TraitItemKind::Fn(_, hir::TraitFn::Provided(_)) => true,
150150 hir::TraitItemKind::Fn(_, hir::TraitFn::Required(_))
151151 | hir::TraitItemKind::Type(..) => false,
......@@ -266,11 +266,11 @@ impl<'tcx> ReachableContext<'tcx> {
266266 }
267267 Node::TraitItem(trait_method) => {
268268 match trait_method.kind {
269 hir::TraitItemKind::Const(_, None, _)
269 hir::TraitItemKind::Const(_, None)
270270 | hir::TraitItemKind::Fn(_, hir::TraitFn::Required(_)) => {
271271 // Keep going, nothing to get exported
272272 }
273 hir::TraitItemKind::Const(_, Some(rhs), _) => self.visit_const_item_rhs(rhs),
273 hir::TraitItemKind::Const(_, Some(rhs)) => self.visit_const_item_rhs(rhs),
274274 hir::TraitItemKind::Fn(_, hir::TraitFn::Provided(body_id)) => {
275275 self.visit_nested_body(body_id);
276276 }
compiler/rustc_resolve/src/imports.rs+9
......@@ -628,6 +628,15 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
628628 module.underscore_disambiguator.get()
629629 });
630630 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 }
631640 if decl.is_glob_import() {
632641 resolution.glob_decl = Some(match resolution.glob_decl {
633642 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> {
15061506 /// Generic args to suggest for required params (e.g. `<'_>`, `<_, _>`), if any.
15071507 item_required_generic_args_suggestions: FxHashMap<LocalDefId, String> = default::fx_hash_map(),
15081508 delegation_fn_sigs: LocalDefIdMap<DelegationFnSig> = Default::default(),
1509 delegation_infos: LocalDefIdMap<DelegationInfo> = Default::default(),
1509 delegation_infos: FxIndexMap<LocalDefId, DelegationInfo>,
15101510
15111511 main_def: Option<MainDefinition> = None,
15121512 trait_impls: FxIndexMap<DefId, Vec<LocalDefId>>,
......@@ -1871,6 +1871,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
18711871 doc_link_traits_in_scope: Default::default(),
18721872 current_crate_outer_attr_insert_span,
18731873 disambiguators: Default::default(),
1874 delegation_infos: Default::default(),
18741875 ..
18751876 };
18761877
......@@ -1991,6 +1992,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
19911992 doc_link_traits_in_scope: self.doc_link_traits_in_scope,
19921993 all_macro_rules: self.all_macro_rules,
19931994 stripped_cfg_items,
1995 delegation_infos: self.delegation_infos,
19941996 };
19951997 let ast_lowering = ty::ResolverAstLowering {
19961998 partial_res_map: self.partial_res_map,
......@@ -1998,7 +2000,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
19982000 next_node_id: self.next_node_id,
19992001 owners: self.owners,
20002002 lint_buffer: Steal::new(self.lint_buffer),
2001 delegation_infos: self.delegation_infos,
20022003 disambiguators,
20032004 };
20042005 ResolverOutputs { global_ctxt, ast_lowering }
compiler/rustc_serialize/src/opaque.rs+28-8
......@@ -29,7 +29,10 @@ const BUF_SIZE: usize = 64 * 1024;
2929/// `Vec`. `FileEncoder` is better because its memory use is determined by the
3030/// size of the buffer, rather than the full length of the encoded data, and
3131/// because it doesn't need to reallocate memory along the way.
32pub 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.
35pub struct FileEncoder<'a> {
3336 // The input buffer. For adequate performance, we need to be able to write
3437 // directly to the unwritten region of the buffer, without calling copy_from_slice.
3538 // Note that our buffer is always initialized so that we can do that direct access
......@@ -43,11 +46,12 @@ pub struct FileEncoder {
4346 // comment on `trait Encoder`.
4447 res: Result<(), io::Error>,
4548 path: PathBuf,
49 flush_strategy: Option<&'a mut (dyn FnMut(&[u8]) + Send)>,
4650 #[cfg(debug_assertions)]
4751 finished: bool,
4852}
4953
50impl FileEncoder {
54impl<'a> FileEncoder<'a> {
5155 pub fn new<P: AsRef<Path>>(path: P) -> io::Result<Self> {
5256 // File::create opens the file for writing only. When -Zmeta-stats is enabled, the metadata
5357 // encoder rewinds the file to inspect what was written. So we need to always open the file
......@@ -62,11 +66,21 @@ impl FileEncoder {
6266 flushed: 0,
6367 file,
6468 res: Ok(()),
69 flush_strategy: None,
6570 #[cfg(debug_assertions)]
6671 finished: false,
6772 })
6873 }
6974
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
7084 #[inline]
7185 pub fn position(&self) -> usize {
7286 // Tracking position this way instead of having a `self.position` field
......@@ -86,6 +100,9 @@ impl FileEncoder {
86100 self.res = self.file.write_all(&self.buf[..self.buffered]);
87101 }
88102 self.flushed += self.buffered;
103 if let Some(f) = &mut self.flush_strategy {
104 f(&self.buf[..self.buffered]);
105 }
89106 self.buffered = 0;
90107 }
91108
......@@ -115,6 +132,9 @@ impl FileEncoder {
115132 } else {
116133 if self.res.is_ok() {
117134 self.res = self.file.write_all(buf);
135 if let Some(f) = &mut self.flush_strategy {
136 f(buf);
137 }
118138 }
119139 self.flushed += buf.len();
120140 }
......@@ -200,7 +220,7 @@ impl FileEncoder {
200220}
201221
202222#[cfg(debug_assertions)]
203impl Drop for FileEncoder {
223impl Drop for FileEncoder<'_> {
204224 fn drop(&mut self) {
205225 if !std::thread::panicking() {
206226 assert!(self.finished);
......@@ -217,7 +237,7 @@ macro_rules! write_leb128 {
217237 };
218238}
219239
220impl Encoder for FileEncoder {
240impl Encoder for FileEncoder<'_> {
221241 write_leb128!(emit_usize, usize, write_usize_leb128);
222242 write_leb128!(emit_u128, u128, write_u128_leb128);
223243 write_leb128!(emit_u64, u64, write_u64_leb128);
......@@ -415,8 +435,8 @@ impl<'a> Decoder for MemDecoder<'a> {
415435
416436// Specialize encoding byte slices. This specialization also applies to encoding `Vec<u8>`s, etc.,
417437// since the default implementations call `encode` on their slices internally.
418impl Encodable<FileEncoder> for [u8] {
419 fn encode(&self, e: &mut FileEncoder) {
438impl Encodable<FileEncoder<'_>> for [u8] {
439 fn encode(&self, e: &mut FileEncoder<'_>) {
420440 Encoder::emit_usize(e, self.len());
421441 e.emit_raw_bytes(self);
422442 }
......@@ -438,9 +458,9 @@ impl IntEncodedWithFixedSize {
438458 pub const ENCODED_SIZE: usize = 8;
439459}
440460
441impl Encodable<FileEncoder> for IntEncodedWithFixedSize {
461impl Encodable<FileEncoder<'_>> for IntEncodedWithFixedSize {
442462 #[inline]
443 fn encode(&self, e: &mut FileEncoder) {
463 fn encode(&self, e: &mut FileEncoder<'_>) {
444464 let start_pos = e.position();
445465 e.write_array(self.0.to_le_bytes());
446466 let end_pos = e.position();
compiler/rustc_serialize/src/opaque/tests.rs+34-2
......@@ -3,7 +3,7 @@ use std::fs;
33
44use rustc_macros::{Decodable_NoContext, Encodable_NoContext};
55
6use crate::opaque::{FileEncoder, MemDecoder};
6use crate::opaque::{FileEncoder, MAGIC_END_BYTES, MemDecoder};
77use crate::{Decodable, Encodable};
88
99#[derive(PartialEq, Clone, Debug, Encodable_NoContext, Decodable_NoContext)]
......@@ -28,7 +28,7 @@ struct Struct {
2828}
2929
3030fn 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,
3232>(
3333 values: Vec<T>,
3434) {
......@@ -293,3 +293,35 @@ fn test_cell() {
293293 let obj = B { foo: Cell::new(true), bar: RefCell::new(A { baz: 2 }) };
294294 check_round_trip(vec![obj]);
295295}
296
297#[test]
298fn 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 {
181181 ///
182182 /// The value is the `DepNodeIndex` of the node encodes the used feature.
183183 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,
184188}
185189
186190#[derive(Clone, Copy)]
......@@ -1133,6 +1137,7 @@ pub fn build_session(
11331137 thin_lto_supported: true, // filled by `run_compiler`
11341138 mir_opt_bisect_eval_count: AtomicUsize::new(0),
11351139 used_features: Lock::default(),
1140 removed_rustc_main_attr: AtomicBool::new(false),
11361141 };
11371142
11381143 validate_commandline_args_with_session_available(&sess);
compiler/rustc_span/src/lib.rs+1-1
......@@ -1362,7 +1362,7 @@ pub trait SpanEncoder: Encoder {
13621362 fn encode_def_id(&mut self, def_id: DefId);
13631363}
13641364
1365impl SpanEncoder for FileEncoder {
1365impl SpanEncoder for FileEncoder<'_> {
13661366 fn encode_span(&mut self, span: Span) {
13671367 let span = span.data();
13681368 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> {
339339 }),
340340 );
341341 self.depth += 1;
342 let res = if free.kind.is_type() {
342 let res: ty::Term<'tcx> = if free.kind.is_type() {
343343 infcx
344344 .tcx
345345 .type_of(free.def_id())
......@@ -356,6 +356,19 @@ impl<'a, 'b, 'tcx> AssocTypeNormalizer<'a, 'b, 'tcx> {
356356 .fold_with(self)
357357 .into()
358358 };
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 }
359372 self.depth -= 1;
360373 res
361374 }
compiler/rustc_trait_selection/src/traits/project.rs+48-1
......@@ -5,6 +5,7 @@ use std::ops::ControlFlow;
55use rustc_data_structures::sso::SsoHashSet;
66use rustc_data_structures::stack::ensure_sufficient_stack;
77use rustc_errors::ErrorGuaranteed;
8use rustc_hir::def_id::DefId;
89use rustc_hir::lang_items::LangItem;
910use rustc_infer::infer::DefineOpaqueTypes;
1011use rustc_infer::infer::resolve::OpportunisticRegionResolver;
......@@ -487,6 +488,30 @@ fn normalize_to_error<'a, 'tcx>(
487488 Normalized { value: new_value, obligations }
488489}
489490
491/// When normalizing a const alias, register a `ConstArgHasType` obligation
492/// to ensure the const value's type matches the declared type.
493fn 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
490515/// Confirm and normalize the given inherent projection.
491516// FIXME(mgca): While this supports constants, it is only used for types by default right now
492517#[instrument(level = "debug", skip(selcx, param_env, cause, obligations))]
......@@ -554,6 +579,17 @@ pub fn normalize_inherent_projection<'a, 'b, 'tcx>(
554579 tcx.const_of_item(alias_term.def_id()).instantiate(tcx, args).skip_norm_wip().into()
555580 };
556581
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
557593 let mut term = selcx.infcx.resolve_vars_if_possible(term);
558594 if term.has_aliases() {
559595 term =
......@@ -2049,7 +2085,18 @@ fn confirm_impl_candidate<'cx, 'tcx>(
20492085 Progress { term: err, obligations: nested }
20502086 } else {
20512087 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 }
20532100 };
20542101 Ok(Projected::Progress(progress))
20552102}
compiler/rustc_traits/src/normalize_projection_ty.rs+39-2
......@@ -2,7 +2,7 @@ use rustc_infer::infer::TyCtxtInferExt;
22use rustc_infer::infer::canonical::{Canonical, QueryResponse};
33use rustc_infer::traits::PredicateObligations;
44use rustc_middle::query::Providers;
5use rustc_middle::ty::{ParamEnvAnd, TyCtxt};
5use rustc_middle::ty::{self, ParamEnvAnd, TyCtxt};
66use rustc_trait_selection::error_reporting::InferCtxtErrorExt;
77use rustc_trait_selection::infer::InferCtxtBuilderExt;
88use rustc_trait_selection::traits::query::normalize::NormalizationResult;
......@@ -19,6 +19,25 @@ pub(crate) fn provide(p: &mut Providers) {
1919 };
2020}
2121
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.
25fn 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
2241fn normalize_canonicalized_projection<'tcx>(
2342 tcx: TyCtxt<'tcx>,
2443 goal: CanonicalAliasGoal<'tcx>,
......@@ -40,6 +59,12 @@ fn normalize_canonicalized_projection<'tcx>(
4059 0,
4160 &mut obligations,
4261 );
62 obligations.extend(const_arg_has_type_obligation(
63 tcx,
64 param_env,
65 normalized_term,
66 goal.into(),
67 ));
4368 ocx.register_obligations(obligations);
4469 // #112047: With projections and opaques, we are able to create opaques that
4570 // are recursive (given some generic parameters of the opaque's type variables).
......@@ -86,11 +111,17 @@ fn normalize_canonicalized_free_alias<'tcx>(
86111 },
87112 );
88113 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() {
90115 tcx.type_of(goal.def_id()).instantiate(tcx, goal.args).skip_norm_wip().into()
91116 } else {
92117 tcx.const_of_item(goal.def_id()).instantiate(tcx, goal.args).skip_norm_wip().into()
93118 };
119 ocx.register_obligations(const_arg_has_type_obligation(
120 tcx,
121 param_env,
122 normalized_term,
123 goal.into(),
124 ));
94125 Ok(NormalizationResult { normalized_term })
95126 },
96127 )
......@@ -116,6 +147,12 @@ fn normalize_canonicalized_inherent_projection<'tcx>(
116147 0,
117148 &mut obligations,
118149 );
150 obligations.extend(const_arg_has_type_obligation(
151 tcx,
152 param_env,
153 normalized_term,
154 goal.into(),
155 ));
119156 ocx.register_obligations(obligations);
120157
121158 Ok(NormalizationResult { normalized_term })
compiler/rustc_ty_utils/src/assoc.rs+2-2
......@@ -88,8 +88,8 @@ fn associated_item_from_trait_item(
8888 let owner_id = trait_item.owner_id;
8989 let name = trait_item.ident.name;
9090 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) }
9393 }
9494 hir::TraitItemKind::Fn { .. } => {
9595 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:
244244 type AdtDef: AdtDef<Self>;
245245 fn adt_def(self, adt_def_id: Self::AdtId) -> Self::AdtDef;
246246
247 fn alias_ty_kind_from_def_id(self, def_id: Self::DefId) -> ty::AliasTyKind<Self>;
248
249247 fn unevaluated_const_kind_from_def_id(
250248 self,
251249 def_id: Self::DefId,
compiler/rustc_type_ir/src/predicate.rs-7
......@@ -429,13 +429,6 @@ impl<I: Interner> ExistentialTraitRef<I> {
429429 /// Therefore, you must specify *some* self type to perform the conversion.
430430 /// A common choice is the trait object type itself or some kind of dummy type.
431431 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
439432 TraitRef::new(interner, self.def_id, [self_ty.into()].into_iter().chain(self.args.iter()))
440433 }
441434}
compiler/rustc_type_ir/src/ty_kind.rs-4
......@@ -65,10 +65,6 @@ pub enum AliasTyKind<I: Interner> {
6565}
6666
6767impl<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
7268 pub fn descr(self) -> &'static str {
7369 match self {
7470 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> {
165165 /// ```
166166 #[stable(feature = "rust1", since = "1.0.0")]
167167 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> {
168201 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()?)),
171204 }
172205 }
173206
......@@ -193,11 +226,44 @@ impl<'a, K: Ord, V, A: Allocator + Clone> Entry<'a, K, V, A> {
193226 #[inline]
194227 #[stable(feature = "or_insert_with_key", since = "1.50.0")]
195228 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> {
196262 match self {
197 Occupied(entry) => entry.into_mut(),
263 Occupied(entry) => Ok(entry.into_mut()),
198264 Vacant(entry) => {
199 let value = default(entry.key());
200 entry.insert(value)
265 let value = default(entry.key())?;
266 Ok(entry.insert(value))
201267 }
202268 }
203269 }
library/alloctests/lib.rs+1
......@@ -51,6 +51,7 @@
5151#![feature(trusted_random_access)]
5252#![feature(try_reserve_kind)]
5353#![feature(try_trait_v2)]
54#![feature(unwrap_infallible)]
5455#![feature(wtf8_internals)]
5556// tidy-alphabetical-end
5657//
library/core/src/any.rs+4-4
......@@ -785,9 +785,8 @@ impl TypeId {
785785 /// ```
786786 #[unstable(feature = "type_info", issue = "146922")]
787787 #[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>(
791790 self,
792791 ) -> Option<TraitImpl<T>> {
793792 // SAFETY: The vtable was obtained for `T`, so it is guaranteed to be `DynMetadata<T>`.
......@@ -812,7 +811,8 @@ impl TypeId {
812811 /// ```
813812 #[unstable(feature = "type_info", issue = "146922")]
814813 #[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(
816816 self,
817817 trait_represented_by_type_id: TypeId,
818818 ) -> Option<TraitImpl<*const ()>> {
library/core/src/char/methods.rs+272-119
......@@ -5,7 +5,6 @@ use crate::panic::const_panic;
55use crate::slice;
66use crate::str::from_utf8_unchecked_mut;
77use crate::ub_checks::assert_unsafe_precondition;
8use crate::unicode::printable::is_printable;
98use crate::unicode::{self, conversions};
109
1110impl char {
......@@ -93,13 +92,18 @@ impl char {
9392 /// The version of [Unicode](https://www.unicode.org/) that the Unicode parts of
9493 /// `char` and `str` methods are based on.
9594 ///
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
100102 ///
101103 /// 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
103107 #[stable(feature = "assoc_char_consts", since = "1.52.0")]
104108 pub const UNICODE_VERSION: (u8, u8, u8) = crate::unicode::UNICODE_VERSION;
105109
......@@ -473,18 +477,30 @@ impl char {
473477 #[inline]
474478 pub(crate) fn escape_debug_ext(self, args: EscapeDebugExtArgs) -> EscapeDebug {
475479 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
481481 '\"' if args.escape_double_quote => EscapeDebug::backslash(ascii::Char::QuotationMark),
482482 '\'' 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 {
484500 EscapeDebug::unicode(self)
485501 }
486 _ if is_printable(self) => EscapeDebug::printable(self),
487 _ => EscapeDebug::unicode(self),
502
503 _ => EscapeDebug::printable(self),
488504 }
489505 }
490506
......@@ -753,11 +769,11 @@ impl char {
753769
754770 /// Returns `true` if this `char` has the `Alphabetic` property.
755771 ///
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`].
758774 ///
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
761777 /// [`DerivedCoreProperties.txt`]: https://www.unicode.org/Public/UCD/latest/ucd/DerivedCoreProperties.txt
762778 ///
763779 /// # Examples
......@@ -786,11 +802,11 @@ impl char {
786802 /// Returns `true` if this `char` has the `Cased` property.
787803 /// A character is cased if and only if it is uppercase, lowercase, or titlecase.
788804 ///
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`].
791807 ///
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
794810 /// [`DerivedCoreProperties.txt`]: https://www.unicode.org/Public/UCD/latest/ucd/DerivedCoreProperties.txt
795811 ///
796812 /// # Examples
......@@ -849,11 +865,11 @@ impl char {
849865
850866 /// Returns `true` if this `char` has the `Lowercase` property.
851867 ///
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`].
854870 ///
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
857873 /// [`DerivedCoreProperties.txt`]: https://www.unicode.org/Public/UCD/latest/ucd/DerivedCoreProperties.txt
858874 ///
859875 /// # Examples
......@@ -889,15 +905,15 @@ impl char {
889905 }
890906 }
891907
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.
893909 /// Conceptually, these characters consist of an uppercase portion followed by a lowercase portion.
894910 ///
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`].
898914 ///
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
901917 /// [`UnicodeData.txt`]: https://www.unicode.org/Public/UCD/latest/ucd/UnicodeData.txt
902918 ///
903919 /// # Examples
......@@ -925,11 +941,11 @@ impl char {
925941
926942 /// Returns `true` if this `char` has the `Uppercase` property.
927943 ///
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`].
930946 ///
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
933949 /// [`DerivedCoreProperties.txt`]: https://www.unicode.org/Public/UCD/latest/ucd/DerivedCoreProperties.txt
934950 ///
935951 /// # Examples
......@@ -965,44 +981,54 @@ impl char {
965981 }
966982 }
967983
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.
969985 ///
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`].
971989 ///
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
9741001 ///
9751002 /// # Examples
9761003 ///
9771004 /// Basic usage:
9781005 ///
9791006 /// ```
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());
9891016 /// ```
9901017 #[must_use]
9911018 #[stable(feature = "rust1", since = "1.0.0")]
992 #[rustc_const_stable(feature = "const_char_classify", since = "1.87.0")]
9931019 #[inline]
994 pub const fn is_whitespace(self) -> bool {
1020 pub fn is_numeric(self) -> bool {
9951021 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),
9991025 }
10001026 }
10011027
10021028 /// Returns `true` if this `char` satisfies either [`is_alphabetic()`] or [`is_numeric()`].
10031029 ///
1004 /// [`is_alphabetic()`]: #method.is_alphabetic
1005 /// [`is_numeric()`]: #method.is_numeric
1030 /// [`is_alphabetic()`]: Self::is_alphabetic
1031 /// [`is_numeric()`]: Self::is_numeric
10061032 ///
10071033 /// # Examples
10081034 ///
......@@ -1029,14 +1055,49 @@ impl char {
10291055 }
10301056 }
10311057
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
10321092 /// Returns `true` if this `char` has the general category for control codes.
10331093 ///
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.
10371098 ///
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
10401101 /// [`UnicodeData.txt`]: https://www.unicode.org/Public/UCD/latest/ucd/UnicodeData.txt
10411102 ///
10421103 /// # Examples
......@@ -1044,8 +1105,9 @@ impl char {
10441105 /// Basic usage:
10451106 ///
10461107 /// ```
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
10491111 /// assert!(!'q'.is_control());
10501112 /// ```
10511113 #[must_use]
......@@ -1060,85 +1122,176 @@ impl char {
10601122 matches!(self, '\0'..='\x1f' | '\x7f'..='\u{9f}')
10611123 }
10621124
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.
10641128 ///
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
10681140 ///
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
10721141 #[must_use]
10731142 #[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}')
10761149 }
10771150
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.
10811152 ///
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`].
10851156 ///
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 /// ```
10901173 #[must_use]
10911174 #[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)
10991177 }
11001178
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`].
11021181 ///
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
11061183 ///
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.
11111186 ///
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
11141188 ///
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
11171199 /// [`UnicodeData.txt`]: https://www.unicode.org/Public/UCD/latest/ucd/UnicodeData.txt
11181200 ///
11191201 /// # Examples
11201202 ///
11211203 /// Basic usage:
11221204 ///
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
11331212 /// ```
11341213 #[must_use]
1135 #[stable(feature = "rust1", since = "1.0.0")]
11361214 #[inline]
1137 pub fn is_numeric(self) -> bool {
1215 fn is_unassigned(self) -> bool {
11381216 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)
11421295 }
11431296 }
11441297
......@@ -2270,8 +2423,8 @@ impl char {
22702423}
22712424
22722425pub(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,
22752428
22762429 /// Escape single quotes?
22772430 pub(crate) escape_single_quote: bool,
......@@ -2282,7 +2435,7 @@ pub(crate) struct EscapeDebugExtArgs {
22822435
22832436impl EscapeDebugExtArgs {
22842437 pub(crate) const ESCAPE_ALL: Self = Self {
2285 escape_grapheme_extended: true,
2438 escape_grapheme_extender: true,
22862439 escape_single_quote: true,
22872440 escape_double_quote: true,
22882441 };
library/core/src/fmt/mod.rs+2-2
......@@ -2941,7 +2941,7 @@ impl Debug for str {
29412941 let mut chars = rest.chars();
29422942 if let Some(c) = chars.next() {
29432943 let esc = c.escape_debug_ext(EscapeDebugExtArgs {
2944 escape_grapheme_extended: true,
2944 escape_grapheme_extender: true,
29452945 escape_single_quote: false,
29462946 escape_double_quote: true,
29472947 });
......@@ -2973,7 +2973,7 @@ impl Debug for char {
29732973 fn fmt(&self, f: &mut Formatter<'_>) -> Result {
29742974 f.write_char('\'')?;
29752975 let esc = self.escape_debug_ext(EscapeDebugExtArgs {
2976 escape_grapheme_extended: true,
2976 escape_grapheme_extender: true,
29772977 escape_single_quote: true,
29782978 escape_double_quote: false,
29792979 });
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;
28742874pub const unsafe fn align_of_val<T: ?Sized>(ptr: *const T) -> usize;
28752875
28762876#[rustc_intrinsic]
2877#[rustc_comptime]
28772878#[unstable(feature = "core_intrinsics", issue = "none")]
28782879/// Check if a type represented by a `TypeId` implements a trait represented by a `TypeId`.
28792880/// It can only be called at compile time, the backends do
28802881/// not implement it. If it implements the trait the dyn metadata gets returned for vtable access.
2881pub const fn type_id_vtable(
2882pub fn type_id_vtable(
28822883 _id: crate::any::TypeId,
28832884 _trait: crate::any::TypeId,
28842885) -> Option<ptr::DynMetadata<*const ()>> {
......@@ -2922,7 +2923,8 @@ pub const fn type_name<T: ?Sized>() -> &'static str;
29222923#[rustc_nounwind]
29232924#[unstable(feature = "core_intrinsics", issue = "none")]
29242925#[rustc_intrinsic]
2925pub const fn type_id<T: ?Sized>() -> crate::any::TypeId;
2926#[rustc_comptime]
2927pub fn type_id<T: ?Sized>() -> crate::any::TypeId;
29262928
29272929/// Tests (at compile-time) if two [`crate::any::TypeId`] instances identify the
29282930/// 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 {
29442946/// The more user-friendly version of this intrinsic is [`core::any::TypeId::size`].
29452947#[rustc_intrinsic]
29462948#[unstable(feature = "core_intrinsics", issue = "none")]
2947pub const fn size_of_type_id(_id: crate::any::TypeId) -> Option<usize> {
2949#[rustc_comptime]
2950pub fn size_of_type_id(_id: crate::any::TypeId) -> Option<usize> {
29482951 panic!("`TypeId::size` can only be called at compile-time")
29492952}
29502953
......@@ -2953,7 +2956,8 @@ pub const fn size_of_type_id(_id: crate::any::TypeId) -> Option<usize> {
29532956/// The more user-friendly version of this intrinsic is [`core::any::TypeId::variants`].
29542957#[rustc_intrinsic]
29552958#[unstable(feature = "core_intrinsics", issue = "none")]
2956pub const fn type_id_variants(_id: crate::any::TypeId) -> usize {
2959#[rustc_comptime]
2960pub fn type_id_variants(_id: crate::any::TypeId) -> usize {
29572961 panic!("`TypeId::variants` can only be called at compile-time")
29582962}
29592963
......@@ -2962,7 +2966,8 @@ pub const fn type_id_variants(_id: crate::any::TypeId) -> usize {
29622966/// The more user-friendly version of this intrinsic is [`core::any::TypeId::fields`].
29632967#[rustc_intrinsic]
29642968#[unstable(feature = "core_intrinsics", issue = "none")]
2965pub const fn type_id_fields(_id: crate::any::TypeId, _variant_index: usize) -> usize {
2969#[rustc_comptime]
2970pub fn type_id_fields(_id: crate::any::TypeId, _variant_index: usize) -> usize {
29662971 panic!("`TypeId::fields` can only be called at compile-time")
29672972}
29682973
......@@ -2973,7 +2978,8 @@ pub const fn type_id_fields(_id: crate::any::TypeId, _variant_index: usize) -> u
29732978/// [`FieldRepresentingType`]: crate::field::FieldRepresentingType
29742979#[rustc_intrinsic]
29752980#[unstable(feature = "core_intrinsics", issue = "none")]
2976pub const fn type_id_field_representing_type(
2981#[rustc_comptime]
2982pub fn type_id_field_representing_type(
29772983 _id: crate::any::TypeId,
29782984 _variant_index: usize,
29792985 _field_index: usize,
......@@ -2988,7 +2994,8 @@ pub const fn type_id_field_representing_type(
29882994/// [`FieldRepresentingType`]: crate::field::FieldRepresentingType
29892995#[rustc_intrinsic]
29902996#[unstable(feature = "core_intrinsics", issue = "none")]
2991pub const fn field_representing_type_actual_type_id(
2997#[rustc_comptime]
2998pub fn field_representing_type_actual_type_id(
29922999 _frt_type_id: crate::any::TypeId,
29933000) -> crate::any::TypeId {
29943001 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 {
374374 /// ```
375375 #[unstable(feature = "type_info", issue = "146922")]
376376 #[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> {
378379 intrinsics::size_of_type_id(self)
379380 }
380381
......@@ -399,7 +400,8 @@ impl TypeId {
399400 /// ```
400401 #[unstable(feature = "type_info", issue = "146922")]
401402 #[rustc_const_unstable(feature = "type_info", issue = "146922")]
402 pub const fn variants(self) -> usize {
403 #[rustc_comptime]
404 pub fn variants(self) -> usize {
403405 intrinsics::type_id_variants(self)
404406 }
405407
......@@ -461,7 +463,8 @@ impl TypeId {
461463 /// ```
462464 #[unstable(feature = "type_info", issue = "146922")]
463465 #[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 {
465468 intrinsics::type_id_fields(self, variant_index)
466469 }
467470
......@@ -527,7 +530,8 @@ impl TypeId {
527530 /// ```
528531 #[unstable(feature = "type_info", issue = "146922")]
529532 #[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 {
531535 FieldId {
532536 frt_type_id: intrinsics::type_id_field_representing_type(
533537 self,
......@@ -571,7 +575,8 @@ impl FieldId {
571575 /// ```
572576 #[unstable(feature = "type_info", issue = "146922")]
573577 #[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 {
575580 intrinsics::field_representing_type_actual_type_id(self.frt_type_id)
576581 }
577582}
library/core/src/range.rs+8-12
......@@ -20,9 +20,11 @@ use crate::hash::Hash;
2020
2121mod iter;
2222
23#[unstable(feature = "new_range_api_legacy", issue = "125687")]
23#[stable(feature = "new_range_api_legacy", since = "CURRENT_RUSTC_VERSION")]
2424pub mod legacy;
2525
26use core::ops::Bound::{self, Excluded, Included, Unbounded};
27
2628#[doc(inline)]
2729#[stable(feature = "new_range_from_api", since = "1.96.0")]
2830pub use iter::RangeFromIter;
......@@ -33,19 +35,13 @@ pub use iter::RangeInclusiveIter;
3335#[stable(feature = "new_range_api", since = "1.96.0")]
3436pub use iter::RangeIter;
3537
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};
4638use crate::iter::Step;
47use 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.
4841use crate::ops::{IntoBounds, OneSidedRange, OneSidedRangeBound, RangeBounds};
42#[doc(inline)]
43#[stable(feature = "new_range_api_exports", since = "CURRENT_RUSTC_VERSION")]
44pub use crate::ops::{RangeFull, RangeTo};
4945
5046/// A (half-open) range bounded inclusively below and exclusively above.
5147///
library/core/src/range/legacy.rs+1
......@@ -7,4 +7,5 @@
77//! The types here are equivalent to those in [`core::ops`].
88
99#[doc(inline)]
10#[stable(feature = "new_range_api_legacy", since = "CURRENT_RUSTC_VERSION")]
1011pub use crate::ops::{Range, RangeFrom, RangeInclusive, RangeToInclusive};
library/core/src/str/lossy.rs+1-1
......@@ -123,7 +123,7 @@ impl fmt::Debug for Debug<'_> {
123123 let mut from = 0;
124124 for (i, c) in valid.char_indices() {
125125 let esc = c.escape_debug_ext(EscapeDebugExtArgs {
126 escape_grapheme_extended: true,
126 escape_grapheme_extender: true,
127127 escape_single_quote: false,
128128 escape_double_quote: true,
129129 });
library/core/src/str/mod.rs+1-1
......@@ -3266,7 +3266,7 @@ impl_fn_for_zst! {
32663266 #[derive(Clone)]
32673267 struct CharEscapeDebugContinue impl Fn = |c: char| -> char::EscapeDebug {
32683268 c.escape_debug_ext(EscapeDebugExtArgs {
3269 escape_grapheme_extended: false,
3269 escape_grapheme_extender: false,
32703270 escape_single_quote: true,
32713271 escape_double_quote: true
32723272 })
library/core/src/unicode/mod.rs+10-4
......@@ -9,6 +9,9 @@ pub use unicode_data::conversions;
99#[rustfmt::skip]
1010pub(crate) use unicode_data::alphabetic::lookup as Alphabetic;
1111pub(crate) use unicode_data::case_ignorable::lookup as Case_Ignorable;
12pub(crate) use unicode_data::cf::lookup as Cf;
13pub(crate) use unicode_data::cn_planes_0_3::lookup as Cn_planes_0_3;
14pub(crate) use unicode_data::default_ignorable_code_point::lookup as Default_Ignorable_Code_Point;
1215pub(crate) use unicode_data::grapheme_extend::lookup as Grapheme_Extend;
1316pub(crate) use unicode_data::lowercase::lookup as Lowercase;
1417pub(crate) use unicode_data::lt::lookup as Lt;
......@@ -16,8 +19,6 @@ pub(crate) use unicode_data::n::lookup as N;
1619pub(crate) use unicode_data::uppercase::lookup as Uppercase;
1720pub(crate) use unicode_data::white_space::lookup as White_Space;
1821
19pub(crate) mod printable;
20
2122#[allow(unreachable_pub)]
2223pub mod unicode_data;
2324
......@@ -27,8 +28,13 @@ pub mod unicode_data;
2728/// New versions of Unicode are released regularly and subsequently all methods
2829/// in the standard library depending on Unicode are updated. Therefore the
2930/// 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
3135///
3236/// 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
3440pub 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
7from collections import namedtuple
8import csv
9import os
10import subprocess
11
12NUM_CODEPOINTS = 0x110000
13
14
15def 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
28def 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
36def 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
44Codepoint = namedtuple("Codepoint", "value class_")
45
46
47def 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
77def 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
94def 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
123def 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
138def 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
146def 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
190fn 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
225pub(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
257if __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
4fn 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
39pub(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]
86const 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]
127const 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]
166const 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]
215const 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]
245const 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]
379const 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 @@
11//! 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
1518
1619#[inline(always)]
1720const fn bitset_search<
......@@ -338,6 +341,193 @@ pub mod case_ignorable {
338341 }
339342}
340343
344#[rustfmt::skip]
345pub 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]
383pub 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]
494pub 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
341531#[rustfmt::skip]
342532pub mod grapheme_extend {
343533 use super::ShortOffsetRunHeader;
library/core/src/wtf8.rs+1-1
......@@ -147,7 +147,7 @@ impl fmt::Debug for Wtf8 {
147147 use crate::fmt::Write as _;
148148 for c in s.chars().flat_map(|c| {
149149 c.escape_debug_ext(EscapeDebugExtArgs {
150 escape_grapheme_extended: true,
150 escape_grapheme_extender: true,
151151 escape_single_quote: false,
152152 escape_double_quote: true,
153153 })
library/coretests/tests/unicode.rs+26-4
......@@ -1,3 +1,4 @@
1use core::iter::Step;
12use core::unicode::unicode_data;
23use std::ops::RangeInclusive;
34
......@@ -19,7 +20,7 @@ fn test_boolean_property(ranges: &[RangeInclusive<char>], lookup: fn(char) -> bo
1920 for c in range.clone() {
2021 assert!(lookup(c), "{c:?}");
2122 }
22 start = char::from_u32(*range.end() as u32 + 1).unwrap();
23 start = Step::forward(*range.end(), 1);
2324 }
2425 for c in start..=char::MAX {
2526 assert!(!lookup(c), "{c:?}");
......@@ -60,9 +61,23 @@ fn case_ignorable() {
6061
6162#[test]
6263#[cfg_attr(miri, ignore)] // Miri is too slow
63fn lt() {
64 test_boolean_property(test_data::LT, unicode_data::lt::lookup);
65 test_boolean_property(test_data::LT, char::is_titlecase);
64fn 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
70fn 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
76fn default_ignorable_code_point() {
77 test_boolean_property(
78 test_data::DEFAULT_IGNORABLE_CODE_POINT,
79 unicode_data::default_ignorable_code_point::lookup,
80 );
6681}
6782
6883#[test]
......@@ -78,6 +93,13 @@ fn lowercase() {
7893 test_boolean_property(test_data::LOWERCASE, char::is_lowercase);
7994}
8095
96#[test]
97#[cfg_attr(miri, ignore)] // Miri is too slow
98fn lt() {
99 test_boolean_property(test_data::LT, unicode_data::lt::lookup);
100 test_boolean_property(test_data::LT, char::is_titlecase);
101}
102
81103#[test]
82104#[cfg_attr(miri, ignore)] // Miri is too slow
83105fn n() {
library/coretests/tests/unicode/test_data.rs+256
......@@ -392,6 +392,262 @@ pub(super) static CASE_IGNORABLE: &[RangeInclusive<char>; 459] = &[
392392 '\u{e0100}'..='\u{e01ef}',
393393];
394394
395#[rustfmt::skip]
396pub(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]
407pub(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]
642pub(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
395651#[rustfmt::skip]
396652pub(super) static GRAPHEME_EXTEND: &[RangeInclusive<char>; 383] = &[
397653 '\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> {
25382538 #[inline]
25392539 #[stable(feature = "rust1", since = "1.0.0")]
25402540 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> {
25412574 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()?)),
25442577 }
25452578 }
25462579
......@@ -2565,11 +2598,44 @@ impl<'a, K, V, A: Allocator> Entry<'a, K, V, A> {
25652598 #[inline]
25662599 #[stable(feature = "or_insert_with_key", since = "1.50.0")]
25672600 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> {
25682634 match self {
2569 Occupied(entry) => entry.into_mut(),
2635 Occupied(entry) => Ok(entry.into_mut()),
25702636 Vacant(entry) => {
2571 let value = default(entry.key());
2572 entry.insert(value)
2637 let value = default(entry.key())?;
2638 Ok(entry.insert(value))
25732639 }
25742640 }
25752641 }
library/std/src/env.rs+6
......@@ -101,6 +101,12 @@ pub struct VarsOs {
101101 inner: env_imp::Env,
102102}
103103
104#[stable(feature = "env_vars_unimpl_send_sync", since = "CURRENT_RUSTC_VERSION")]
105impl !Send for VarsOs {}
106
107#[stable(feature = "env_vars_unimpl_send_sync", since = "CURRENT_RUSTC_VERSION")]
108impl !Sync for VarsOs {}
109
104110/// Returns an iterator of (variable, value) pairs of strings, for all the
105111/// environment variables of the current process.
106112///
library/std/src/lib.rs+1
......@@ -313,6 +313,7 @@
313313#![feature(try_blocks)]
314314#![feature(try_trait_v2)]
315315#![feature(type_alias_impl_trait)]
316#![feature(unwrap_infallible)]
316317// tidy-alphabetical-end
317318//
318319// Library features (core):
library/std/src/sys/env/common.rs-3
......@@ -17,9 +17,6 @@ impl fmt::Debug for Env {
1717 }
1818}
1919
20impl !Send for Env {}
21impl !Sync for Env {}
22
2320impl Iterator for Env {
2421 type Item = (OsString, OsString);
2522 fn next(&mut self) -> Option<(OsString, OsString)> {
library/std/src/sys/pal/windows/c/bindings.txt+3
......@@ -2154,6 +2154,8 @@ GENERIC_ALL
21542154GENERIC_EXECUTE
21552155GENERIC_READ
21562156GENERIC_WRITE
2157GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS
2158GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT
21572159GetActiveProcessorCount
21582160getaddrinfo
21592161GetCommandLineW
......@@ -2178,6 +2180,7 @@ GetFullPathNameW
21782180GetLastError
21792181GetModuleFileNameW
21802182GetModuleHandleA
2183GetModuleHandleExW
21812184GetModuleHandleW
21822185GetOverlappedResult
21832186getpeername
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
5656windows_link::link!("kernel32.dll" "system" fn GetLastError() -> WIN32_ERROR);
5757windows_link::link!("kernel32.dll" "system" fn GetModuleFileNameW(hmodule : HMODULE, lpfilename : PWSTR, nsize : u32) -> u32);
5858windows_link::link!("kernel32.dll" "system" fn GetModuleHandleA(lpmodulename : PCSTR) -> HMODULE);
59windows_link::link!("kernel32.dll" "system" fn GetModuleHandleExW(dwflags : u32, lpmodulename : PCWSTR, phmodule : *mut HMODULE) -> BOOL);
5960windows_link::link!("kernel32.dll" "system" fn GetModuleHandleW(lpmodulename : PCWSTR) -> HMODULE);
6061windows_link::link!("kernel32.dll" "system" fn GetOverlappedResult(hfile : HANDLE, lpoverlapped : *const OVERLAPPED, lpnumberofbytestransferred : *mut u32, bwait : BOOL) -> BOOL);
6162windows_link::link!("kernel32.dll" "system" fn GetProcAddress(hmodule : HMODULE, lpprocname : PCSTR) -> FARPROC);
......@@ -2716,6 +2717,8 @@ pub const GENERIC_EXECUTE: GENERIC_ACCESS_RIGHTS = 536870912u32;
27162717pub const GENERIC_READ: GENERIC_ACCESS_RIGHTS = 2147483648u32;
27172718pub const GENERIC_WRITE: GENERIC_ACCESS_RIGHTS = 1073741824u32;
27182719pub type GETFINALPATHNAMEBYHANDLE_FLAGS = u32;
2720pub const GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS: u32 = 4u32;
2721pub const GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT: u32 = 2u32;
27192722#[repr(C)]
27202723#[derive(Clone, Copy)]
27212724pub struct GUID {
library/std/src/sys/thread_local/guard/windows.rs+47-3
......@@ -159,9 +159,11 @@ pub fn enable() {
159159 //
160160 // Miri has no DLL unloading so we can skip this step here.
161161 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 }
165167 }
166168 }
167169
......@@ -179,6 +181,48 @@ pub fn enable() {
179181 }
180182}
181183
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.
195fn 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
182226extern "C" fn free_fls_key_at_exit() {
183227 // The main purpose of this hook is to free the FLS slot during DLL unload.
184228 // 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;
104104/// If a process loads a Rust `cdylib`, it must not cause the Rust TLS destructor support
105105// to be initialized for the first time during process shutdown.
106106///
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.
109109///
110110/// [converted into a fiber]: https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-convertthreadtofiber
111111/// [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};
137137/// if available, which is the case for all [tier 1] platforms.
138138/// In practice such guarantees are – under rare circumstances – broken by hardware, virtualization
139139/// 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.
143143///
144144/// This workaround obscures programming errors where earlier and later instants are accidentally
145145/// swapped. For this reason future Rust versions may reintroduce panics.
license-metadata.json+22-10
......@@ -3,6 +3,28 @@
33 "children": [
44 {
55 "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 },
628 {
729 "children": [
830 {
......@@ -178,16 +200,6 @@
178200 "name": "library/backtrace",
179201 "type": "directory"
180202 },
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 },
191203 {
192204 "children": [],
193205 "license": {
package.json+1-1
......@@ -1,6 +1,6 @@
11{
22 "dependencies": {
3 "browser-ui-test": "^0.23.5",
3 "browser-ui-test": "^0.24.0",
44 "es-check": "^9.4.4",
55 "eslint": "^8.57.1",
66 "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
3636COPY host-x86_64/pr-check-1/check-default-config-profiles.sh /scripts/
3737COPY host-x86_64/pr-check-1/validate-toolstate.sh /scripts/
3838
39ENV PUPPETEER_SKIP_DOWNLOAD 1
40
3941# Check library crates on all tier 1 targets.
4042# We disable optimized compiler built-ins because that requires a C toolchain for the target.
4143# 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 \
2424 mingw-w64 \
2525 && rm -rf /var/lib/apt/lists/*
2626
27ENV PUPPETEER_SKIP_DOWNLOAD 1
28
2729COPY scripts/nodejs.sh /scripts/
2830RUN sh /scripts/nodejs.sh /node
2931ENV 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 \
5656 lsb-release \
5757 xdg-utils \
5858 wget \
59 unzip \
5960 # libgccjit dependencies
6061 flex \
6162 libmpfr-dev \
......@@ -72,6 +73,16 @@ ENV GCC_EXEC_PREFIX="/usr/lib/gcc/"
7273
7374COPY host-x86_64/x86_64-gnu-tools/checktools.sh /tmp/
7475
76# The version used by current `browser-ui-test` version. To be removed once `yarn` can download
77# it without failing...
78RUN curl https://ci-mirrors.rust-lang.org/rustc/chrome-linux64.zip > chrome-linux64.zip
79RUN unzip -d /usr/bin/ chrome-linux64.zip && rm chrome-linux64.zip
80
81# We already downloaded chromium so no need to download it again.
82ENV PUPPETEER_SKIP_DOWNLOAD 1
83# We provide the path to the extracted chrome binary.
84ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chrome-linux64/chrome
85
7586COPY scripts/nodejs.sh /scripts/
7687RUN sh /scripts/nodejs.sh /node
7788ENV PATH="/node/bin:${PATH}"
src/ci/docker/scripts/nodejs.sh+1-1
......@@ -2,7 +2,7 @@
22
33set -ex
44
5NODEJS_VERSION=v20.12.2
5NODEJS_VERSION=v24.15.0
66YARN_VERSION=1.22.22
77INSTALL_PATH=${1:-/node}
88
src/doc/rustc/src/platform-support.md+21-17
......@@ -352,23 +352,23 @@ target | std | host | notes
352352[`loongarch32-unknown-none-softfloat`](platform-support/loongarch-none.md) | * | | LoongArch32 Bare-metal (ILP32S ABI)
353353[`m68k-unknown-linux-gnu`](platform-support/m68k-unknown-linux-gnu.md) | ? | | Motorola 680x0 Linux
354354[`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]
372372[`mipsisa32r6-unknown-linux-gnu`](platform-support/mips-release-6.md) | ? | | 32-bit MIPS Release 6 Big Endian
373373[`mipsisa32r6el-unknown-linux-gnu`](platform-support/mips-release-6.md) | ? | | 32-bit MIPS Release 6 Little Endian
374374[`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
472472
473473[runs on NVIDIA GPUs]: https://github.com/japaric-archived/nvptx#targets
474474[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
12711271 let local_did = trait_item.owner_id.to_def_id();
12721272 cx.with_param_env(local_did, |cx| {
12731273 let inner = match trait_item.kind {
1274 hir::TraitItemKind::Const(ty, Some(default), _) => {
1274 hir::TraitItemKind::Const(ty, Some(default)) => {
12751275 ProvidedAssocConstItem(Box::new(Constant {
12761276 generics: enter_impl_trait(cx, |cx| clean_generics(trait_item.generics, cx)),
12771277 kind: clean_const_item_rhs(default, local_did),
12781278 type_: clean_ty(ty, cx),
12791279 }))
12801280 }
1281 hir::TraitItemKind::Const(ty, None, _) => {
1281 hir::TraitItemKind::Const(ty, None) => {
12821282 let generics = enter_impl_trait(cx, |cx| clean_generics(trait_item.generics, cx));
12831283 RequiredAssocConstItem(generics, Box::new(clean_ty(ty, cx)))
12841284 }
src/tools/clippy/clippy_lints/src/non_copy_const.rs+2-2
......@@ -757,7 +757,7 @@ impl<'tcx> LateLintPass<'tcx> for NonCopyConst<'tcx> {
757757 }
758758
759759 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
761761 && let ty = cx.tcx.type_of(item.owner_id).instantiate_identity().skip_norm_wip()
762762 && match self.is_ty_freeze(cx.tcx, cx.typing_env(), ty) {
763763 IsFreeze::No => true,
......@@ -958,7 +958,7 @@ fn get_const_hir_value<'tcx>(
958958 {
959959 match tcx.hir_node(tcx.local_def_id_to_hir_id(did)) {
960960 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),
962962 _ => return None,
963963 }
964964 },
src/tools/clippy/clippy_lints/src/types/mod.rs+1-1
......@@ -514,7 +514,7 @@ impl<'tcx> LateLintPass<'tcx> for Types {
514514 };
515515
516516 match item.kind {
517 TraitItemKind::Const(ty, _, _) | TraitItemKind::Type(_, Some(ty)) => {
517 TraitItemKind::Const(ty, _) | TraitItemKind::Type(_, Some(ty)) => {
518518 self.check_ty(cx, ty, context);
519519 },
520520 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>(
10501050 #[cfg(debug_assertions)]
10511051 assert_generic_args_match(tcx, assoc_item.def_id, args);
10521052
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))
10581060 }
10591061 helper(
10601062 tcx,
src/tools/compiletest/src/runtest.rs+22-5
......@@ -2304,6 +2304,23 @@ impl<'test> TestCx<'test> {
23042304 self.props.compile_flags.iter().any(|s| s.contains("--color=always"))
23052305 }
23062306
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
23072324 fn load_compare_outputs(
23082325 &self,
23092326 proc_res: &ProcRes,
......@@ -2719,10 +2736,8 @@ impl<'test> TestCx<'test> {
27192736 (&tmp.0, &tmp.1)
27202737 }
27212738 } 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);
27262741 actual_lines.sort_unstable();
27272742 expected_lines.sort_unstable();
27282743 if actual_lines == expected_lines {
......@@ -2866,7 +2881,9 @@ impl<'test> TestCx<'test> {
28662881 }
28672882
28682883 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));
28702887 }
28712888 }
28722889
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
105105 output
106106}
107107
108pub(crate) fn diff_by_lines(expected: &str, actual: &str) -> String {
108pub(crate) fn diff_by_lines(expected: &[String], actual: &[String]) -> String {
109109 use std::collections::HashMap;
110110 use std::fmt::Write;
111111 let mut output = String::new();
112112 let mut expected_counts: HashMap<&str, usize> = HashMap::new();
113113 let mut actual_counts: HashMap<&str, usize> = HashMap::new();
114114
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;
118117 }
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;
121120 }
122121
123122 fn write_expected_only_lines(
src/tools/unicode-table-generator/src/main.rs+40-8
......@@ -71,7 +71,7 @@
7171//! index of that offset is utilized as the answer to whether we're in the set
7272//! or not.
7373
74use std::collections::BTreeMap;
74use std::collections::{BTreeMap, BTreeSet};
7575use std::fmt::Write;
7676use std::ops::Range;
7777
......@@ -89,14 +89,19 @@ use fmt_helpers::CharEscape;
8989use raw_emitter::{RawEmitter, emit_codepoints, emit_whitespace};
9090
9191static PROPERTIES: &[&str] = &[
92 // tidy-alphabetical-start
9293 "Alphabetic",
93 "Lowercase",
94 "Uppercase",
9594 "Case_Ignorable",
95 "Cf",
96 "Cn_Planes_0_3",
97 "Default_Ignorable_Code_Point",
9698 "Grapheme_Extend",
97 "White_Space",
98 "N",
99 "Lowercase",
99100 "Lt",
101 "N",
102 "Uppercase",
103 "White_Space",
104 // tidy-alphabetical-end
100105];
101106
102107struct UnicodeData {
......@@ -142,6 +147,9 @@ fn load_data() -> UnicodeData {
142147 }
143148 }
144149
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();
145153 let [mut to_lower, mut to_upper, mut to_title, mut to_casefold] =
146154 [const { BTreeMap::new() }; 4];
147155 for row in ucd_parse::UnicodeDataExpander::new(
......@@ -152,6 +160,11 @@ fn load_data() -> UnicodeData {
152160 } else {
153161 row.general_category.as_str()
154162 };
163
164 if !matches!(general_category, "Cs" | "Cn") {
165 assigned_chars.insert(row.codepoint.value());
166 }
167
155168 if let Some(name) = PROPERTIES.iter().find(|prop| **prop == general_category) {
156169 properties
157170 .entry(*name)
......@@ -176,6 +189,25 @@ fn load_data() -> UnicodeData {
176189 }
177190 }
178191
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
179211 for row in ucd_parse::parse::<_, ucd_parse::SpecialCaseMapping>(&UNICODE_DIRECTORY).unwrap() {
180212 if !row.conditions.is_empty() {
181213 // Skip conditional case mappings
......@@ -324,7 +356,7 @@ fn main() {
324356
325357 modules.push((property.to_lowercase().to_string(), emitter.file));
326358 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",
328360 property,
329361 emitter.bytes_used,
330362 datapoints,
......@@ -339,10 +371,10 @@ fn main() {
339371 for (name, (desc, size)) in
340372 ["to_lower", "to_upper", "to_title", "to_casefold"].iter().zip(sizes)
341373 {
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,));
343375 total_bytes += size;
344376 }
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));
346378
347379 // Include the range search function
348380 table_file.push('\n');
tests/run-make/dynamic-loading-cdylib/load_and_unload.rs+12-2
......@@ -88,6 +88,9 @@ mod libloading {
8888type ExternFn = unsafe extern "C" fn(u32, u32) -> u32;
8989
9090fn 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
9194 let foo = libloading::load("foo").expect("Failed to load library");
9295 println!("loaded library");
9396
......@@ -110,6 +113,13 @@ fn main() {
110113 .expect("Thread panicked");
111114 println!("thread joined");
112115
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 }
115125}
tests/run-make/dynamic-loading-cdylib/output_load_only_unix.txt created+12
......@@ -0,0 +1,12 @@
1loaded library
2extern_fn_1
3result of extern_fn_1(2, 3): 5
4extern_fn_2(2, 3)
5result of extern_fn_2(2, 3): 6
6spawning thread
7extern_fn_2(4, 5)
8result of extern_fn_2(4, 5) in other thread: 20
9dropping, last result: 20
10thread joined
11dropping library handle without unloading
12dropping, last result: 6
tests/run-make/dynamic-loading-cdylib/output_load_only_windows.txt created+12
......@@ -0,0 +1,12 @@
1loaded library
2extern_fn_1
3result of extern_fn_1(2, 3): 5
4extern_fn_2(2, 3)
5result of extern_fn_2(2, 3): 6
6spawning thread
7extern_fn_2(4, 5)
8result of extern_fn_2(4, 5) in other thread: 20
9dropping, last result: 20
10thread joined
11dropping library handle without unloading
12dropping, last result: 6
tests/run-make/dynamic-loading-cdylib/output_unix.txt deleted-12
......@@ -1,12 +0,0 @@
1loaded library
2extern_fn_1
3result of extern_fn_1(2, 3): 5
4extern_fn_2(2, 3)
5result of extern_fn_2(2, 3): 6
6spawning thread
7extern_fn_2(4, 5)
8result of extern_fn_2(4, 5) in other thread: 20
9dropping, last result: 20
10thread joined
11unloaded library
12dropping, last result: 6
tests/run-make/dynamic-loading-cdylib/output_unload_unix.txt created+13
......@@ -0,0 +1,13 @@
1loaded library
2extern_fn_1
3result of extern_fn_1(2, 3): 5
4extern_fn_2(2, 3)
5result of extern_fn_2(2, 3): 6
6spawning thread
7extern_fn_2(4, 5)
8result of extern_fn_2(4, 5) in other thread: 20
9dropping, last result: 20
10thread joined
11unloading library
12unloaded library
13dropping, last result: 6
tests/run-make/dynamic-loading-cdylib/output_unload_windows.txt created+13
......@@ -0,0 +1,13 @@
1loaded library
2extern_fn_1
3result of extern_fn_1(2, 3): 5
4extern_fn_2(2, 3)
5result of extern_fn_2(2, 3): 6
6spawning thread
7extern_fn_2(4, 5)
8result of extern_fn_2(4, 5) in other thread: 20
9dropping, last result: 20
10thread joined
11unloading library
12dropping, last result: 6
13unloaded library
tests/run-make/dynamic-loading-cdylib/output_windows.txt deleted-12
......@@ -1,12 +0,0 @@
1loaded library
2extern_fn_1
3result of extern_fn_1(2, 3): 5
4extern_fn_2(2, 3)
5result of extern_fn_2(2, 3): 6
6spawning thread
7extern_fn_2(4, 5)
8result of extern_fn_2(4, 5) in other thread: 20
9dropping, last result: 20
10thread joined
11dropping, last result: 6
12unloaded library
tests/run-make/dynamic-loading-cdylib/rmake.rs+13-11
......@@ -7,23 +7,25 @@
77
88//@ ignore-cross-compile
99
10use run_make_support::{diff, run, rustc};
10use run_make_support::{diff, run_with_args, rustc};
1111
1212fn main() {
1313 rustc().input("foo.rs").run();
1414
1515 rustc().crate_type("bin").crate_name("load_and_unload_bin").input("load_and_unload.rs").run();
1616
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();
1819
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);
2324
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 }
2931}
tests/ui/abi/simd-abi-checks-avx.rs+1-1
......@@ -1,7 +1,7 @@
11//@ only-x86_64
22//@ build-fail
33//@ compile-flags: -C target-feature=-avx
4//@ ignore-parallel-frontend post-monomorphization errors
4
55#![feature(portable_simd)]
66#![feature(simd_ffi)]
77#![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"]
11pub trait PointeeSized {}
12
13#[lang = "meta_sized"]
14pub trait MetaSized: PointeeSized {}
15
16#[lang = "sized"]
17pub trait Sized: MetaSized {}
18
19#[lang = "legacy_receiver"]
20pub trait LegacyReceiver {}
21
22impl<T: PointeeSized> LegacyReceiver for &T {}
23impl<T: PointeeSized> LegacyReceiver for &mut T {}
24
25#[lang = "copy"]
26pub trait Copy {}
27
28impl Copy for *mut () {}
29
30#[lang = "drop"]
31pub trait Drop {
32 fn drop(&mut self);
33}
34
35unsafe extern "C" {
36 fn free(_: *mut ());
37}
38
39unsafe fn transmute<T, U>(_: T) -> U {
40 loop {}
41}
42
43#[repr(transparent)]
44pub struct NonNull<T: ?Sized>(pub *const T);
45
46#[lang = "owned_box"]
47pub struct Box<T: ?Sized, A = ()>(NonNull<T>, A);
48
49impl<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 @@
1error[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 |
4LL | 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
7error: aborting due to 1 previous error
8
9For 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
18pub struct Foo;
19
20pub fn in_fn<F: Fn() -> Result<(), ()>>(f: F) -> Result<(), ()> {
21 f()
22}
23
24pub 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.
29pub 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.
39pub 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 @@
1error[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 |
4LL | 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
8LL | in_fn(|| {
9 | -- captured by this `Fn` closure
10LL | for _ in foos {
11 | ^^^^
12 | |
13 | `foos` moved due to this implicit call to `.into_iter()`
14 | `foos` is moved here
15 |
16help: `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 |
19LL | pub fn in_fn<F: Fn() -> Result<(), ()>>(f: F) -> Result<(), ()> {
20 | ^^^^^^^^^^^^^^^^^^^^^^
21note: `into_iter` takes ownership of the receiver `self`, which moves `foos`
22 --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
23
24error[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 |
27LL | 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
31LL | in_fn_mut(|| {
32 | -- captured by this `FnMut` closure
33LL | for _ in foos {
34 | ^^^^
35 | |
36 | `foos` moved due to this implicit call to `.into_iter()`
37 | `foos` is moved here
38 |
39help: `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 |
42LL | pub fn in_fn_mut<F: FnMut() -> Result<(), ()>>(mut f: F) -> Result<(), ()> {
43 | ^^^^^^^^^^^^^^^^^^^^^^^^^
44note: `into_iter` takes ownership of the receiver `self`, which moves `foos`
45 --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
46help: consider creating a fresh reborrow of `foos` here
47 |
48LL | for _ in &mut *foos {
49 | ++++++
50
51error: aborting due to 2 previous errors
52
53For 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)]
4pub enum Enum<T> {
5 Unit,
6 Tuple(),
7 Store(T),
8}
9pub mod module {
10 pub use super::Enum::Store;
11}
12fn 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 @@
1error[E0109]: type arguments are not allowed on unit variant `Unit`
2 --> $DIR/generic-args-on-enum-variant-segments-fail.rs:13:49
3 |
4LL | 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
10help: remove the generics arguments from one of the path segments
11 |
12LL - type const _: Enum<()> = Enum::<()>::Unit::<()>;
13LL + type const _: Enum<()> = Enum::<()>::Unit;
14 |
15
16error[E0109]: type arguments are not allowed on tuple variant `Tuple`
17 --> $DIR/generic-args-on-enum-variant-segments-fail.rs:15:50
18 |
19LL | 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
25help: remove the generics arguments from one of the path segments
26 |
27LL - type const _: Enum<()> = Enum::<()>::Tuple::<()>();
28LL + type const _: Enum<()> = Enum::<()>::Tuple();
29 |
30
31error[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 |
34LL | 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
39error: aborting due to 3 previous errors
40
41For 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)]
7enum Enum<T> {
8 Unit,
9 Tuple(),
10 Store(T),
11}
12
13type const _: Enum<()> = Enum::<()>::Unit;
14type const _: Enum<()> = Enum::<()>::Tuple();
15
16fn 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
5type const X: usize = const { N };
6//~^ ERROR type annotations needed
7
8type const N: usize = "this isn't a usize";
9//~^ ERROR the constant `"this isn't a usize"` is not of type `usize`
10
11fn main() {}
tests/ui/const-generics/mgca/type-const-free-anon-const-mismatch.stderr created+15
......@@ -0,0 +1,15 @@
1error[E0284]: type annotations needed: cannot normalize `X::{constant#0}`
2 --> $DIR/type-const-free-anon-const-mismatch.rs:5:1
3 |
4LL | type const X: usize = const { N };
5 | ^^^^^^^^^^^^^^^^^^^ cannot normalize `X::{constant#0}`
6
7error: the constant `"this isn't a usize"` is not of type `usize`
8 --> $DIR/type-const-free-anon-const-mismatch.rs:8:1
9 |
10LL | type const N: usize = "this isn't a usize";
11 | ^^^^^^^^^^^^^^^^^^^ expected `usize`, found `&'static str`
12
13error: aborting due to 2 previous errors
14
15For 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 @@
1error: the constant `"this isn't a usize"` is not of type `usize`
2 --> $DIR/type-const-free-value-type-mismatch.rs:8:1
3 |
4LL | type const N: usize = "this isn't a usize";
5 | ^^^^^^^^^^^^^^^^^^^ expected `usize`, found `&'static str`
6
7error[E0308]: mismatched types
8 --> $DIR/type-const-free-value-type-mismatch.rs:11:11
9 |
10LL | 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
15error: aborting due to 2 previous errors
16
17For 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 @@
1error: the constant `"this isn't a usize"` is not of type `usize`
2 --> $DIR/type-const-free-value-type-mismatch.rs:8:1
3 |
4LL | type const N: usize = "this isn't a usize";
5 | ^^^^^^^^^^^^^^^^^^^ expected `usize`, found `&'static str`
6
7error[E0284]: type annotations needed: cannot normalize `f::{constant#0}`
8 --> $DIR/type-const-free-value-type-mismatch.rs:11:11
9 |
10LL | fn f() -> [u8; const { N }] {}
11 | ^^^^^^^^^^^^^^^^^ cannot normalize `f::{constant#0}`
12
13error[E0308]: mismatched types
14 --> $DIR/type-const-free-value-type-mismatch.rs:11:11
15 |
16LL | fn f() -> [u8; const { N }] {}
17 | - ^^^^^^^^^^^^^^^^^ expected `[u8; _]`, found `()`
18 | |
19 | implicitly returns `()` as its body has no tail or `return` expression
20
21error: aborting due to 3 previous errors
22
23Some errors have detailed explanations: E0284, E0308.
24For 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
8type const N: usize = "this isn't a usize";
9//~^ ERROR the constant `"this isn't a usize"` is not of type `usize`
10
11fn f() -> [u8; const { N }] {}
12//[current]~^ ERROR mismatched types [E0308]
13//[next]~^^ ERROR type annotations needed
14//[next]~| ERROR mismatched types [E0308]
15
16fn 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
7type const CONST: usize = 1u32;
8//~^ ERROR the constant `1` is not of type `usize`
9
10type const S: bool = 1i32;
11//~^ ERROR the constant `1` is not of type `bool`
12
13fn 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 @@
1error: the constant `1` is not of type `usize`
2 --> $DIR/type-const-free-value-used-in-body.rs:7:1
3 |
4LL | type const CONST: usize = 1u32;
5 | ^^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `u32`
6
7error: the constant `1` is not of type `bool`
8 --> $DIR/type-const-free-value-used-in-body.rs:10:1
9 |
10LL | type const S: bool = 1i32;
11 | ^^^^^^^^^^^^^^^^^^ expected `bool`, found `i32`
12
13error: 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 @@
1error: the constant `"this isn't a usize"` is not of type `usize`
2 --> $DIR/type-const-inherent-value-type-mismatch.rs:13:5
3 |
4LL | type const N: usize = "this isn't a usize";
5 | ^^^^^^^^^^^^^^^^^^^ expected `usize`, found `&'static str`
6
7error[E0308]: mismatched types
8 --> $DIR/type-const-inherent-value-type-mismatch.rs:17:11
9 |
10LL | 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
15error: aborting due to 2 previous errors
16
17For 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 @@
1error[E0284]: type annotations needed: cannot normalize `f::{constant#0}`
2 --> $DIR/type-const-inherent-value-type-mismatch.rs:17:11
3 |
4LL | fn f() -> [u8; const { Struct::N }] {}
5 | ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot normalize `f::{constant#0}`
6
7error: the constant `"this isn't a usize"` is not of type `usize`
8 --> $DIR/type-const-inherent-value-type-mismatch.rs:13:5
9 |
10LL | type const N: usize = "this isn't a usize";
11 | ^^^^^^^^^^^^^^^^^^^ expected `usize`, found `&'static str`
12
13error[E0308]: mismatched types
14 --> $DIR/type-const-inherent-value-type-mismatch.rs:17:11
15 |
16LL | fn f() -> [u8; const { Struct::N }] {}
17 | - ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `[u8; _]`, found `()`
18 | |
19 | implicitly returns `()` as its body has no tail or `return` expression
20
21error: aborting due to 3 previous errors
22
23Some errors have detailed explanations: E0284, E0308.
24For 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
10struct Struct;
11
12impl 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
17fn f() -> [u8; const { Struct::N }] {}
18//~^ ERROR mismatched types [E0308]
19//[next]~| ERROR type annotations needed
20
21fn main() {}
tests/ui/const-generics/mgca/type-const-value-type-mismatch.current.stderr created+32
......@@ -0,0 +1,32 @@
1error[E0053]: method `arr` has an incompatible type for trait
2 --> $DIR/type-const-value-type-mismatch.rs:21:5
3 |
4LL | 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 |
7note: type in trait
8 --> $DIR/type-const-value-type-mismatch.rs:14:5
9 |
10LL | fn arr() -> [u8; Self::LEN];
11 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12 = note: expected signature `fn() -> [u8; 0]`
13 found signature `fn() -> [u8; const { Self::LEN }]`
14
15error: the constant `0` is not of type `usize`
16 --> $DIR/type-const-value-type-mismatch.rs:18:5
17 |
18LL | type const LEN: usize = 0u8;
19 | ^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `u8`
20
21error[E0308]: mismatched types
22 --> $DIR/type-const-value-type-mismatch.rs:21:17
23 |
24LL | 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
29error: aborting due to 3 previous errors
30
31Some errors have detailed explanations: E0053, E0308.
32For 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 @@
1error[E0271]: type mismatch resolving `<A as Array>::LEN normalizes-to 0`
2 --> $DIR/type-const-value-type-mismatch.rs:21:5
3 |
4LL | fn arr() -> [u8; const { Self::LEN }] {}
5 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ
6
7error: the constant `0` is not of type `usize`
8 --> $DIR/type-const-value-type-mismatch.rs:18:5
9 |
10LL | type const LEN: usize = 0u8;
11 | ^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `u8`
12
13error[E0284]: type annotations needed: cannot normalize `<A as Array>::arr::{constant#0}`
14 --> $DIR/type-const-value-type-mismatch.rs:21:17
15 |
16LL | fn arr() -> [u8; const { Self::LEN }] {}
17 | ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot normalize `<A as Array>::arr::{constant#0}`
18
19error[E0308]: mismatched types
20 --> $DIR/type-const-value-type-mismatch.rs:21:17
21 |
22LL | fn arr() -> [u8; const { Self::LEN }] {}
23 | --- ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `[u8; _]`, found `()`
24 | |
25 | implicitly returns `()` as its body has no tail or `return` expression
26
27error: aborting due to 4 previous errors
28
29Some errors have detailed explanations: E0271, E0284, E0308.
30For 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
10pub struct A;
11
12pub trait Array {
13 type const LEN: usize;
14 fn arr() -> [u8; Self::LEN];
15}
16
17impl 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
28fn main() {}
tests/ui/const-generics/mgca/type_const-mismatched-types.rs+2-1
......@@ -5,7 +5,8 @@ type const FREE: u32 = 5_usize;
55//~^ ERROR the constant `5` is not of type `u32`
66
77type 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`
910
1011trait Tr {
1112 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`
44LL | type const FREE: u32 = 5_usize;
55 | ^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `usize`
66
7error: the constant `5` is not of type `u32`
8 --> $DIR/type_const-mismatched-types.rs:7:1
9 |
10LL | type const FREE2: isize = FREE;
11 | ^^^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `usize`
12
713error: the constant `5` is not of type `isize`
814 --> $DIR/type_const-mismatched-types.rs:7:1
915 |
......@@ -11,10 +17,10 @@ LL | type const FREE2: isize = FREE;
1117 | ^^^^^^^^^^^^^^^^^^^^^^^ expected `isize`, found `usize`
1218
1319error: 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
1521 |
1622LL | type const N: usize = false;
1723 | ^^^^^^^^^^^^^^^^^^^ expected `usize`, found `bool`
1824
19error: aborting due to 3 previous errors
25error: aborting due to 4 previous errors
2026
tests/ui/consts/const-eval/index-out-of-bounds-never-type.rs+1-1
......@@ -1,5 +1,5 @@
11//@ build-fail
2//@ ignore-parallel-frontend post-monomorphization errors
2
33// Regression test for #66975
44#![warn(unconditional_panic)]
55#![feature(never_type)]
tests/ui/consts/const-eval/issue-50814-2.rs+1-1
......@@ -2,7 +2,7 @@
22//@ revisions: normal mir-opt
33//@ [mir-opt]compile-flags: -Zmir-opt-level=4
44//@ dont-require-annotations: NOTE
5//@ ignore-parallel-frontend post-monomorphization errors
5
66trait C {
77 const BOO: usize;
88}
tests/ui/consts/const-eval/issue-50814.rs+1-1
......@@ -1,6 +1,6 @@
11//@ build-fail
22//@ dont-require-annotations: NOTE
3//@ ignore-parallel-frontend post-monomorphization errors
3
44trait Unsigned {
55 const MAX: u8;
66}
tests/ui/consts/mono-reachable-invalid-const.rs+1-1
......@@ -1,5 +1,5 @@
11//@ build-fail
2//@ ignore-parallel-frontend post-monomorphization errors
2
33struct Bar<const BITS: usize>;
44
55impl<const BITS: usize> Bar<BITS> {
tests/ui/consts/required-consts/collect-in-called-fn.rs+1-1
......@@ -4,7 +4,7 @@
44//@[opt] compile-flags: -O
55//! Make sure we detect erroneous constants post-monomorphization even when they are unused. This is
66//! crucial, people rely on it for soundness. (https://github.com/rust-lang/rust/issues/112090)
7//@ ignore-parallel-frontend post-monomorphization errors
7
88struct Fail<T>(T);
99impl<T> Fail<T> {
1010 const C: () = panic!(); //~ERROR evaluation panicked: explicit panic
tests/ui/consts/required-consts/collect-in-dead-closure.rs+1-1
......@@ -3,7 +3,7 @@
33//@[noopt] compile-flags: -Copt-level=0
44//@[opt] compile-flags: -O
55//! This fails without optimizations, so it should also fail with optimizations.
6//@ ignore-parallel-frontend post-monomorphization errors
6
77struct Fail<T>(T);
88impl<T> Fail<T> {
99 const C: () = panic!(); //~ERROR evaluation panicked: explicit panic
tests/ui/consts/required-consts/collect-in-dead-drop.rs+1-1
......@@ -3,7 +3,7 @@
33//@[noopt] compile-flags: -Copt-level=0
44//@[opt] compile-flags: -O
55//! This fails without optimizations, so it should also fail with optimizations.
6//@ ignore-parallel-frontend post-monomorphization errors
6
77struct Fail<T>(T);
88impl<T> Fail<T> {
99 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 @@
44//@[noopt] compile-flags: -Copt-level=0
55//@[opt] compile-flags: -O
66//! This fails without optimizations, so it should also fail with optimizations.
7//@ ignore-parallel-frontend post-monomorphization errors
7
88struct Fail<T>(T);
99impl<T> Fail<T> {
1010 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 @@
33//@[noopt] compile-flags: -Copt-level=0
44//@[opt] compile-flags: -O
55//! This fails without optimizations, so it should also fail with optimizations.
6//@ ignore-parallel-frontend post-monomorphization errors
6
77struct Fail<T>(T);
88impl<T> Fail<T> {
99 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 @@
44//@[opt] compile-flags: -O
55//! This fails without optimizations, so it should also fail with optimizations.
66#![feature(type_alias_impl_trait)]
7//@ ignore-parallel-frontend post-monomorphization errors
7
88mod m {
99 struct Fail<T>(T);
1010 impl<T> Fail<T> {
tests/ui/consts/required-consts/collect-in-dead-fn.rs+1-1
......@@ -3,7 +3,7 @@
33//@[noopt] compile-flags: -Copt-level=0
44//@[opt] compile-flags: -O
55//! This fails without optimizations, so it should also fail with optimizations.
6//@ ignore-parallel-frontend post-monomorphization errors
6
77struct Fail<T>(T);
88impl<T> Fail<T> {
99 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 @@
33//@[noopt] compile-flags: -Copt-level=0
44//@[opt] compile-flags: -O
55//! This fails without optimizations, so it should also fail with optimizations.
6//@ ignore-parallel-frontend post-monomorphization errors
6
77struct Late<T>(T);
88impl<T> Late<T> {
99 const FAIL: () = panic!(); //~ERROR evaluation panicked: explicit panic
tests/ui/consts/required-consts/collect-in-dead-fnptr.rs+1-1
......@@ -3,7 +3,7 @@
33//@[noopt] compile-flags: -Copt-level=0
44//@[opt] compile-flags: -O
55//! This fails without optimizations, so it should also fail with optimizations.
6//@ ignore-parallel-frontend post-monomorphization errors
6
77struct Fail<T>(T);
88impl<T> Fail<T> {
99 const C: () = panic!(); //~ERROR evaluation panicked: explicit panic
tests/ui/consts/required-consts/collect-in-dead-forget.rs+1-1
......@@ -3,7 +3,7 @@
33//@[noopt] compile-flags: -Copt-level=0
44//@[opt] compile-flags: -O
55//! This passes without optimizations, so it can (and should) also pass with optimizations.
6//@ ignore-parallel-frontend post-monomorphization errors
6
77struct Fail<T>(T);
88impl<T> Fail<T> {
99 const C: () = panic!();
tests/ui/consts/required-consts/collect-in-dead-move.rs+1-1
......@@ -3,7 +3,7 @@
33//@[noopt] compile-flags: -Copt-level=0
44//@[opt] compile-flags: -O
55//! This fails without optimizations, so it should also fail with optimizations.
6//@ ignore-parallel-frontend post-monomorphization errors
6
77struct Fail<T>(T);
88impl<T> Fail<T> {
99 const C: () = panic!(); //~ERROR evaluation panicked: explicit panic
tests/ui/consts/required-consts/collect-in-dead-vtable.rs+1-1
......@@ -3,7 +3,7 @@
33//@[noopt] compile-flags: -Copt-level=0
44//@[opt] compile-flags: -O
55//! This fails without optimizations, so it should also fail with optimizations.
6//@ ignore-parallel-frontend post-monomorphization errors
6
77struct Fail<T>(T);
88impl<T> Fail<T> {
99 const C: () = panic!(); //~ERROR evaluation panicked: explicit panic
tests/ui/consts/required-consts/collect-in-promoted-const.rs+1-1
......@@ -3,7 +3,7 @@
33//@[noopt] compile-flags: -Copt-level=0
44//@[opt] compile-flags: -O
55//! Make sure we error on erroneous consts even if they get promoted.
6//@ ignore-parallel-frontend post-monomorphization errors
6
77struct Fail<T>(T);
88impl<T> Fail<T> {
99 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 @@
22//@[noopt] compile-flags: -Copt-level=0
33//@[opt] compile-flags: -O
44//! Make sure we error on erroneous consts even if they are unused.
5//@ ignore-parallel-frontend post-monomorphization errors
5
66struct Fail<T>(T);
77impl<T> Fail<T> {
88 const C: () = panic!(); //~ERROR explicit panic
tests/ui/consts/required-consts/interpret-in-promoted.rs+1-1
......@@ -2,7 +2,7 @@
22//@[noopt] compile-flags: -Copt-level=0
33//@[opt] compile-flags: -O
44//@ dont-require-annotations: NOTE
5//@ ignore-parallel-frontend post-monomorphization errors
5
66//! Make sure we evaluate const fn calls even if they get promoted and their result ignored.
77
88const unsafe fn ub() {
tests/ui/consts/required-consts/interpret-in-static.rs+1-1
......@@ -2,7 +2,7 @@
22//@[noopt] compile-flags: -Copt-level=0
33//@[opt] compile-flags: -O
44//! Make sure we error on erroneous consts even if they are unused.
5//@ ignore-parallel-frontend post-monomorphization errors
5
66struct Fail<T>(T);
77impl<T> Fail<T> {
88 const C: () = panic!(); //~ERROR explicit panic
tests/ui/delegation/self-coercion-static-free.rs+2
......@@ -23,6 +23,7 @@ impl Trait for S {
2323 //~^ ERROR: mismatched types
2424 //~| ERROR: mismatched types
2525 //~| ERROR: mismatched types
26 //~| ERROR: unused target expression is specified for glob or list delegation
2627 let _ = self;
2728 S::static_self()
2829 }
......@@ -35,6 +36,7 @@ impl Trait for S1 {
3536 //~^ ERROR: mismatched types
3637 //~| ERROR: mismatched types
3738 //~| ERROR: mismatched types
39 //~| ERROR: unused target expression is specified for glob or list delegation
3840 let _ = self;
3941 S1::static_self()
4042 }
tests/ui/delegation/self-coercion-static-free.stderr+20-8
......@@ -1,3 +1,15 @@
1error: unused target expression is specified for glob or list delegation
2 --> $DIR/self-coercion-static-free.rs:22:26
3 |
4LL | reuse <F as Trait>::{static_value, static_mut_ref, static_ref} {
5 | ^^^^^^^^^^^^
6
7error: unused target expression is specified for glob or list delegation
8 --> $DIR/self-coercion-static-free.rs:35:26
9 |
10LL | reuse <F as Trait>::{static_value, static_mut_ref, static_ref} {
11 | ^^^^^^^^^^^^
12
113error[E0308]: mismatched types
214 --> $DIR/self-coercion-static-free.rs:22:26
315 |
......@@ -48,7 +60,7 @@ LL | fn static_ref(_: &Self) -> i32 { 3 }
4860 | ^^^^^^^^^^ --------
4961
5062error[E0308]: mismatched types
51 --> $DIR/self-coercion-static-free.rs:34:26
63 --> $DIR/self-coercion-static-free.rs:35:26
5264 |
5365LL | reuse <F as Trait>::{static_value, static_mut_ref, static_ref} {
5466 | ^^^^^^^^^^^^
......@@ -63,7 +75,7 @@ LL | fn static_value(_: Self) -> i32 { 1 }
6375 | ^^^^^^^^^^^^ -------
6476
6577error[E0308]: mismatched types
66 --> $DIR/self-coercion-static-free.rs:34:40
78 --> $DIR/self-coercion-static-free.rs:35:40
6779 |
6880LL | reuse <F as Trait>::{static_value, static_mut_ref, static_ref} {
6981 | ^^^^^^^^^^^^^^
......@@ -80,7 +92,7 @@ LL | fn static_mut_ref(_: &mut Self) -> i32 { 2 }
8092 | ^^^^^^^^^^^^^^ ------------
8193
8294error[E0308]: mismatched types
83 --> $DIR/self-coercion-static-free.rs:34:56
95 --> $DIR/self-coercion-static-free.rs:35:56
8496 |
8597LL | reuse <F as Trait>::{static_value, static_mut_ref, static_ref} {
8698 | ^^^^^^^^^^
......@@ -97,7 +109,7 @@ LL | fn static_ref(_: &Self) -> i32 { 3 }
97109 | ^^^^^^^^^^ --------
98110
99111error[E0308]: mismatched types
100 --> $DIR/self-coercion-static-free.rs:50:43
112 --> $DIR/self-coercion-static-free.rs:52:43
101113 |
102114LL | reuse to_reuse::{value, mut_ref, r#ref} { F }
103115 | ------- ^ expected `&mut _`, found `F`
......@@ -107,7 +119,7 @@ LL | reuse to_reuse::{value, mut_ref, r#ref} { F }
107119 = note: expected mutable reference `&mut _`
108120 found struct `F`
109121note: function defined here
110 --> $DIR/self-coercion-static-free.rs:46:12
122 --> $DIR/self-coercion-static-free.rs:48:12
111123 |
112124LL | pub fn mut_ref(_: &mut impl Trait) -> i32 { 2 }
113125 | ^^^^^^^ ------------------
......@@ -117,7 +129,7 @@ LL | reuse to_reuse::{value, mut_ref, r#ref} { &mut F }
117129 | ++++
118130
119131error[E0308]: mismatched types
120 --> $DIR/self-coercion-static-free.rs:50:43
132 --> $DIR/self-coercion-static-free.rs:52:43
121133 |
122134LL | reuse to_reuse::{value, mut_ref, r#ref} { F }
123135 | ----- ^ expected `&_`, found `F`
......@@ -127,7 +139,7 @@ LL | reuse to_reuse::{value, mut_ref, r#ref} { F }
127139 = note: expected reference `&_`
128140 found struct `F`
129141note: function defined here
130 --> $DIR/self-coercion-static-free.rs:47:12
142 --> $DIR/self-coercion-static-free.rs:49:12
131143 |
132144LL | pub fn r#ref(_: &impl Trait) -> i32 { 3 }
133145 | ^^^^^ --------------
......@@ -136,6 +148,6 @@ help: consider borrowing here
136148LL | reuse to_reuse::{value, mut_ref, r#ref} { &F }
137149 | +
138150
139error: aborting due to 8 previous errors
151error: aborting due to 10 previous errors
140152
141153For 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
3pub 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)]
13pub struct F;
14impl Trait for F {}
15
16struct S(F);
17impl Trait for S {
18 reuse <F as Trait>::* { self.0 }
19 //~^ ERROR: unused target expression is specified for glob or list delegation
20}
21
22struct S1(F);
23impl S1 {
24 reuse <F as Trait>::* { self.0 }
25 //~^ ERROR: unused target expression is specified for glob or list delegation
26}
27
28struct S2(F);
29impl 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
34struct S3(F);
35impl 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
40struct S4(F);
41impl 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
46struct S5(F);
47impl 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
52struct S6(F);
53impl 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
59struct S7(F);
60impl Trait for S7 {
61 reuse <F as Trait>::*;
62}
63
64struct S8(F);
65impl 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
70struct S9;
71impl 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
79trait 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
89mod 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
101mod 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
147mod 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
171mod 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
208fn main() {}
tests/ui/delegation/unused-target-expr-in-glob-or-list.stderr created+569
......@@ -0,0 +1,569 @@
1error[E0433]: cannot find type `UnresolvedTrait` in this scope
2 --> $DIR/unused-target-expr-in-glob-or-list.rs:55:11
3 |
4LL | reuse UnresolvedTrait::* { self.0 }
5 | ^^^^^^^^^^^^^^^ use of undeclared type `UnresolvedTrait`
6
7error: delegation's target expression is specified for function with no params
8 --> $DIR/unused-target-expr-in-glob-or-list.rs:154:45
9 |
10LL | reuse to_reuse::{value, mut_ref, r#ref} { () }
11 | ^^^^^^
12
13error: delegation's target expression is specified for function with no params
14 --> $DIR/unused-target-expr-in-glob-or-list.rs:154:45
15 |
16LL | reuse to_reuse::{value, mut_ref, r#ref} { () }
17 | ^^^^^^
18 |
19 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
20
21error: delegation's target expression is specified for function with no params
22 --> $DIR/unused-target-expr-in-glob-or-list.rs:154:45
23 |
24LL | reuse to_reuse::{value, mut_ref, r#ref} { () }
25 | ^^^^^^
26 |
27 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
28
29error: delegation's target expression is specified for function with no params
30 --> $DIR/unused-target-expr-in-glob-or-list.rs:165:39
31 |
32LL | reuse to_reuse::{value as value2} { }
33 | ^^^
34
35error: delegation's target expression is specified for function with no params
36 --> $DIR/unused-target-expr-in-glob-or-list.rs:195:49
37 |
38LL | reuse to_reuse::{value, mut_ref, r#ref} { 1 + 1 }
39 | ^^^^^^^^^
40
41error: delegation's target expression is specified for function with no params
42 --> $DIR/unused-target-expr-in-glob-or-list.rs:195:49
43 |
44LL | reuse to_reuse::{value, mut_ref, r#ref} { 1 + 1 }
45 | ^^^^^^^^^
46 |
47 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
48
49error: delegation's target expression is specified for function with no params
50 --> $DIR/unused-target-expr-in-glob-or-list.rs:195:49
51 |
52LL | reuse to_reuse::{value, mut_ref, r#ref} { 1 + 1 }
53 | ^^^^^^^^^
54 |
55 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
56
57error: delegation's target expression is specified for function with no params
58 --> $DIR/unused-target-expr-in-glob-or-list.rs:107:49
59 |
60LL | reuse <F as Trait>::static_self { self.0 }
61 | ^^^^^^^^^^
62...
63LL | 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
68error: delegation's target expression is specified for function with no params
69 --> $DIR/unused-target-expr-in-glob-or-list.rs:127:45
70 |
71LL | reuse <F as Trait>::static_self { self.0 }
72 | ^^^^^^^^^^
73...
74LL | 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
79error: unused target expression is specified for glob or list delegation
80 --> $DIR/unused-target-expr-in-glob-or-list.rs:18:25
81 |
82LL | reuse <F as Trait>::* { self.0 }
83 | ^
84
85error: unused target expression is specified for glob or list delegation
86 --> $DIR/unused-target-expr-in-glob-or-list.rs:24:25
87 |
88LL | reuse <F as Trait>::* { self.0 }
89 | ^
90
91error: unused target expression is specified for glob or list delegation
92 --> $DIR/unused-target-expr-in-glob-or-list.rs:30:26
93 |
94LL | reuse <F as Trait>::{static_self} { self.0 }
95 | ^^^^^^^^^^^
96
97error: unused target expression is specified for glob or list delegation
98 --> $DIR/unused-target-expr-in-glob-or-list.rs:36:26
99 |
100LL | reuse <F as Trait>::{static_self, static_value} { self.0 }
101 | ^^^^^^^^^^^
102
103error: unused target expression is specified for glob or list delegation
104 --> $DIR/unused-target-expr-in-glob-or-list.rs:42:26
105 |
106LL | reuse <F as Trait>::{static_self, static_value, static_mut_ref, static_ref} { self.0 }
107 | ^^^^^^^^^^^
108
109error: unused target expression is specified for glob or list delegation
110 --> $DIR/unused-target-expr-in-glob-or-list.rs:48:26
111 |
112LL | reuse <F as Trait>::{static_self, static_value, static_mut_ref, static_ref} { }
113 | ^^^^^^^^^^^
114
115error: unused target expression is specified for glob or list delegation
116 --> $DIR/unused-target-expr-in-glob-or-list.rs:66:26
117 |
118LL | reuse <F as Trait>::{static_self, static_self2} { { F } }
119 | ^^^^^^^^^^^
120
121error: unused target expression is specified for glob or list delegation
122 --> $DIR/unused-target-expr-in-glob-or-list.rs:72:26
123 |
124LL | reuse <F as Trait>::{static_self, static_self2} { { F } }
125 | ^^^^^^^^^^^
126
127error: unused target expression is specified for glob or list delegation
128 --> $DIR/unused-target-expr-in-glob-or-list.rs:75:26
129 |
130LL | reuse <F as Trait>::{static_value, static_mut_ref, static_ref} { }
131 | ^^^^^^^^^^^^
132
133error: unused target expression is specified for glob or list delegation
134 --> $DIR/unused-target-expr-in-glob-or-list.rs:80:26
135 |
136LL | reuse <F as Trait>::{static_self, static_self2} { { F } }
137 | ^^^^^^^^^^^
138
139error: unused target expression is specified for glob or list delegation
140 --> $DIR/unused-target-expr-in-glob-or-list.rs:83:26
141 |
142LL | reuse <F as Trait>::{static_value, static_mut_ref} { }
143 | ^^^^^^^^^^^^
144
145error: unused target expression is specified for glob or list delegation
146 --> $DIR/unused-target-expr-in-glob-or-list.rs:92:26
147 |
148LL | reuse <F as Trait>::{static_self, static_self2} { { F } }
149 | ^^^^^^^^^^^
150
151error: unused target expression is specified for glob or list delegation
152 --> $DIR/unused-target-expr-in-glob-or-list.rs:95:26
153 |
154LL | reuse <F as Trait>::{static_value, static_mut_ref} { }
155 | ^^^^^^^^^^^^
156
157error: unused target expression is specified for glob or list delegation
158 --> $DIR/unused-target-expr-in-glob-or-list.rs:189:26
159 |
160LL | reuse to_reuse::{value, mut_ref, r#ref} { () }
161 | ^^^^^
162
163error[E0053]: method `static_self` has an incompatible type for trait
164 --> $DIR/unused-target-expr-in-glob-or-list.rs:107:37
165 |
166LL | reuse <F as Trait>::static_self { self.0 }
167 | ^^^^^^^^^^^ expected `F`, found `()`
168...
169LL | delegation!();
170 | ------------- in this macro invocation
171 |
172note: type in trait
173 --> $DIR/unused-target-expr-in-glob-or-list.rs:4:25
174 |
175LL | 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)
180help: change the output type to match the trait
181 |
182LL - reuse <F as Trait>::static_self { self.0 }
183LL + reuse <F as Trait>:: -> F { self.0 }
184 |
185
186error[E0053]: method `static_self` has an incompatible type for trait
187 --> $DIR/unused-target-expr-in-glob-or-list.rs:127:33
188 |
189LL | reuse <F as Trait>::static_self { self.0 }
190 | ^^^^^^^^^^^ expected `F`, found `()`
191...
192LL | delegation2!();
193 | -------------- in this macro invocation
194 |
195note: type in trait
196 --> $DIR/unused-target-expr-in-glob-or-list.rs:4:25
197 |
198LL | 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)
203help: change the output type to match the trait
204 |
205LL - reuse <F as Trait>::static_self { self.0 }
206LL + reuse <F as Trait>:: -> F { self.0 }
207 |
208
209error[E0061]: this function takes 0 arguments but 1 argument was supplied
210 --> $DIR/unused-target-expr-in-glob-or-list.rs:107:37
211 |
212LL | reuse <F as Trait>::static_self { self.0 }
213 | ^^^^^^^^^^^ ---------- unexpected argument
214...
215LL | delegation!();
216 | ------------- in this macro invocation
217 |
218note: associated function defined here
219 --> $DIR/unused-target-expr-in-glob-or-list.rs:4:8
220 |
221LL | 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
225error[E0308]: mismatched types
226 --> $DIR/unused-target-expr-in-glob-or-list.rs:107:37
227 |
228LL | 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...
234LL | 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
239error[E0609]: no field `0` on type `F`
240 --> $DIR/unused-target-expr-in-glob-or-list.rs:112:57
241 |
242LL | reuse <F as Trait>::static_value { self.0 }
243 | ^ unknown field
244...
245LL | 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
250error[E0609]: no field `0` on type `&mut F`
251 --> $DIR/unused-target-expr-in-glob-or-list.rs:114:59
252 |
253LL | reuse <F as Trait>::static_mut_ref { self.0 }
254 | ^ unknown field
255...
256LL | 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
261error[E0609]: no field `0` on type `&F`
262 --> $DIR/unused-target-expr-in-glob-or-list.rs:116:55
263 |
264LL | reuse <F as Trait>::static_ref { self.0 }
265 | ^ unknown field
266...
267LL | 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
272error[E0061]: this function takes 0 arguments but 1 argument was supplied
273 --> $DIR/unused-target-expr-in-glob-or-list.rs:127:33
274 |
275LL | reuse <F as Trait>::static_self { self.0 }
276 | ^^^^^^^^^^^ ---------- unexpected argument
277...
278LL | delegation2!();
279 | -------------- in this macro invocation
280 |
281note: associated function defined here
282 --> $DIR/unused-target-expr-in-glob-or-list.rs:4:8
283 |
284LL | 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
288error[E0308]: mismatched types
289 --> $DIR/unused-target-expr-in-glob-or-list.rs:127:33
290 |
291LL | 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...
297LL | 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
302error[E0609]: no field `0` on type `F`
303 --> $DIR/unused-target-expr-in-glob-or-list.rs:132:53
304 |
305LL | reuse <F as Trait>::static_value { self.0 }
306 | ^ unknown field
307...
308LL | 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
313error[E0609]: no field `0` on type `&mut F`
314 --> $DIR/unused-target-expr-in-glob-or-list.rs:134:55
315 |
316LL | reuse <F as Trait>::static_mut_ref { self.0 }
317 | ^ unknown field
318...
319LL | 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
324error[E0609]: no field `0` on type `&F`
325 --> $DIR/unused-target-expr-in-glob-or-list.rs:136:51
326 |
327LL | reuse <F as Trait>::static_ref { self.0 }
328 | ^ unknown field
329...
330LL | 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
335error[E0061]: this function takes 0 arguments but 1 argument was supplied
336 --> $DIR/unused-target-expr-in-glob-or-list.rs:154:22
337 |
338LL | reuse to_reuse::{value, mut_ref, r#ref} { () }
339 | ^^^^^ ------ unexpected argument of type `()`
340 |
341note: function defined here
342 --> $DIR/unused-target-expr-in-glob-or-list.rs:149:16
343 |
344LL | pub fn value() -> i32 { 1 }
345 | ^^^^^
346help: remove the extra argument
347 |
348LL - reuse to_reuse::{value, mut_ref, r#ref} { () }
349LL + reuse to_reuse::{valu{ () }
350 |
351
352error[E0308]: mismatched types
353 --> $DIR/unused-target-expr-in-glob-or-list.rs:154:22
354 |
355LL | reuse to_reuse::{value, mut_ref, r#ref} { () }
356 | ^^^^^ expected `()`, found `i32`
357 |
358help: consider using a semicolon here
359 |
360LL | reuse to_reuse::{value;, mut_ref, r#ref} { () }
361 | +
362help: try adding a return type
363 |
364LL - reuse to_reuse::{value, mut_ref, r#ref} { () }
365LL + reuse to_reuse::{ -> i32, mut_ref, r#ref} { () }
366 |
367
368error[E0061]: this function takes 0 arguments but 1 argument was supplied
369 --> $DIR/unused-target-expr-in-glob-or-list.rs:154:29
370 |
371LL | reuse to_reuse::{value, mut_ref, r#ref} { () }
372 | ^^^^^^^ ------ unexpected argument of type `()`
373 |
374note: function defined here
375 --> $DIR/unused-target-expr-in-glob-or-list.rs:150:16
376 |
377LL | pub fn mut_ref() -> i32 { 2 }
378 | ^^^^^^^
379help: remove the extra argument
380 |
381LL - reuse to_reuse::{value, mut_ref, r#ref} { () }
382LL + reuse to_reuse::{value, mut_re{ () }
383 |
384
385error[E0308]: mismatched types
386 --> $DIR/unused-target-expr-in-glob-or-list.rs:154:29
387 |
388LL | reuse to_reuse::{value, mut_ref, r#ref} { () }
389 | ^^^^^^^ expected `()`, found `i32`
390 |
391help: consider using a semicolon here
392 |
393LL | reuse to_reuse::{value, mut_ref;, r#ref} { () }
394 | +
395help: try adding a return type
396 |
397LL - reuse to_reuse::{value, mut_ref, r#ref} { () }
398LL + reuse to_reuse::{value, -> i32, r#ref} { () }
399 |
400
401error[E0061]: this function takes 0 arguments but 1 argument was supplied
402 --> $DIR/unused-target-expr-in-glob-or-list.rs:154:38
403 |
404LL | reuse to_reuse::{value, mut_ref, r#ref} { () }
405 | ^^^^^ ------ unexpected argument of type `()`
406 |
407note: function defined here
408 --> $DIR/unused-target-expr-in-glob-or-list.rs:151:16
409 |
410LL | pub fn r#ref() -> i32 { 3 }
411 | ^^^^^
412help: remove the extra argument
413 |
414LL - reuse to_reuse::{value, mut_ref, r#ref} { () }
415LL + reuse to_reuse::{value, mut_ref, r#re{ () }
416 |
417
418error[E0308]: mismatched types
419 --> $DIR/unused-target-expr-in-glob-or-list.rs:154:38
420 |
421LL | reuse to_reuse::{value, mut_ref, r#ref} { () }
422 | ^^^^^ expected `()`, found `i32`
423 |
424help: consider using a semicolon here
425 |
426LL | reuse to_reuse::{value, mut_ref, r#ref;} { () }
427 | +
428help: try adding a return type
429 |
430LL - reuse to_reuse::{value, mut_ref, r#ref} { () }
431LL + reuse to_reuse::{value, mut_ref, -> i32} { () }
432 |
433
434error[E0061]: this function takes 0 arguments but 1 argument was supplied
435 --> $DIR/unused-target-expr-in-glob-or-list.rs:165:22
436 |
437LL | reuse to_reuse::{value as value2} { }
438 | ^^^^^ --- unexpected argument of type `()`
439 |
440note: function defined here
441 --> $DIR/unused-target-expr-in-glob-or-list.rs:149:16
442 |
443LL | pub fn value() -> i32 { 1 }
444 | ^^^^^
445help: remove the extra argument
446 |
447LL - reuse to_reuse::{value as value2} { }
448LL + reuse to_reuse::{valu{ }
449 |
450
451error[E0308]: mismatched types
452 --> $DIR/unused-target-expr-in-glob-or-list.rs:165:22
453 |
454LL | reuse to_reuse::{value as value2} { }
455 | ^^^^^ expected `()`, found `i32`
456 |
457help: consider using a semicolon here
458 |
459LL | reuse to_reuse::{value; as value2} { }
460 | +
461help: try adding a return type
462 |
463LL - reuse to_reuse::{value as value2} { }
464LL + reuse to_reuse::{ -> i32 as value2} { }
465 |
466
467error[E0061]: this function takes 0 arguments but 1 argument was supplied
468 --> $DIR/unused-target-expr-in-glob-or-list.rs:195:26
469 |
470LL | reuse to_reuse::{value, mut_ref, r#ref} { 1 + 1 }
471 | ^^^^^ --------- unexpected argument of type `{integer}`
472 |
473note: function defined here
474 --> $DIR/unused-target-expr-in-glob-or-list.rs:179:16
475 |
476LL | pub fn value() -> i32 { 1 }
477 | ^^^^^
478help: remove the extra argument
479 |
480LL - reuse to_reuse::{value, mut_ref, r#ref} { 1 + 1 }
481LL + reuse to_reuse::{valu{ 1 + 1 }
482 |
483
484error[E0308]: mismatched types
485 --> $DIR/unused-target-expr-in-glob-or-list.rs:195:26
486 |
487LL | reuse to_reuse::{value, mut_ref, r#ref} { 1 + 1 }
488 | ^^^^^ expected `()`, found `i32`
489 |
490help: consider using a semicolon here
491 |
492LL | reuse to_reuse::{value;, mut_ref, r#ref} { 1 + 1 }
493 | +
494help: try adding a return type
495 |
496LL - reuse to_reuse::{value, mut_ref, r#ref} { 1 + 1 }
497LL + reuse to_reuse::{ -> i32, mut_ref, r#ref} { 1 + 1 }
498 |
499
500error[E0061]: this function takes 0 arguments but 1 argument was supplied
501 --> $DIR/unused-target-expr-in-glob-or-list.rs:195:33
502 |
503LL | reuse to_reuse::{value, mut_ref, r#ref} { 1 + 1 }
504 | ^^^^^^^ --------- unexpected argument of type `{integer}`
505 |
506note: function defined here
507 --> $DIR/unused-target-expr-in-glob-or-list.rs:180:16
508 |
509LL | pub fn mut_ref() -> i32 { 2 }
510 | ^^^^^^^
511help: remove the extra argument
512 |
513LL - reuse to_reuse::{value, mut_ref, r#ref} { 1 + 1 }
514LL + reuse to_reuse::{value, mut_re{ 1 + 1 }
515 |
516
517error[E0308]: mismatched types
518 --> $DIR/unused-target-expr-in-glob-or-list.rs:195:33
519 |
520LL | reuse to_reuse::{value, mut_ref, r#ref} { 1 + 1 }
521 | ^^^^^^^ expected `()`, found `i32`
522 |
523help: consider using a semicolon here
524 |
525LL | reuse to_reuse::{value, mut_ref;, r#ref} { 1 + 1 }
526 | +
527help: try adding a return type
528 |
529LL - reuse to_reuse::{value, mut_ref, r#ref} { 1 + 1 }
530LL + reuse to_reuse::{value, -> i32, r#ref} { 1 + 1 }
531 |
532
533error[E0061]: this function takes 0 arguments but 1 argument was supplied
534 --> $DIR/unused-target-expr-in-glob-or-list.rs:195:42
535 |
536LL | reuse to_reuse::{value, mut_ref, r#ref} { 1 + 1 }
537 | ^^^^^ --------- unexpected argument of type `{integer}`
538 |
539note: function defined here
540 --> $DIR/unused-target-expr-in-glob-or-list.rs:181:16
541 |
542LL | pub fn r#ref() -> i32 { 3 }
543 | ^^^^^
544help: remove the extra argument
545 |
546LL - reuse to_reuse::{value, mut_ref, r#ref} { 1 + 1 }
547LL + reuse to_reuse::{value, mut_ref, r#re{ 1 + 1 }
548 |
549
550error[E0308]: mismatched types
551 --> $DIR/unused-target-expr-in-glob-or-list.rs:195:42
552 |
553LL | reuse to_reuse::{value, mut_ref, r#ref} { 1 + 1 }
554 | ^^^^^ expected `()`, found `i32`
555 |
556help: consider using a semicolon here
557 |
558LL | reuse to_reuse::{value, mut_ref, r#ref;} { 1 + 1 }
559 | +
560help: try adding a return type
561 |
562LL - reuse to_reuse::{value, mut_ref, r#ref} { 1 + 1 }
563LL + reuse to_reuse::{value, mut_ref, -> i32} { 1 + 1 }
564 |
565
566error: aborting due to 50 previous errors
567
568Some errors have detailed explanations: E0053, E0061, E0308, E0433, E0609.
569For 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 @@
11// Test that when a trait impl changes, fns whose body uses that trait
22// must also be recompiled.
3//@ ignore-parallel-frontend dep graph
3
44//@ incremental
55//@ compile-flags: -Z query-dep-graph
66
tests/ui/dep-graph/dep-graph-caller-callee.rs+1-1
......@@ -3,7 +3,7 @@
33
44//@ incremental
55//@ compile-flags: -Z query-dep-graph
6//@ ignore-parallel-frontend dep graph
6
77#![feature(rustc_attrs)]
88#![allow(dead_code)]
99
tests/ui/dep-graph/dep-graph-struct-signature.rs+1-1
......@@ -1,6 +1,6 @@
11// Test cases where a changing struct appears in the signature of fns
22// and methods.
3//@ ignore-parallel-frontend dep graph
3
44//@ incremental
55//@ compile-flags: -Z query-dep-graph
66
tests/ui/dep-graph/dep-graph-trait-impl-two-traits-same-method.rs+1-1
......@@ -1,6 +1,6 @@
11// Test that adding an impl to a trait `Foo` DOES affect functions
22// that only use `Bar` if they have methods in common.
3//@ ignore-parallel-frontend dep graph
3
44//@ incremental
55//@ compile-flags: -Z query-dep-graph
66
tests/ui/dep-graph/dep-graph-trait-impl.rs+1-1
......@@ -1,6 +1,6 @@
11// Test that when a trait impl changes, fns whose body uses that trait
22// must also be recompiled.
3//@ ignore-parallel-frontend dep graph
3
44//@ incremental
55//@ compile-flags: -Z query-dep-graph
66
tests/ui/dep-graph/dep-graph-type-alias.rs+1-1
......@@ -1,5 +1,5 @@
11// Test that changing what a `type` points to does not go unnoticed.
2//@ ignore-parallel-frontend dep graph
2
33//@ incremental
44//@ compile-flags: -Z query-dep-graph
55
tests/ui/dep-graph/dep-graph-variance-alias.rs+1-1
......@@ -1,6 +1,6 @@
11// Test that changing what a `type` points to does not go unnoticed
22// by the variance analysis.
3//@ ignore-parallel-frontend dep graph
3
44//@ incremental
55//@ compile-flags: -Z query-dep-graph
66
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
3struct NamedStruct {
4 opt_field: Option<usize>,
5 res_field: Result<usize, ()>,
6}
7
8fn 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 @@
1error[E0308]: mismatched types
2 --> $DIR/dont-suggest-wrong-expect-suggestion.rs:13:20
3 |
4LL | let a: usize;
5 | ----- expected due to this type
6...
7LL | opt_field: a,
8 | ^ expected `usize`, found `Option<usize>`
9 |
10 = note: expected type `usize`
11 found enum `Option<usize>`
12
13error[E0308]: mismatched types
14 --> $DIR/dont-suggest-wrong-expect-suggestion.rs:14:20
15 |
16LL | let b: usize;
17 | ----- expected due to this type
18...
19LL | res_field: b,
20 | ^ expected `usize`, found `Result<usize, ()>`
21 |
22 = note: expected type `usize`
23 found enum `Result<usize, ()>`
24
25error: aborting due to 2 previous errors
26
27For 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;
1010 |
1111LL + use std::collections::btree_set::Range;
1212 |
13LL + use std::ops::Range;
14 |
1513LL + use std::range::Range;
1614 |
15LL + use std::range::legacy::Range;
16 |
1717
1818error: aborting due to 1 previous error
1919
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)]
6pub 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
6extern crate decl_with_default as decl;
7
8#[decl::eii1]
9pub 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)]
13pub static DECL1: u64 = 5;
14
15fn main() {
16 println!("{DECL1}");
17}
tests/ui/eii/static/default.run.stdout created+1
......@@ -0,0 +1 @@
15
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)]
7pub 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 @@
1error: `#[eii]` cannot be used on statics with a value on Apple targets
2 --> $DIR/default_apple.rs:7:25
3 |
4LL | pub static DECL1: u64 = 5;
5 | ^
6 |
7 = note: see issue #157649 <https://github.com/rust-lang/rust/issues/157649> for more information
8
9error: 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
11extern crate decl_with_default;
12
13fn main() {
14 println!("{}", decl_with_default::DECL1);
15}
tests/ui/eii/static/default_cross_crate.run.stdout created+1
......@@ -0,0 +1 @@
15
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
12extern crate decl_with_default;
13extern crate impl_default_override;
14
15fn main() {
16 println!("{}", decl_with_default::DECL1);
17}
tests/ui/eii/static/default_cross_crate_explicit.run.stdout created+1
......@@ -0,0 +1 @@
110
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)]
14pub static DECL1: u64 = 5;
15
16#[eii1]
17pub static EII1_IMPL: u64 = 10;
18
19fn main() {
20 println!("{DECL1}");
21}
tests/ui/eii/static/default_explicit.run.stdout created+1
......@@ -0,0 +1 @@
110
tests/ui/error-emitter/multiline-removal-suggestion.rs-1
......@@ -56,4 +56,3 @@ fn bay() -> Vec<(bool, HashSet<u8>)> {
5656 .collect()
5757}
5858fn 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 @@
1extern crate proc_macro;
2use proc_macro::TokenStream;
3
4#[proc_macro]
5pub 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
6extern crate dummy_import_ice_macro;
7
8pub fn foo() {
9 ambiguous();
10}
11
12mod submodule {
13 pub fn ambiguous() {}
14}
15
16pub mod ambiguous {}
17
18dummy_import_ice_macro::my_macro!();
19
20fn main() {}
tests/ui/imports/issue-56125.rs+1-1
......@@ -15,7 +15,7 @@ mod m2 {
1515mod m3 {
1616 mod empty {}
1717 use empty::issue_56125; //~ ERROR unresolved import `empty::issue_56125`
18 use issue_56125::*;
18 use issue_56125::*; //~ ERROR `issue_56125` is ambiguous
1919}
2020
2121fn main() {}
tests/ui/imports/issue-56125.stderr+18-1
......@@ -56,7 +56,24 @@ LL | use issue_56125::non_last_segment::non_last_segment::*;
5656 = help: consider adding an explicit import of `issue_56125` to disambiguate
5757 = help: or use `self::issue_56125` to refer to this module unambiguously
5858
59error: aborting due to 3 previous errors
59error[E0659]: `issue_56125` is ambiguous
60 --> $DIR/issue-56125.rs:18:9
61 |
62LL | 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
68note: `issue_56125` could also refer to the module imported here
69 --> $DIR/issue-56125.rs:18:9
70 |
71LL | 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
76error: aborting due to 4 previous errors
6077
6178Some errors have detailed explanations: E0432, E0659.
6279For 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::*;
1414use e as b;
1515//~^ ERROR: unresolved import `e`
1616use b::c::D as e;
17//~^ ERROR: cannot determine resolution for the import
18//~| ERROR: cannot determine resolution for the import
1719
1820fn main() { }
tests/ui/imports/shadow-glob-module-resolution-2.stderr+15-1
......@@ -1,3 +1,17 @@
1error: cannot determine resolution for the import
2 --> $DIR/shadow-glob-module-resolution-2.rs:16:5
3 |
4LL | use b::c::D as e;
5 | ^^^^^^^^^^^^
6
7error: cannot determine resolution for the import
8 --> $DIR/shadow-glob-module-resolution-2.rs:16:5
9 |
10LL | use b::c::D as e;
11 | ^^^^^^^^^^^^
12 |
13 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
14
115error[E0432]: unresolved import `e`
216 --> $DIR/shadow-glob-module-resolution-2.rs:14:5
317 |
......@@ -12,6 +26,6 @@ LL - use e as b;
1226LL + use a as b;
1327 |
1428
15error: aborting due to 1 previous error
29error: aborting due to 3 previous errors
1630
1731For 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;
1212
1313use b::C as e;
1414//~^ ERROR: unresolved import `b::C`
15//~| ERROR: cannot determine resolution for the import
16//~| ERROR: cannot determine resolution for the import
1517
1618fn e() {}
1719
tests/ui/imports/shadow-glob-module-resolution-4.stderr+15-1
......@@ -1,9 +1,23 @@
1error: cannot determine resolution for the import
2 --> $DIR/shadow-glob-module-resolution-4.rs:13:5
3 |
4LL | use b::C as e;
5 | ^^^^^^^^^
6
7error: cannot determine resolution for the import
8 --> $DIR/shadow-glob-module-resolution-4.rs:13:5
9 |
10LL | use b::C as e;
11 | ^^^^^^^^^
12 |
13 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
14
115error[E0432]: unresolved import `b::C`
216 --> $DIR/shadow-glob-module-resolution-4.rs:13:5
317 |
418LL | use b::C as e;
519 | ^^^^^^^^^
620
7error: aborting due to 1 previous error
21error: aborting due to 3 previous errors
822
923For more information about this error, try `rustc --explain E0432`.
tests/ui/inline-const/required-const.rs+1-1
......@@ -1,6 +1,6 @@
11//@ build-fail
22//@ compile-flags: -Zmir-opt-level=3
3//@ ignore-parallel-frontend post-monomorphization errors
3
44fn foo<T>() {
55 if false {
66 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
7type _A<T> = <T as std::ops::Mul>::Output; //~ ERROR cannot multiply `T` by `T`
8type _B = Vec<str>; //~ ERROR the size for values of type `str` cannot be known at compilation time
9
10// unsatisfied outlives-bounds
11type _C<'a> = &'static &'a (); //~ ERROR reference has a longer lifetime than the data it references
12
13// diverging const exprs
14type _D = [(); panic!()]; //~ ERROR evaluation panicked
15
16// dyn incompatibility
17type _E = dyn Sized; //~ ERROR the trait `Sized` is not dyn compatible
18
19fn main() {}
tests/ui/lazy-type-alias/def-site-body-wf.stderr created+54
......@@ -0,0 +1,54 @@
1error[E0277]: cannot multiply `T` by `T`
2 --> $DIR/def-site-body-wf.rs:7:14
3 |
4LL | type _A<T> = <T as std::ops::Mul>::Output;
5 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `T * T`
6 |
7help: consider restricting type parameter `T` with trait `Mul`
8 |
9LL | type _A<T: std::ops::Mul> = <T as std::ops::Mul>::Output;
10 | +++++++++++++++
11
12error[E0277]: the size for values of type `str` cannot be known at compilation time
13 --> $DIR/def-site-body-wf.rs:8:11
14 |
15LL | 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`
19note: required by an implicit `Sized` bound in `Vec`
20 --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
21
22error[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 |
25LL | type _C<'a> = &'static &'a ();
26 | ^^^^^^^^^^^
27 |
28 = note: the pointer is valid for the static lifetime
29note: but the referenced data is only valid for the lifetime `'a` as defined here
30 --> $DIR/def-site-body-wf.rs:11:9
31 |
32LL | type _C<'a> = &'static &'a ();
33 | ^^
34
35error[E0080]: evaluation panicked: explicit panic
36 --> $DIR/def-site-body-wf.rs:14:16
37 |
38LL | type _D = [(); panic!()];
39 | ^^^^^^^^ evaluation of `_D::{constant#0}` failed here
40
41error[E0038]: the trait `Sized` is not dyn compatible
42 --> $DIR/def-site-body-wf.rs:17:11
43 |
44LL | 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
51error: aborting due to 5 previous errors
52
53Some errors have detailed explanations: E0038, E0080, E0277, E0491.
54For 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,)>;
2323 = note: in case this is a recursive type alias, consider using a struct, enum, or union instead
2424
2525error[E0275]: overflow normalizing the type alias `Poly1<(((((((...,),),),),),),)>`
26 --> $DIR/inherent-impls-overflow.rs:21:1
26 --> $DIR/inherent-impls-overflow.rs:20:1
2727 |
2828LL | type Poly1<T> = Poly0<(T,)>;
2929 | ^^^^^^^^^^^^^
......@@ -31,7 +31,7 @@ LL | type Poly1<T> = Poly0<(T,)>;
3131 = note: in case this is a recursive type alias, consider using a struct, enum, or union instead
3232
3333error[E0275]: overflow normalizing the type alias `Poly1<(((((((...,),),),),),),)>`
34 --> $DIR/inherent-impls-overflow.rs:26:1
34 --> $DIR/inherent-impls-overflow.rs:24:1
3535 |
3636LL | impl Poly0<()> {}
3737 | ^^^^^^^^^^^^^^^^^
tests/ui/lazy-type-alias/inherent-impls-overflow.next.stderr+4-26
......@@ -24,38 +24,16 @@ LL | type Poly0<T> = Poly1<(T,)>;
2424 |
2525 = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`inherent_impls_overflow`)
2626
27error: type parameter `T` is only used recursively
28 --> $DIR/inherent-impls-overflow.rs:17:24
29 |
30LL | 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
3827error[E0275]: overflow evaluating the requirement `Poly0<(T,)> == _`
39 --> $DIR/inherent-impls-overflow.rs:21:1
28 --> $DIR/inherent-impls-overflow.rs:20:1
4029 |
4130LL | type Poly1<T> = Poly0<(T,)>;
4231 | ^^^^^^^^^^^^^
4332 |
4433 = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`inherent_impls_overflow`)
4534
46error: type parameter `T` is only used recursively
47 --> $DIR/inherent-impls-overflow.rs:21:24
48 |
49LL | 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
5735error[E0275]: overflow evaluating the requirement `Poly0<()> == _`
58 --> $DIR/inherent-impls-overflow.rs:26:1
36 --> $DIR/inherent-impls-overflow.rs:24:1
5937 |
6038LL | impl Poly0<()> {}
6139 | ^^^^^^^^^^^^^^^^^
......@@ -63,14 +41,14 @@ LL | impl Poly0<()> {}
6341 = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`inherent_impls_overflow`)
6442
6543error[E0275]: overflow evaluating the requirement `Poly0<()> == _`
66 --> $DIR/inherent-impls-overflow.rs:26:6
44 --> $DIR/inherent-impls-overflow.rs:24:6
6745 |
6846LL | impl Poly0<()> {}
6947 | ^^^^^^^^^
7048 |
7149 = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`inherent_impls_overflow`)
7250
73error: aborting due to 9 previous errors
51error: aborting due to 7 previous errors
7452
7553Some errors have detailed explanations: E0271, E0275.
7654For 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 {}
1616
1717type Poly0<T> = Poly1<(T,)>;
1818//[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
2120type Poly1<T> = Poly0<(T,)>;
2221//[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
2523
2624impl Poly0<()> {}
2725//[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
6type Alias<T> = <T as std::ops::Mul>::Output; //~ ERROR cannot multiply `T` by `T`
7
8fn main() {}
tests/ui/lazy-type-alias/unsatisfied-bounds-type-alias-body.stderr deleted-14
......@@ -1,14 +0,0 @@
1error[E0277]: cannot multiply `T` by `T`
2 --> $DIR/unsatisfied-bounds-type-alias-body.rs:6:17
3 |
4LL | type Alias<T> = <T as std::ops::Mul>::Output;
5 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `T * T`
6 |
7help: consider restricting type parameter `T` with trait `Mul`
8 |
9LL | type Alias<T: std::ops::Mul> = <T as std::ops::Mul>::Output;
10 | +++++++++++++++
11
12error: aborting due to 1 previous error
13
14For 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 @@
1error[E0080]: evaluation panicked: explicit panic
2 --> $DIR/unused-generic-arguments-not-wfchecked.rs:28:43
3 |
4LL | #[cfg(not(next_bugged))] type A2 = A<[(); panic!()]>; // FIXME: `panic!()` diverging
5 | ^^^^^^^^ evaluation of `A2::{constant#0}` failed here
6
7error: aborting due to 1 previous error
8
9For 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
24type A<T: ?Sized> = ();
25
26type A0 = A<[str]>; // FIXME: `str: Sized` unsatisfied
27type 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
33fn main() {}
tests/ui/lazy-type-alias/unused-generic-parameters.fail.stderr created+50
......@@ -0,0 +1,50 @@
1error[E0478]: lifetime bound not satisfied
2 --> $DIR/unused-generic-parameters.rs:24:22
3 |
4LL | #[cfg(fail)] fn a(_: A<'_>) {}
5 | ^^^^^
6 |
7note: lifetime parameter instantiated with the anonymous lifetime defined here
8 --> $DIR/unused-generic-parameters.rs:24:22
9 |
10LL | #[cfg(fail)] fn a(_: A<'_>) {}
11 | ^^^^^
12 = note: but lifetime parameter must outlive the static lifetime
13
14error[E0277]: the size for values of type `str` cannot be known at compilation time
15 --> $DIR/unused-generic-parameters.rs:28:22
16 |
17LL | #[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`
21note: required by a bound on the type alias `B`
22 --> $DIR/unused-generic-parameters.rs:26:8
23 |
24LL | type B<T> = ();
25 | ^ required by this bound
26
27error[E0080]: evaluation panicked: explicit panic
28 --> $DIR/unused-generic-parameters.rs:34:26
29 |
30LL | #[cfg(fail)] fn c(_: C<{ panic!() }>) {}
31 | ^^^^^^^^ evaluation of `c::{constant#0}` failed here
32
33error[E0277]: the size for values of type `str` cannot be known at compilation time
34 --> $DIR/unused-generic-parameters.rs:28:22
35 |
36LL | #[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`
40note: required by a bound on the type alias `B`
41 --> $DIR/unused-generic-parameters.rs:26:8
42 |
43LL | type B<T> = ();
44 | ^ required by this bound
45 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
46
47error: aborting due to 4 previous errors
48
49Some errors have detailed explanations: E0080, E0277, E0478.
50For 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
419
520#![feature(lazy_type_alias)]
6#![allow(incomplete_features)]
721
8type A<'a> = ();
9//~^ ERROR lifetime parameter `'a` is never used
10//~| HELP consider removing `'a`
22type A<'a: 'static> = ();
23const _: A<'static> = ();
24#[cfg(fail)] fn a(_: A<'_>) {} //[fail]~ ERROR lifetime bound not satisfied
1125
1226type 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
27const _: 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
1631
17// Check that we don't emit the const param help message here:
18type C<T: Copy> = ();
19//~^ ERROR type parameter `T` is never used
20//~| HELP consider removing `T`
32type C<const N: usize> = ();
33const _: C<{ 0 * 1 }> = ();
34#[cfg(fail)] fn c(_: C<{ panic!() }>) {} //[fail]~ ERROR evaluation panicked
2135
2236fn main() {}
tests/ui/lazy-type-alias/unused-generic-parameters.stderr deleted-28
......@@ -1,28 +0,0 @@
1error[E0392]: lifetime parameter `'a` is never used
2 --> $DIR/unused-generic-parameters.rs:8:8
3 |
4LL | 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
9error[E0392]: type parameter `T` is never used
10 --> $DIR/unused-generic-parameters.rs:12:8
11 |
12LL | 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
18error[E0392]: type parameter `T` is never used
19 --> $DIR/unused-generic-parameters.rs:18:8
20 |
21LL | 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
26error: aborting due to 3 previous errors
27
28For 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
6type B<T: Copy> = T;
7
8fn 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
12type A<'a: 'static> = &'a ();
13
14fn a<'r>(_: A<'r>) {} //~ ERROR lifetime bound not satisfied
15
16fn main() {}
tests/ui/lazy-type-alias/use-site-wf.stderr created+50
......@@ -0,0 +1,50 @@
1error[E0277]: the trait bound `X: Copy` is not satisfied
2 --> $DIR/use-site-wf.rs:8:12
3 |
4LL | fn b<X>(_: B<X>) {}
5 | ^^^^ the trait `Copy` is not implemented for `X`
6 |
7note: required by a bound on the type alias `B`
8 --> $DIR/use-site-wf.rs:6:11
9 |
10LL | type B<T: Copy> = T;
11 | ^^^^ required by this bound
12help: consider restricting type parameter `X` with trait `Copy`
13 |
14LL | fn b<X: std::marker::Copy>(_: B<X>) {}
15 | +++++++++++++++++++
16
17error[E0478]: lifetime bound not satisfied
18 --> $DIR/use-site-wf.rs:14:13
19 |
20LL | fn a<'r>(_: A<'r>) {}
21 | ^^^^^
22 |
23note: lifetime parameter instantiated with the lifetime `'r` as defined here
24 --> $DIR/use-site-wf.rs:14:6
25 |
26LL | fn a<'r>(_: A<'r>) {}
27 | ^^
28 = note: but lifetime parameter must outlive the static lifetime
29
30error[E0277]: the trait bound `X: Copy` is not satisfied
31 --> $DIR/use-site-wf.rs:8:12
32 |
33LL | fn b<X>(_: B<X>) {}
34 | ^^^^ the trait `Copy` is not implemented for `X`
35 |
36note: required by a bound on the type alias `B`
37 --> $DIR/use-site-wf.rs:6:11
38 |
39LL | type B<T: Copy> = T;
40 | ^^^^ required by this bound
41 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
42help: consider restricting type parameter `X` with trait `Copy`
43 |
44LL | fn b<X: std::marker::Copy>(_: B<X>) {}
45 | +++++++++++++++++++
46
47error: aborting due to 3 previous errors
48
49Some errors have detailed explanations: E0277, E0478.
50For 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 ()`.
23struct Co<'a>(A<'a>);
24
25// `A` is *not* in a variance relation with its args since it's a type alias.
26type A<'a> = &'a ();
27
28fn 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 ())`.
33struct Contra<'a>(B<'a>);
34
35// (not in a variance relation)
36type B<'a> = fn(&'a ());
37
38fn 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`.
43struct CoContra<T, U>(C<T, U>);
44
45// (not in a variance relation)
46type C<T, U> = Option<(T, fn(U))>;
47
48fn co_contra<'a>(x: CoContra<&'static (), &'a ()>) -> CoContra<&'a (), &'static ()> {
49 x // OK
50}
51
52// Check that we deeply expand:
53struct Co2<'a>(D0<'a>);
54type D0<'a> = D1<'a>;
55type D1<'a> = D2<'a>;
56type D2<'a> = D3<'a>;
57type D3<'a> = &'a ();
58
59fn co2<'a>(x: Co2<'static>) -> Co2<'a> { x } // OK
60
61fn 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
14type Discard<'a, T> = ();
15
16// `'a` and `T` are bivariant & unconstrained => rejection
17struct WrapDiscard<'a, T>(Discard<'a, T>);
18//~^ ERROR lifetime parameter `'a` is never used
19//~| ERROR type parameter `T` is never used
20
21type DiscardConstrained<'a, T, X> = X
22where
23 X: Iterator<Item = (&'a (), T)>;
24
25// `'a` and `T` are bivariant & constrained => acceptance
26struct WrapDiscardConstrained<'a, T, X>(DiscardConstrained<'a, T, X>)
27where
28 X: Iterator<Item = (&'a (), T)>;
29
30type 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.
36fn bi<'r>(
37 x: WrapDiscardConstrained<'static, &'static (), Co<'static>>,
38) -> WrapDiscardConstrained<'r, &'r (), Co<'r>> {
39 x
40}
41
42fn main() {}
tests/ui/lazy-type-alias/variance-1.stderr created+22
......@@ -0,0 +1,22 @@
1error[E0392]: lifetime parameter `'a` is never used
2 --> $DIR/variance-1.rs:17:20
3 |
4LL | 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
9error[E0392]: type parameter `T` is never used
10 --> $DIR/variance-1.rs:17:24
11 |
12LL | 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
20error: aborting due to 2 previous errors
21
22For 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`.
15struct First<T>(Second);
16//~^ ERROR type parameter `T` is never used
17//~| ERROR overflow normalizing the type alias `Second`
18
19type Second = Second; // diverging free alias type
20//~^ ERROR overflow normalizing the type alias `Second`
21
22fn main() {}
tests/ui/lazy-type-alias/variance-overflow.stderr created+29
......@@ -0,0 +1,29 @@
1error[E0392]: type parameter `T` is never used
2 --> $DIR/variance-overflow.rs:15:14
3 |
4LL | 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
10error[E0275]: overflow normalizing the type alias `Second`
11 --> $DIR/variance-overflow.rs:15:17
12 |
13LL | 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
18error[E0275]: overflow normalizing the type alias `Second`
19 --> $DIR/variance-overflow.rs:19:1
20 |
21LL | 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
26error: aborting due to 3 previous errors
27
28Some errors have detailed explanations: E0275, E0392.
29For 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`.
10struct A<'a>(Co<'a>);
11
12// [+] `Co` is covariant over `'a`.
13type Co<'a> = &'a ();
14
15fn co<'a>(x: A<'static>) {
16 let _: A<'a> = x;
17}
18
19// [-] `B` is contravariant over `'a`.
20struct B<'a>(Contra<'a>);
21
22// [-] `Contra` is contravariant over `'a`.
23type Contra<'a> = fn(&'a ());
24
25fn contra<'a>(x: B<'a>) {
26 let _: B<'static> = x;
27}
28
29struct C<T, U>(CoContra<T, U>);
30
31// [+, -] `CoContra` is covariant over `T` and contravariant over `U`.
32type CoContra<T, U> = Option<(T, fn(U))>;
33
34fn co_contra<'a>(x: C<&'static (), &'a ()>) -> C<&'a (), &'static ()> {
35 x
36}
37
38fn 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
9fn different_main() {
10 println!("Hello from different_main");
11}
12
13use 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
6mod m {
7 pub fn main() {}
8}
9
10use 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
6mod m {
7 pub fn main() {}
8}
9
10use 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
7mod m {
8 pub fn other() {}
9}
10
11use 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
10fn dead_fn() {} //~ ERROR: function `dead_fn` is never used
11
12fn used_fn() {}
13
14#[rustc_main]
15fn actual_main() {
16 used_fn();
17}
18
19// this is not main
20fn 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 @@
1error: function `dead_fn` is never used
2 --> $DIR/lint-dead-code-2-under-test.rs:10:4
3 |
4LL | fn dead_fn() {}
5 | ^^^^^^^
6 |
7note: the lint level is defined here
8 --> $DIR/lint-dead-code-2-under-test.rs:7:9
9 |
10LL | #![deny(dead_code)]
11 | ^^^^^^^^^
12
13error: function `main` is never used
14 --> $DIR/lint-dead-code-2-under-test.rs:20:4
15 |
16LL | fn main() {
17 | ^^^^
18
19error: 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
5fn main() {}
6
7mod 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 @@
1error: function `main` is never used
2 --> $DIR/submodule_main_not_entry_under_test.rs:8:12
3 |
4LL | pub fn main() {}
5 | ^^^^
6 |
7note: the lint level is defined here
8 --> $DIR/submodule_main_not_entry_under_test.rs:3:9
9 |
10LL | #![deny(dead_code)]
11 | ^^^^^^^^^
12
13error: aborting due to 1 previous error
14
tests/ui/lint/large_assignments/copy_into_box_rc_arc.rs+1-1
......@@ -3,7 +3,7 @@
33#![move_size_limit = "1000"]
44//@ build-fail
55//@ only-64bit
6//@ ignore-parallel-frontend post-monomorphization errors
6
77//@ edition:2018
88//@ compile-flags: -Zmir-opt-level=1
99
tests/ui/lint/large_assignments/copy_into_fn.rs+1-1
......@@ -1,5 +1,5 @@
11//@ build-fail
2//@ ignore-parallel-frontend post-monomorphization errors
2
33#![feature(large_assignments)]
44#![move_size_limit = "1000"]
55#![deny(large_assignments)]
tests/ui/lint/large_assignments/inline_mir.rs+1-1
......@@ -13,7 +13,7 @@
1313//! ```
1414//!
1515//! We want the diagnostics to point to the relevant user code.
16//@ ignore-parallel-frontend post-monomorphization errors
16
1717//@ build-fail
1818//@ compile-flags: -Zmir-opt-level=1 -Zinline-mir
1919
tests/ui/lint/large_assignments/large_future.rs+1-1
......@@ -5,7 +5,7 @@
55//@ only-64bit
66//@ revisions: attribute option
77//@ [option]compile-flags: -Zmove-size-limit=1000
8//@ ignore-parallel-frontend post-monomorphization errors
8
99//@ edition:2018
1010//@ compile-flags: -Zmir-opt-level=0
1111
tests/ui/lint/large_assignments/move_into_fn.rs+1-1
......@@ -1,5 +1,5 @@
11//@ build-fail
2//@ ignore-parallel-frontend post-monomorphization errors
2
33#![feature(large_assignments)]
44#![move_size_limit = "1000"]
55#![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.
12//@ check-pass
23
3#![feature(new_range_api_legacy)]
4
54fn main() {
65 // Unchanged
76 let a: core::ops::RangeFull = ..;
87 let b: core::ops::RangeTo<u8> = ..2;
98
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;
1311
1412 // Changed
1513 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.
12//@ check-pass
23
34#![feature(new_range)]
......@@ -7,9 +8,8 @@ fn main() {
78 let a: core::ops::RangeFull = ..;
89 let b: core::ops::RangeTo<u8> = ..2;
910
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;
1313
1414 // Changed
1515 let a: core::range::RangeFrom<u8> = 1..;
tests/ui/parser/dyn-2015-identifier.fail.stderr created+80
......@@ -0,0 +1,80 @@
1error[E0425]: cannot find type `dyn` in this scope
2 --> $DIR/dyn-2015-identifier.rs:7:11
3 |
4LL | type A0 = dyn;
5 | ^^^ not found in this scope
6
7error[E0425]: cannot find type `dyn` in this scope
8 --> $DIR/dyn-2015-identifier.rs:13:11
9 |
10LL | type A2 = dyn<dyn, dyn>;
11 | ^^^ not found in this scope
12
13error[E0425]: cannot find type `dyn` in this scope
14 --> $DIR/dyn-2015-identifier.rs:13:15
15 |
16LL | type A2 = dyn<dyn, dyn>;
17 | ^^^ not found in this scope
18
19error[E0425]: cannot find type `dyn` in this scope
20 --> $DIR/dyn-2015-identifier.rs:13:20
21 |
22LL | type A2 = dyn<dyn, dyn>;
23 | ^^^ not found in this scope
24
25error[E0425]: cannot find type `dyn` in this scope
26 --> $DIR/dyn-2015-identifier.rs:18:11
27 |
28LL | type A3 = dyn<<dyn as dyn>::dyn>;
29 | ^^^ not found in this scope
30
31error[E0405]: cannot find trait `dyn` in this scope
32 --> $DIR/dyn-2015-identifier.rs:18:23
33 |
34LL | type A3 = dyn<<dyn as dyn>::dyn>;
35 | ^^^ not found in this scope
36
37error[E0425]: cannot find type `dyn` in this scope
38 --> $DIR/dyn-2015-identifier.rs:18:16
39 |
40LL | type A3 = dyn<<dyn as dyn>::dyn>;
41 | ^^^ not found in this scope
42
43error[E0405]: cannot find trait `dyn` in this scope
44 --> $DIR/dyn-2015-identifier.rs:24:11
45 |
46LL | type A4 = dyn + dyn;
47 | ^^^ not found in this scope
48
49error[E0405]: cannot find trait `dyn` in this scope
50 --> $DIR/dyn-2015-identifier.rs:24:17
51 |
52LL | type A4 = dyn + dyn;
53 | ^^^ not found in this scope
54
55warning: trait objects without an explicit `dyn` are deprecated
56 --> $DIR/dyn-2015-identifier.rs:24:11
57 |
58LL | 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
64help: if this is a dyn-compatible trait, use `dyn`
65 |
66LL | type A4 = dyn dyn + dyn;
67 | +++
68
69error[E0433]: cannot find module or crate `dyn` in this scope
70 --> $DIR/dyn-2015-identifier.rs:10:11
71 |
72LL | 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
77error: aborting due to 10 previous errors; 1 warning emitted
78
79Some errors have detailed explanations: E0405, E0425, E0433.
80For 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
7type A0 = dyn;
8//[fail]~^ ERROR cannot find type `dyn` in this scope
9
10type A1 = dyn::dyn;
11//[fail]~^ ERROR cannot find module or crate `dyn` in this scope
12
13type 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
18type 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>
24type 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
3type A0 = dyn;
4//~^ ERROR cannot find type `dyn` in this scope
5type A1 = dyn::dyn;
6//~^ ERROR cannot find module or crate `dyn` in this scope
7type 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
11type 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
16fn main() {}
tests/ui/parser/dyn-trait-compatibility.stderr deleted-54
......@@ -1,54 +0,0 @@
1error[E0425]: cannot find type `dyn` in this scope
2 --> $DIR/dyn-trait-compatibility.rs:3:11
3 |
4LL | type A0 = dyn;
5 | ^^^ not found in this scope
6
7error[E0425]: cannot find type `dyn` in this scope
8 --> $DIR/dyn-trait-compatibility.rs:7:11
9 |
10LL | type A2 = dyn<dyn, dyn>;
11 | ^^^ not found in this scope
12
13error[E0425]: cannot find type `dyn` in this scope
14 --> $DIR/dyn-trait-compatibility.rs:7:15
15 |
16LL | type A2 = dyn<dyn, dyn>;
17 | ^^^ not found in this scope
18
19error[E0425]: cannot find type `dyn` in this scope
20 --> $DIR/dyn-trait-compatibility.rs:7:20
21 |
22LL | type A2 = dyn<dyn, dyn>;
23 | ^^^ not found in this scope
24
25error[E0425]: cannot find type `dyn` in this scope
26 --> $DIR/dyn-trait-compatibility.rs:11:11
27 |
28LL | type A3 = dyn<<dyn as dyn>::dyn>;
29 | ^^^ not found in this scope
30
31error[E0405]: cannot find trait `dyn` in this scope
32 --> $DIR/dyn-trait-compatibility.rs:11:23
33 |
34LL | type A3 = dyn<<dyn as dyn>::dyn>;
35 | ^^^ not found in this scope
36
37error[E0425]: cannot find type `dyn` in this scope
38 --> $DIR/dyn-trait-compatibility.rs:11:16
39 |
40LL | type A3 = dyn<<dyn as dyn>::dyn>;
41 | ^^^ not found in this scope
42
43error[E0433]: cannot find module or crate `dyn` in this scope
44 --> $DIR/dyn-trait-compatibility.rs:5:11
45 |
46LL | 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
51error: aborting due to 8 previous errors
52
53Some errors have detailed explanations: E0405, E0425, E0433.
54For 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::{
77 RangeFrom,
88 RangeFromIter,
99 Range,
10 legacy,
1011};
1112
1213fn range_inclusive(mut r: RangeInclusive<usize>) {
......@@ -60,8 +61,4 @@ fn range(mut r: Range<usize>) {
6061 i.remainder(); //~ ERROR unstable
6162}
6263
63// Unstable module
64
65use std::range::legacy; //~ ERROR unstable
66
6764fn main() {}
tests/ui/range/new_range_stability.stderr+4-14
......@@ -1,15 +1,5 @@
1error[E0658]: use of unstable library feature `new_range_api_legacy`
2 --> $DIR/new_range_stability.rs:65:5
3 |
4LL | 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
111error[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
133 |
144LL | i.remainder();
155 | ^^^^^^^^^
......@@ -19,7 +9,7 @@ LL | i.remainder();
199 = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
2010
2111error[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
2313 |
2414LL | i.remainder();
2515 | ^^^^^^^^^
......@@ -29,7 +19,7 @@ LL | i.remainder();
2919 = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
3020
3121error[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
3323 |
3424LL | i.remainder();
3525 | ^^^^^^^^^
......@@ -38,6 +28,6 @@ LL | i.remainder();
3828 = help: add `#![feature(new_range_remainder)]` to the crate attributes to enable
3929 = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
4030
41error: aborting due to 4 previous errors
31error: aborting due to 3 previous errors
4232
4333For 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
3trait Trait {}
4
5fn 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 @@
1error: comptime fns can only be called at compile time
2 --> $DIR/reflection_methods_in_runtime_code.rs:7:5
3 |
4LL | std::any::TypeId::of::<[u8; usize::MAX]>().trait_info_of::<dyn Trait>();
5 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6
7error: aborting due to 1 previous error
8
tests/ui/simd/const-err-trumps-simd-err.rs+1-1
......@@ -1,6 +1,6 @@
11//@build-fail
22//@ dont-require-annotations: NOTE
3//@ ignore-parallel-frontend post-monomorphization errors
3
44//! Make sure that monomorphization-time const errors from `static_assert` take priority over the
55//! error from simd_extract. Basically this checks that if a const fails to evaluate in some
66//! function, we don't bother codegen'ing the function.
tests/ui/structs/default-field-values/post-mono.rs+1-1
......@@ -1,6 +1,6 @@
11//@ build-fail
22//@ revisions: direct indirect
3//@ ignore-parallel-frontend post-monomorphization errors
3
44#![feature(default_field_values)]
55
66struct 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
8struct S<T: ?Sized>(T);
9
10fn should_fail_1() {
11 let ref y @ [ref x, _]; //~ ERROR E0277
12 x = "";
13}
14
15fn should_fail_2() {
16 let [ref x]; //~ ERROR E0277
17 x = "";
18}
19
20fn should_fail_3() {
21 let [[ref x], [_, y @ ..]]; //~ ERROR E0277
22 x = "";
23 y = [];
24}
25
26fn should_fail_4() {
27 let [(ref a, b), x]; //~ ERROR E0277
28 a = "";
29 b = 5;
30}
31
32fn should_fail_5() {
33 let (ref a, b); //~ ERROR E0277
34 a = "";
35 b = 5;
36}
37
38fn should_fail_6() {
39 let [S(ref x)]; //~ ERROR E0277
40 x = "";
41}
42
43fn should_pass_1() {
44 let ref x;
45 x = "";
46}
47
48fn should_pass_2() {
49 let ref y @ (ref x,);
50 x = "";
51}
52
53fn should_pass_3() {
54 let S(ref x);
55 x = "";
56}
57
58fn main() {}
tests/ui/wf/let-pat-inferred-non-wf.stderr created+62
......@@ -0,0 +1,62 @@
1error[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 |
4LL | 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
10error[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 |
13LL | 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
19error[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 |
22LL | 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
28error[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 |
31LL | 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
37error[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 |
40LL | 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
46error[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 |
49LL | 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`
53note: required because it appears within the type `S<str>`
54 --> $DIR/let-pat-inferred-non-wf.rs:8:8
55 |
56LL | struct S<T: ?Sized>(T);
57 | ^
58 = note: slice and array elements must have `Sized` type
59
60error: aborting due to 6 previous errors
61
62For 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
14trait HasConst<'a, const N: usize> {}
15
16fn 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
19fn main() {}
tests/ui/wf/wf-dyn-in-hrtb-bound-const-mismatch.stderr created+14
......@@ -0,0 +1,14 @@
1error: the constant `B` is not of type `usize`
2 --> $DIR/wf-dyn-in-hrtb-bound-const-mismatch.rs:16:30
3 |
4LL | fn nested<const B: bool>(_f: &dyn for<'a> Fn(&'a (), &'a dyn HasConst<'a, B>)) {}
5 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `bool`
6 |
7note: required by a const generic parameter in `HasConst`
8 --> $DIR/wf-dyn-in-hrtb-bound-const-mismatch.rs:14:20
9 |
10LL | trait HasConst<'a, const N: usize> {}
11 | ^^^^^^^^^^^^^^ required by this const generic parameter in `HasConst`
12
13error: 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
17use std::fmt;
18
19fn call<F>(mut f: F)
20where
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
26fn main() {
27 call(|cb| cb(&0i32));
28}
yarn.lock+217-887
......@@ -2,49 +2,21 @@
22# yarn lockfile v1
33
44
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
335"@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==
379 dependencies:
3810 eslint-visitor-keys "^3.4.3"
3911
4012"@eslint-community/regexpp@^4.6.1":
4113 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"
4315 integrity sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew==
4416
4517"@eslint/eslintrc@^2.1.4":
4618 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"
4820 integrity sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==
4921 dependencies:
5022 ajv "^6.12.4"
......@@ -59,12 +31,12 @@
5931
6032"@eslint/js@8.57.1":
6133 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"
6335 integrity sha512-d9zaMRSTIKDLhctzH12MtXvJKSSUhaHcjV+2Z+GK+EEY7XKpP5yR4x+N3TAcHTcu963nIr+TMcCb4DBCYX1z6Q==
6436
6537"@humanwhocodes/config-array@^0.13.0":
6638 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"
6840 integrity sha512-DZLEEqFWQFiyK6h5YIeynKx7JlvCYWL0cImfSRXZ9l4Sg2efkFGTuFf6vzXjK1cq6IYkU+Eg/JizXw+TD2vRNw==
6941 dependencies:
7042 "@humanwhocodes/object-schema" "^2.0.3"
......@@ -73,17 +45,17 @@
7345
7446"@humanwhocodes/module-importer@^1.0.1":
7547 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"
7749 integrity sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==
7850
7951"@humanwhocodes/object-schema@^2.0.3":
8052 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"
8254 integrity sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==
8355
8456"@nodelib/fs.scandir@2.1.5":
8557 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"
8759 integrity sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==
8860 dependencies:
8961 "@nodelib/fs.stat" "2.0.5"
......@@ -91,93 +63,44 @@
9163
9264"@nodelib/fs.stat@2.0.5", "@nodelib/fs.stat@^2.0.2":
9365 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"
9567 integrity sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==
9668
9769"@nodelib/fs.walk@^1.2.3", "@nodelib/fs.walk@^1.2.8":
9870 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"
10072 integrity sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==
10173 dependencies:
10274 "@nodelib/fs.scandir" "2.1.5"
10375 fastq "^1.6.0"
10476
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==
10981 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"
11683 yargs "^17.7.2"
11784
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
15085"@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==
15489
15590acorn-jsx@^5.3.2:
15691 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"
15893 integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==
15994
160acorn-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
167acorn@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
172agent-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==
95acorn@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==
17699
177100ajv@^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==
181104 dependencies:
182105 fast-deep-equal "^3.1.1"
183106 fast-json-stable-stringify "^2.0.0"
......@@ -186,165 +109,75 @@ ajv@^6.12.4:
186109
187110ansi-regex@^5.0.1:
188111 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"
190113 integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==
191114
192115ansi-styles@^4.0.0, ansi-styles@^4.1.0:
193116 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"
195118 integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==
196119 dependencies:
197120 color-convert "^2.0.1"
198121
199122argparse@^2.0.1:
200123 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"
202125 integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==
203126
204ast-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
211async@^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
216b4a@^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
221127balanced-match@^1.0.0:
222128 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"
224130 integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==
225131
226bare-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
231bare-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
242bare-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
247bare-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
254bare-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
261bare-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
268baseline-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
273basic-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
278132brace-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==
282136 dependencies:
283137 balanced-match "^1.0.0"
284138 concat-map "0.0.1"
285139
286140braces@^3.0.3:
287141 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"
289143 integrity sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==
290144 dependencies:
291145 fill-range "^7.1.1"
292146
293browser-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==
147browser-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==
297151 dependencies:
298152 css-unit-converter "^1.1.2"
299153 pngjs "^3.4.0"
300 puppeteer "^24.31.0"
154 puppeteer "^25.1.0"
301155 readline-sync "^1.4.10"
302156
303browserslist@^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
314buffer-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
319157callsites@^3.0.0:
320158 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"
322160 integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==
323161
324caniuse-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
329162chalk@^4.0.0:
330163 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"
332165 integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==
333166 dependencies:
334167 ansi-styles "^4.1.0"
335168 supports-color "^7.1.0"
336169
337chromium-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==
170chromium-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==
341174 dependencies:
342175 mitt "^3.0.1"
343176 zod "^3.24.1"
344177
345178cliui@^8.0.1:
346179 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"
348181 integrity sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==
349182 dependencies:
350183 string-width "^4.2.0"
......@@ -353,66 +186,24 @@ cliui@^8.0.1:
353186
354187color-convert@^2.0.1:
355188 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"
357190 integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==
358191 dependencies:
359192 color-name "~1.1.4"
360193
361color-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
368color-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
373194color-name@~1.1.4:
374195 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"
376197 integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==
377198
378color-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
385color@^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
393commander@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
398199concat-map@0.0.1:
399200 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"
401202 integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==
402203
403cosmiconfig@^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
413204cross-spawn@^7.0.2:
414205 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"
416207 integrity sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==
417208 dependencies:
418209 path-key "^3.1.0"
......@@ -421,121 +212,59 @@ cross-spawn@^7.0.2:
421212
422213css-unit-converter@^1.1.2:
423214 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"
425216 integrity sha512-IiJwMC8rdZE0+xiEZHeru6YoONC4rfPMqGm2W85jMIbkFvv5nFTwJVFHam2eFrN6txmoUYFAFXiv8ICVeTO0MA==
426217
427data-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
432debug@4, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2, debug@^4.3.4, debug@^4.4.3:
218debug@^4.3.1, debug@^4.3.2:
433219 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"
435221 integrity sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==
436222 dependencies:
437223 ms "^2.1.3"
438224
439225deep-is@^0.1.3:
440226 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"
442228 integrity sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==
443229
444degenerator@^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
453devtools-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==
230devtools-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==
457234
458235doctrine@^3.0.0:
459236 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"
461238 integrity sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==
462239 dependencies:
463240 esutils "^2.0.2"
464241
465electron-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
470242emoji-regex@^8.0.0:
471243 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"
473245 integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==
474246
475enabled@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
480end-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
487env-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
492error-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
499247es-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==
503251 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"
509253 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"
514254
515escalade@^3.1.1, escalade@^3.2.0:
255escalade@^3.1.1:
516256 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"
518258 integrity sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==
519259
520260escape-string-regexp@^4.0.0:
521261 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"
523263 integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==
524264
525escodegen@^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
536265eslint-scope@^7.2.2:
537266 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"
539268 integrity sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==
540269 dependencies:
541270 esrecurse "^4.3.0"
......@@ -543,12 +272,12 @@ eslint-scope@^7.2.2:
543272
544273eslint-visitor-keys@^3.4.1, eslint-visitor-keys@^3.4.3:
545274 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"
547276 integrity sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==
548277
549278eslint@^8.57.1:
550279 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"
552281 integrity sha512-ypowyDxpVSYpkXr9WPv2PAZCtNip1Mv5KTW0SCurXv/9iOpcrH9PaqUElksqEB6pChqHGDRCFTyrZlGhnLNGiA==
553282 dependencies:
554283 "@eslint-community/eslint-utils" "^4.2.0"
......@@ -592,78 +321,45 @@ eslint@^8.57.1:
592321
593322espree@^9.6.0, espree@^9.6.1:
594323 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"
596325 integrity sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==
597326 dependencies:
598327 acorn "^8.9.0"
599328 acorn-jsx "^5.3.2"
600329 eslint-visitor-keys "^3.4.1"
601330
602esprima@^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
607331esquery@^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==
611335 dependencies:
612336 estraverse "^5.1.0"
613337
614338esrecurse@^4.3.0:
615339 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"
617341 integrity sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==
618342 dependencies:
619343 estraverse "^5.2.0"
620344
621345estraverse@^5.1.0, estraverse@^5.2.0:
622346 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"
624348 integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==
625349
626350esutils@^2.0.2:
627351 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"
629353 integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==
630354
631events-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
638extract-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
649fast-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
654355fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3:
655356 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"
657358 integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==
658359
659fast-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
664360fast-glob@^3.3.3:
665361 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"
667363 integrity sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==
668364 dependencies:
669365 "@nodelib/fs.stat" "^2.0.2"
......@@ -674,50 +370,38 @@ fast-glob@^3.3.3:
674370
675371fast-json-stable-stringify@^2.0.0:
676372 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"
678374 integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==
679375
680376fast-levenshtein@^2.0.6:
681377 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"
683379 integrity sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==
684380
685381fastq@^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==
689385 dependencies:
690386 reusify "^1.0.4"
691387
692fd-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
699fecha@^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
704388file-entry-cache@^6.0.1:
705389 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"
707391 integrity sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==
708392 dependencies:
709393 flat-cache "^3.0.4"
710394
711395fill-range@^7.1.1:
712396 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"
714398 integrity sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==
715399 dependencies:
716400 to-regex-range "^5.0.1"
717401
718402find-up@^5.0.0:
719403 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"
721405 integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==
722406 dependencies:
723407 locate-path "^6.0.0"
......@@ -725,7 +409,7 @@ find-up@^5.0.0:
725409
726410flat-cache@^3.0.4:
727411 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"
729413 integrity sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==
730414 dependencies:
731415 flatted "^3.2.9"
......@@ -733,58 +417,37 @@ flat-cache@^3.0.4:
733417 rimraf "^3.0.2"
734418
735419flatted@^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
740fn.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==
744423
745424fs.realpath@^1.0.0:
746425 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"
748427 integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==
749428
750429get-caller-file@^2.0.5:
751430 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"
753432 integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==
754433
755get-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
762get-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
771434glob-parent@^5.1.2:
772435 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"
774437 integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==
775438 dependencies:
776439 is-glob "^4.0.1"
777440
778441glob-parent@^6.0.2:
779442 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"
781444 integrity sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==
782445 dependencies:
783446 is-glob "^4.0.3"
784447
785448glob@^7.1.3:
786449 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"
788451 integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==
789452 dependencies:
790453 fs.realpath "^1.0.0"
......@@ -796,45 +459,29 @@ glob@^7.1.3:
796459
797460globals@^13.19.0:
798461 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"
800463 integrity sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==
801464 dependencies:
802465 type-fest "^0.20.2"
803466
804467graphemer@^1.4.0:
805468 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"
807470 integrity sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==
808471
809472has-flag@^4.0.0:
810473 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"
812475 integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==
813476
814http-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
822https-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
830477ignore@^5.2.0:
831478 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"
833480 integrity sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==
834481
835import-fresh@^3.2.1, import-fresh@^3.3.0:
482import-fresh@^3.2.1:
836483 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"
838485 integrity sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==
839486 dependencies:
840487 parent-module "^1.0.0"
......@@ -842,116 +489,86 @@ import-fresh@^3.2.1, import-fresh@^3.3.0:
842489
843490imurmurhash@^0.1.4:
844491 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"
846493 integrity sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==
847494
848495inflight@^1.0.4:
849496 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"
851498 integrity sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==
852499 dependencies:
853500 once "^1.3.0"
854501 wrappy "1"
855502
856inherits@2, inherits@^2.0.3:
503inherits@2:
857504 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"
859506 integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==
860507
861ip-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
866is-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
871508is-extglob@^2.1.1:
872509 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"
874511 integrity sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==
875512
876513is-fullwidth-code-point@^3.0.0:
877514 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"
879516 integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==
880517
881518is-glob@^4.0.0, is-glob@^4.0.1, is-glob@^4.0.3:
882519 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"
884521 integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==
885522 dependencies:
886523 is-extglob "^2.1.1"
887524
888525is-number@^7.0.0:
889526 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"
891528 integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==
892529
893530is-path-inside@^3.0.3:
894531 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"
896533 integrity sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==
897534
898is-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
903535isexe@^2.0.0:
904536 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"
906538 integrity sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==
907539
908js-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
913540js-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==
917544 dependencies:
918545 argparse "^2.0.1"
919546
920547json-buffer@3.0.1:
921548 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"
923550 integrity sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==
924551
925json-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
930552json-schema-traverse@^0.4.1:
931553 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"
933555 integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==
934556
935557json-stable-stringify-without-jsonify@^1.0.1:
936558 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"
938560 integrity sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==
939561
940562keyv@^4.5.3:
941563 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"
943565 integrity sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==
944566 dependencies:
945567 json-buffer "3.0.1"
946568
947kuler@^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
952569levn@^0.4.1:
953570 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"
955572 integrity sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==
956573 dependencies:
957574 prelude-ls "^1.2.1"
......@@ -959,105 +576,71 @@ levn@^0.4.1:
959576
960577lilconfig@^3.1.3:
961578 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"
963580 integrity sha512-/vlFKAoH5Cgt3Ie+JLhRbwOsCQePABiU3tJ1egGvyQ+33R/vcwM2Zl2QR/LzjsBeItPt3oSVXapn+m4nQDvpzw==
964581
965lines-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
970582locate-path@^6.0.0:
971583 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"
973585 integrity sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==
974586 dependencies:
975587 p-locate "^5.0.0"
976588
977589lodash.merge@^4.6.2:
978590 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"
980592 integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==
981593
982logform@^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
994lru-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
999594merge2@^1.3.0:
1000595 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"
1002597 integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==
1003598
1004599micromatch@^4.0.8:
1005600 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"
1007602 integrity sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==
1008603 dependencies:
1009604 braces "^3.0.3"
1010605 picomatch "^2.3.1"
1011606
1012607minimatch@^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==
1016611 dependencies:
1017612 brace-expansion "^1.1.7"
1018613
1019614mitt@^3.0.1:
1020615 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"
1022617 integrity sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==
1023618
1024ms@^2.1.1, ms@^2.1.3:
619modern-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
624ms@^2.1.3:
1025625 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"
1027627 integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==
1028628
1029629natural-compare@^1.4.0:
1030630 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"
1032632 integrity sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==
1033633
1034netmask@^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
1039node-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
1044once@^1.3.0, once@^1.3.1, once@^1.4.0:
634once@^1.3.0:
1045635 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"
1047637 integrity sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==
1048638 dependencies:
1049639 wrappy "1"
1050640
1051one-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
1058641optionator@^0.9.3:
1059642 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"
1061644 integrity sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==
1062645 dependencies:
1063646 deep-is "^0.1.3"
......@@ -1069,469 +652,224 @@ optionator@^0.9.3:
1069652
1070653p-limit@^3.0.2:
1071654 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"
1073656 integrity sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==
1074657 dependencies:
1075658 yocto-queue "^0.1.0"
1076659
1077660p-locate@^5.0.0:
1078661 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"
1080663 integrity sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==
1081664 dependencies:
1082665 p-limit "^3.0.2"
1083666
1084pac-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
1098pac-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
1106667parent-module@^1.0.0:
1107668 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"
1109670 integrity sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==
1110671 dependencies:
1111672 callsites "^3.0.0"
1112673
1113parse-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
1123674path-exists@^4.0.0:
1124675 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"
1126677 integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==
1127678
1128679path-is-absolute@^1.0.0:
1129680 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"
1131682 integrity sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==
1132683
1133684path-key@^3.1.0:
1134685 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"
1136687 integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==
1137688
1138pend@~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
1143picocolors@^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
1148689picomatch@^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==
1152693
1153694pngjs@^3.4.0:
1154695 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"
1156697 integrity sha512-NCrCHhWmnQklfH4MtJMRjZ2a8c80qXeMlQMv2uVp9ISJMTt562SbGd6n2oq0PaPgKm7Z6pL9E2UlLIhC+SHL3w==
1157698
1158699prelude-ls@^1.2.1:
1159700 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"
1161702 integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==
1162703
1163progress@^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
1168proxy-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
1182proxy-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
1187pump@^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
1195704punycode@^2.1.0:
1196705 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"
1198707 integrity sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==
1199708
1200puppeteer-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
1213puppeteer@^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"
709puppeteer-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
721puppeteer@^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"
1224732
1225733queue-microtask@^1.2.2:
1226734 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"
1228736 integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==
1229737
1230readable-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
1239738readline-sync@^1.4.10:
1240739 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"
1242741 integrity sha512-gNva8/6UAe8QYepIQH/jQ2qn91Qj0B9sYjMBBs3QOB8F2CXcKgLxQaJRP76sWVRQt+QU+8fAkCbCvjjMFu7Ycw==
1243742
1244743require-directory@^2.1.1:
1245744 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"
1247746 integrity sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==
1248747
1249748resolve-from@^4.0.0:
1250749 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"
1252751 integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==
1253752
1254753reusify@^1.0.4:
1255754 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"
1257756 integrity sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==
1258757
1259758rimraf@^3.0.2:
1260759 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"
1262761 integrity sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==
1263762 dependencies:
1264763 glob "^7.1.3"
1265764
1266765run-parallel@^1.1.9:
1267766 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"
1269768 integrity sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==
1270769 dependencies:
1271770 queue-microtask "^1.2.2"
1272771
1273safe-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
1278safe-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
1283semver@^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
1288772shebang-command@^2.0.0:
1289773 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"
1291775 integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==
1292776 dependencies:
1293777 shebang-regex "^3.0.0"
1294778
1295779shebang-regex@^3.0.0:
1296780 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"
1298782 integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==
1299783
1300smart-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
1305socks-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
1314socks@^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
1322source-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
1327source-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
1332stack-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
1337streamx@^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
1346784string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
1347785 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"
1349787 integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
1350788 dependencies:
1351789 emoji-regex "^8.0.0"
1352790 is-fullwidth-code-point "^3.0.0"
1353791 strip-ansi "^6.0.1"
1354792
1355string_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
1362793strip-ansi@^6.0.0, strip-ansi@^6.0.1:
1363794 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"
1365796 integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
1366797 dependencies:
1367798 ansi-regex "^5.0.1"
1368799
1369800strip-json-comments@^3.1.1:
1370801 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"
1372803 integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==
1373804
1374supports-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
1381805supports-color@^7.1.0:
1382806 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"
1384808 integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==
1385809 dependencies:
1386810 has-flag "^4.0.0"
1387811
1388tar-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
1399tar-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
1408text-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
1415text-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
1420812text-table@^0.2.0:
1421813 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"
1423815 integrity sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==
1424816
1425817to-regex-range@^5.0.1:
1426818 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"
1428820 integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==
1429821 dependencies:
1430822 is-number "^7.0.0"
1431823
1432triple-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
1437tslib@^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
1442824type-check@^0.4.0, type-check@~0.4.0:
1443825 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"
1445827 integrity sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==
1446828 dependencies:
1447829 prelude-ls "^1.2.1"
1448830
1449831type-fest@^0.20.2:
1450832 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"
1452834 integrity sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==
1453835
1454typed-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==
836typed-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==
1458840
1459841typescript@^5.8.3:
1460842 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"
1462844 integrity sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==
1463845
1464undici-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
1469update-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
1477846uri-js@^4.2.2:
1478847 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"
1480849 integrity sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==
1481850 dependencies:
1482851 punycode "^2.1.0"
1483852
1484util-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
1489webdriver-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==
853webdriver-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==
1493857
1494858which@^2.0.1:
1495859 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"
1497861 integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==
1498862 dependencies:
1499863 isexe "^2.0.0"
1500864
1501winston-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
1510winston@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
1527865word-wrap@^1.2.5:
1528866 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"
1530868 integrity sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==
1531869
1532870wrap-ansi@^7.0.0:
1533871 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"
1535873 integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
1536874 dependencies:
1537875 ansi-styles "^4.0.0"
......@@ -1540,27 +878,27 @@ wrap-ansi@^7.0.0:
1540878
1541879wrappy@1:
1542880 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"
1544882 integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==
1545883
1546ws@^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==
884ws@^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==
1550888
1551889y18n@^5.0.5:
1552890 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"
1554892 integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==
1555893
1556894yargs-parser@^21.1.1:
1557895 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"
1559897 integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==
1560898
1561899yargs@^17.7.2:
1562900 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"
1564902 integrity sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==
1565903 dependencies:
1566904 cliui "^8.0.1"
......@@ -1571,20 +909,12 @@ yargs@^17.7.2:
1571909 y18n "^5.0.5"
1572910 yargs-parser "^21.1.1"
1573911
1574yauzl@^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
1582912yocto-queue@^0.1.0:
1583913 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"
1585915 integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==
1586916
1587917zod@^3.24.1:
1588918 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"
1590920 integrity sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==