| author | bors <bors@rust-lang.org> 2025-11-21 20:45:11 UTC |
| committer | bors <bors@rust-lang.org> 2025-11-21 20:45:11 UTC |
| log | 27b076af7e3e7a363975443d81dfa9ecee5a74ec |
| tree | 9513bd135f4878f1008605519298035a2d48d4dd |
| parent | e22dab387f6b4f6a87dfc54ac2f6013dddb41e68 |
| parent | 228b49e7916b18937b8e9dade04f0d52b53de834 |
Rollup of 7 pull requests
Successful merges:
- rust-lang/rust#146978 (Emit error when using path-segment keyword as cfg pred)
- rust-lang/rust#148719 (Allow unnormalized types in drop elaboration)
- rust-lang/rust#148795 (add `rust.rustflags` and per target `rustflags` options to `bootstrap.toml`)
- rust-lang/rust#149028 ([rustdoc] Remove `UrlFragment::render` method to unify `clean::types::links` and `anchor`)
- rust-lang/rust#149043 ( rustdoc-json: add rlib path to ExternalCrate to enable robust crate resolution)
- rust-lang/rust#149098 (Fix error message for calling a non-tuple struct)
- rust-lang/rust#149151 (Add test for importing path-segment keyword)
r? `@ghost`
`@rustbot` modify labels: rollup86 files changed, 4177 insertions(+), 1619 deletions(-)
Cargo.lock+1| ... | ... | @@ -3336,6 +3336,7 @@ dependencies = [ |
| 3336 | 3336 | "libc", |
| 3337 | 3337 | "object 0.37.3", |
| 3338 | 3338 | "regex", |
| 3339 | "rustdoc-json-types", | |
| 3339 | 3340 | "serde_json", |
| 3340 | 3341 | "similar", |
| 3341 | 3342 | "wasmparser 0.236.1", |
bootstrap.example.toml+12| ... | ... | @@ -708,6 +708,12 @@ |
| 708 | 708 | # desired in distributions, for example. |
| 709 | 709 | #rust.rpath = true |
| 710 | 710 | |
| 711 | # Additional flags to pass to `rustc`. | |
| 712 | # Takes precedence over bootstrap's own flags but not over per target rustflags nor env. vars. like RUSTFLAGS. | |
| 713 | # Applies to all stages and targets. | |
| 714 | # | |
| 715 | #rust.rustflags = [] | |
| 716 | ||
| 711 | 717 | # Indicates whether symbols should be stripped using `-Cstrip=symbols`. |
| 712 | 718 | #rust.strip = false |
| 713 | 719 | |
| ... | ... | @@ -1013,6 +1019,12 @@ |
| 1013 | 1019 | # and will override the same option under [rust] section. It only works on Unix platforms |
| 1014 | 1020 | #rpath = rust.rpath (bool) |
| 1015 | 1021 | |
| 1022 | # Additional flags to pass to `rustc`. | |
| 1023 | # Takes precedence over bootstrap's own flags and `rust.rustflags` but not over env. vars. like RUSTFLAGS. | |
| 1024 | # Applies to all stages. | |
| 1025 | # | |
| 1026 | #rustflags = rust.rustflags | |
| 1027 | ||
| 1016 | 1028 | # Force static or dynamic linkage of the standard library for this target. If |
| 1017 | 1029 | # this target is a host for rustc, this will also affect the linkage of the |
| 1018 | 1030 | # compiler itself. This is useful for building rustc on targets that normally |
compiler/rustc_attr_parsing/src/attributes/cfg.rs+3-2| ... | ... | @@ -82,7 +82,8 @@ pub fn parse_cfg_entry<S: Stage>( |
| 82 | 82 | } |
| 83 | 83 | }, |
| 84 | 84 | a @ (ArgParser::NoArgs | ArgParser::NameValue(_)) => { |
| 85 | let Some(name) = meta.path().word_sym() else { | |
| 85 | let Some(name) = meta.path().word_sym().filter(|s| !s.is_path_segment_keyword()) | |
| 86 | else { | |
| 86 | 87 | return Err(cx.expected_identifier(meta.path().span())); |
| 87 | 88 | }; |
| 88 | 89 | parse_name_value(name, meta.path().span(), a.name_value(), meta.span(), cx)? |
| ... | ... | @@ -158,7 +159,7 @@ fn parse_cfg_entry_target<S: Stage>( |
| 158 | 159 | }; |
| 159 | 160 | |
| 160 | 161 | // Then, parse it as a name-value item |
| 161 | let Some(name) = sub_item.path().word_sym() else { | |
| 162 | let Some(name) = sub_item.path().word_sym().filter(|s| !s.is_path_segment_keyword()) else { | |
| 162 | 163 | return Err(cx.expected_identifier(sub_item.path().span())); |
| 163 | 164 | }; |
| 164 | 165 | let name = Symbol::intern(&format!("target_{name}")); |
compiler/rustc_attr_parsing/src/attributes/cfg_old.rs+4-1| ... | ... | @@ -220,7 +220,10 @@ pub fn eval_condition( |
| 220 | 220 | } |
| 221 | 221 | } |
| 222 | 222 | } |
| 223 | MetaItemKind::Word | MetaItemKind::NameValue(..) if cfg.path.segments.len() != 1 => { | |
| 223 | MetaItemKind::Word | MetaItemKind::NameValue(..) | |
| 224 | if cfg.path.segments.len() != 1 | |
| 225 | || cfg.path.segments[0].ident.is_path_segment_keyword() => | |
| 226 | { | |
| 224 | 227 | dcx.emit_err(session_diagnostics::CfgPredicateIdentifier { span: cfg.path.span }); |
| 225 | 228 | true |
| 226 | 229 | } |
compiler/rustc_errors/src/emitter.rs+8-14| ... | ... | @@ -532,30 +532,24 @@ impl Emitter for HumanEmitter { |
| 532 | 532 | } |
| 533 | 533 | } |
| 534 | 534 | |
| 535 | /// An emitter that does nothing when emitting a non-fatal diagnostic. | |
| 536 | /// Fatal diagnostics are forwarded to `fatal_emitter` to avoid silent | |
| 537 | /// failures of rustc, as witnessed e.g. in issue #89358. | |
| 538 | pub struct FatalOnlyEmitter { | |
| 539 | pub fatal_emitter: Box<dyn Emitter + DynSend>, | |
| 540 | pub fatal_note: Option<String>, | |
| 535 | /// An emitter that adds a note to each diagnostic. | |
| 536 | pub struct EmitterWithNote { | |
| 537 | pub emitter: Box<dyn Emitter + DynSend>, | |
| 538 | pub note: String, | |
| 541 | 539 | } |
| 542 | 540 | |
| 543 | impl Emitter for FatalOnlyEmitter { | |
| 541 | impl Emitter for EmitterWithNote { | |
| 544 | 542 | fn source_map(&self) -> Option<&SourceMap> { |
| 545 | 543 | None |
| 546 | 544 | } |
| 547 | 545 | |
| 548 | 546 | fn emit_diagnostic(&mut self, mut diag: DiagInner, registry: &Registry) { |
| 549 | if diag.level == Level::Fatal { | |
| 550 | if let Some(fatal_note) = &self.fatal_note { | |
| 551 | diag.sub(Level::Note, fatal_note.clone(), MultiSpan::new()); | |
| 552 | } | |
| 553 | self.fatal_emitter.emit_diagnostic(diag, registry); | |
| 554 | } | |
| 547 | diag.sub(Level::Note, self.note.clone(), MultiSpan::new()); | |
| 548 | self.emitter.emit_diagnostic(diag, registry); | |
| 555 | 549 | } |
| 556 | 550 | |
| 557 | 551 | fn translator(&self) -> &Translator { |
| 558 | self.fatal_emitter.translator() | |
| 552 | self.emitter.translator() | |
| 559 | 553 | } |
| 560 | 554 | } |
| 561 | 555 |
compiler/rustc_interface/src/interface.rs+44-26| ... | ... | @@ -15,6 +15,7 @@ use rustc_middle::ty::CurrentGcx; |
| 15 | 15 | use rustc_middle::util::Providers; |
| 16 | 16 | use rustc_parse::lexer::StripTokens; |
| 17 | 17 | use rustc_parse::new_parser_from_source_str; |
| 18 | use rustc_parse::parser::Recovery; | |
| 18 | 19 | use rustc_parse::parser::attr::AllowLeadingUnsafe; |
| 19 | 20 | use rustc_query_impl::QueryCtxt; |
| 20 | 21 | use rustc_query_system::query::print_query_stack; |
| ... | ... | @@ -52,9 +53,9 @@ pub struct Compiler { |
| 52 | 53 | pub(crate) fn parse_cfg(dcx: DiagCtxtHandle<'_>, cfgs: Vec<String>) -> Cfg { |
| 53 | 54 | cfgs.into_iter() |
| 54 | 55 | .map(|s| { |
| 55 | let psess = ParseSess::with_fatal_emitter( | |
| 56 | let psess = ParseSess::emitter_with_note( | |
| 56 | 57 | vec![crate::DEFAULT_LOCALE_RESOURCE, rustc_parse::DEFAULT_LOCALE_RESOURCE], |
| 57 | format!("this error occurred on the command line: `--cfg={s}`"), | |
| 58 | format!("this occurred on the command line: `--cfg={s}`"), | |
| 58 | 59 | ); |
| 59 | 60 | let filename = FileName::cfg_spec_source_code(&s); |
| 60 | 61 | |
| ... | ... | @@ -62,36 +63,46 @@ pub(crate) fn parse_cfg(dcx: DiagCtxtHandle<'_>, cfgs: Vec<String>) -> Cfg { |
| 62 | 63 | ($reason: expr) => { |
| 63 | 64 | #[allow(rustc::untranslatable_diagnostic)] |
| 64 | 65 | #[allow(rustc::diagnostic_outside_of_impl)] |
| 65 | dcx.fatal(format!( | |
| 66 | concat!("invalid `--cfg` argument: `{}` (", $reason, ")"), | |
| 67 | s | |
| 68 | )); | |
| 66 | dcx.fatal(format!("invalid `--cfg` argument: `{s}` ({})", $reason)); | |
| 69 | 67 | }; |
| 70 | 68 | } |
| 71 | 69 | |
| 72 | 70 | match new_parser_from_source_str(&psess, filename, s.to_string(), StripTokens::Nothing) |
| 73 | 71 | { |
| 74 | Ok(mut parser) => match parser.parse_meta_item(AllowLeadingUnsafe::No) { | |
| 75 | Ok(meta_item) if parser.token == token::Eof => { | |
| 76 | if meta_item.path.segments.len() != 1 { | |
| 77 | error!("argument key must be an identifier"); | |
| 78 | } | |
| 79 | match &meta_item.kind { | |
| 80 | MetaItemKind::List(..) => {} | |
| 81 | MetaItemKind::NameValue(lit) if !lit.kind.is_str() => { | |
| 82 | error!("argument value must be a string"); | |
| 72 | Ok(mut parser) => { | |
| 73 | parser = parser.recovery(Recovery::Forbidden); | |
| 74 | match parser.parse_meta_item(AllowLeadingUnsafe::No) { | |
| 75 | Ok(meta_item) | |
| 76 | if parser.token == token::Eof | |
| 77 | && parser.dcx().has_errors().is_none() => | |
| 78 | { | |
| 79 | if meta_item.path.segments.len() != 1 { | |
| 80 | error!("argument key must be an identifier"); | |
| 83 | 81 | } |
| 84 | MetaItemKind::NameValue(..) | MetaItemKind::Word => { | |
| 85 | let ident = meta_item.ident().expect("multi-segment cfg key"); | |
| 86 | return (ident.name, meta_item.value_str()); | |
| 82 | match &meta_item.kind { | |
| 83 | MetaItemKind::List(..) => {} | |
| 84 | MetaItemKind::NameValue(lit) if !lit.kind.is_str() => { | |
| 85 | error!("argument value must be a string"); | |
| 86 | } | |
| 87 | MetaItemKind::NameValue(..) | MetaItemKind::Word => { | |
| 88 | let ident = meta_item.ident().expect("multi-segment cfg key"); | |
| 89 | ||
| 90 | if ident.is_path_segment_keyword() { | |
| 91 | error!( | |
| 92 | "malformed `cfg` input, expected a valid identifier" | |
| 93 | ); | |
| 94 | } | |
| 95 | ||
| 96 | return (ident.name, meta_item.value_str()); | |
| 97 | } | |
| 87 | 98 | } |
| 88 | 99 | } |
| 100 | Ok(..) => {} | |
| 101 | Err(err) => err.cancel(), | |
| 89 | 102 | } |
| 90 | Ok(..) => {} | |
| 91 | Err(err) => err.cancel(), | |
| 92 | }, | |
| 103 | } | |
| 93 | 104 | Err(errs) => errs.into_iter().for_each(|err| err.cancel()), |
| 94 | } | |
| 105 | }; | |
| 95 | 106 | |
| 96 | 107 | // If the user tried to use a key="value" flag, but is missing the quotes, provide |
| 97 | 108 | // a hint about how to resolve this. |
| ... | ... | @@ -116,9 +127,9 @@ pub(crate) fn parse_check_cfg(dcx: DiagCtxtHandle<'_>, specs: Vec<String>) -> Ch |
| 116 | 127 | let mut check_cfg = CheckCfg { exhaustive_names, exhaustive_values, ..CheckCfg::default() }; |
| 117 | 128 | |
| 118 | 129 | for s in specs { |
| 119 | let psess = ParseSess::with_fatal_emitter( | |
| 130 | let psess = ParseSess::emitter_with_note( | |
| 120 | 131 | vec![crate::DEFAULT_LOCALE_RESOURCE, rustc_parse::DEFAULT_LOCALE_RESOURCE], |
| 121 | format!("this error occurred on the command line: `--check-cfg={s}`"), | |
| 132 | format!("this occurred on the command line: `--check-cfg={s}`"), | |
| 122 | 133 | ); |
| 123 | 134 | let filename = FileName::cfg_spec_source_code(&s); |
| 124 | 135 | |
| ... | ... | @@ -171,7 +182,7 @@ pub(crate) fn parse_check_cfg(dcx: DiagCtxtHandle<'_>, specs: Vec<String>) -> Ch |
| 171 | 182 | let mut parser = |
| 172 | 183 | match new_parser_from_source_str(&psess, filename, s.to_string(), StripTokens::Nothing) |
| 173 | 184 | { |
| 174 | Ok(parser) => parser, | |
| 185 | Ok(parser) => parser.recovery(Recovery::Forbidden), | |
| 175 | 186 | Err(errs) => { |
| 176 | 187 | errs.into_iter().for_each(|err| err.cancel()); |
| 177 | 188 | expected_error(); |
| ... | ... | @@ -179,7 +190,9 @@ pub(crate) fn parse_check_cfg(dcx: DiagCtxtHandle<'_>, specs: Vec<String>) -> Ch |
| 179 | 190 | }; |
| 180 | 191 | |
| 181 | 192 | let meta_item = match parser.parse_meta_item(AllowLeadingUnsafe::No) { |
| 182 | Ok(meta_item) if parser.token == token::Eof => meta_item, | |
| 193 | Ok(meta_item) if parser.token == token::Eof && parser.dcx().has_errors().is_none() => { | |
| 194 | meta_item | |
| 195 | } | |
| 183 | 196 | Ok(..) => expected_error(), |
| 184 | 197 | Err(err) => { |
| 185 | 198 | err.cancel(); |
| ... | ... | @@ -209,6 +222,11 @@ pub(crate) fn parse_check_cfg(dcx: DiagCtxtHandle<'_>, specs: Vec<String>) -> Ch |
| 209 | 222 | if values_specified { |
| 210 | 223 | error!("`cfg()` names cannot be after values"); |
| 211 | 224 | } |
| 225 | ||
| 226 | if ident.is_path_segment_keyword() { | |
| 227 | error!("malformed `cfg` input, expected a valid identifier"); | |
| 228 | } | |
| 229 | ||
| 212 | 230 | names.push(ident); |
| 213 | 231 | } else if let Some(boolean) = arg.boolean_literal() { |
| 214 | 232 | if values_specified { |
compiler/rustc_mir_transform/src/elaborate_drop.rs+6-13| ... | ... | @@ -511,19 +511,12 @@ where |
| 511 | 511 | let tcx = self.tcx(); |
| 512 | 512 | |
| 513 | 513 | assert_eq!(self.elaborator.typing_env().typing_mode, ty::TypingMode::PostAnalysis); |
| 514 | let field_ty = match tcx.try_normalize_erasing_regions( | |
| 515 | self.elaborator.typing_env(), | |
| 516 | field.ty(tcx, args), | |
| 517 | ) { | |
| 518 | Ok(t) => t, | |
| 519 | Err(_) => Ty::new_error( | |
| 520 | self.tcx(), | |
| 521 | self.tcx().dcx().span_delayed_bug( | |
| 522 | self.elaborator.body().span, | |
| 523 | "Error normalizing in drop elaboration.", | |
| 524 | ), | |
| 525 | ), | |
| 526 | }; | |
| 514 | let field_ty = field.ty(tcx, args); | |
| 515 | // We silently leave an unnormalized type here to support polymorphic drop | |
| 516 | // elaboration for users of rustc internal APIs | |
| 517 | let field_ty = tcx | |
| 518 | .try_normalize_erasing_regions(self.elaborator.typing_env(), field_ty) | |
| 519 | .unwrap_or(field_ty); | |
| 527 | 520 | |
| 528 | 521 | (tcx.mk_place_field(base_place, field_idx, field_ty), subpath) |
| 529 | 522 | }) |
compiler/rustc_parse/src/parser/mod.rs+1-1| ... | ... | @@ -466,7 +466,7 @@ impl<'a> Parser<'a> { |
| 466 | 466 | |
| 467 | 467 | // Public for rustfmt usage. |
| 468 | 468 | pub fn parse_ident(&mut self) -> PResult<'a, Ident> { |
| 469 | self.parse_ident_common(true) | |
| 469 | self.parse_ident_common(self.may_recover()) | |
| 470 | 470 | } |
| 471 | 471 | |
| 472 | 472 | fn parse_ident_common(&mut self, recover: bool) -> PResult<'a, Ident> { |
compiler/rustc_resolve/src/late/diagnostics.rs+24-3| ... | ... | @@ -823,8 +823,16 @@ impl<'ast, 'ra, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> { |
| 823 | 823 | } |
| 824 | 824 | |
| 825 | 825 | if let Some(Res::Def(DefKind::Struct, def_id)) = res { |
| 826 | self.update_err_for_private_tuple_struct_fields(err, &source, def_id); | |
| 827 | err.note("constructor is not visible here due to private fields"); | |
| 826 | let private_fields = self.has_private_fields(def_id); | |
| 827 | let adjust_error_message = | |
| 828 | private_fields && self.is_struct_with_fn_ctor(def_id); | |
| 829 | if adjust_error_message { | |
| 830 | self.update_err_for_private_tuple_struct_fields(err, &source, def_id); | |
| 831 | } | |
| 832 | ||
| 833 | if private_fields { | |
| 834 | err.note("constructor is not visible here due to private fields"); | |
| 835 | } | |
| 828 | 836 | } else { |
| 829 | 837 | err.span_suggestion( |
| 830 | 838 | call_span, |
| ... | ... | @@ -1642,6 +1650,19 @@ impl<'ast, 'ra, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> { |
| 1642 | 1650 | } |
| 1643 | 1651 | } |
| 1644 | 1652 | |
| 1653 | fn is_struct_with_fn_ctor(&mut self, def_id: DefId) -> bool { | |
| 1654 | def_id | |
| 1655 | .as_local() | |
| 1656 | .and_then(|local_id| self.r.struct_constructors.get(&local_id)) | |
| 1657 | .map(|struct_ctor| { | |
| 1658 | matches!( | |
| 1659 | struct_ctor.0, | |
| 1660 | def::Res::Def(DefKind::Ctor(CtorOf::Struct, CtorKind::Fn), _) | |
| 1661 | ) | |
| 1662 | }) | |
| 1663 | .unwrap_or(false) | |
| 1664 | } | |
| 1665 | ||
| 1645 | 1666 | fn update_err_for_private_tuple_struct_fields( |
| 1646 | 1667 | &mut self, |
| 1647 | 1668 | err: &mut Diag<'_>, |
| ... | ... | @@ -1674,7 +1695,7 @@ impl<'ast, 'ra, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> { |
| 1674 | 1695 | *call_span, |
| 1675 | 1696 | &args[..], |
| 1676 | 1697 | ); |
| 1677 | // Use spans of the tuple struct definition. | |
| 1698 | ||
| 1678 | 1699 | self.r |
| 1679 | 1700 | .field_idents(def_id) |
| 1680 | 1701 | .map(|fields| fields.iter().map(|f| f.span).collect::<Vec<_>>()) |
compiler/rustc_session/src/parse.rs+4-8| ... | ... | @@ -8,7 +8,7 @@ use rustc_ast::attr::AttrIdGenerator; |
| 8 | 8 | use rustc_ast::node_id::NodeId; |
| 9 | 9 | use rustc_data_structures::fx::{FxHashMap, FxIndexMap, FxIndexSet}; |
| 10 | 10 | use rustc_data_structures::sync::{AppendOnlyVec, Lock}; |
| 11 | use rustc_errors::emitter::{FatalOnlyEmitter, HumanEmitter, stderr_destination}; | |
| 11 | use rustc_errors::emitter::{EmitterWithNote, HumanEmitter, stderr_destination}; | |
| 12 | 12 | use rustc_errors::translation::Translator; |
| 13 | 13 | use rustc_errors::{ |
| 14 | 14 | BufferedEarlyLint, ColorConfig, DecorateDiagCompat, Diag, DiagCtxt, DiagCtxtHandle, |
| ... | ... | @@ -315,16 +315,12 @@ impl ParseSess { |
| 315 | 315 | } |
| 316 | 316 | } |
| 317 | 317 | |
| 318 | pub fn with_fatal_emitter(locale_resources: Vec<&'static str>, fatal_note: String) -> Self { | |
| 318 | pub fn emitter_with_note(locale_resources: Vec<&'static str>, note: String) -> Self { | |
| 319 | 319 | let translator = Translator::with_fallback_bundle(locale_resources, false); |
| 320 | 320 | let sm = Arc::new(SourceMap::new(FilePathMapping::empty())); |
| 321 | let fatal_emitter = | |
| 321 | let emitter = | |
| 322 | 322 | Box::new(HumanEmitter::new(stderr_destination(ColorConfig::Auto), translator)); |
| 323 | let dcx = DiagCtxt::new(Box::new(FatalOnlyEmitter { | |
| 324 | fatal_emitter, | |
| 325 | fatal_note: Some(fatal_note), | |
| 326 | })) | |
| 327 | .disable_warnings(); | |
| 323 | let dcx = DiagCtxt::new(Box::new(EmitterWithNote { emitter, note })); | |
| 328 | 324 | ParseSess::with_dcx(dcx, sm) |
| 329 | 325 | } |
| 330 | 326 |
src/bootstrap/src/core/builder/cargo.rs+16| ... | ... | @@ -105,6 +105,7 @@ pub struct Cargo { |
| 105 | 105 | allow_features: String, |
| 106 | 106 | release_build: bool, |
| 107 | 107 | build_compiler_stage: u32, |
| 108 | extra_rustflags: Vec<String>, | |
| 108 | 109 | } |
| 109 | 110 | |
| 110 | 111 | impl Cargo { |
| ... | ... | @@ -403,6 +404,11 @@ impl From<Cargo> for BootstrapCommand { |
| 403 | 404 | cargo.args.insert(0, "--release".into()); |
| 404 | 405 | } |
| 405 | 406 | |
| 407 | for arg in &cargo.extra_rustflags { | |
| 408 | cargo.rustflags.arg(arg); | |
| 409 | cargo.rustdocflags.arg(arg); | |
| 410 | } | |
| 411 | ||
| 406 | 412 | // Propagate the envs here at the very end to make sure they override any previously set flags. |
| 407 | 413 | cargo.rustflags.propagate_rustflag_envs(cargo.build_compiler_stage); |
| 408 | 414 | cargo.rustdocflags.propagate_rustflag_envs(cargo.build_compiler_stage); |
| ... | ... | @@ -1379,6 +1385,15 @@ impl Builder<'_> { |
| 1379 | 1385 | rustflags.arg("-Zmir_strip_debuginfo=locals-in-tiny-functions"); |
| 1380 | 1386 | } |
| 1381 | 1387 | |
| 1388 | // take target-specific extra rustflags if any otherwise take `rust.rustflags` | |
| 1389 | let extra_rustflags = self | |
| 1390 | .config | |
| 1391 | .target_config | |
| 1392 | .get(&target) | |
| 1393 | .map(|t| &t.rustflags) | |
| 1394 | .unwrap_or(&self.config.rust_rustflags) | |
| 1395 | .clone(); | |
| 1396 | ||
| 1382 | 1397 | let release_build = self.config.rust_optimize.is_release() && |
| 1383 | 1398 | // cargo bench/install do not accept `--release` and miri doesn't want it |
| 1384 | 1399 | !matches!(cmd_kind, Kind::Bench | Kind::Install | Kind::Miri | Kind::MiriSetup | Kind::MiriTest); |
| ... | ... | @@ -1394,6 +1409,7 @@ impl Builder<'_> { |
| 1394 | 1409 | allow_features, |
| 1395 | 1410 | release_build, |
| 1396 | 1411 | build_compiler_stage, |
| 1412 | extra_rustflags, | |
| 1397 | 1413 | } |
| 1398 | 1414 | } |
| 1399 | 1415 | } |
src/bootstrap/src/core/config/config.rs+5| ... | ... | @@ -225,6 +225,7 @@ pub struct Config { |
| 225 | 225 | pub rust_std_features: BTreeSet<String>, |
| 226 | 226 | pub rust_break_on_ice: bool, |
| 227 | 227 | pub rust_parallel_frontend_threads: Option<u32>, |
| 228 | pub rust_rustflags: Vec<String>, | |
| 228 | 229 | |
| 229 | 230 | pub llvm_profile_use: Option<String>, |
| 230 | 231 | pub llvm_profile_generate: bool, |
| ... | ... | @@ -575,6 +576,7 @@ impl Config { |
| 575 | 576 | bootstrap_override_lld_legacy: rust_bootstrap_override_lld_legacy, |
| 576 | 577 | std_features: rust_std_features, |
| 577 | 578 | break_on_ice: rust_break_on_ice, |
| 579 | rustflags: rust_rustflags, | |
| 578 | 580 | } = toml.rust.unwrap_or_default(); |
| 579 | 581 | |
| 580 | 582 | let Llvm { |
| ... | ... | @@ -864,6 +866,7 @@ impl Config { |
| 864 | 866 | sanitizers: target_sanitizers, |
| 865 | 867 | profiler: target_profiler, |
| 866 | 868 | rpath: target_rpath, |
| 869 | rustflags: target_rustflags, | |
| 867 | 870 | crt_static: target_crt_static, |
| 868 | 871 | musl_root: target_musl_root, |
| 869 | 872 | musl_libdir: target_musl_libdir, |
| ... | ... | @@ -947,6 +950,7 @@ impl Config { |
| 947 | 950 | target.sanitizers = target_sanitizers; |
| 948 | 951 | target.profiler = target_profiler; |
| 949 | 952 | target.rpath = target_rpath; |
| 953 | target.rustflags = target_rustflags.unwrap_or_default(); | |
| 950 | 954 | target.optimized_compiler_builtins = target_optimized_compiler_builtins; |
| 951 | 955 | target.jemalloc = target_jemalloc; |
| 952 | 956 | if let Some(backends) = target_codegen_backends { |
| ... | ... | @@ -1441,6 +1445,7 @@ impl Config { |
| 1441 | 1445 | rust_randomize_layout: rust_randomize_layout.unwrap_or(false), |
| 1442 | 1446 | rust_remap_debuginfo: rust_remap_debuginfo.unwrap_or(false), |
| 1443 | 1447 | rust_rpath: rust_rpath.unwrap_or(true), |
| 1448 | rust_rustflags: rust_rustflags.unwrap_or_default(), | |
| 1444 | 1449 | rust_stack_protector, |
| 1445 | 1450 | rust_std_features: rust_std_features |
| 1446 | 1451 | .unwrap_or(BTreeSet::from([String::from("panic-unwind")])), |
src/bootstrap/src/core/config/toml/rust.rs+2| ... | ... | @@ -33,6 +33,7 @@ define_config! { |
| 33 | 33 | channel: Option<String> = "channel", |
| 34 | 34 | musl_root: Option<String> = "musl-root", |
| 35 | 35 | rpath: Option<bool> = "rpath", |
| 36 | rustflags: Option<Vec<String>> = "rustflags", | |
| 36 | 37 | strip: Option<bool> = "strip", |
| 37 | 38 | frame_pointers: Option<bool> = "frame-pointers", |
| 38 | 39 | stack_protector: Option<String> = "stack-protector", |
| ... | ... | @@ -375,6 +376,7 @@ pub fn check_incompatible_options_for_ci_rustc( |
| 375 | 376 | parallel_frontend_threads: _, |
| 376 | 377 | bootstrap_override_lld: _, |
| 377 | 378 | bootstrap_override_lld_legacy: _, |
| 379 | rustflags: _, | |
| 378 | 380 | } = ci_rust_config; |
| 379 | 381 | |
| 380 | 382 | // There are two kinds of checks for CI rustc incompatible options: |
src/bootstrap/src/core/config/toml/target.rs+2| ... | ... | @@ -37,6 +37,7 @@ define_config! { |
| 37 | 37 | sanitizers: Option<bool> = "sanitizers", |
| 38 | 38 | profiler: Option<StringOrBool> = "profiler", |
| 39 | 39 | rpath: Option<bool> = "rpath", |
| 40 | rustflags: Option<Vec<String>> = "rustflags", | |
| 40 | 41 | crt_static: Option<bool> = "crt-static", |
| 41 | 42 | musl_root: Option<String> = "musl-root", |
| 42 | 43 | musl_libdir: Option<String> = "musl-libdir", |
| ... | ... | @@ -70,6 +71,7 @@ pub struct Target { |
| 70 | 71 | pub sanitizers: Option<bool>, |
| 71 | 72 | pub profiler: Option<StringOrBool>, |
| 72 | 73 | pub rpath: Option<bool>, |
| 74 | pub rustflags: Vec<String>, | |
| 73 | 75 | pub crt_static: Option<bool>, |
| 74 | 76 | pub musl_root: Option<PathBuf>, |
| 75 | 77 | pub musl_libdir: Option<PathBuf>, |
src/bootstrap/src/utils/change_tracker.rs+5| ... | ... | @@ -596,4 +596,9 @@ pub const CONFIG_CHANGE_HISTORY: &[ChangeInfo] = &[ |
| 596 | 596 | severity: ChangeSeverity::Info, |
| 597 | 597 | summary: "The `-Zannotate-moves` option is now always enabled when building rustc, sysroot and tools.", |
| 598 | 598 | }, |
| 599 | ChangeInfo { | |
| 600 | change_id: 148795, | |
| 601 | severity: ChangeSeverity::Info, | |
| 602 | summary: "New options `rust.rustflags` for all targets and `rustflags` par target that will pass specified flags to rustc for all stages. Target specific flags override global `rust.rustflags` ones.", | |
| 603 | }, | |
| 599 | 604 | ]; |
src/librustdoc/clean/mod.rs+1-1| ... | ... | @@ -249,7 +249,7 @@ pub(crate) fn clean_trait_ref_with_constraints<'tcx>( |
| 249 | 249 | trait_ref: ty::PolyTraitRef<'tcx>, |
| 250 | 250 | constraints: ThinVec<AssocItemConstraint>, |
| 251 | 251 | ) -> Path { |
| 252 | let kind = cx.tcx.def_kind(trait_ref.def_id()).into(); | |
| 252 | let kind = ItemType::from_def_id(trait_ref.def_id(), cx.tcx); | |
| 253 | 253 | if !matches!(kind, ItemType::Trait | ItemType::TraitAlias) { |
| 254 | 254 | span_bug!(cx.tcx.def_span(trait_ref.def_id()), "`TraitRef` had unexpected kind {kind:?}"); |
| 255 | 255 | } |
src/librustdoc/clean/types.rs+11-2| ... | ... | @@ -1,3 +1,4 @@ |
| 1 | use std::fmt::Write; | |
| 1 | 2 | use std::hash::Hash; |
| 2 | 3 | use std::path::PathBuf; |
| 3 | 4 | use std::sync::{Arc, OnceLock as OnceCell}; |
| ... | ... | @@ -522,8 +523,16 @@ impl Item { |
| 522 | 523 | debug!(?id); |
| 523 | 524 | if let Ok(HrefInfo { mut url, .. }) = href(*id, cx) { |
| 524 | 525 | debug!(?url); |
| 525 | if let Some(ref fragment) = *fragment { | |
| 526 | fragment.render(&mut url, cx.tcx()) | |
| 526 | match fragment { | |
| 527 | Some(UrlFragment::Item(def_id)) => { | |
| 528 | write!(url, "{}", crate::html::format::fragment(*def_id, cx.tcx())) | |
| 529 | .unwrap(); | |
| 530 | } | |
| 531 | Some(UrlFragment::UserWritten(raw)) => { | |
| 532 | url.push('#'); | |
| 533 | url.push_str(raw); | |
| 534 | } | |
| 535 | None => {} | |
| 527 | 536 | } |
| 528 | 537 | Some(RenderedLink { |
| 529 | 538 | original_text: s.clone(), |
src/librustdoc/clean/utils.rs+4-3| ... | ... | @@ -26,6 +26,7 @@ use crate::clean::{ |
| 26 | 26 | }; |
| 27 | 27 | use crate::core::DocContext; |
| 28 | 28 | use crate::display::Joined as _; |
| 29 | use crate::formats::item_type::ItemType; | |
| 29 | 30 | |
| 30 | 31 | #[cfg(test)] |
| 31 | 32 | mod tests; |
| ... | ... | @@ -496,7 +497,7 @@ pub(crate) fn register_res(cx: &mut DocContext<'_>, res: Res) -> DefId { |
| 496 | 497 | |
| 497 | 498 | let (kind, did) = match res { |
| 498 | 499 | Res::Def( |
| 499 | kind @ (AssocTy | |
| 500 | AssocTy | |
| 500 | 501 | | AssocFn |
| 501 | 502 | | AssocConst |
| 502 | 503 | | Variant |
| ... | ... | @@ -511,9 +512,9 @@ pub(crate) fn register_res(cx: &mut DocContext<'_>, res: Res) -> DefId { |
| 511 | 512 | | Const |
| 512 | 513 | | Static { .. } |
| 513 | 514 | | Macro(..) |
| 514 | | TraitAlias), | |
| 515 | | TraitAlias, | |
| 515 | 516 | did, |
| 516 | ) => (kind.into(), did), | |
| 517 | ) => (ItemType::from_def_id(did, cx.tcx), did), | |
| 517 | 518 | |
| 518 | 519 | _ => panic!("register_res: unexpected {res:?}"), |
| 519 | 520 | }; |
src/librustdoc/formats/item_type.rs+12-12| ... | ... | @@ -3,6 +3,8 @@ |
| 3 | 3 | use std::fmt; |
| 4 | 4 | |
| 5 | 5 | use rustc_hir::def::{CtorOf, DefKind, MacroKinds}; |
| 6 | use rustc_hir::def_id::DefId; | |
| 7 | use rustc_middle::ty::TyCtxt; | |
| 6 | 8 | use rustc_span::hygiene::MacroKind; |
| 7 | 9 | use serde::{Deserialize, Deserializer, Serialize, Serializer, de}; |
| 8 | 10 | |
| ... | ... | @@ -147,17 +149,10 @@ impl<'a> From<&'a clean::Item> for ItemType { |
| 147 | 149 | } |
| 148 | 150 | } |
| 149 | 151 | |
| 150 | impl From<DefKind> for ItemType { | |
| 151 | fn from(other: DefKind) -> Self { | |
| 152 | Self::from_def_kind(other, None) | |
| 153 | } | |
| 154 | } | |
| 155 | ||
| 156 | 152 | impl ItemType { |
| 157 | /// Depending on the parent kind, some variants have a different translation (like a `Method` | |
| 158 | /// becoming a `TyMethod`). | |
| 159 | pub(crate) fn from_def_kind(kind: DefKind, parent_kind: Option<DefKind>) -> Self { | |
| 160 | match kind { | |
| 153 | pub(crate) fn from_def_id(def_id: DefId, tcx: TyCtxt<'_>) -> Self { | |
| 154 | let def_kind = tcx.def_kind(def_id); | |
| 155 | match def_kind { | |
| 161 | 156 | DefKind::Enum => Self::Enum, |
| 162 | 157 | DefKind::Fn => Self::Function, |
| 163 | 158 | DefKind::Mod => Self::Module, |
| ... | ... | @@ -176,8 +171,13 @@ impl ItemType { |
| 176 | 171 | DefKind::Variant => Self::Variant, |
| 177 | 172 | DefKind::Field => Self::StructField, |
| 178 | 173 | DefKind::AssocTy => Self::AssocType, |
| 179 | DefKind::AssocFn if let Some(DefKind::Trait) = parent_kind => Self::TyMethod, | |
| 180 | DefKind::AssocFn => Self::Method, | |
| 174 | DefKind::AssocFn => { | |
| 175 | if tcx.associated_item(def_id).defaultness(tcx).has_value() { | |
| 176 | Self::Method | |
| 177 | } else { | |
| 178 | Self::TyMethod | |
| 179 | } | |
| 180 | } | |
| 181 | 181 | DefKind::Ctor(CtorOf::Struct, _) => Self::Struct, |
| 182 | 182 | DefKind::Ctor(CtorOf::Variant, _) => Self::Variant, |
| 183 | 183 | DefKind::AssocConst => Self::AssocConst, |
src/librustdoc/html/format.rs+27-19| ... | ... | @@ -431,7 +431,6 @@ fn generate_item_def_id_path( |
| 431 | 431 | original_def_id: DefId, |
| 432 | 432 | cx: &Context<'_>, |
| 433 | 433 | root_path: Option<&str>, |
| 434 | original_def_kind: DefKind, | |
| 435 | 434 | ) -> Result<HrefInfo, HrefError> { |
| 436 | 435 | use rustc_middle::traits::ObligationCause; |
| 437 | 436 | use rustc_trait_selection::infer::TyCtxtInferExt; |
| ... | ... | @@ -457,15 +456,14 @@ fn generate_item_def_id_path( |
| 457 | 456 | let relative = clean::inline::item_relative_path(tcx, def_id); |
| 458 | 457 | let fqp: Vec<Symbol> = once(crate_name).chain(relative).collect(); |
| 459 | 458 | |
| 460 | let def_kind = tcx.def_kind(def_id); | |
| 461 | let shortty = def_kind.into(); | |
| 459 | let shortty = ItemType::from_def_id(def_id, tcx); | |
| 462 | 460 | let module_fqp = to_module_fqp(shortty, &fqp); |
| 463 | 461 | let mut is_remote = false; |
| 464 | 462 | |
| 465 | 463 | let url_parts = url_parts(cx.cache(), def_id, module_fqp, &cx.current, &mut is_remote)?; |
| 466 | 464 | let mut url_parts = make_href(root_path, shortty, url_parts, &fqp, is_remote); |
| 467 | 465 | if def_id != original_def_id { |
| 468 | let kind = ItemType::from_def_kind(original_def_kind, Some(def_kind)); | |
| 466 | let kind = ItemType::from_def_id(original_def_id, tcx); | |
| 469 | 467 | url_parts = format!("{url_parts}#{kind}.{}", tcx.item_name(original_def_id)) |
| 470 | 468 | }; |
| 471 | 469 | Ok(HrefInfo { url: url_parts, kind: shortty, rust_path: fqp }) |
| ... | ... | @@ -605,7 +603,7 @@ pub(crate) fn href_with_root_path( |
| 605 | 603 | } else if did.is_local() { |
| 606 | 604 | return Err(HrefError::Private); |
| 607 | 605 | } else { |
| 608 | return generate_item_def_id_path(did, original_did, cx, root_path, def_kind); | |
| 606 | return generate_item_def_id_path(did, original_did, cx, root_path); | |
| 609 | 607 | } |
| 610 | 608 | } |
| 611 | 609 | }; |
| ... | ... | @@ -835,26 +833,36 @@ fn print_higher_ranked_params_with_space( |
| 835 | 833 | }) |
| 836 | 834 | } |
| 837 | 835 | |
| 838 | pub(crate) fn print_anchor(did: DefId, text: Symbol, cx: &Context<'_>) -> impl Display { | |
| 836 | pub(crate) fn fragment(did: DefId, tcx: TyCtxt<'_>) -> impl Display { | |
| 839 | 837 | fmt::from_fn(move |f| { |
| 840 | if let Ok(HrefInfo { url, kind, rust_path }) = href(did, cx) { | |
| 841 | let tcx = cx.tcx(); | |
| 842 | let def_kind = tcx.def_kind(did); | |
| 843 | let anchor = if matches!( | |
| 844 | def_kind, | |
| 845 | DefKind::AssocTy | DefKind::AssocFn | DefKind::AssocConst | DefKind::Variant | |
| 846 | ) { | |
| 838 | let def_kind = tcx.def_kind(did); | |
| 839 | match def_kind { | |
| 840 | DefKind::AssocTy | DefKind::AssocFn | DefKind::AssocConst | DefKind::Variant => { | |
| 841 | let item_type = ItemType::from_def_id(did, tcx); | |
| 842 | write!(f, "#{}.{}", item_type.as_str(), tcx.item_name(did)) | |
| 843 | } | |
| 844 | DefKind::Field => { | |
| 847 | 845 | let parent_def_id = tcx.parent(did); |
| 848 | let item_type = | |
| 849 | ItemType::from_def_kind(def_kind, Some(tcx.def_kind(parent_def_id))); | |
| 850 | format!("#{}.{}", item_type.as_str(), tcx.item_name(did)) | |
| 851 | } else { | |
| 852 | String::new() | |
| 853 | }; | |
| 846 | f.write_char('#')?; | |
| 847 | if tcx.def_kind(parent_def_id) == DefKind::Variant { | |
| 848 | write!(f, "variant.{}.field", tcx.item_name(parent_def_id).as_str())?; | |
| 849 | } else { | |
| 850 | f.write_str("structfield")?; | |
| 851 | }; | |
| 852 | write!(f, ".{}", tcx.item_name(did)) | |
| 853 | } | |
| 854 | _ => Ok(()), | |
| 855 | } | |
| 856 | }) | |
| 857 | } | |
| 854 | 858 | |
| 859 | pub(crate) fn print_anchor(did: DefId, text: Symbol, cx: &Context<'_>) -> impl Display { | |
| 860 | fmt::from_fn(move |f| { | |
| 861 | if let Ok(HrefInfo { url, kind, rust_path }) = href(did, cx) { | |
| 855 | 862 | write!( |
| 856 | 863 | f, |
| 857 | 864 | r#"<a class="{kind}" href="{url}{anchor}" title="{kind} {path}">{text}</a>"#, |
| 865 | anchor = fragment(did, cx.tcx()), | |
| 858 | 866 | path = join_path_syms(rust_path), |
| 859 | 867 | text = EscapeBodyText(text.as_str()), |
| 860 | 868 | ) |
src/librustdoc/json/mod.rs+11-3| ... | ... | @@ -302,6 +302,13 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> { |
| 302 | 302 | ExternalLocation::Remote(s) => Some(s.clone()), |
| 303 | 303 | _ => None, |
| 304 | 304 | }, |
| 305 | path: self | |
| 306 | .tcx | |
| 307 | .used_crate_source(*crate_num) | |
| 308 | .paths() | |
| 309 | .next() | |
| 310 | .expect("crate should have at least 1 path") | |
| 311 | .clone(), | |
| 305 | 312 | }, |
| 306 | 313 | ) |
| 307 | 314 | }) |
| ... | ... | @@ -339,15 +346,12 @@ mod size_asserts { |
| 339 | 346 | // tidy-alphabetical-start |
| 340 | 347 | static_assert_size!(AssocItemConstraint, 112); |
| 341 | 348 | static_assert_size!(Crate, 184); |
| 342 | static_assert_size!(ExternalCrate, 48); | |
| 343 | 349 | static_assert_size!(FunctionPointer, 168); |
| 344 | 350 | static_assert_size!(GenericArg, 80); |
| 345 | 351 | static_assert_size!(GenericArgs, 104); |
| 346 | 352 | static_assert_size!(GenericBound, 72); |
| 347 | 353 | static_assert_size!(GenericParamDef, 136); |
| 348 | 354 | static_assert_size!(Impl, 304); |
| 349 | // `Item` contains a `PathBuf`, which is different sizes on different OSes. | |
| 350 | static_assert_size!(Item, 528 + size_of::<std::path::PathBuf>()); | |
| 351 | 355 | static_assert_size!(ItemSummary, 32); |
| 352 | 356 | static_assert_size!(PolyTrait, 64); |
| 353 | 357 | static_assert_size!(PreciseCapturingArg, 32); |
| ... | ... | @@ -355,4 +359,8 @@ mod size_asserts { |
| 355 | 359 | static_assert_size!(Type, 80); |
| 356 | 360 | static_assert_size!(WherePredicate, 160); |
| 357 | 361 | // tidy-alphabetical-end |
| 362 | ||
| 363 | // These contains a `PathBuf`, which is different sizes on different OSes. | |
| 364 | static_assert_size!(Item, 528 + size_of::<std::path::PathBuf>()); | |
| 365 | static_assert_size!(ExternalCrate, 48 + size_of::<std::path::PathBuf>()); | |
| 358 | 366 | } |
src/librustdoc/passes/collect_intra_doc_links.rs-37| ... | ... | @@ -203,43 +203,6 @@ pub(crate) enum UrlFragment { |
| 203 | 203 | UserWritten(String), |
| 204 | 204 | } |
| 205 | 205 | |
| 206 | impl UrlFragment { | |
| 207 | /// Render the fragment, including the leading `#`. | |
| 208 | pub(crate) fn render(&self, s: &mut String, tcx: TyCtxt<'_>) { | |
| 209 | s.push('#'); | |
| 210 | match self { | |
| 211 | &UrlFragment::Item(def_id) => { | |
| 212 | let kind = match tcx.def_kind(def_id) { | |
| 213 | DefKind::AssocFn => { | |
| 214 | if tcx.associated_item(def_id).defaultness(tcx).has_value() { | |
| 215 | "method." | |
| 216 | } else { | |
| 217 | "tymethod." | |
| 218 | } | |
| 219 | } | |
| 220 | DefKind::AssocConst => "associatedconstant.", | |
| 221 | DefKind::AssocTy => "associatedtype.", | |
| 222 | DefKind::Variant => "variant.", | |
| 223 | DefKind::Field => { | |
| 224 | let parent_id = tcx.parent(def_id); | |
| 225 | if tcx.def_kind(parent_id) == DefKind::Variant { | |
| 226 | s.push_str("variant."); | |
| 227 | s.push_str(tcx.item_name(parent_id).as_str()); | |
| 228 | ".field." | |
| 229 | } else { | |
| 230 | "structfield." | |
| 231 | } | |
| 232 | } | |
| 233 | kind => bug!("unexpected associated item kind: {kind:?}"), | |
| 234 | }; | |
| 235 | s.push_str(kind); | |
| 236 | s.push_str(tcx.item_name(def_id).as_str()); | |
| 237 | } | |
| 238 | UrlFragment::UserWritten(raw) => s.push_str(raw), | |
| 239 | } | |
| 240 | } | |
| 241 | } | |
| 242 | ||
| 243 | 206 | #[derive(Clone, Debug, Hash, PartialEq, Eq)] |
| 244 | 207 | pub(crate) struct ResolutionInfo { |
| 245 | 208 | item_id: DefId, |
src/rustdoc-json-types/lib.rs+8-2| ... | ... | @@ -37,8 +37,8 @@ pub type FxHashMap<K, V> = HashMap<K, V>; // re-export for use in src/librustdoc |
| 37 | 37 | // will instead cause conflicts. See #94591 for more. (This paragraph and the "Latest feature" line |
| 38 | 38 | // are deliberately not in a doc comment, because they need not be in public docs.) |
| 39 | 39 | // |
| 40 | // Latest feature: Add `ItemKind::Attribute`. | |
| 41 | pub const FORMAT_VERSION: u32 = 56; | |
| 40 | // Latest feature: Add `ExternCrate::path`. | |
| 41 | pub const FORMAT_VERSION: u32 = 57; | |
| 42 | 42 | |
| 43 | 43 | /// The root of the emitted JSON blob. |
| 44 | 44 | /// |
| ... | ... | @@ -135,6 +135,12 @@ pub struct ExternalCrate { |
| 135 | 135 | pub name: String, |
| 136 | 136 | /// The root URL at which the crate's documentation lives. |
| 137 | 137 | pub html_root_url: Option<String>, |
| 138 | ||
| 139 | /// A path from where this crate was loaded. | |
| 140 | /// | |
| 141 | /// This will typically be a `.rlib` or `.rmeta`. It can be used to determine which crate | |
| 142 | /// this was in terms of whatever build-system invoked rustc. | |
| 143 | pub path: PathBuf, | |
| 138 | 144 | } |
| 139 | 145 | |
| 140 | 146 | /// Information about an external (not defined in the local crate) [`Item`]. |
src/tools/clippy/tests/ui/cast_size.32bit.stderr deleted-198| ... | ... | @@ -1,198 +0,0 @@ |
| 1 | error: casting `isize` to `i8` may truncate the value | |
| 2 | --> tests/ui/cast_size.rs:17:5 | |
| 3 | | | |
| 4 | LL | 1isize as i8; | |
| 5 | | ^^^^^^^^^^^^ | |
| 6 | | | |
| 7 | = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ... | |
| 8 | = note: `-D clippy::cast-possible-truncation` implied by `-D warnings` | |
| 9 | = help: to override `-D warnings` add `#[allow(clippy::cast_possible_truncation)]` | |
| 10 | help: ... or use `try_from` and handle the error accordingly | |
| 11 | | | |
| 12 | LL - 1isize as i8; | |
| 13 | LL + i8::try_from(1isize); | |
| 14 | | | |
| 15 | ||
| 16 | error: casting `isize` to `f32` causes a loss of precision (`isize` is 32 or 64 bits wide, but `f32`'s mantissa is only 23 bits wide) | |
| 17 | --> tests/ui/cast_size.rs:24:5 | |
| 18 | | | |
| 19 | LL | x0 as f32; | |
| 20 | | ^^^^^^^^^ | |
| 21 | | | |
| 22 | = note: `-D clippy::cast-precision-loss` implied by `-D warnings` | |
| 23 | = help: to override `-D warnings` add `#[allow(clippy::cast_precision_loss)]` | |
| 24 | ||
| 25 | error: casting `usize` to `f32` causes a loss of precision (`usize` is 32 or 64 bits wide, but `f32`'s mantissa is only 23 bits wide) | |
| 26 | --> tests/ui/cast_size.rs:26:5 | |
| 27 | | | |
| 28 | LL | x1 as f32; | |
| 29 | | ^^^^^^^^^ | |
| 30 | ||
| 31 | error: casting `isize` to `f64` causes a loss of precision on targets with 64-bit wide pointers (`isize` is 64 bits wide, but `f64`'s mantissa is only 52 bits wide) | |
| 32 | --> tests/ui/cast_size.rs:28:5 | |
| 33 | | | |
| 34 | LL | x0 as f64; | |
| 35 | | ^^^^^^^^^ | |
| 36 | ||
| 37 | error: casting `usize` to `f64` causes a loss of precision on targets with 64-bit wide pointers (`usize` is 64 bits wide, but `f64`'s mantissa is only 52 bits wide) | |
| 38 | --> tests/ui/cast_size.rs:30:5 | |
| 39 | | | |
| 40 | LL | x1 as f64; | |
| 41 | | ^^^^^^^^^ | |
| 42 | ||
| 43 | error: casting `isize` to `i32` may truncate the value on targets with 64-bit wide pointers | |
| 44 | --> tests/ui/cast_size.rs:35:5 | |
| 45 | | | |
| 46 | LL | 1isize as i32; | |
| 47 | | ^^^^^^^^^^^^^ | |
| 48 | | | |
| 49 | = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ... | |
| 50 | help: ... or use `try_from` and handle the error accordingly | |
| 51 | | | |
| 52 | LL - 1isize as i32; | |
| 53 | LL + i32::try_from(1isize); | |
| 54 | | | |
| 55 | ||
| 56 | error: casting `isize` to `u32` may truncate the value on targets with 64-bit wide pointers | |
| 57 | --> tests/ui/cast_size.rs:37:5 | |
| 58 | | | |
| 59 | LL | 1isize as u32; | |
| 60 | | ^^^^^^^^^^^^^ | |
| 61 | | | |
| 62 | = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ... | |
| 63 | help: ... or use `try_from` and handle the error accordingly | |
| 64 | | | |
| 65 | LL - 1isize as u32; | |
| 66 | LL + u32::try_from(1isize); | |
| 67 | | | |
| 68 | ||
| 69 | error: casting `usize` to `u32` may truncate the value on targets with 64-bit wide pointers | |
| 70 | --> tests/ui/cast_size.rs:39:5 | |
| 71 | | | |
| 72 | LL | 1usize as u32; | |
| 73 | | ^^^^^^^^^^^^^ | |
| 74 | | | |
| 75 | = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ... | |
| 76 | help: ... or use `try_from` and handle the error accordingly | |
| 77 | | | |
| 78 | LL - 1usize as u32; | |
| 79 | LL + u32::try_from(1usize); | |
| 80 | | | |
| 81 | ||
| 82 | error: casting `usize` to `i32` may truncate the value on targets with 64-bit wide pointers | |
| 83 | --> tests/ui/cast_size.rs:41:5 | |
| 84 | | | |
| 85 | LL | 1usize as i32; | |
| 86 | | ^^^^^^^^^^^^^ | |
| 87 | | | |
| 88 | = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ... | |
| 89 | help: ... or use `try_from` and handle the error accordingly | |
| 90 | | | |
| 91 | LL - 1usize as i32; | |
| 92 | LL + i32::try_from(1usize); | |
| 93 | | | |
| 94 | ||
| 95 | error: casting `usize` to `i32` may wrap around the value on targets with 32-bit wide pointers | |
| 96 | --> tests/ui/cast_size.rs:41:5 | |
| 97 | | | |
| 98 | LL | 1usize as i32; | |
| 99 | | ^^^^^^^^^^^^^ | |
| 100 | | | |
| 101 | = note: `-D clippy::cast-possible-wrap` implied by `-D warnings` | |
| 102 | = help: to override `-D warnings` add `#[allow(clippy::cast_possible_wrap)]` | |
| 103 | ||
| 104 | error: casting `i64` to `isize` may truncate the value on targets with 32-bit wide pointers | |
| 105 | --> tests/ui/cast_size.rs:44:5 | |
| 106 | | | |
| 107 | LL | 1i64 as isize; | |
| 108 | | ^^^^^^^^^^^^^ | |
| 109 | | | |
| 110 | = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ... | |
| 111 | help: ... or use `try_from` and handle the error accordingly | |
| 112 | | | |
| 113 | LL - 1i64 as isize; | |
| 114 | LL + isize::try_from(1i64); | |
| 115 | | | |
| 116 | ||
| 117 | error: casting `i64` to `usize` may truncate the value on targets with 32-bit wide pointers | |
| 118 | --> tests/ui/cast_size.rs:46:5 | |
| 119 | | | |
| 120 | LL | 1i64 as usize; | |
| 121 | | ^^^^^^^^^^^^^ | |
| 122 | | | |
| 123 | = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ... | |
| 124 | help: ... or use `try_from` and handle the error accordingly | |
| 125 | | | |
| 126 | LL - 1i64 as usize; | |
| 127 | LL + usize::try_from(1i64); | |
| 128 | | | |
| 129 | ||
| 130 | error: casting `u64` to `isize` may truncate the value on targets with 32-bit wide pointers | |
| 131 | --> tests/ui/cast_size.rs:48:5 | |
| 132 | | | |
| 133 | LL | 1u64 as isize; | |
| 134 | | ^^^^^^^^^^^^^ | |
| 135 | | | |
| 136 | = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ... | |
| 137 | help: ... or use `try_from` and handle the error accordingly | |
| 138 | | | |
| 139 | LL - 1u64 as isize; | |
| 140 | LL + isize::try_from(1u64); | |
| 141 | | | |
| 142 | ||
| 143 | error: casting `u64` to `isize` may wrap around the value on targets with 64-bit wide pointers | |
| 144 | --> tests/ui/cast_size.rs:48:5 | |
| 145 | | | |
| 146 | LL | 1u64 as isize; | |
| 147 | | ^^^^^^^^^^^^^ | |
| 148 | ||
| 149 | error: casting `u64` to `usize` may truncate the value on targets with 32-bit wide pointers | |
| 150 | --> tests/ui/cast_size.rs:51:5 | |
| 151 | | | |
| 152 | LL | 1u64 as usize; | |
| 153 | | ^^^^^^^^^^^^^ | |
| 154 | | | |
| 155 | = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ... | |
| 156 | help: ... or use `try_from` and handle the error accordingly | |
| 157 | | | |
| 158 | LL - 1u64 as usize; | |
| 159 | LL + usize::try_from(1u64); | |
| 160 | | | |
| 161 | ||
| 162 | error: casting `u32` to `isize` may wrap around the value on targets with 32-bit wide pointers | |
| 163 | --> tests/ui/cast_size.rs:53:5 | |
| 164 | | | |
| 165 | LL | 1u32 as isize; | |
| 166 | | ^^^^^^^^^^^^^ | |
| 167 | ||
| 168 | error: casting `i32` to `f32` causes a loss of precision (`i32` is 32 bits wide, but `f32`'s mantissa is only 23 bits wide) | |
| 169 | --> tests/ui/cast_size.rs:61:5 | |
| 170 | | | |
| 171 | LL | 999_999_999 as f32; | |
| 172 | | ^^^^^^^^^^^^^^^^^^ | |
| 173 | ||
| 174 | error: casting `usize` to `f64` causes a loss of precision on targets with 64-bit wide pointers (`usize` is 64 bits wide, but `f64`'s mantissa is only 52 bits wide) | |
| 175 | --> tests/ui/cast_size.rs:63:5 | |
| 176 | | | |
| 177 | LL | 9_999_999_999_999_999usize as f64; | |
| 178 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 179 | ||
| 180 | error: casting `usize` to `u16` may truncate the value | |
| 181 | --> tests/ui/cast_size.rs:71:20 | |
| 182 | | | |
| 183 | LL | const N: u16 = M as u16; | |
| 184 | | ^^^^^^^^ | |
| 185 | | | |
| 186 | = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ... | |
| 187 | ||
| 188 | error: literal out of range for `usize` | |
| 189 | --> tests/ui/cast_size.rs:63:5 | |
| 190 | | | |
| 191 | LL | 9_999_999_999_999_999usize as f64; | |
| 192 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 193 | | | |
| 194 | = note: the literal `9_999_999_999_999_999usize` does not fit into the type `usize` whose range is `0..=4294967295` | |
| 195 | = note: `#[deny(overflowing_literals)]` on by default | |
| 196 | ||
| 197 | error: aborting due to 20 previous errors | |
| 198 |
src/tools/clippy/tests/ui/cast_size.64bit.stderr deleted-189| ... | ... | @@ -1,189 +0,0 @@ |
| 1 | error: casting `isize` to `i8` may truncate the value | |
| 2 | --> tests/ui/cast_size.rs:17:5 | |
| 3 | | | |
| 4 | LL | 1isize as i8; | |
| 5 | | ^^^^^^^^^^^^ | |
| 6 | | | |
| 7 | = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ... | |
| 8 | = note: `-D clippy::cast-possible-truncation` implied by `-D warnings` | |
| 9 | = help: to override `-D warnings` add `#[allow(clippy::cast_possible_truncation)]` | |
| 10 | help: ... or use `try_from` and handle the error accordingly | |
| 11 | | | |
| 12 | LL - 1isize as i8; | |
| 13 | LL + i8::try_from(1isize); | |
| 14 | | | |
| 15 | ||
| 16 | error: casting `isize` to `f32` causes a loss of precision (`isize` is 32 or 64 bits wide, but `f32`'s mantissa is only 23 bits wide) | |
| 17 | --> tests/ui/cast_size.rs:24:5 | |
| 18 | | | |
| 19 | LL | x0 as f32; | |
| 20 | | ^^^^^^^^^ | |
| 21 | | | |
| 22 | = note: `-D clippy::cast-precision-loss` implied by `-D warnings` | |
| 23 | = help: to override `-D warnings` add `#[allow(clippy::cast_precision_loss)]` | |
| 24 | ||
| 25 | error: casting `usize` to `f32` causes a loss of precision (`usize` is 32 or 64 bits wide, but `f32`'s mantissa is only 23 bits wide) | |
| 26 | --> tests/ui/cast_size.rs:26:5 | |
| 27 | | | |
| 28 | LL | x1 as f32; | |
| 29 | | ^^^^^^^^^ | |
| 30 | ||
| 31 | error: casting `isize` to `f64` causes a loss of precision on targets with 64-bit wide pointers (`isize` is 64 bits wide, but `f64`'s mantissa is only 52 bits wide) | |
| 32 | --> tests/ui/cast_size.rs:28:5 | |
| 33 | | | |
| 34 | LL | x0 as f64; | |
| 35 | | ^^^^^^^^^ | |
| 36 | ||
| 37 | error: casting `usize` to `f64` causes a loss of precision on targets with 64-bit wide pointers (`usize` is 64 bits wide, but `f64`'s mantissa is only 52 bits wide) | |
| 38 | --> tests/ui/cast_size.rs:30:5 | |
| 39 | | | |
| 40 | LL | x1 as f64; | |
| 41 | | ^^^^^^^^^ | |
| 42 | ||
| 43 | error: casting `isize` to `i32` may truncate the value on targets with 64-bit wide pointers | |
| 44 | --> tests/ui/cast_size.rs:35:5 | |
| 45 | | | |
| 46 | LL | 1isize as i32; | |
| 47 | | ^^^^^^^^^^^^^ | |
| 48 | | | |
| 49 | = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ... | |
| 50 | help: ... or use `try_from` and handle the error accordingly | |
| 51 | | | |
| 52 | LL - 1isize as i32; | |
| 53 | LL + i32::try_from(1isize); | |
| 54 | | | |
| 55 | ||
| 56 | error: casting `isize` to `u32` may truncate the value on targets with 64-bit wide pointers | |
| 57 | --> tests/ui/cast_size.rs:37:5 | |
| 58 | | | |
| 59 | LL | 1isize as u32; | |
| 60 | | ^^^^^^^^^^^^^ | |
| 61 | | | |
| 62 | = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ... | |
| 63 | help: ... or use `try_from` and handle the error accordingly | |
| 64 | | | |
| 65 | LL - 1isize as u32; | |
| 66 | LL + u32::try_from(1isize); | |
| 67 | | | |
| 68 | ||
| 69 | error: casting `usize` to `u32` may truncate the value on targets with 64-bit wide pointers | |
| 70 | --> tests/ui/cast_size.rs:39:5 | |
| 71 | | | |
| 72 | LL | 1usize as u32; | |
| 73 | | ^^^^^^^^^^^^^ | |
| 74 | | | |
| 75 | = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ... | |
| 76 | help: ... or use `try_from` and handle the error accordingly | |
| 77 | | | |
| 78 | LL - 1usize as u32; | |
| 79 | LL + u32::try_from(1usize); | |
| 80 | | | |
| 81 | ||
| 82 | error: casting `usize` to `i32` may truncate the value on targets with 64-bit wide pointers | |
| 83 | --> tests/ui/cast_size.rs:41:5 | |
| 84 | | | |
| 85 | LL | 1usize as i32; | |
| 86 | | ^^^^^^^^^^^^^ | |
| 87 | | | |
| 88 | = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ... | |
| 89 | help: ... or use `try_from` and handle the error accordingly | |
| 90 | | | |
| 91 | LL - 1usize as i32; | |
| 92 | LL + i32::try_from(1usize); | |
| 93 | | | |
| 94 | ||
| 95 | error: casting `usize` to `i32` may wrap around the value on targets with 32-bit wide pointers | |
| 96 | --> tests/ui/cast_size.rs:41:5 | |
| 97 | | | |
| 98 | LL | 1usize as i32; | |
| 99 | | ^^^^^^^^^^^^^ | |
| 100 | | | |
| 101 | = note: `-D clippy::cast-possible-wrap` implied by `-D warnings` | |
| 102 | = help: to override `-D warnings` add `#[allow(clippy::cast_possible_wrap)]` | |
| 103 | ||
| 104 | error: casting `i64` to `isize` may truncate the value on targets with 32-bit wide pointers | |
| 105 | --> tests/ui/cast_size.rs:44:5 | |
| 106 | | | |
| 107 | LL | 1i64 as isize; | |
| 108 | | ^^^^^^^^^^^^^ | |
| 109 | | | |
| 110 | = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ... | |
| 111 | help: ... or use `try_from` and handle the error accordingly | |
| 112 | | | |
| 113 | LL - 1i64 as isize; | |
| 114 | LL + isize::try_from(1i64); | |
| 115 | | | |
| 116 | ||
| 117 | error: casting `i64` to `usize` may truncate the value on targets with 32-bit wide pointers | |
| 118 | --> tests/ui/cast_size.rs:46:5 | |
| 119 | | | |
| 120 | LL | 1i64 as usize; | |
| 121 | | ^^^^^^^^^^^^^ | |
| 122 | | | |
| 123 | = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ... | |
| 124 | help: ... or use `try_from` and handle the error accordingly | |
| 125 | | | |
| 126 | LL - 1i64 as usize; | |
| 127 | LL + usize::try_from(1i64); | |
| 128 | | | |
| 129 | ||
| 130 | error: casting `u64` to `isize` may truncate the value on targets with 32-bit wide pointers | |
| 131 | --> tests/ui/cast_size.rs:48:5 | |
| 132 | | | |
| 133 | LL | 1u64 as isize; | |
| 134 | | ^^^^^^^^^^^^^ | |
| 135 | | | |
| 136 | = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ... | |
| 137 | help: ... or use `try_from` and handle the error accordingly | |
| 138 | | | |
| 139 | LL - 1u64 as isize; | |
| 140 | LL + isize::try_from(1u64); | |
| 141 | | | |
| 142 | ||
| 143 | error: casting `u64` to `isize` may wrap around the value on targets with 64-bit wide pointers | |
| 144 | --> tests/ui/cast_size.rs:48:5 | |
| 145 | | | |
| 146 | LL | 1u64 as isize; | |
| 147 | | ^^^^^^^^^^^^^ | |
| 148 | ||
| 149 | error: casting `u64` to `usize` may truncate the value on targets with 32-bit wide pointers | |
| 150 | --> tests/ui/cast_size.rs:51:5 | |
| 151 | | | |
| 152 | LL | 1u64 as usize; | |
| 153 | | ^^^^^^^^^^^^^ | |
| 154 | | | |
| 155 | = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ... | |
| 156 | help: ... or use `try_from` and handle the error accordingly | |
| 157 | | | |
| 158 | LL - 1u64 as usize; | |
| 159 | LL + usize::try_from(1u64); | |
| 160 | | | |
| 161 | ||
| 162 | error: casting `u32` to `isize` may wrap around the value on targets with 32-bit wide pointers | |
| 163 | --> tests/ui/cast_size.rs:53:5 | |
| 164 | | | |
| 165 | LL | 1u32 as isize; | |
| 166 | | ^^^^^^^^^^^^^ | |
| 167 | ||
| 168 | error: casting `i32` to `f32` causes a loss of precision (`i32` is 32 bits wide, but `f32`'s mantissa is only 23 bits wide) | |
| 169 | --> tests/ui/cast_size.rs:61:5 | |
| 170 | | | |
| 171 | LL | 999_999_999 as f32; | |
| 172 | | ^^^^^^^^^^^^^^^^^^ | |
| 173 | ||
| 174 | error: casting `usize` to `f64` causes a loss of precision on targets with 64-bit wide pointers (`usize` is 64 bits wide, but `f64`'s mantissa is only 52 bits wide) | |
| 175 | --> tests/ui/cast_size.rs:63:5 | |
| 176 | | | |
| 177 | LL | 9_999_999_999_999_999usize as f64; | |
| 178 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 179 | ||
| 180 | error: casting `usize` to `u16` may truncate the value | |
| 181 | --> tests/ui/cast_size.rs:71:20 | |
| 182 | | | |
| 183 | LL | const N: u16 = M as u16; | |
| 184 | | ^^^^^^^^ | |
| 185 | | | |
| 186 | = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ... | |
| 187 | ||
| 188 | error: aborting due to 19 previous errors | |
| 189 |
src/tools/clippy/tests/ui/cast_size.r32bit.stderr created+198| ... | ... | @@ -0,0 +1,198 @@ |
| 1 | error: casting `isize` to `i8` may truncate the value | |
| 2 | --> tests/ui/cast_size.rs:17:5 | |
| 3 | | | |
| 4 | LL | 1isize as i8; | |
| 5 | | ^^^^^^^^^^^^ | |
| 6 | | | |
| 7 | = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ... | |
| 8 | = note: `-D clippy::cast-possible-truncation` implied by `-D warnings` | |
| 9 | = help: to override `-D warnings` add `#[allow(clippy::cast_possible_truncation)]` | |
| 10 | help: ... or use `try_from` and handle the error accordingly | |
| 11 | | | |
| 12 | LL - 1isize as i8; | |
| 13 | LL + i8::try_from(1isize); | |
| 14 | | | |
| 15 | ||
| 16 | error: casting `isize` to `f32` causes a loss of precision (`isize` is 32 or 64 bits wide, but `f32`'s mantissa is only 23 bits wide) | |
| 17 | --> tests/ui/cast_size.rs:24:5 | |
| 18 | | | |
| 19 | LL | x0 as f32; | |
| 20 | | ^^^^^^^^^ | |
| 21 | | | |
| 22 | = note: `-D clippy::cast-precision-loss` implied by `-D warnings` | |
| 23 | = help: to override `-D warnings` add `#[allow(clippy::cast_precision_loss)]` | |
| 24 | ||
| 25 | error: casting `usize` to `f32` causes a loss of precision (`usize` is 32 or 64 bits wide, but `f32`'s mantissa is only 23 bits wide) | |
| 26 | --> tests/ui/cast_size.rs:26:5 | |
| 27 | | | |
| 28 | LL | x1 as f32; | |
| 29 | | ^^^^^^^^^ | |
| 30 | ||
| 31 | error: casting `isize` to `f64` causes a loss of precision on targets with 64-bit wide pointers (`isize` is 64 bits wide, but `f64`'s mantissa is only 52 bits wide) | |
| 32 | --> tests/ui/cast_size.rs:28:5 | |
| 33 | | | |
| 34 | LL | x0 as f64; | |
| 35 | | ^^^^^^^^^ | |
| 36 | ||
| 37 | error: casting `usize` to `f64` causes a loss of precision on targets with 64-bit wide pointers (`usize` is 64 bits wide, but `f64`'s mantissa is only 52 bits wide) | |
| 38 | --> tests/ui/cast_size.rs:30:5 | |
| 39 | | | |
| 40 | LL | x1 as f64; | |
| 41 | | ^^^^^^^^^ | |
| 42 | ||
| 43 | error: casting `isize` to `i32` may truncate the value on targets with 64-bit wide pointers | |
| 44 | --> tests/ui/cast_size.rs:35:5 | |
| 45 | | | |
| 46 | LL | 1isize as i32; | |
| 47 | | ^^^^^^^^^^^^^ | |
| 48 | | | |
| 49 | = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ... | |
| 50 | help: ... or use `try_from` and handle the error accordingly | |
| 51 | | | |
| 52 | LL - 1isize as i32; | |
| 53 | LL + i32::try_from(1isize); | |
| 54 | | | |
| 55 | ||
| 56 | error: casting `isize` to `u32` may truncate the value on targets with 64-bit wide pointers | |
| 57 | --> tests/ui/cast_size.rs:37:5 | |
| 58 | | | |
| 59 | LL | 1isize as u32; | |
| 60 | | ^^^^^^^^^^^^^ | |
| 61 | | | |
| 62 | = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ... | |
| 63 | help: ... or use `try_from` and handle the error accordingly | |
| 64 | | | |
| 65 | LL - 1isize as u32; | |
| 66 | LL + u32::try_from(1isize); | |
| 67 | | | |
| 68 | ||
| 69 | error: casting `usize` to `u32` may truncate the value on targets with 64-bit wide pointers | |
| 70 | --> tests/ui/cast_size.rs:39:5 | |
| 71 | | | |
| 72 | LL | 1usize as u32; | |
| 73 | | ^^^^^^^^^^^^^ | |
| 74 | | | |
| 75 | = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ... | |
| 76 | help: ... or use `try_from` and handle the error accordingly | |
| 77 | | | |
| 78 | LL - 1usize as u32; | |
| 79 | LL + u32::try_from(1usize); | |
| 80 | | | |
| 81 | ||
| 82 | error: casting `usize` to `i32` may truncate the value on targets with 64-bit wide pointers | |
| 83 | --> tests/ui/cast_size.rs:41:5 | |
| 84 | | | |
| 85 | LL | 1usize as i32; | |
| 86 | | ^^^^^^^^^^^^^ | |
| 87 | | | |
| 88 | = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ... | |
| 89 | help: ... or use `try_from` and handle the error accordingly | |
| 90 | | | |
| 91 | LL - 1usize as i32; | |
| 92 | LL + i32::try_from(1usize); | |
| 93 | | | |
| 94 | ||
| 95 | error: casting `usize` to `i32` may wrap around the value on targets with 32-bit wide pointers | |
| 96 | --> tests/ui/cast_size.rs:41:5 | |
| 97 | | | |
| 98 | LL | 1usize as i32; | |
| 99 | | ^^^^^^^^^^^^^ | |
| 100 | | | |
| 101 | = note: `-D clippy::cast-possible-wrap` implied by `-D warnings` | |
| 102 | = help: to override `-D warnings` add `#[allow(clippy::cast_possible_wrap)]` | |
| 103 | ||
| 104 | error: casting `i64` to `isize` may truncate the value on targets with 32-bit wide pointers | |
| 105 | --> tests/ui/cast_size.rs:44:5 | |
| 106 | | | |
| 107 | LL | 1i64 as isize; | |
| 108 | | ^^^^^^^^^^^^^ | |
| 109 | | | |
| 110 | = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ... | |
| 111 | help: ... or use `try_from` and handle the error accordingly | |
| 112 | | | |
| 113 | LL - 1i64 as isize; | |
| 114 | LL + isize::try_from(1i64); | |
| 115 | | | |
| 116 | ||
| 117 | error: casting `i64` to `usize` may truncate the value on targets with 32-bit wide pointers | |
| 118 | --> tests/ui/cast_size.rs:46:5 | |
| 119 | | | |
| 120 | LL | 1i64 as usize; | |
| 121 | | ^^^^^^^^^^^^^ | |
| 122 | | | |
| 123 | = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ... | |
| 124 | help: ... or use `try_from` and handle the error accordingly | |
| 125 | | | |
| 126 | LL - 1i64 as usize; | |
| 127 | LL + usize::try_from(1i64); | |
| 128 | | | |
| 129 | ||
| 130 | error: casting `u64` to `isize` may truncate the value on targets with 32-bit wide pointers | |
| 131 | --> tests/ui/cast_size.rs:48:5 | |
| 132 | | | |
| 133 | LL | 1u64 as isize; | |
| 134 | | ^^^^^^^^^^^^^ | |
| 135 | | | |
| 136 | = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ... | |
| 137 | help: ... or use `try_from` and handle the error accordingly | |
| 138 | | | |
| 139 | LL - 1u64 as isize; | |
| 140 | LL + isize::try_from(1u64); | |
| 141 | | | |
| 142 | ||
| 143 | error: casting `u64` to `isize` may wrap around the value on targets with 64-bit wide pointers | |
| 144 | --> tests/ui/cast_size.rs:48:5 | |
| 145 | | | |
| 146 | LL | 1u64 as isize; | |
| 147 | | ^^^^^^^^^^^^^ | |
| 148 | ||
| 149 | error: casting `u64` to `usize` may truncate the value on targets with 32-bit wide pointers | |
| 150 | --> tests/ui/cast_size.rs:51:5 | |
| 151 | | | |
| 152 | LL | 1u64 as usize; | |
| 153 | | ^^^^^^^^^^^^^ | |
| 154 | | | |
| 155 | = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ... | |
| 156 | help: ... or use `try_from` and handle the error accordingly | |
| 157 | | | |
| 158 | LL - 1u64 as usize; | |
| 159 | LL + usize::try_from(1u64); | |
| 160 | | | |
| 161 | ||
| 162 | error: casting `u32` to `isize` may wrap around the value on targets with 32-bit wide pointers | |
| 163 | --> tests/ui/cast_size.rs:53:5 | |
| 164 | | | |
| 165 | LL | 1u32 as isize; | |
| 166 | | ^^^^^^^^^^^^^ | |
| 167 | ||
| 168 | error: casting `i32` to `f32` causes a loss of precision (`i32` is 32 bits wide, but `f32`'s mantissa is only 23 bits wide) | |
| 169 | --> tests/ui/cast_size.rs:61:5 | |
| 170 | | | |
| 171 | LL | 999_999_999 as f32; | |
| 172 | | ^^^^^^^^^^^^^^^^^^ | |
| 173 | ||
| 174 | error: casting `usize` to `f64` causes a loss of precision on targets with 64-bit wide pointers (`usize` is 64 bits wide, but `f64`'s mantissa is only 52 bits wide) | |
| 175 | --> tests/ui/cast_size.rs:63:5 | |
| 176 | | | |
| 177 | LL | 9_999_999_999_999_999usize as f64; | |
| 178 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 179 | ||
| 180 | error: casting `usize` to `u16` may truncate the value | |
| 181 | --> tests/ui/cast_size.rs:71:20 | |
| 182 | | | |
| 183 | LL | const N: u16 = M as u16; | |
| 184 | | ^^^^^^^^ | |
| 185 | | | |
| 186 | = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ... | |
| 187 | ||
| 188 | error: literal out of range for `usize` | |
| 189 | --> tests/ui/cast_size.rs:63:5 | |
| 190 | | | |
| 191 | LL | 9_999_999_999_999_999usize as f64; | |
| 192 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 193 | | | |
| 194 | = note: the literal `9_999_999_999_999_999usize` does not fit into the type `usize` whose range is `0..=4294967295` | |
| 195 | = note: `#[deny(overflowing_literals)]` on by default | |
| 196 | ||
| 197 | error: aborting due to 20 previous errors | |
| 198 |
src/tools/clippy/tests/ui/cast_size.r64bit.stderr created+189| ... | ... | @@ -0,0 +1,189 @@ |
| 1 | error: casting `isize` to `i8` may truncate the value | |
| 2 | --> tests/ui/cast_size.rs:17:5 | |
| 3 | | | |
| 4 | LL | 1isize as i8; | |
| 5 | | ^^^^^^^^^^^^ | |
| 6 | | | |
| 7 | = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ... | |
| 8 | = note: `-D clippy::cast-possible-truncation` implied by `-D warnings` | |
| 9 | = help: to override `-D warnings` add `#[allow(clippy::cast_possible_truncation)]` | |
| 10 | help: ... or use `try_from` and handle the error accordingly | |
| 11 | | | |
| 12 | LL - 1isize as i8; | |
| 13 | LL + i8::try_from(1isize); | |
| 14 | | | |
| 15 | ||
| 16 | error: casting `isize` to `f32` causes a loss of precision (`isize` is 32 or 64 bits wide, but `f32`'s mantissa is only 23 bits wide) | |
| 17 | --> tests/ui/cast_size.rs:24:5 | |
| 18 | | | |
| 19 | LL | x0 as f32; | |
| 20 | | ^^^^^^^^^ | |
| 21 | | | |
| 22 | = note: `-D clippy::cast-precision-loss` implied by `-D warnings` | |
| 23 | = help: to override `-D warnings` add `#[allow(clippy::cast_precision_loss)]` | |
| 24 | ||
| 25 | error: casting `usize` to `f32` causes a loss of precision (`usize` is 32 or 64 bits wide, but `f32`'s mantissa is only 23 bits wide) | |
| 26 | --> tests/ui/cast_size.rs:26:5 | |
| 27 | | | |
| 28 | LL | x1 as f32; | |
| 29 | | ^^^^^^^^^ | |
| 30 | ||
| 31 | error: casting `isize` to `f64` causes a loss of precision on targets with 64-bit wide pointers (`isize` is 64 bits wide, but `f64`'s mantissa is only 52 bits wide) | |
| 32 | --> tests/ui/cast_size.rs:28:5 | |
| 33 | | | |
| 34 | LL | x0 as f64; | |
| 35 | | ^^^^^^^^^ | |
| 36 | ||
| 37 | error: casting `usize` to `f64` causes a loss of precision on targets with 64-bit wide pointers (`usize` is 64 bits wide, but `f64`'s mantissa is only 52 bits wide) | |
| 38 | --> tests/ui/cast_size.rs:30:5 | |
| 39 | | | |
| 40 | LL | x1 as f64; | |
| 41 | | ^^^^^^^^^ | |
| 42 | ||
| 43 | error: casting `isize` to `i32` may truncate the value on targets with 64-bit wide pointers | |
| 44 | --> tests/ui/cast_size.rs:35:5 | |
| 45 | | | |
| 46 | LL | 1isize as i32; | |
| 47 | | ^^^^^^^^^^^^^ | |
| 48 | | | |
| 49 | = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ... | |
| 50 | help: ... or use `try_from` and handle the error accordingly | |
| 51 | | | |
| 52 | LL - 1isize as i32; | |
| 53 | LL + i32::try_from(1isize); | |
| 54 | | | |
| 55 | ||
| 56 | error: casting `isize` to `u32` may truncate the value on targets with 64-bit wide pointers | |
| 57 | --> tests/ui/cast_size.rs:37:5 | |
| 58 | | | |
| 59 | LL | 1isize as u32; | |
| 60 | | ^^^^^^^^^^^^^ | |
| 61 | | | |
| 62 | = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ... | |
| 63 | help: ... or use `try_from` and handle the error accordingly | |
| 64 | | | |
| 65 | LL - 1isize as u32; | |
| 66 | LL + u32::try_from(1isize); | |
| 67 | | | |
| 68 | ||
| 69 | error: casting `usize` to `u32` may truncate the value on targets with 64-bit wide pointers | |
| 70 | --> tests/ui/cast_size.rs:39:5 | |
| 71 | | | |
| 72 | LL | 1usize as u32; | |
| 73 | | ^^^^^^^^^^^^^ | |
| 74 | | | |
| 75 | = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ... | |
| 76 | help: ... or use `try_from` and handle the error accordingly | |
| 77 | | | |
| 78 | LL - 1usize as u32; | |
| 79 | LL + u32::try_from(1usize); | |
| 80 | | | |
| 81 | ||
| 82 | error: casting `usize` to `i32` may truncate the value on targets with 64-bit wide pointers | |
| 83 | --> tests/ui/cast_size.rs:41:5 | |
| 84 | | | |
| 85 | LL | 1usize as i32; | |
| 86 | | ^^^^^^^^^^^^^ | |
| 87 | | | |
| 88 | = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ... | |
| 89 | help: ... or use `try_from` and handle the error accordingly | |
| 90 | | | |
| 91 | LL - 1usize as i32; | |
| 92 | LL + i32::try_from(1usize); | |
| 93 | | | |
| 94 | ||
| 95 | error: casting `usize` to `i32` may wrap around the value on targets with 32-bit wide pointers | |
| 96 | --> tests/ui/cast_size.rs:41:5 | |
| 97 | | | |
| 98 | LL | 1usize as i32; | |
| 99 | | ^^^^^^^^^^^^^ | |
| 100 | | | |
| 101 | = note: `-D clippy::cast-possible-wrap` implied by `-D warnings` | |
| 102 | = help: to override `-D warnings` add `#[allow(clippy::cast_possible_wrap)]` | |
| 103 | ||
| 104 | error: casting `i64` to `isize` may truncate the value on targets with 32-bit wide pointers | |
| 105 | --> tests/ui/cast_size.rs:44:5 | |
| 106 | | | |
| 107 | LL | 1i64 as isize; | |
| 108 | | ^^^^^^^^^^^^^ | |
| 109 | | | |
| 110 | = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ... | |
| 111 | help: ... or use `try_from` and handle the error accordingly | |
| 112 | | | |
| 113 | LL - 1i64 as isize; | |
| 114 | LL + isize::try_from(1i64); | |
| 115 | | | |
| 116 | ||
| 117 | error: casting `i64` to `usize` may truncate the value on targets with 32-bit wide pointers | |
| 118 | --> tests/ui/cast_size.rs:46:5 | |
| 119 | | | |
| 120 | LL | 1i64 as usize; | |
| 121 | | ^^^^^^^^^^^^^ | |
| 122 | | | |
| 123 | = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ... | |
| 124 | help: ... or use `try_from` and handle the error accordingly | |
| 125 | | | |
| 126 | LL - 1i64 as usize; | |
| 127 | LL + usize::try_from(1i64); | |
| 128 | | | |
| 129 | ||
| 130 | error: casting `u64` to `isize` may truncate the value on targets with 32-bit wide pointers | |
| 131 | --> tests/ui/cast_size.rs:48:5 | |
| 132 | | | |
| 133 | LL | 1u64 as isize; | |
| 134 | | ^^^^^^^^^^^^^ | |
| 135 | | | |
| 136 | = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ... | |
| 137 | help: ... or use `try_from` and handle the error accordingly | |
| 138 | | | |
| 139 | LL - 1u64 as isize; | |
| 140 | LL + isize::try_from(1u64); | |
| 141 | | | |
| 142 | ||
| 143 | error: casting `u64` to `isize` may wrap around the value on targets with 64-bit wide pointers | |
| 144 | --> tests/ui/cast_size.rs:48:5 | |
| 145 | | | |
| 146 | LL | 1u64 as isize; | |
| 147 | | ^^^^^^^^^^^^^ | |
| 148 | ||
| 149 | error: casting `u64` to `usize` may truncate the value on targets with 32-bit wide pointers | |
| 150 | --> tests/ui/cast_size.rs:51:5 | |
| 151 | | | |
| 152 | LL | 1u64 as usize; | |
| 153 | | ^^^^^^^^^^^^^ | |
| 154 | | | |
| 155 | = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ... | |
| 156 | help: ... or use `try_from` and handle the error accordingly | |
| 157 | | | |
| 158 | LL - 1u64 as usize; | |
| 159 | LL + usize::try_from(1u64); | |
| 160 | | | |
| 161 | ||
| 162 | error: casting `u32` to `isize` may wrap around the value on targets with 32-bit wide pointers | |
| 163 | --> tests/ui/cast_size.rs:53:5 | |
| 164 | | | |
| 165 | LL | 1u32 as isize; | |
| 166 | | ^^^^^^^^^^^^^ | |
| 167 | ||
| 168 | error: casting `i32` to `f32` causes a loss of precision (`i32` is 32 bits wide, but `f32`'s mantissa is only 23 bits wide) | |
| 169 | --> tests/ui/cast_size.rs:61:5 | |
| 170 | | | |
| 171 | LL | 999_999_999 as f32; | |
| 172 | | ^^^^^^^^^^^^^^^^^^ | |
| 173 | ||
| 174 | error: casting `usize` to `f64` causes a loss of precision on targets with 64-bit wide pointers (`usize` is 64 bits wide, but `f64`'s mantissa is only 52 bits wide) | |
| 175 | --> tests/ui/cast_size.rs:63:5 | |
| 176 | | | |
| 177 | LL | 9_999_999_999_999_999usize as f64; | |
| 178 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 179 | ||
| 180 | error: casting `usize` to `u16` may truncate the value | |
| 181 | --> tests/ui/cast_size.rs:71:20 | |
| 182 | | | |
| 183 | LL | const N: u16 = M as u16; | |
| 184 | | ^^^^^^^^ | |
| 185 | | | |
| 186 | = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ... | |
| 187 | ||
| 188 | error: aborting due to 19 previous errors | |
| 189 |
src/tools/clippy/tests/ui/cast_size.rs+4-4| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | //@revisions: 32bit 64bit | |
| 2 | //@[32bit]ignore-bitwidth: 64 | |
| 3 | //@[64bit]ignore-bitwidth: 32 | |
| 1 | //@revisions: r32bit r64bit | |
| 2 | //@[r32bit]ignore-bitwidth: 64 | |
| 3 | //@[r64bit]ignore-bitwidth: 32 | |
| 4 | 4 | //@no-rustfix: only some diagnostics have suggestions |
| 5 | 5 | |
| 6 | 6 | #![warn( |
| ... | ... | @@ -62,7 +62,7 @@ fn main() { |
| 62 | 62 | //~^ cast_precision_loss |
| 63 | 63 | 9_999_999_999_999_999usize as f64; |
| 64 | 64 | //~^ cast_precision_loss |
| 65 | //~[32bit]^^ ERROR: literal out of range for `usize` | |
| 65 | //~[r32bit]^^ ERROR: literal out of range for `usize` | |
| 66 | 66 | // 999_999_999_999_999_999_999_999_999_999u128 as f128; |
| 67 | 67 | } |
| 68 | 68 |
src/tools/clippy/tests/ui/fn_to_numeric_cast.32bit.stderr deleted-146| ... | ... | @@ -1,146 +0,0 @@ |
| 1 | error: casting function pointer `foo` to `i8`, which truncates the value | |
| 2 | --> tests/ui/fn_to_numeric_cast.rs:13:13 | |
| 3 | | | |
| 4 | LL | let _ = foo as i8; | |
| 5 | | ^^^^^^^^^ help: try: `foo as usize` | |
| 6 | | | |
| 7 | = note: `-D clippy::fn-to-numeric-cast-with-truncation` implied by `-D warnings` | |
| 8 | = help: to override `-D warnings` add `#[allow(clippy::fn_to_numeric_cast_with_truncation)]` | |
| 9 | ||
| 10 | error: casting function pointer `foo` to `i16`, which truncates the value | |
| 11 | --> tests/ui/fn_to_numeric_cast.rs:15:13 | |
| 12 | | | |
| 13 | LL | let _ = foo as i16; | |
| 14 | | ^^^^^^^^^^ help: try: `foo as usize` | |
| 15 | ||
| 16 | error: casting function pointer `foo` to `i32` | |
| 17 | --> tests/ui/fn_to_numeric_cast.rs:17:13 | |
| 18 | | | |
| 19 | LL | let _ = foo as i32; | |
| 20 | | ^^^^^^^^^^ help: try: `foo as usize` | |
| 21 | | | |
| 22 | = note: `-D clippy::fn-to-numeric-cast` implied by `-D warnings` | |
| 23 | = help: to override `-D warnings` add `#[allow(clippy::fn_to_numeric_cast)]` | |
| 24 | ||
| 25 | error: casting function pointer `foo` to `i64` | |
| 26 | --> tests/ui/fn_to_numeric_cast.rs:20:13 | |
| 27 | | | |
| 28 | LL | let _ = foo as i64; | |
| 29 | | ^^^^^^^^^^ help: try: `foo as usize` | |
| 30 | ||
| 31 | error: casting function pointer `foo` to `i128` | |
| 32 | --> tests/ui/fn_to_numeric_cast.rs:22:13 | |
| 33 | | | |
| 34 | LL | let _ = foo as i128; | |
| 35 | | ^^^^^^^^^^^ help: try: `foo as usize` | |
| 36 | ||
| 37 | error: casting function pointer `foo` to `isize` | |
| 38 | --> tests/ui/fn_to_numeric_cast.rs:24:13 | |
| 39 | | | |
| 40 | LL | let _ = foo as isize; | |
| 41 | | ^^^^^^^^^^^^ help: try: `foo as usize` | |
| 42 | ||
| 43 | error: casting function pointer `foo` to `u8`, which truncates the value | |
| 44 | --> tests/ui/fn_to_numeric_cast.rs:27:13 | |
| 45 | | | |
| 46 | LL | let _ = foo as u8; | |
| 47 | | ^^^^^^^^^ help: try: `foo as usize` | |
| 48 | ||
| 49 | error: casting function pointer `foo` to `u16`, which truncates the value | |
| 50 | --> tests/ui/fn_to_numeric_cast.rs:29:13 | |
| 51 | | | |
| 52 | LL | let _ = foo as u16; | |
| 53 | | ^^^^^^^^^^ help: try: `foo as usize` | |
| 54 | ||
| 55 | error: casting function pointer `foo` to `u32` | |
| 56 | --> tests/ui/fn_to_numeric_cast.rs:31:13 | |
| 57 | | | |
| 58 | LL | let _ = foo as u32; | |
| 59 | | ^^^^^^^^^^ help: try: `foo as usize` | |
| 60 | ||
| 61 | error: casting function pointer `foo` to `u64` | |
| 62 | --> tests/ui/fn_to_numeric_cast.rs:34:13 | |
| 63 | | | |
| 64 | LL | let _ = foo as u64; | |
| 65 | | ^^^^^^^^^^ help: try: `foo as usize` | |
| 66 | ||
| 67 | error: casting function pointer `foo` to `u128` | |
| 68 | --> tests/ui/fn_to_numeric_cast.rs:36:13 | |
| 69 | | | |
| 70 | LL | let _ = foo as u128; | |
| 71 | | ^^^^^^^^^^^ help: try: `foo as usize` | |
| 72 | ||
| 73 | error: casting function pointer `abc` to `i8`, which truncates the value | |
| 74 | --> tests/ui/fn_to_numeric_cast.rs:50:13 | |
| 75 | | | |
| 76 | LL | let _ = abc as i8; | |
| 77 | | ^^^^^^^^^ help: try: `abc as usize` | |
| 78 | ||
| 79 | error: casting function pointer `abc` to `i16`, which truncates the value | |
| 80 | --> tests/ui/fn_to_numeric_cast.rs:52:13 | |
| 81 | | | |
| 82 | LL | let _ = abc as i16; | |
| 83 | | ^^^^^^^^^^ help: try: `abc as usize` | |
| 84 | ||
| 85 | error: casting function pointer `abc` to `i32` | |
| 86 | --> tests/ui/fn_to_numeric_cast.rs:54:13 | |
| 87 | | | |
| 88 | LL | let _ = abc as i32; | |
| 89 | | ^^^^^^^^^^ help: try: `abc as usize` | |
| 90 | ||
| 91 | error: casting function pointer `abc` to `i64` | |
| 92 | --> tests/ui/fn_to_numeric_cast.rs:57:13 | |
| 93 | | | |
| 94 | LL | let _ = abc as i64; | |
| 95 | | ^^^^^^^^^^ help: try: `abc as usize` | |
| 96 | ||
| 97 | error: casting function pointer `abc` to `i128` | |
| 98 | --> tests/ui/fn_to_numeric_cast.rs:59:13 | |
| 99 | | | |
| 100 | LL | let _ = abc as i128; | |
| 101 | | ^^^^^^^^^^^ help: try: `abc as usize` | |
| 102 | ||
| 103 | error: casting function pointer `abc` to `isize` | |
| 104 | --> tests/ui/fn_to_numeric_cast.rs:61:13 | |
| 105 | | | |
| 106 | LL | let _ = abc as isize; | |
| 107 | | ^^^^^^^^^^^^ help: try: `abc as usize` | |
| 108 | ||
| 109 | error: casting function pointer `abc` to `u8`, which truncates the value | |
| 110 | --> tests/ui/fn_to_numeric_cast.rs:64:13 | |
| 111 | | | |
| 112 | LL | let _ = abc as u8; | |
| 113 | | ^^^^^^^^^ help: try: `abc as usize` | |
| 114 | ||
| 115 | error: casting function pointer `abc` to `u16`, which truncates the value | |
| 116 | --> tests/ui/fn_to_numeric_cast.rs:66:13 | |
| 117 | | | |
| 118 | LL | let _ = abc as u16; | |
| 119 | | ^^^^^^^^^^ help: try: `abc as usize` | |
| 120 | ||
| 121 | error: casting function pointer `abc` to `u32` | |
| 122 | --> tests/ui/fn_to_numeric_cast.rs:68:13 | |
| 123 | | | |
| 124 | LL | let _ = abc as u32; | |
| 125 | | ^^^^^^^^^^ help: try: `abc as usize` | |
| 126 | ||
| 127 | error: casting function pointer `abc` to `u64` | |
| 128 | --> tests/ui/fn_to_numeric_cast.rs:71:13 | |
| 129 | | | |
| 130 | LL | let _ = abc as u64; | |
| 131 | | ^^^^^^^^^^ help: try: `abc as usize` | |
| 132 | ||
| 133 | error: casting function pointer `abc` to `u128` | |
| 134 | --> tests/ui/fn_to_numeric_cast.rs:73:13 | |
| 135 | | | |
| 136 | LL | let _ = abc as u128; | |
| 137 | | ^^^^^^^^^^^ help: try: `abc as usize` | |
| 138 | ||
| 139 | error: casting function pointer `f` to `i32` | |
| 140 | --> tests/ui/fn_to_numeric_cast.rs:81:5 | |
| 141 | | | |
| 142 | LL | f as i32 | |
| 143 | | ^^^^^^^^ help: try: `f as usize` | |
| 144 | ||
| 145 | error: aborting due to 23 previous errors | |
| 146 |
src/tools/clippy/tests/ui/fn_to_numeric_cast.64bit.stderr deleted-146| ... | ... | @@ -1,146 +0,0 @@ |
| 1 | error: casting function pointer `foo` to `i8`, which truncates the value | |
| 2 | --> tests/ui/fn_to_numeric_cast.rs:13:13 | |
| 3 | | | |
| 4 | LL | let _ = foo as i8; | |
| 5 | | ^^^^^^^^^ help: try: `foo as usize` | |
| 6 | | | |
| 7 | = note: `-D clippy::fn-to-numeric-cast-with-truncation` implied by `-D warnings` | |
| 8 | = help: to override `-D warnings` add `#[allow(clippy::fn_to_numeric_cast_with_truncation)]` | |
| 9 | ||
| 10 | error: casting function pointer `foo` to `i16`, which truncates the value | |
| 11 | --> tests/ui/fn_to_numeric_cast.rs:15:13 | |
| 12 | | | |
| 13 | LL | let _ = foo as i16; | |
| 14 | | ^^^^^^^^^^ help: try: `foo as usize` | |
| 15 | ||
| 16 | error: casting function pointer `foo` to `i32`, which truncates the value | |
| 17 | --> tests/ui/fn_to_numeric_cast.rs:17:13 | |
| 18 | | | |
| 19 | LL | let _ = foo as i32; | |
| 20 | | ^^^^^^^^^^ help: try: `foo as usize` | |
| 21 | ||
| 22 | error: casting function pointer `foo` to `i64` | |
| 23 | --> tests/ui/fn_to_numeric_cast.rs:20:13 | |
| 24 | | | |
| 25 | LL | let _ = foo as i64; | |
| 26 | | ^^^^^^^^^^ help: try: `foo as usize` | |
| 27 | | | |
| 28 | = note: `-D clippy::fn-to-numeric-cast` implied by `-D warnings` | |
| 29 | = help: to override `-D warnings` add `#[allow(clippy::fn_to_numeric_cast)]` | |
| 30 | ||
| 31 | error: casting function pointer `foo` to `i128` | |
| 32 | --> tests/ui/fn_to_numeric_cast.rs:22:13 | |
| 33 | | | |
| 34 | LL | let _ = foo as i128; | |
| 35 | | ^^^^^^^^^^^ help: try: `foo as usize` | |
| 36 | ||
| 37 | error: casting function pointer `foo` to `isize` | |
| 38 | --> tests/ui/fn_to_numeric_cast.rs:24:13 | |
| 39 | | | |
| 40 | LL | let _ = foo as isize; | |
| 41 | | ^^^^^^^^^^^^ help: try: `foo as usize` | |
| 42 | ||
| 43 | error: casting function pointer `foo` to `u8`, which truncates the value | |
| 44 | --> tests/ui/fn_to_numeric_cast.rs:27:13 | |
| 45 | | | |
| 46 | LL | let _ = foo as u8; | |
| 47 | | ^^^^^^^^^ help: try: `foo as usize` | |
| 48 | ||
| 49 | error: casting function pointer `foo` to `u16`, which truncates the value | |
| 50 | --> tests/ui/fn_to_numeric_cast.rs:29:13 | |
| 51 | | | |
| 52 | LL | let _ = foo as u16; | |
| 53 | | ^^^^^^^^^^ help: try: `foo as usize` | |
| 54 | ||
| 55 | error: casting function pointer `foo` to `u32`, which truncates the value | |
| 56 | --> tests/ui/fn_to_numeric_cast.rs:31:13 | |
| 57 | | | |
| 58 | LL | let _ = foo as u32; | |
| 59 | | ^^^^^^^^^^ help: try: `foo as usize` | |
| 60 | ||
| 61 | error: casting function pointer `foo` to `u64` | |
| 62 | --> tests/ui/fn_to_numeric_cast.rs:34:13 | |
| 63 | | | |
| 64 | LL | let _ = foo as u64; | |
| 65 | | ^^^^^^^^^^ help: try: `foo as usize` | |
| 66 | ||
| 67 | error: casting function pointer `foo` to `u128` | |
| 68 | --> tests/ui/fn_to_numeric_cast.rs:36:13 | |
| 69 | | | |
| 70 | LL | let _ = foo as u128; | |
| 71 | | ^^^^^^^^^^^ help: try: `foo as usize` | |
| 72 | ||
| 73 | error: casting function pointer `abc` to `i8`, which truncates the value | |
| 74 | --> tests/ui/fn_to_numeric_cast.rs:50:13 | |
| 75 | | | |
| 76 | LL | let _ = abc as i8; | |
| 77 | | ^^^^^^^^^ help: try: `abc as usize` | |
| 78 | ||
| 79 | error: casting function pointer `abc` to `i16`, which truncates the value | |
| 80 | --> tests/ui/fn_to_numeric_cast.rs:52:13 | |
| 81 | | | |
| 82 | LL | let _ = abc as i16; | |
| 83 | | ^^^^^^^^^^ help: try: `abc as usize` | |
| 84 | ||
| 85 | error: casting function pointer `abc` to `i32`, which truncates the value | |
| 86 | --> tests/ui/fn_to_numeric_cast.rs:54:13 | |
| 87 | | | |
| 88 | LL | let _ = abc as i32; | |
| 89 | | ^^^^^^^^^^ help: try: `abc as usize` | |
| 90 | ||
| 91 | error: casting function pointer `abc` to `i64` | |
| 92 | --> tests/ui/fn_to_numeric_cast.rs:57:13 | |
| 93 | | | |
| 94 | LL | let _ = abc as i64; | |
| 95 | | ^^^^^^^^^^ help: try: `abc as usize` | |
| 96 | ||
| 97 | error: casting function pointer `abc` to `i128` | |
| 98 | --> tests/ui/fn_to_numeric_cast.rs:59:13 | |
| 99 | | | |
| 100 | LL | let _ = abc as i128; | |
| 101 | | ^^^^^^^^^^^ help: try: `abc as usize` | |
| 102 | ||
| 103 | error: casting function pointer `abc` to `isize` | |
| 104 | --> tests/ui/fn_to_numeric_cast.rs:61:13 | |
| 105 | | | |
| 106 | LL | let _ = abc as isize; | |
| 107 | | ^^^^^^^^^^^^ help: try: `abc as usize` | |
| 108 | ||
| 109 | error: casting function pointer `abc` to `u8`, which truncates the value | |
| 110 | --> tests/ui/fn_to_numeric_cast.rs:64:13 | |
| 111 | | | |
| 112 | LL | let _ = abc as u8; | |
| 113 | | ^^^^^^^^^ help: try: `abc as usize` | |
| 114 | ||
| 115 | error: casting function pointer `abc` to `u16`, which truncates the value | |
| 116 | --> tests/ui/fn_to_numeric_cast.rs:66:13 | |
| 117 | | | |
| 118 | LL | let _ = abc as u16; | |
| 119 | | ^^^^^^^^^^ help: try: `abc as usize` | |
| 120 | ||
| 121 | error: casting function pointer `abc` to `u32`, which truncates the value | |
| 122 | --> tests/ui/fn_to_numeric_cast.rs:68:13 | |
| 123 | | | |
| 124 | LL | let _ = abc as u32; | |
| 125 | | ^^^^^^^^^^ help: try: `abc as usize` | |
| 126 | ||
| 127 | error: casting function pointer `abc` to `u64` | |
| 128 | --> tests/ui/fn_to_numeric_cast.rs:71:13 | |
| 129 | | | |
| 130 | LL | let _ = abc as u64; | |
| 131 | | ^^^^^^^^^^ help: try: `abc as usize` | |
| 132 | ||
| 133 | error: casting function pointer `abc` to `u128` | |
| 134 | --> tests/ui/fn_to_numeric_cast.rs:73:13 | |
| 135 | | | |
| 136 | LL | let _ = abc as u128; | |
| 137 | | ^^^^^^^^^^^ help: try: `abc as usize` | |
| 138 | ||
| 139 | error: casting function pointer `f` to `i32`, which truncates the value | |
| 140 | --> tests/ui/fn_to_numeric_cast.rs:81:5 | |
| 141 | | | |
| 142 | LL | f as i32 | |
| 143 | | ^^^^^^^^ help: try: `f as usize` | |
| 144 | ||
| 145 | error: aborting due to 23 previous errors | |
| 146 |
src/tools/clippy/tests/ui/fn_to_numeric_cast.r32bit.stderr created+146| ... | ... | @@ -0,0 +1,146 @@ |
| 1 | error: casting function pointer `foo` to `i8`, which truncates the value | |
| 2 | --> tests/ui/fn_to_numeric_cast.rs:13:13 | |
| 3 | | | |
| 4 | LL | let _ = foo as i8; | |
| 5 | | ^^^^^^^^^ help: try: `foo as usize` | |
| 6 | | | |
| 7 | = note: `-D clippy::fn-to-numeric-cast-with-truncation` implied by `-D warnings` | |
| 8 | = help: to override `-D warnings` add `#[allow(clippy::fn_to_numeric_cast_with_truncation)]` | |
| 9 | ||
| 10 | error: casting function pointer `foo` to `i16`, which truncates the value | |
| 11 | --> tests/ui/fn_to_numeric_cast.rs:15:13 | |
| 12 | | | |
| 13 | LL | let _ = foo as i16; | |
| 14 | | ^^^^^^^^^^ help: try: `foo as usize` | |
| 15 | ||
| 16 | error: casting function pointer `foo` to `i32` | |
| 17 | --> tests/ui/fn_to_numeric_cast.rs:17:13 | |
| 18 | | | |
| 19 | LL | let _ = foo as i32; | |
| 20 | | ^^^^^^^^^^ help: try: `foo as usize` | |
| 21 | | | |
| 22 | = note: `-D clippy::fn-to-numeric-cast` implied by `-D warnings` | |
| 23 | = help: to override `-D warnings` add `#[allow(clippy::fn_to_numeric_cast)]` | |
| 24 | ||
| 25 | error: casting function pointer `foo` to `i64` | |
| 26 | --> tests/ui/fn_to_numeric_cast.rs:20:13 | |
| 27 | | | |
| 28 | LL | let _ = foo as i64; | |
| 29 | | ^^^^^^^^^^ help: try: `foo as usize` | |
| 30 | ||
| 31 | error: casting function pointer `foo` to `i128` | |
| 32 | --> tests/ui/fn_to_numeric_cast.rs:22:13 | |
| 33 | | | |
| 34 | LL | let _ = foo as i128; | |
| 35 | | ^^^^^^^^^^^ help: try: `foo as usize` | |
| 36 | ||
| 37 | error: casting function pointer `foo` to `isize` | |
| 38 | --> tests/ui/fn_to_numeric_cast.rs:24:13 | |
| 39 | | | |
| 40 | LL | let _ = foo as isize; | |
| 41 | | ^^^^^^^^^^^^ help: try: `foo as usize` | |
| 42 | ||
| 43 | error: casting function pointer `foo` to `u8`, which truncates the value | |
| 44 | --> tests/ui/fn_to_numeric_cast.rs:27:13 | |
| 45 | | | |
| 46 | LL | let _ = foo as u8; | |
| 47 | | ^^^^^^^^^ help: try: `foo as usize` | |
| 48 | ||
| 49 | error: casting function pointer `foo` to `u16`, which truncates the value | |
| 50 | --> tests/ui/fn_to_numeric_cast.rs:29:13 | |
| 51 | | | |
| 52 | LL | let _ = foo as u16; | |
| 53 | | ^^^^^^^^^^ help: try: `foo as usize` | |
| 54 | ||
| 55 | error: casting function pointer `foo` to `u32` | |
| 56 | --> tests/ui/fn_to_numeric_cast.rs:31:13 | |
| 57 | | | |
| 58 | LL | let _ = foo as u32; | |
| 59 | | ^^^^^^^^^^ help: try: `foo as usize` | |
| 60 | ||
| 61 | error: casting function pointer `foo` to `u64` | |
| 62 | --> tests/ui/fn_to_numeric_cast.rs:34:13 | |
| 63 | | | |
| 64 | LL | let _ = foo as u64; | |
| 65 | | ^^^^^^^^^^ help: try: `foo as usize` | |
| 66 | ||
| 67 | error: casting function pointer `foo` to `u128` | |
| 68 | --> tests/ui/fn_to_numeric_cast.rs:36:13 | |
| 69 | | | |
| 70 | LL | let _ = foo as u128; | |
| 71 | | ^^^^^^^^^^^ help: try: `foo as usize` | |
| 72 | ||
| 73 | error: casting function pointer `abc` to `i8`, which truncates the value | |
| 74 | --> tests/ui/fn_to_numeric_cast.rs:50:13 | |
| 75 | | | |
| 76 | LL | let _ = abc as i8; | |
| 77 | | ^^^^^^^^^ help: try: `abc as usize` | |
| 78 | ||
| 79 | error: casting function pointer `abc` to `i16`, which truncates the value | |
| 80 | --> tests/ui/fn_to_numeric_cast.rs:52:13 | |
| 81 | | | |
| 82 | LL | let _ = abc as i16; | |
| 83 | | ^^^^^^^^^^ help: try: `abc as usize` | |
| 84 | ||
| 85 | error: casting function pointer `abc` to `i32` | |
| 86 | --> tests/ui/fn_to_numeric_cast.rs:54:13 | |
| 87 | | | |
| 88 | LL | let _ = abc as i32; | |
| 89 | | ^^^^^^^^^^ help: try: `abc as usize` | |
| 90 | ||
| 91 | error: casting function pointer `abc` to `i64` | |
| 92 | --> tests/ui/fn_to_numeric_cast.rs:57:13 | |
| 93 | | | |
| 94 | LL | let _ = abc as i64; | |
| 95 | | ^^^^^^^^^^ help: try: `abc as usize` | |
| 96 | ||
| 97 | error: casting function pointer `abc` to `i128` | |
| 98 | --> tests/ui/fn_to_numeric_cast.rs:59:13 | |
| 99 | | | |
| 100 | LL | let _ = abc as i128; | |
| 101 | | ^^^^^^^^^^^ help: try: `abc as usize` | |
| 102 | ||
| 103 | error: casting function pointer `abc` to `isize` | |
| 104 | --> tests/ui/fn_to_numeric_cast.rs:61:13 | |
| 105 | | | |
| 106 | LL | let _ = abc as isize; | |
| 107 | | ^^^^^^^^^^^^ help: try: `abc as usize` | |
| 108 | ||
| 109 | error: casting function pointer `abc` to `u8`, which truncates the value | |
| 110 | --> tests/ui/fn_to_numeric_cast.rs:64:13 | |
| 111 | | | |
| 112 | LL | let _ = abc as u8; | |
| 113 | | ^^^^^^^^^ help: try: `abc as usize` | |
| 114 | ||
| 115 | error: casting function pointer `abc` to `u16`, which truncates the value | |
| 116 | --> tests/ui/fn_to_numeric_cast.rs:66:13 | |
| 117 | | | |
| 118 | LL | let _ = abc as u16; | |
| 119 | | ^^^^^^^^^^ help: try: `abc as usize` | |
| 120 | ||
| 121 | error: casting function pointer `abc` to `u32` | |
| 122 | --> tests/ui/fn_to_numeric_cast.rs:68:13 | |
| 123 | | | |
| 124 | LL | let _ = abc as u32; | |
| 125 | | ^^^^^^^^^^ help: try: `abc as usize` | |
| 126 | ||
| 127 | error: casting function pointer `abc` to `u64` | |
| 128 | --> tests/ui/fn_to_numeric_cast.rs:71:13 | |
| 129 | | | |
| 130 | LL | let _ = abc as u64; | |
| 131 | | ^^^^^^^^^^ help: try: `abc as usize` | |
| 132 | ||
| 133 | error: casting function pointer `abc` to `u128` | |
| 134 | --> tests/ui/fn_to_numeric_cast.rs:73:13 | |
| 135 | | | |
| 136 | LL | let _ = abc as u128; | |
| 137 | | ^^^^^^^^^^^ help: try: `abc as usize` | |
| 138 | ||
| 139 | error: casting function pointer `f` to `i32` | |
| 140 | --> tests/ui/fn_to_numeric_cast.rs:81:5 | |
| 141 | | | |
| 142 | LL | f as i32 | |
| 143 | | ^^^^^^^^ help: try: `f as usize` | |
| 144 | ||
| 145 | error: aborting due to 23 previous errors | |
| 146 |
src/tools/clippy/tests/ui/fn_to_numeric_cast.r64bit.stderr created+146| ... | ... | @@ -0,0 +1,146 @@ |
| 1 | error: casting function pointer `foo` to `i8`, which truncates the value | |
| 2 | --> tests/ui/fn_to_numeric_cast.rs:13:13 | |
| 3 | | | |
| 4 | LL | let _ = foo as i8; | |
| 5 | | ^^^^^^^^^ help: try: `foo as usize` | |
| 6 | | | |
| 7 | = note: `-D clippy::fn-to-numeric-cast-with-truncation` implied by `-D warnings` | |
| 8 | = help: to override `-D warnings` add `#[allow(clippy::fn_to_numeric_cast_with_truncation)]` | |
| 9 | ||
| 10 | error: casting function pointer `foo` to `i16`, which truncates the value | |
| 11 | --> tests/ui/fn_to_numeric_cast.rs:15:13 | |
| 12 | | | |
| 13 | LL | let _ = foo as i16; | |
| 14 | | ^^^^^^^^^^ help: try: `foo as usize` | |
| 15 | ||
| 16 | error: casting function pointer `foo` to `i32`, which truncates the value | |
| 17 | --> tests/ui/fn_to_numeric_cast.rs:17:13 | |
| 18 | | | |
| 19 | LL | let _ = foo as i32; | |
| 20 | | ^^^^^^^^^^ help: try: `foo as usize` | |
| 21 | ||
| 22 | error: casting function pointer `foo` to `i64` | |
| 23 | --> tests/ui/fn_to_numeric_cast.rs:20:13 | |
| 24 | | | |
| 25 | LL | let _ = foo as i64; | |
| 26 | | ^^^^^^^^^^ help: try: `foo as usize` | |
| 27 | | | |
| 28 | = note: `-D clippy::fn-to-numeric-cast` implied by `-D warnings` | |
| 29 | = help: to override `-D warnings` add `#[allow(clippy::fn_to_numeric_cast)]` | |
| 30 | ||
| 31 | error: casting function pointer `foo` to `i128` | |
| 32 | --> tests/ui/fn_to_numeric_cast.rs:22:13 | |
| 33 | | | |
| 34 | LL | let _ = foo as i128; | |
| 35 | | ^^^^^^^^^^^ help: try: `foo as usize` | |
| 36 | ||
| 37 | error: casting function pointer `foo` to `isize` | |
| 38 | --> tests/ui/fn_to_numeric_cast.rs:24:13 | |
| 39 | | | |
| 40 | LL | let _ = foo as isize; | |
| 41 | | ^^^^^^^^^^^^ help: try: `foo as usize` | |
| 42 | ||
| 43 | error: casting function pointer `foo` to `u8`, which truncates the value | |
| 44 | --> tests/ui/fn_to_numeric_cast.rs:27:13 | |
| 45 | | | |
| 46 | LL | let _ = foo as u8; | |
| 47 | | ^^^^^^^^^ help: try: `foo as usize` | |
| 48 | ||
| 49 | error: casting function pointer `foo` to `u16`, which truncates the value | |
| 50 | --> tests/ui/fn_to_numeric_cast.rs:29:13 | |
| 51 | | | |
| 52 | LL | let _ = foo as u16; | |
| 53 | | ^^^^^^^^^^ help: try: `foo as usize` | |
| 54 | ||
| 55 | error: casting function pointer `foo` to `u32`, which truncates the value | |
| 56 | --> tests/ui/fn_to_numeric_cast.rs:31:13 | |
| 57 | | | |
| 58 | LL | let _ = foo as u32; | |
| 59 | | ^^^^^^^^^^ help: try: `foo as usize` | |
| 60 | ||
| 61 | error: casting function pointer `foo` to `u64` | |
| 62 | --> tests/ui/fn_to_numeric_cast.rs:34:13 | |
| 63 | | | |
| 64 | LL | let _ = foo as u64; | |
| 65 | | ^^^^^^^^^^ help: try: `foo as usize` | |
| 66 | ||
| 67 | error: casting function pointer `foo` to `u128` | |
| 68 | --> tests/ui/fn_to_numeric_cast.rs:36:13 | |
| 69 | | | |
| 70 | LL | let _ = foo as u128; | |
| 71 | | ^^^^^^^^^^^ help: try: `foo as usize` | |
| 72 | ||
| 73 | error: casting function pointer `abc` to `i8`, which truncates the value | |
| 74 | --> tests/ui/fn_to_numeric_cast.rs:50:13 | |
| 75 | | | |
| 76 | LL | let _ = abc as i8; | |
| 77 | | ^^^^^^^^^ help: try: `abc as usize` | |
| 78 | ||
| 79 | error: casting function pointer `abc` to `i16`, which truncates the value | |
| 80 | --> tests/ui/fn_to_numeric_cast.rs:52:13 | |
| 81 | | | |
| 82 | LL | let _ = abc as i16; | |
| 83 | | ^^^^^^^^^^ help: try: `abc as usize` | |
| 84 | ||
| 85 | error: casting function pointer `abc` to `i32`, which truncates the value | |
| 86 | --> tests/ui/fn_to_numeric_cast.rs:54:13 | |
| 87 | | | |
| 88 | LL | let _ = abc as i32; | |
| 89 | | ^^^^^^^^^^ help: try: `abc as usize` | |
| 90 | ||
| 91 | error: casting function pointer `abc` to `i64` | |
| 92 | --> tests/ui/fn_to_numeric_cast.rs:57:13 | |
| 93 | | | |
| 94 | LL | let _ = abc as i64; | |
| 95 | | ^^^^^^^^^^ help: try: `abc as usize` | |
| 96 | ||
| 97 | error: casting function pointer `abc` to `i128` | |
| 98 | --> tests/ui/fn_to_numeric_cast.rs:59:13 | |
| 99 | | | |
| 100 | LL | let _ = abc as i128; | |
| 101 | | ^^^^^^^^^^^ help: try: `abc as usize` | |
| 102 | ||
| 103 | error: casting function pointer `abc` to `isize` | |
| 104 | --> tests/ui/fn_to_numeric_cast.rs:61:13 | |
| 105 | | | |
| 106 | LL | let _ = abc as isize; | |
| 107 | | ^^^^^^^^^^^^ help: try: `abc as usize` | |
| 108 | ||
| 109 | error: casting function pointer `abc` to `u8`, which truncates the value | |
| 110 | --> tests/ui/fn_to_numeric_cast.rs:64:13 | |
| 111 | | | |
| 112 | LL | let _ = abc as u8; | |
| 113 | | ^^^^^^^^^ help: try: `abc as usize` | |
| 114 | ||
| 115 | error: casting function pointer `abc` to `u16`, which truncates the value | |
| 116 | --> tests/ui/fn_to_numeric_cast.rs:66:13 | |
| 117 | | | |
| 118 | LL | let _ = abc as u16; | |
| 119 | | ^^^^^^^^^^ help: try: `abc as usize` | |
| 120 | ||
| 121 | error: casting function pointer `abc` to `u32`, which truncates the value | |
| 122 | --> tests/ui/fn_to_numeric_cast.rs:68:13 | |
| 123 | | | |
| 124 | LL | let _ = abc as u32; | |
| 125 | | ^^^^^^^^^^ help: try: `abc as usize` | |
| 126 | ||
| 127 | error: casting function pointer `abc` to `u64` | |
| 128 | --> tests/ui/fn_to_numeric_cast.rs:71:13 | |
| 129 | | | |
| 130 | LL | let _ = abc as u64; | |
| 131 | | ^^^^^^^^^^ help: try: `abc as usize` | |
| 132 | ||
| 133 | error: casting function pointer `abc` to `u128` | |
| 134 | --> tests/ui/fn_to_numeric_cast.rs:73:13 | |
| 135 | | | |
| 136 | LL | let _ = abc as u128; | |
| 137 | | ^^^^^^^^^^^ help: try: `abc as usize` | |
| 138 | ||
| 139 | error: casting function pointer `f` to `i32`, which truncates the value | |
| 140 | --> tests/ui/fn_to_numeric_cast.rs:81:5 | |
| 141 | | | |
| 142 | LL | f as i32 | |
| 143 | | ^^^^^^^^ help: try: `f as usize` | |
| 144 | ||
| 145 | error: aborting due to 23 previous errors | |
| 146 |
src/tools/clippy/tests/ui/fn_to_numeric_cast.rs+13-13| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | //@revisions: 32bit 64bit | |
| 2 | //@[32bit]ignore-bitwidth: 64 | |
| 3 | //@[64bit]ignore-bitwidth: 32 | |
| 1 | //@revisions: r32bit r64bit | |
| 2 | //@[r32bit]ignore-bitwidth: 64 | |
| 3 | //@[r64bit]ignore-bitwidth: 32 | |
| 4 | 4 | //@no-rustfix |
| 5 | 5 | #![warn(clippy::fn_to_numeric_cast, clippy::fn_to_numeric_cast_with_truncation)] |
| 6 | 6 | #![allow(function_casts_as_integer)] |
| ... | ... | @@ -15,8 +15,8 @@ fn test_function_to_numeric_cast() { |
| 15 | 15 | let _ = foo as i16; |
| 16 | 16 | //~^ fn_to_numeric_cast_with_truncation |
| 17 | 17 | let _ = foo as i32; |
| 18 | //~[64bit]^ fn_to_numeric_cast_with_truncation | |
| 19 | //~[32bit]^^ fn_to_numeric_cast | |
| 18 | //~[r64bit]^ fn_to_numeric_cast_with_truncation | |
| 19 | //~[r32bit]^^ fn_to_numeric_cast | |
| 20 | 20 | let _ = foo as i64; |
| 21 | 21 | //~^ fn_to_numeric_cast |
| 22 | 22 | let _ = foo as i128; |
| ... | ... | @@ -29,8 +29,8 @@ fn test_function_to_numeric_cast() { |
| 29 | 29 | let _ = foo as u16; |
| 30 | 30 | //~^ fn_to_numeric_cast_with_truncation |
| 31 | 31 | let _ = foo as u32; |
| 32 | //~[64bit]^ fn_to_numeric_cast_with_truncation | |
| 33 | //~[32bit]^^ fn_to_numeric_cast | |
| 32 | //~[r64bit]^ fn_to_numeric_cast_with_truncation | |
| 33 | //~[r32bit]^^ fn_to_numeric_cast | |
| 34 | 34 | let _ = foo as u64; |
| 35 | 35 | //~^ fn_to_numeric_cast |
| 36 | 36 | let _ = foo as u128; |
| ... | ... | @@ -52,8 +52,8 @@ fn test_function_var_to_numeric_cast() { |
| 52 | 52 | let _ = abc as i16; |
| 53 | 53 | //~^ fn_to_numeric_cast_with_truncation |
| 54 | 54 | let _ = abc as i32; |
| 55 | //~[64bit]^ fn_to_numeric_cast_with_truncation | |
| 56 | //~[32bit]^^ fn_to_numeric_cast | |
| 55 | //~[r64bit]^ fn_to_numeric_cast_with_truncation | |
| 56 | //~[r32bit]^^ fn_to_numeric_cast | |
| 57 | 57 | let _ = abc as i64; |
| 58 | 58 | //~^ fn_to_numeric_cast |
| 59 | 59 | let _ = abc as i128; |
| ... | ... | @@ -66,8 +66,8 @@ fn test_function_var_to_numeric_cast() { |
| 66 | 66 | let _ = abc as u16; |
| 67 | 67 | //~^ fn_to_numeric_cast_with_truncation |
| 68 | 68 | let _ = abc as u32; |
| 69 | //~[64bit]^ fn_to_numeric_cast_with_truncation | |
| 70 | //~[32bit]^^ fn_to_numeric_cast | |
| 69 | //~[r64bit]^ fn_to_numeric_cast_with_truncation | |
| 70 | //~[r32bit]^^ fn_to_numeric_cast | |
| 71 | 71 | let _ = abc as u64; |
| 72 | 72 | //~^ fn_to_numeric_cast |
| 73 | 73 | let _ = abc as u128; |
| ... | ... | @@ -79,8 +79,8 @@ fn test_function_var_to_numeric_cast() { |
| 79 | 79 | |
| 80 | 80 | fn fn_with_fn_args(f: fn(i32) -> i32) -> i32 { |
| 81 | 81 | f as i32 |
| 82 | //~[64bit]^ fn_to_numeric_cast_with_truncation | |
| 83 | //~[32bit]^^ fn_to_numeric_cast | |
| 82 | //~[r64bit]^ fn_to_numeric_cast_with_truncation | |
| 83 | //~[r32bit]^^ fn_to_numeric_cast | |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | fn main() {} |
src/tools/clippy/tests/ui/large_enum_variant.32bit.stderr deleted-345| ... | ... | @@ -1,345 +0,0 @@ |
| 1 | error: large size difference between variants | |
| 2 | --> tests/ui/large_enum_variant.rs:13:1 | |
| 3 | | | |
| 4 | LL | / enum LargeEnum { | |
| 5 | LL | | | |
| 6 | LL | | A(i32), | |
| 7 | | | ------ the second-largest variant contains at least 4 bytes | |
| 8 | LL | | B([i32; 8000]), | |
| 9 | | | -------------- the largest variant contains at least 32000 bytes | |
| 10 | LL | | } | |
| 11 | | |_^ the entire enum is at least 32004 bytes | |
| 12 | | | |
| 13 | = note: `-D clippy::large-enum-variant` implied by `-D warnings` | |
| 14 | = help: to override `-D warnings` add `#[allow(clippy::large_enum_variant)]` | |
| 15 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 16 | | | |
| 17 | LL - B([i32; 8000]), | |
| 18 | LL + B(Box<[i32; 8000]>), | |
| 19 | | | |
| 20 | ||
| 21 | error: large size difference between variants | |
| 22 | --> tests/ui/large_enum_variant.rs:38:1 | |
| 23 | | | |
| 24 | LL | / enum LargeEnum2 { | |
| 25 | LL | | | |
| 26 | LL | | VariantOk(i32, u32), | |
| 27 | | | ------------------- the second-largest variant contains at least 8 bytes | |
| 28 | LL | | ContainingLargeEnum(LargeEnum), | |
| 29 | | | ------------------------------ the largest variant contains at least 32004 bytes | |
| 30 | LL | | } | |
| 31 | | |_^ the entire enum is at least 32004 bytes | |
| 32 | | | |
| 33 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 34 | | | |
| 35 | LL - ContainingLargeEnum(LargeEnum), | |
| 36 | LL + ContainingLargeEnum(Box<LargeEnum>), | |
| 37 | | | |
| 38 | ||
| 39 | error: large size difference between variants | |
| 40 | --> tests/ui/large_enum_variant.rs:44:1 | |
| 41 | | | |
| 42 | LL | / enum LargeEnum3 { | |
| 43 | LL | | | |
| 44 | LL | | ContainingMoreThanOneField(i32, [i32; 8000], [i32; 9500]), | |
| 45 | | | --------------------------------------------------------- the largest variant contains at least 70004 bytes | |
| 46 | LL | | VoidVariant, | |
| 47 | LL | | StructLikeLittle { x: i32, y: i32 }, | |
| 48 | | | ----------------------------------- the second-largest variant contains at least 8 bytes | |
| 49 | LL | | } | |
| 50 | | |_^ the entire enum is at least 70008 bytes | |
| 51 | | | |
| 52 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 53 | | | |
| 54 | LL - ContainingMoreThanOneField(i32, [i32; 8000], [i32; 9500]), | |
| 55 | LL + ContainingMoreThanOneField(i32, Box<[i32; 8000]>, Box<[i32; 9500]>), | |
| 56 | | | |
| 57 | ||
| 58 | error: large size difference between variants | |
| 59 | --> tests/ui/large_enum_variant.rs:51:1 | |
| 60 | | | |
| 61 | LL | / enum LargeEnum4 { | |
| 62 | LL | | | |
| 63 | LL | | VariantOk(i32, u32), | |
| 64 | | | ------------------- the second-largest variant contains at least 8 bytes | |
| 65 | LL | | StructLikeLarge { x: [i32; 8000], y: i32 }, | |
| 66 | | | ------------------------------------------ the largest variant contains at least 32004 bytes | |
| 67 | LL | | } | |
| 68 | | |_^ the entire enum is at least 32008 bytes | |
| 69 | | | |
| 70 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 71 | | | |
| 72 | LL - StructLikeLarge { x: [i32; 8000], y: i32 }, | |
| 73 | LL + StructLikeLarge { x: Box<[i32; 8000]>, y: i32 }, | |
| 74 | | | |
| 75 | ||
| 76 | error: large size difference between variants | |
| 77 | --> tests/ui/large_enum_variant.rs:57:1 | |
| 78 | | | |
| 79 | LL | / enum LargeEnum5 { | |
| 80 | LL | | | |
| 81 | LL | | VariantOk(i32, u32), | |
| 82 | | | ------------------- the second-largest variant contains at least 8 bytes | |
| 83 | LL | | StructLikeLarge2 { x: [i32; 8000] }, | |
| 84 | | | ----------------------------------- the largest variant contains at least 32000 bytes | |
| 85 | LL | | } | |
| 86 | | |_^ the entire enum is at least 32004 bytes | |
| 87 | | | |
| 88 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 89 | | | |
| 90 | LL - StructLikeLarge2 { x: [i32; 8000] }, | |
| 91 | LL + StructLikeLarge2 { x: Box<[i32; 8000]> }, | |
| 92 | | | |
| 93 | ||
| 94 | error: large size difference between variants | |
| 95 | --> tests/ui/large_enum_variant.rs:74:1 | |
| 96 | | | |
| 97 | LL | / enum LargeEnum7 { | |
| 98 | LL | | | |
| 99 | LL | | A, | |
| 100 | LL | | B([u8; 1255]), | |
| 101 | | | ------------- the largest variant contains at least 1255 bytes | |
| 102 | LL | | C([u8; 200]), | |
| 103 | | | ------------ the second-largest variant contains at least 200 bytes | |
| 104 | LL | | } | |
| 105 | | |_^ the entire enum is at least 1256 bytes | |
| 106 | | | |
| 107 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 108 | | | |
| 109 | LL - B([u8; 1255]), | |
| 110 | LL + B(Box<[u8; 1255]>), | |
| 111 | | | |
| 112 | ||
| 113 | error: large size difference between variants | |
| 114 | --> tests/ui/large_enum_variant.rs:81:1 | |
| 115 | | | |
| 116 | LL | / enum LargeEnum8 { | |
| 117 | LL | | | |
| 118 | LL | | VariantOk(i32, u32), | |
| 119 | | | ------------------- the second-largest variant contains at least 8 bytes | |
| 120 | LL | | ContainingMoreThanOneField([i32; 8000], [i32; 2], [i32; 9500], [i32; 30]), | |
| 121 | | | ------------------------------------------------------------------------- the largest variant contains at least 70128 bytes | |
| 122 | LL | | } | |
| 123 | | |_^ the entire enum is at least 70132 bytes | |
| 124 | | | |
| 125 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 126 | | | |
| 127 | LL - ContainingMoreThanOneField([i32; 8000], [i32; 2], [i32; 9500], [i32; 30]), | |
| 128 | LL + ContainingMoreThanOneField(Box<[i32; 8000]>, [i32; 2], Box<[i32; 9500]>, [i32; 30]), | |
| 129 | | | |
| 130 | ||
| 131 | error: large size difference between variants | |
| 132 | --> tests/ui/large_enum_variant.rs:87:1 | |
| 133 | | | |
| 134 | LL | / enum LargeEnum9 { | |
| 135 | LL | | | |
| 136 | LL | | A(Struct<()>), | |
| 137 | | | ------------- the second-largest variant contains at least 4 bytes | |
| 138 | LL | | B(Struct2), | |
| 139 | | | ---------- the largest variant contains at least 32000 bytes | |
| 140 | LL | | } | |
| 141 | | |_^ the entire enum is at least 32004 bytes | |
| 142 | | | |
| 143 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 144 | | | |
| 145 | LL - B(Struct2), | |
| 146 | LL + B(Box<Struct2>), | |
| 147 | | | |
| 148 | ||
| 149 | error: large size difference between variants | |
| 150 | --> tests/ui/large_enum_variant.rs:93:1 | |
| 151 | | | |
| 152 | LL | / enum LargeEnumOk2<T> { | |
| 153 | LL | | | |
| 154 | LL | | A(T), | |
| 155 | | | ---- the second-largest variant contains at least 0 bytes | |
| 156 | LL | | B(Struct2), | |
| 157 | | | ---------- the largest variant contains at least 32000 bytes | |
| 158 | LL | | } | |
| 159 | | |_^ the entire enum is at least 32000 bytes | |
| 160 | | | |
| 161 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 162 | | | |
| 163 | LL - B(Struct2), | |
| 164 | LL + B(Box<Struct2>), | |
| 165 | | | |
| 166 | ||
| 167 | error: large size difference between variants | |
| 168 | --> tests/ui/large_enum_variant.rs:99:1 | |
| 169 | | | |
| 170 | LL | / enum LargeEnumOk3<T> { | |
| 171 | LL | | | |
| 172 | LL | | A(Struct<T>), | |
| 173 | | | ------------ the second-largest variant contains at least 4 bytes | |
| 174 | LL | | B(Struct2), | |
| 175 | | | ---------- the largest variant contains at least 32000 bytes | |
| 176 | LL | | } | |
| 177 | | |_^ the entire enum is at least 32000 bytes | |
| 178 | | | |
| 179 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 180 | | | |
| 181 | LL - B(Struct2), | |
| 182 | LL + B(Box<Struct2>), | |
| 183 | | | |
| 184 | ||
| 185 | error: large size difference between variants | |
| 186 | --> tests/ui/large_enum_variant.rs:115:1 | |
| 187 | | | |
| 188 | LL | / enum CopyableLargeEnum { | |
| 189 | LL | | | |
| 190 | LL | | A(bool), | |
| 191 | | | ------- the second-largest variant contains at least 1 bytes | |
| 192 | LL | | B([u64; 8000]), | |
| 193 | | | -------------- the largest variant contains at least 64000 bytes | |
| 194 | LL | | } | |
| 195 | | |_^ the entire enum is at least 64004 bytes | |
| 196 | | | |
| 197 | note: boxing a variant would require the type no longer be `Copy` | |
| 198 | --> tests/ui/large_enum_variant.rs:115:6 | |
| 199 | | | |
| 200 | LL | enum CopyableLargeEnum { | |
| 201 | | ^^^^^^^^^^^^^^^^^ | |
| 202 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 203 | --> tests/ui/large_enum_variant.rs:118:5 | |
| 204 | | | |
| 205 | LL | B([u64; 8000]), | |
| 206 | | ^^^^^^^^^^^^^^ | |
| 207 | ||
| 208 | error: large size difference between variants | |
| 209 | --> tests/ui/large_enum_variant.rs:121:1 | |
| 210 | | | |
| 211 | LL | / enum ManuallyCopyLargeEnum { | |
| 212 | LL | | | |
| 213 | LL | | A(bool), | |
| 214 | | | ------- the second-largest variant contains at least 1 bytes | |
| 215 | LL | | B([u64; 8000]), | |
| 216 | | | -------------- the largest variant contains at least 64000 bytes | |
| 217 | LL | | } | |
| 218 | | |_^ the entire enum is at least 64004 bytes | |
| 219 | | | |
| 220 | note: boxing a variant would require the type no longer be `Copy` | |
| 221 | --> tests/ui/large_enum_variant.rs:121:6 | |
| 222 | | | |
| 223 | LL | enum ManuallyCopyLargeEnum { | |
| 224 | | ^^^^^^^^^^^^^^^^^^^^^ | |
| 225 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 226 | --> tests/ui/large_enum_variant.rs:124:5 | |
| 227 | | | |
| 228 | LL | B([u64; 8000]), | |
| 229 | | ^^^^^^^^^^^^^^ | |
| 230 | ||
| 231 | error: large size difference between variants | |
| 232 | --> tests/ui/large_enum_variant.rs:135:1 | |
| 233 | | | |
| 234 | LL | / enum SomeGenericPossiblyCopyEnum<T> { | |
| 235 | LL | | | |
| 236 | LL | | A(bool, std::marker::PhantomData<T>), | |
| 237 | | | ------------------------------------ the second-largest variant contains at least 1 bytes | |
| 238 | LL | | B([u64; 4000]), | |
| 239 | | | -------------- the largest variant contains at least 32000 bytes | |
| 240 | LL | | } | |
| 241 | | |_^ the entire enum is at least 32004 bytes | |
| 242 | | | |
| 243 | note: boxing a variant would require the type no longer be `Copy` | |
| 244 | --> tests/ui/large_enum_variant.rs:135:6 | |
| 245 | | | |
| 246 | LL | enum SomeGenericPossiblyCopyEnum<T> { | |
| 247 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 248 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 249 | --> tests/ui/large_enum_variant.rs:138:5 | |
| 250 | | | |
| 251 | LL | B([u64; 4000]), | |
| 252 | | ^^^^^^^^^^^^^^ | |
| 253 | ||
| 254 | error: large size difference between variants | |
| 255 | --> tests/ui/large_enum_variant.rs:149:1 | |
| 256 | | | |
| 257 | LL | / enum LargeEnumWithGenerics<T> { | |
| 258 | LL | | | |
| 259 | LL | | Small, | |
| 260 | | | ----- the second-largest variant carries no data at all | |
| 261 | LL | | Large((T, [u8; 512])), | |
| 262 | | | --------------------- the largest variant contains at least 512 bytes | |
| 263 | LL | | } | |
| 264 | | |_^ the entire enum is at least 512 bytes | |
| 265 | | | |
| 266 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 267 | | | |
| 268 | LL - Large((T, [u8; 512])), | |
| 269 | LL + Large(Box<(T, [u8; 512])>), | |
| 270 | | | |
| 271 | ||
| 272 | error: large size difference between variants | |
| 273 | --> tests/ui/large_enum_variant.rs:159:1 | |
| 274 | | | |
| 275 | LL | / enum WithGenerics { | |
| 276 | LL | | | |
| 277 | LL | | Large([Foo<u64>; 64]), | |
| 278 | | | --------------------- the largest variant contains at least 512 bytes | |
| 279 | LL | | Small(u8), | |
| 280 | | | --------- the second-largest variant contains at least 1 bytes | |
| 281 | LL | | } | |
| 282 | | |_^ the entire enum is at least 516 bytes | |
| 283 | | | |
| 284 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 285 | | | |
| 286 | LL - Large([Foo<u64>; 64]), | |
| 287 | LL + Large(Box<[Foo<u64>; 64]>), | |
| 288 | | | |
| 289 | ||
| 290 | error: large size difference between variants | |
| 291 | --> tests/ui/large_enum_variant.rs:170:1 | |
| 292 | | | |
| 293 | LL | / enum LargeEnumOfConst { | |
| 294 | LL | | | |
| 295 | LL | | Ok, | |
| 296 | | | -- the second-largest variant carries no data at all | |
| 297 | LL | | Error(PossiblyLargeEnumWithConst<256>), | |
| 298 | | | -------------------------------------- the largest variant contains at least 514 bytes | |
| 299 | LL | | } | |
| 300 | | |_^ the entire enum is at least 514 bytes | |
| 301 | | | |
| 302 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 303 | | | |
| 304 | LL - Error(PossiblyLargeEnumWithConst<256>), | |
| 305 | LL + Error(Box<PossiblyLargeEnumWithConst<256>>), | |
| 306 | | | |
| 307 | ||
| 308 | error: large size difference between variants | |
| 309 | --> tests/ui/large_enum_variant.rs:176:1 | |
| 310 | | | |
| 311 | LL | / enum WithRecursion { | |
| 312 | LL | | | |
| 313 | LL | | Large([u64; 64]), | |
| 314 | | | ---------------- the largest variant contains at least 512 bytes | |
| 315 | LL | | Recursive(Box<WithRecursion>), | |
| 316 | | | ----------------------------- the second-largest variant contains at least 4 bytes | |
| 317 | LL | | } | |
| 318 | | |_^ the entire enum is at least 516 bytes | |
| 319 | | | |
| 320 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 321 | | | |
| 322 | LL - Large([u64; 64]), | |
| 323 | LL + Large(Box<[u64; 64]>), | |
| 324 | | | |
| 325 | ||
| 326 | error: large size difference between variants | |
| 327 | --> tests/ui/large_enum_variant.rs:187:1 | |
| 328 | | | |
| 329 | LL | / enum LargeEnumWithGenericsAndRecursive { | |
| 330 | LL | | | |
| 331 | LL | | Ok(), | |
| 332 | | | ---- the second-largest variant carries no data at all | |
| 333 | LL | | Error(WithRecursionAndGenerics<u64>), | |
| 334 | | | ------------------------------------ the largest variant contains at least 516 bytes | |
| 335 | LL | | } | |
| 336 | | |_^ the entire enum is at least 516 bytes | |
| 337 | | | |
| 338 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 339 | | | |
| 340 | LL - Error(WithRecursionAndGenerics<u64>), | |
| 341 | LL + Error(Box<WithRecursionAndGenerics<u64>>), | |
| 342 | | | |
| 343 | ||
| 344 | error: aborting due to 18 previous errors | |
| 345 |
src/tools/clippy/tests/ui/large_enum_variant.64bit.stderr deleted-381| ... | ... | @@ -1,381 +0,0 @@ |
| 1 | error: large size difference between variants | |
| 2 | --> tests/ui/large_enum_variant.rs:13:1 | |
| 3 | | | |
| 4 | LL | / enum LargeEnum { | |
| 5 | LL | | | |
| 6 | LL | | A(i32), | |
| 7 | | | ------ the second-largest variant contains at least 4 bytes | |
| 8 | LL | | B([i32; 8000]), | |
| 9 | | | -------------- the largest variant contains at least 32000 bytes | |
| 10 | LL | | } | |
| 11 | | |_^ the entire enum is at least 32004 bytes | |
| 12 | | | |
| 13 | = note: `-D clippy::large-enum-variant` implied by `-D warnings` | |
| 14 | = help: to override `-D warnings` add `#[allow(clippy::large_enum_variant)]` | |
| 15 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 16 | | | |
| 17 | LL - B([i32; 8000]), | |
| 18 | LL + B(Box<[i32; 8000]>), | |
| 19 | | | |
| 20 | ||
| 21 | error: large size difference between variants | |
| 22 | --> tests/ui/large_enum_variant.rs:38:1 | |
| 23 | | | |
| 24 | LL | / enum LargeEnum2 { | |
| 25 | LL | | | |
| 26 | LL | | VariantOk(i32, u32), | |
| 27 | | | ------------------- the second-largest variant contains at least 8 bytes | |
| 28 | LL | | ContainingLargeEnum(LargeEnum), | |
| 29 | | | ------------------------------ the largest variant contains at least 32004 bytes | |
| 30 | LL | | } | |
| 31 | | |_^ the entire enum is at least 32004 bytes | |
| 32 | | | |
| 33 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 34 | | | |
| 35 | LL - ContainingLargeEnum(LargeEnum), | |
| 36 | LL + ContainingLargeEnum(Box<LargeEnum>), | |
| 37 | | | |
| 38 | ||
| 39 | error: large size difference between variants | |
| 40 | --> tests/ui/large_enum_variant.rs:44:1 | |
| 41 | | | |
| 42 | LL | / enum LargeEnum3 { | |
| 43 | LL | | | |
| 44 | LL | | ContainingMoreThanOneField(i32, [i32; 8000], [i32; 9500]), | |
| 45 | | | --------------------------------------------------------- the largest variant contains at least 70004 bytes | |
| 46 | LL | | VoidVariant, | |
| 47 | LL | | StructLikeLittle { x: i32, y: i32 }, | |
| 48 | | | ----------------------------------- the second-largest variant contains at least 8 bytes | |
| 49 | LL | | } | |
| 50 | | |_^ the entire enum is at least 70008 bytes | |
| 51 | | | |
| 52 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 53 | | | |
| 54 | LL - ContainingMoreThanOneField(i32, [i32; 8000], [i32; 9500]), | |
| 55 | LL + ContainingMoreThanOneField(i32, Box<[i32; 8000]>, Box<[i32; 9500]>), | |
| 56 | | | |
| 57 | ||
| 58 | error: large size difference between variants | |
| 59 | --> tests/ui/large_enum_variant.rs:51:1 | |
| 60 | | | |
| 61 | LL | / enum LargeEnum4 { | |
| 62 | LL | | | |
| 63 | LL | | VariantOk(i32, u32), | |
| 64 | | | ------------------- the second-largest variant contains at least 8 bytes | |
| 65 | LL | | StructLikeLarge { x: [i32; 8000], y: i32 }, | |
| 66 | | | ------------------------------------------ the largest variant contains at least 32004 bytes | |
| 67 | LL | | } | |
| 68 | | |_^ the entire enum is at least 32008 bytes | |
| 69 | | | |
| 70 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 71 | | | |
| 72 | LL - StructLikeLarge { x: [i32; 8000], y: i32 }, | |
| 73 | LL + StructLikeLarge { x: Box<[i32; 8000]>, y: i32 }, | |
| 74 | | | |
| 75 | ||
| 76 | error: large size difference between variants | |
| 77 | --> tests/ui/large_enum_variant.rs:57:1 | |
| 78 | | | |
| 79 | LL | / enum LargeEnum5 { | |
| 80 | LL | | | |
| 81 | LL | | VariantOk(i32, u32), | |
| 82 | | | ------------------- the second-largest variant contains at least 8 bytes | |
| 83 | LL | | StructLikeLarge2 { x: [i32; 8000] }, | |
| 84 | | | ----------------------------------- the largest variant contains at least 32000 bytes | |
| 85 | LL | | } | |
| 86 | | |_^ the entire enum is at least 32004 bytes | |
| 87 | | | |
| 88 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 89 | | | |
| 90 | LL - StructLikeLarge2 { x: [i32; 8000] }, | |
| 91 | LL + StructLikeLarge2 { x: Box<[i32; 8000]> }, | |
| 92 | | | |
| 93 | ||
| 94 | error: large size difference between variants | |
| 95 | --> tests/ui/large_enum_variant.rs:74:1 | |
| 96 | | | |
| 97 | LL | / enum LargeEnum7 { | |
| 98 | LL | | | |
| 99 | LL | | A, | |
| 100 | LL | | B([u8; 1255]), | |
| 101 | | | ------------- the largest variant contains at least 1255 bytes | |
| 102 | LL | | C([u8; 200]), | |
| 103 | | | ------------ the second-largest variant contains at least 200 bytes | |
| 104 | LL | | } | |
| 105 | | |_^ the entire enum is at least 1256 bytes | |
| 106 | | | |
| 107 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 108 | | | |
| 109 | LL - B([u8; 1255]), | |
| 110 | LL + B(Box<[u8; 1255]>), | |
| 111 | | | |
| 112 | ||
| 113 | error: large size difference between variants | |
| 114 | --> tests/ui/large_enum_variant.rs:81:1 | |
| 115 | | | |
| 116 | LL | / enum LargeEnum8 { | |
| 117 | LL | | | |
| 118 | LL | | VariantOk(i32, u32), | |
| 119 | | | ------------------- the second-largest variant contains at least 8 bytes | |
| 120 | LL | | ContainingMoreThanOneField([i32; 8000], [i32; 2], [i32; 9500], [i32; 30]), | |
| 121 | | | ------------------------------------------------------------------------- the largest variant contains at least 70128 bytes | |
| 122 | LL | | } | |
| 123 | | |_^ the entire enum is at least 70132 bytes | |
| 124 | | | |
| 125 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 126 | | | |
| 127 | LL - ContainingMoreThanOneField([i32; 8000], [i32; 2], [i32; 9500], [i32; 30]), | |
| 128 | LL + ContainingMoreThanOneField(Box<[i32; 8000]>, [i32; 2], Box<[i32; 9500]>, [i32; 30]), | |
| 129 | | | |
| 130 | ||
| 131 | error: large size difference between variants | |
| 132 | --> tests/ui/large_enum_variant.rs:87:1 | |
| 133 | | | |
| 134 | LL | / enum LargeEnum9 { | |
| 135 | LL | | | |
| 136 | LL | | A(Struct<()>), | |
| 137 | | | ------------- the second-largest variant contains at least 4 bytes | |
| 138 | LL | | B(Struct2), | |
| 139 | | | ---------- the largest variant contains at least 32000 bytes | |
| 140 | LL | | } | |
| 141 | | |_^ the entire enum is at least 32004 bytes | |
| 142 | | | |
| 143 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 144 | | | |
| 145 | LL - B(Struct2), | |
| 146 | LL + B(Box<Struct2>), | |
| 147 | | | |
| 148 | ||
| 149 | error: large size difference between variants | |
| 150 | --> tests/ui/large_enum_variant.rs:93:1 | |
| 151 | | | |
| 152 | LL | / enum LargeEnumOk2<T> { | |
| 153 | LL | | | |
| 154 | LL | | A(T), | |
| 155 | | | ---- the second-largest variant contains at least 0 bytes | |
| 156 | LL | | B(Struct2), | |
| 157 | | | ---------- the largest variant contains at least 32000 bytes | |
| 158 | LL | | } | |
| 159 | | |_^ the entire enum is at least 32000 bytes | |
| 160 | | | |
| 161 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 162 | | | |
| 163 | LL - B(Struct2), | |
| 164 | LL + B(Box<Struct2>), | |
| 165 | | | |
| 166 | ||
| 167 | error: large size difference between variants | |
| 168 | --> tests/ui/large_enum_variant.rs:99:1 | |
| 169 | | | |
| 170 | LL | / enum LargeEnumOk3<T> { | |
| 171 | LL | | | |
| 172 | LL | | A(Struct<T>), | |
| 173 | | | ------------ the second-largest variant contains at least 4 bytes | |
| 174 | LL | | B(Struct2), | |
| 175 | | | ---------- the largest variant contains at least 32000 bytes | |
| 176 | LL | | } | |
| 177 | | |_^ the entire enum is at least 32000 bytes | |
| 178 | | | |
| 179 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 180 | | | |
| 181 | LL - B(Struct2), | |
| 182 | LL + B(Box<Struct2>), | |
| 183 | | | |
| 184 | ||
| 185 | error: large size difference between variants | |
| 186 | --> tests/ui/large_enum_variant.rs:115:1 | |
| 187 | | | |
| 188 | LL | / enum CopyableLargeEnum { | |
| 189 | LL | | | |
| 190 | LL | | A(bool), | |
| 191 | | | ------- the second-largest variant contains at least 1 bytes | |
| 192 | LL | | B([u64; 8000]), | |
| 193 | | | -------------- the largest variant contains at least 64000 bytes | |
| 194 | LL | | } | |
| 195 | | |_^ the entire enum is at least 64008 bytes | |
| 196 | | | |
| 197 | note: boxing a variant would require the type no longer be `Copy` | |
| 198 | --> tests/ui/large_enum_variant.rs:115:6 | |
| 199 | | | |
| 200 | LL | enum CopyableLargeEnum { | |
| 201 | | ^^^^^^^^^^^^^^^^^ | |
| 202 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 203 | --> tests/ui/large_enum_variant.rs:118:5 | |
| 204 | | | |
| 205 | LL | B([u64; 8000]), | |
| 206 | | ^^^^^^^^^^^^^^ | |
| 207 | ||
| 208 | error: large size difference between variants | |
| 209 | --> tests/ui/large_enum_variant.rs:121:1 | |
| 210 | | | |
| 211 | LL | / enum ManuallyCopyLargeEnum { | |
| 212 | LL | | | |
| 213 | LL | | A(bool), | |
| 214 | | | ------- the second-largest variant contains at least 1 bytes | |
| 215 | LL | | B([u64; 8000]), | |
| 216 | | | -------------- the largest variant contains at least 64000 bytes | |
| 217 | LL | | } | |
| 218 | | |_^ the entire enum is at least 64008 bytes | |
| 219 | | | |
| 220 | note: boxing a variant would require the type no longer be `Copy` | |
| 221 | --> tests/ui/large_enum_variant.rs:121:6 | |
| 222 | | | |
| 223 | LL | enum ManuallyCopyLargeEnum { | |
| 224 | | ^^^^^^^^^^^^^^^^^^^^^ | |
| 225 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 226 | --> tests/ui/large_enum_variant.rs:124:5 | |
| 227 | | | |
| 228 | LL | B([u64; 8000]), | |
| 229 | | ^^^^^^^^^^^^^^ | |
| 230 | ||
| 231 | error: large size difference between variants | |
| 232 | --> tests/ui/large_enum_variant.rs:135:1 | |
| 233 | | | |
| 234 | LL | / enum SomeGenericPossiblyCopyEnum<T> { | |
| 235 | LL | | | |
| 236 | LL | | A(bool, std::marker::PhantomData<T>), | |
| 237 | | | ------------------------------------ the second-largest variant contains at least 1 bytes | |
| 238 | LL | | B([u64; 4000]), | |
| 239 | | | -------------- the largest variant contains at least 32000 bytes | |
| 240 | LL | | } | |
| 241 | | |_^ the entire enum is at least 32008 bytes | |
| 242 | | | |
| 243 | note: boxing a variant would require the type no longer be `Copy` | |
| 244 | --> tests/ui/large_enum_variant.rs:135:6 | |
| 245 | | | |
| 246 | LL | enum SomeGenericPossiblyCopyEnum<T> { | |
| 247 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 248 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 249 | --> tests/ui/large_enum_variant.rs:138:5 | |
| 250 | | | |
| 251 | LL | B([u64; 4000]), | |
| 252 | | ^^^^^^^^^^^^^^ | |
| 253 | ||
| 254 | error: large size difference between variants | |
| 255 | --> tests/ui/large_enum_variant.rs:149:1 | |
| 256 | | | |
| 257 | LL | / enum LargeEnumWithGenerics<T> { | |
| 258 | LL | | | |
| 259 | LL | | Small, | |
| 260 | | | ----- the second-largest variant carries no data at all | |
| 261 | LL | | Large((T, [u8; 512])), | |
| 262 | | | --------------------- the largest variant contains at least 512 bytes | |
| 263 | LL | | } | |
| 264 | | |_^ the entire enum is at least 512 bytes | |
| 265 | | | |
| 266 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 267 | | | |
| 268 | LL - Large((T, [u8; 512])), | |
| 269 | LL + Large(Box<(T, [u8; 512])>), | |
| 270 | | | |
| 271 | ||
| 272 | error: large size difference between variants | |
| 273 | --> tests/ui/large_enum_variant.rs:159:1 | |
| 274 | | | |
| 275 | LL | / enum WithGenerics { | |
| 276 | LL | | | |
| 277 | LL | | Large([Foo<u64>; 64]), | |
| 278 | | | --------------------- the largest variant contains at least 512 bytes | |
| 279 | LL | | Small(u8), | |
| 280 | | | --------- the second-largest variant contains at least 1 bytes | |
| 281 | LL | | } | |
| 282 | | |_^ the entire enum is at least 520 bytes | |
| 283 | | | |
| 284 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 285 | | | |
| 286 | LL - Large([Foo<u64>; 64]), | |
| 287 | LL + Large(Box<[Foo<u64>; 64]>), | |
| 288 | | | |
| 289 | ||
| 290 | error: large size difference between variants | |
| 291 | --> tests/ui/large_enum_variant.rs:170:1 | |
| 292 | | | |
| 293 | LL | / enum LargeEnumOfConst { | |
| 294 | LL | | | |
| 295 | LL | | Ok, | |
| 296 | | | -- the second-largest variant carries no data at all | |
| 297 | LL | | Error(PossiblyLargeEnumWithConst<256>), | |
| 298 | | | -------------------------------------- the largest variant contains at least 514 bytes | |
| 299 | LL | | } | |
| 300 | | |_^ the entire enum is at least 514 bytes | |
| 301 | | | |
| 302 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 303 | | | |
| 304 | LL - Error(PossiblyLargeEnumWithConst<256>), | |
| 305 | LL + Error(Box<PossiblyLargeEnumWithConst<256>>), | |
| 306 | | | |
| 307 | ||
| 308 | error: large size difference between variants | |
| 309 | --> tests/ui/large_enum_variant.rs:176:1 | |
| 310 | | | |
| 311 | LL | / enum WithRecursion { | |
| 312 | LL | | | |
| 313 | LL | | Large([u64; 64]), | |
| 314 | | | ---------------- the largest variant contains at least 512 bytes | |
| 315 | LL | | Recursive(Box<WithRecursion>), | |
| 316 | | | ----------------------------- the second-largest variant contains at least 8 bytes | |
| 317 | LL | | } | |
| 318 | | |_^ the entire enum is at least 520 bytes | |
| 319 | | | |
| 320 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 321 | | | |
| 322 | LL - Large([u64; 64]), | |
| 323 | LL + Large(Box<[u64; 64]>), | |
| 324 | | | |
| 325 | ||
| 326 | error: large size difference between variants | |
| 327 | --> tests/ui/large_enum_variant.rs:187:1 | |
| 328 | | | |
| 329 | LL | / enum LargeEnumWithGenericsAndRecursive { | |
| 330 | LL | | | |
| 331 | LL | | Ok(), | |
| 332 | | | ---- the second-largest variant carries no data at all | |
| 333 | LL | | Error(WithRecursionAndGenerics<u64>), | |
| 334 | | | ------------------------------------ the largest variant contains at least 520 bytes | |
| 335 | LL | | } | |
| 336 | | |_^ the entire enum is at least 520 bytes | |
| 337 | | | |
| 338 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 339 | | | |
| 340 | LL - Error(WithRecursionAndGenerics<u64>), | |
| 341 | LL + Error(Box<WithRecursionAndGenerics<u64>>), | |
| 342 | | | |
| 343 | ||
| 344 | error: large size difference between variants | |
| 345 | --> tests/ui/large_enum_variant.rs:223:5 | |
| 346 | | | |
| 347 | LL | / enum NoWarnings { | |
| 348 | LL | | | |
| 349 | LL | | BigBoi(PublishWithBytes), | |
| 350 | | | ------------------------ the largest variant contains at least 296 bytes | |
| 351 | LL | | _SmallBoi(u8), | |
| 352 | | | ------------- the second-largest variant contains at least 1 bytes | |
| 353 | LL | | } | |
| 354 | | |_____^ the entire enum is at least 296 bytes | |
| 355 | | | |
| 356 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 357 | | | |
| 358 | LL - BigBoi(PublishWithBytes), | |
| 359 | LL + BigBoi(Box<PublishWithBytes>), | |
| 360 | | | |
| 361 | ||
| 362 | error: large size difference between variants | |
| 363 | --> tests/ui/large_enum_variant.rs:229:5 | |
| 364 | | | |
| 365 | LL | / enum MakesClippyAngry { | |
| 366 | LL | | | |
| 367 | LL | | BigBoi(PublishWithVec), | |
| 368 | | | ---------------------- the largest variant contains at least 224 bytes | |
| 369 | LL | | _SmallBoi(u8), | |
| 370 | | | ------------- the second-largest variant contains at least 1 bytes | |
| 371 | LL | | } | |
| 372 | | |_____^ the entire enum is at least 224 bytes | |
| 373 | | | |
| 374 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 375 | | | |
| 376 | LL - BigBoi(PublishWithVec), | |
| 377 | LL + BigBoi(Box<PublishWithVec>), | |
| 378 | | | |
| 379 | ||
| 380 | error: aborting due to 20 previous errors | |
| 381 |
src/tools/clippy/tests/ui/large_enum_variant.r32bit.stderr created+345| ... | ... | @@ -0,0 +1,345 @@ |
| 1 | error: large size difference between variants | |
| 2 | --> tests/ui/large_enum_variant.rs:13:1 | |
| 3 | | | |
| 4 | LL | / enum LargeEnum { | |
| 5 | LL | | | |
| 6 | LL | | A(i32), | |
| 7 | | | ------ the second-largest variant contains at least 4 bytes | |
| 8 | LL | | B([i32; 8000]), | |
| 9 | | | -------------- the largest variant contains at least 32000 bytes | |
| 10 | LL | | } | |
| 11 | | |_^ the entire enum is at least 32004 bytes | |
| 12 | | | |
| 13 | = note: `-D clippy::large-enum-variant` implied by `-D warnings` | |
| 14 | = help: to override `-D warnings` add `#[allow(clippy::large_enum_variant)]` | |
| 15 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 16 | | | |
| 17 | LL - B([i32; 8000]), | |
| 18 | LL + B(Box<[i32; 8000]>), | |
| 19 | | | |
| 20 | ||
| 21 | error: large size difference between variants | |
| 22 | --> tests/ui/large_enum_variant.rs:38:1 | |
| 23 | | | |
| 24 | LL | / enum LargeEnum2 { | |
| 25 | LL | | | |
| 26 | LL | | VariantOk(i32, u32), | |
| 27 | | | ------------------- the second-largest variant contains at least 8 bytes | |
| 28 | LL | | ContainingLargeEnum(LargeEnum), | |
| 29 | | | ------------------------------ the largest variant contains at least 32004 bytes | |
| 30 | LL | | } | |
| 31 | | |_^ the entire enum is at least 32004 bytes | |
| 32 | | | |
| 33 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 34 | | | |
| 35 | LL - ContainingLargeEnum(LargeEnum), | |
| 36 | LL + ContainingLargeEnum(Box<LargeEnum>), | |
| 37 | | | |
| 38 | ||
| 39 | error: large size difference between variants | |
| 40 | --> tests/ui/large_enum_variant.rs:44:1 | |
| 41 | | | |
| 42 | LL | / enum LargeEnum3 { | |
| 43 | LL | | | |
| 44 | LL | | ContainingMoreThanOneField(i32, [i32; 8000], [i32; 9500]), | |
| 45 | | | --------------------------------------------------------- the largest variant contains at least 70004 bytes | |
| 46 | LL | | VoidVariant, | |
| 47 | LL | | StructLikeLittle { x: i32, y: i32 }, | |
| 48 | | | ----------------------------------- the second-largest variant contains at least 8 bytes | |
| 49 | LL | | } | |
| 50 | | |_^ the entire enum is at least 70008 bytes | |
| 51 | | | |
| 52 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 53 | | | |
| 54 | LL - ContainingMoreThanOneField(i32, [i32; 8000], [i32; 9500]), | |
| 55 | LL + ContainingMoreThanOneField(i32, Box<[i32; 8000]>, Box<[i32; 9500]>), | |
| 56 | | | |
| 57 | ||
| 58 | error: large size difference between variants | |
| 59 | --> tests/ui/large_enum_variant.rs:51:1 | |
| 60 | | | |
| 61 | LL | / enum LargeEnum4 { | |
| 62 | LL | | | |
| 63 | LL | | VariantOk(i32, u32), | |
| 64 | | | ------------------- the second-largest variant contains at least 8 bytes | |
| 65 | LL | | StructLikeLarge { x: [i32; 8000], y: i32 }, | |
| 66 | | | ------------------------------------------ the largest variant contains at least 32004 bytes | |
| 67 | LL | | } | |
| 68 | | |_^ the entire enum is at least 32008 bytes | |
| 69 | | | |
| 70 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 71 | | | |
| 72 | LL - StructLikeLarge { x: [i32; 8000], y: i32 }, | |
| 73 | LL + StructLikeLarge { x: Box<[i32; 8000]>, y: i32 }, | |
| 74 | | | |
| 75 | ||
| 76 | error: large size difference between variants | |
| 77 | --> tests/ui/large_enum_variant.rs:57:1 | |
| 78 | | | |
| 79 | LL | / enum LargeEnum5 { | |
| 80 | LL | | | |
| 81 | LL | | VariantOk(i32, u32), | |
| 82 | | | ------------------- the second-largest variant contains at least 8 bytes | |
| 83 | LL | | StructLikeLarge2 { x: [i32; 8000] }, | |
| 84 | | | ----------------------------------- the largest variant contains at least 32000 bytes | |
| 85 | LL | | } | |
| 86 | | |_^ the entire enum is at least 32004 bytes | |
| 87 | | | |
| 88 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 89 | | | |
| 90 | LL - StructLikeLarge2 { x: [i32; 8000] }, | |
| 91 | LL + StructLikeLarge2 { x: Box<[i32; 8000]> }, | |
| 92 | | | |
| 93 | ||
| 94 | error: large size difference between variants | |
| 95 | --> tests/ui/large_enum_variant.rs:74:1 | |
| 96 | | | |
| 97 | LL | / enum LargeEnum7 { | |
| 98 | LL | | | |
| 99 | LL | | A, | |
| 100 | LL | | B([u8; 1255]), | |
| 101 | | | ------------- the largest variant contains at least 1255 bytes | |
| 102 | LL | | C([u8; 200]), | |
| 103 | | | ------------ the second-largest variant contains at least 200 bytes | |
| 104 | LL | | } | |
| 105 | | |_^ the entire enum is at least 1256 bytes | |
| 106 | | | |
| 107 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 108 | | | |
| 109 | LL - B([u8; 1255]), | |
| 110 | LL + B(Box<[u8; 1255]>), | |
| 111 | | | |
| 112 | ||
| 113 | error: large size difference between variants | |
| 114 | --> tests/ui/large_enum_variant.rs:81:1 | |
| 115 | | | |
| 116 | LL | / enum LargeEnum8 { | |
| 117 | LL | | | |
| 118 | LL | | VariantOk(i32, u32), | |
| 119 | | | ------------------- the second-largest variant contains at least 8 bytes | |
| 120 | LL | | ContainingMoreThanOneField([i32; 8000], [i32; 2], [i32; 9500], [i32; 30]), | |
| 121 | | | ------------------------------------------------------------------------- the largest variant contains at least 70128 bytes | |
| 122 | LL | | } | |
| 123 | | |_^ the entire enum is at least 70132 bytes | |
| 124 | | | |
| 125 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 126 | | | |
| 127 | LL - ContainingMoreThanOneField([i32; 8000], [i32; 2], [i32; 9500], [i32; 30]), | |
| 128 | LL + ContainingMoreThanOneField(Box<[i32; 8000]>, [i32; 2], Box<[i32; 9500]>, [i32; 30]), | |
| 129 | | | |
| 130 | ||
| 131 | error: large size difference between variants | |
| 132 | --> tests/ui/large_enum_variant.rs:87:1 | |
| 133 | | | |
| 134 | LL | / enum LargeEnum9 { | |
| 135 | LL | | | |
| 136 | LL | | A(Struct<()>), | |
| 137 | | | ------------- the second-largest variant contains at least 4 bytes | |
| 138 | LL | | B(Struct2), | |
| 139 | | | ---------- the largest variant contains at least 32000 bytes | |
| 140 | LL | | } | |
| 141 | | |_^ the entire enum is at least 32004 bytes | |
| 142 | | | |
| 143 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 144 | | | |
| 145 | LL - B(Struct2), | |
| 146 | LL + B(Box<Struct2>), | |
| 147 | | | |
| 148 | ||
| 149 | error: large size difference between variants | |
| 150 | --> tests/ui/large_enum_variant.rs:93:1 | |
| 151 | | | |
| 152 | LL | / enum LargeEnumOk2<T> { | |
| 153 | LL | | | |
| 154 | LL | | A(T), | |
| 155 | | | ---- the second-largest variant contains at least 0 bytes | |
| 156 | LL | | B(Struct2), | |
| 157 | | | ---------- the largest variant contains at least 32000 bytes | |
| 158 | LL | | } | |
| 159 | | |_^ the entire enum is at least 32000 bytes | |
| 160 | | | |
| 161 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 162 | | | |
| 163 | LL - B(Struct2), | |
| 164 | LL + B(Box<Struct2>), | |
| 165 | | | |
| 166 | ||
| 167 | error: large size difference between variants | |
| 168 | --> tests/ui/large_enum_variant.rs:99:1 | |
| 169 | | | |
| 170 | LL | / enum LargeEnumOk3<T> { | |
| 171 | LL | | | |
| 172 | LL | | A(Struct<T>), | |
| 173 | | | ------------ the second-largest variant contains at least 4 bytes | |
| 174 | LL | | B(Struct2), | |
| 175 | | | ---------- the largest variant contains at least 32000 bytes | |
| 176 | LL | | } | |
| 177 | | |_^ the entire enum is at least 32000 bytes | |
| 178 | | | |
| 179 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 180 | | | |
| 181 | LL - B(Struct2), | |
| 182 | LL + B(Box<Struct2>), | |
| 183 | | | |
| 184 | ||
| 185 | error: large size difference between variants | |
| 186 | --> tests/ui/large_enum_variant.rs:115:1 | |
| 187 | | | |
| 188 | LL | / enum CopyableLargeEnum { | |
| 189 | LL | | | |
| 190 | LL | | A(bool), | |
| 191 | | | ------- the second-largest variant contains at least 1 bytes | |
| 192 | LL | | B([u64; 8000]), | |
| 193 | | | -------------- the largest variant contains at least 64000 bytes | |
| 194 | LL | | } | |
| 195 | | |_^ the entire enum is at least 64004 bytes | |
| 196 | | | |
| 197 | note: boxing a variant would require the type no longer be `Copy` | |
| 198 | --> tests/ui/large_enum_variant.rs:115:6 | |
| 199 | | | |
| 200 | LL | enum CopyableLargeEnum { | |
| 201 | | ^^^^^^^^^^^^^^^^^ | |
| 202 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 203 | --> tests/ui/large_enum_variant.rs:118:5 | |
| 204 | | | |
| 205 | LL | B([u64; 8000]), | |
| 206 | | ^^^^^^^^^^^^^^ | |
| 207 | ||
| 208 | error: large size difference between variants | |
| 209 | --> tests/ui/large_enum_variant.rs:121:1 | |
| 210 | | | |
| 211 | LL | / enum ManuallyCopyLargeEnum { | |
| 212 | LL | | | |
| 213 | LL | | A(bool), | |
| 214 | | | ------- the second-largest variant contains at least 1 bytes | |
| 215 | LL | | B([u64; 8000]), | |
| 216 | | | -------------- the largest variant contains at least 64000 bytes | |
| 217 | LL | | } | |
| 218 | | |_^ the entire enum is at least 64004 bytes | |
| 219 | | | |
| 220 | note: boxing a variant would require the type no longer be `Copy` | |
| 221 | --> tests/ui/large_enum_variant.rs:121:6 | |
| 222 | | | |
| 223 | LL | enum ManuallyCopyLargeEnum { | |
| 224 | | ^^^^^^^^^^^^^^^^^^^^^ | |
| 225 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 226 | --> tests/ui/large_enum_variant.rs:124:5 | |
| 227 | | | |
| 228 | LL | B([u64; 8000]), | |
| 229 | | ^^^^^^^^^^^^^^ | |
| 230 | ||
| 231 | error: large size difference between variants | |
| 232 | --> tests/ui/large_enum_variant.rs:135:1 | |
| 233 | | | |
| 234 | LL | / enum SomeGenericPossiblyCopyEnum<T> { | |
| 235 | LL | | | |
| 236 | LL | | A(bool, std::marker::PhantomData<T>), | |
| 237 | | | ------------------------------------ the second-largest variant contains at least 1 bytes | |
| 238 | LL | | B([u64; 4000]), | |
| 239 | | | -------------- the largest variant contains at least 32000 bytes | |
| 240 | LL | | } | |
| 241 | | |_^ the entire enum is at least 32004 bytes | |
| 242 | | | |
| 243 | note: boxing a variant would require the type no longer be `Copy` | |
| 244 | --> tests/ui/large_enum_variant.rs:135:6 | |
| 245 | | | |
| 246 | LL | enum SomeGenericPossiblyCopyEnum<T> { | |
| 247 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 248 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 249 | --> tests/ui/large_enum_variant.rs:138:5 | |
| 250 | | | |
| 251 | LL | B([u64; 4000]), | |
| 252 | | ^^^^^^^^^^^^^^ | |
| 253 | ||
| 254 | error: large size difference between variants | |
| 255 | --> tests/ui/large_enum_variant.rs:149:1 | |
| 256 | | | |
| 257 | LL | / enum LargeEnumWithGenerics<T> { | |
| 258 | LL | | | |
| 259 | LL | | Small, | |
| 260 | | | ----- the second-largest variant carries no data at all | |
| 261 | LL | | Large((T, [u8; 512])), | |
| 262 | | | --------------------- the largest variant contains at least 512 bytes | |
| 263 | LL | | } | |
| 264 | | |_^ the entire enum is at least 512 bytes | |
| 265 | | | |
| 266 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 267 | | | |
| 268 | LL - Large((T, [u8; 512])), | |
| 269 | LL + Large(Box<(T, [u8; 512])>), | |
| 270 | | | |
| 271 | ||
| 272 | error: large size difference between variants | |
| 273 | --> tests/ui/large_enum_variant.rs:159:1 | |
| 274 | | | |
| 275 | LL | / enum WithGenerics { | |
| 276 | LL | | | |
| 277 | LL | | Large([Foo<u64>; 64]), | |
| 278 | | | --------------------- the largest variant contains at least 512 bytes | |
| 279 | LL | | Small(u8), | |
| 280 | | | --------- the second-largest variant contains at least 1 bytes | |
| 281 | LL | | } | |
| 282 | | |_^ the entire enum is at least 516 bytes | |
| 283 | | | |
| 284 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 285 | | | |
| 286 | LL - Large([Foo<u64>; 64]), | |
| 287 | LL + Large(Box<[Foo<u64>; 64]>), | |
| 288 | | | |
| 289 | ||
| 290 | error: large size difference between variants | |
| 291 | --> tests/ui/large_enum_variant.rs:170:1 | |
| 292 | | | |
| 293 | LL | / enum LargeEnumOfConst { | |
| 294 | LL | | | |
| 295 | LL | | Ok, | |
| 296 | | | -- the second-largest variant carries no data at all | |
| 297 | LL | | Error(PossiblyLargeEnumWithConst<256>), | |
| 298 | | | -------------------------------------- the largest variant contains at least 514 bytes | |
| 299 | LL | | } | |
| 300 | | |_^ the entire enum is at least 514 bytes | |
| 301 | | | |
| 302 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 303 | | | |
| 304 | LL - Error(PossiblyLargeEnumWithConst<256>), | |
| 305 | LL + Error(Box<PossiblyLargeEnumWithConst<256>>), | |
| 306 | | | |
| 307 | ||
| 308 | error: large size difference between variants | |
| 309 | --> tests/ui/large_enum_variant.rs:176:1 | |
| 310 | | | |
| 311 | LL | / enum WithRecursion { | |
| 312 | LL | | | |
| 313 | LL | | Large([u64; 64]), | |
| 314 | | | ---------------- the largest variant contains at least 512 bytes | |
| 315 | LL | | Recursive(Box<WithRecursion>), | |
| 316 | | | ----------------------------- the second-largest variant contains at least 4 bytes | |
| 317 | LL | | } | |
| 318 | | |_^ the entire enum is at least 516 bytes | |
| 319 | | | |
| 320 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 321 | | | |
| 322 | LL - Large([u64; 64]), | |
| 323 | LL + Large(Box<[u64; 64]>), | |
| 324 | | | |
| 325 | ||
| 326 | error: large size difference between variants | |
| 327 | --> tests/ui/large_enum_variant.rs:187:1 | |
| 328 | | | |
| 329 | LL | / enum LargeEnumWithGenericsAndRecursive { | |
| 330 | LL | | | |
| 331 | LL | | Ok(), | |
| 332 | | | ---- the second-largest variant carries no data at all | |
| 333 | LL | | Error(WithRecursionAndGenerics<u64>), | |
| 334 | | | ------------------------------------ the largest variant contains at least 516 bytes | |
| 335 | LL | | } | |
| 336 | | |_^ the entire enum is at least 516 bytes | |
| 337 | | | |
| 338 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 339 | | | |
| 340 | LL - Error(WithRecursionAndGenerics<u64>), | |
| 341 | LL + Error(Box<WithRecursionAndGenerics<u64>>), | |
| 342 | | | |
| 343 | ||
| 344 | error: aborting due to 18 previous errors | |
| 345 |
src/tools/clippy/tests/ui/large_enum_variant.r64bit.stderr created+381| ... | ... | @@ -0,0 +1,381 @@ |
| 1 | error: large size difference between variants | |
| 2 | --> tests/ui/large_enum_variant.rs:13:1 | |
| 3 | | | |
| 4 | LL | / enum LargeEnum { | |
| 5 | LL | | | |
| 6 | LL | | A(i32), | |
| 7 | | | ------ the second-largest variant contains at least 4 bytes | |
| 8 | LL | | B([i32; 8000]), | |
| 9 | | | -------------- the largest variant contains at least 32000 bytes | |
| 10 | LL | | } | |
| 11 | | |_^ the entire enum is at least 32004 bytes | |
| 12 | | | |
| 13 | = note: `-D clippy::large-enum-variant` implied by `-D warnings` | |
| 14 | = help: to override `-D warnings` add `#[allow(clippy::large_enum_variant)]` | |
| 15 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 16 | | | |
| 17 | LL - B([i32; 8000]), | |
| 18 | LL + B(Box<[i32; 8000]>), | |
| 19 | | | |
| 20 | ||
| 21 | error: large size difference between variants | |
| 22 | --> tests/ui/large_enum_variant.rs:38:1 | |
| 23 | | | |
| 24 | LL | / enum LargeEnum2 { | |
| 25 | LL | | | |
| 26 | LL | | VariantOk(i32, u32), | |
| 27 | | | ------------------- the second-largest variant contains at least 8 bytes | |
| 28 | LL | | ContainingLargeEnum(LargeEnum), | |
| 29 | | | ------------------------------ the largest variant contains at least 32004 bytes | |
| 30 | LL | | } | |
| 31 | | |_^ the entire enum is at least 32004 bytes | |
| 32 | | | |
| 33 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 34 | | | |
| 35 | LL - ContainingLargeEnum(LargeEnum), | |
| 36 | LL + ContainingLargeEnum(Box<LargeEnum>), | |
| 37 | | | |
| 38 | ||
| 39 | error: large size difference between variants | |
| 40 | --> tests/ui/large_enum_variant.rs:44:1 | |
| 41 | | | |
| 42 | LL | / enum LargeEnum3 { | |
| 43 | LL | | | |
| 44 | LL | | ContainingMoreThanOneField(i32, [i32; 8000], [i32; 9500]), | |
| 45 | | | --------------------------------------------------------- the largest variant contains at least 70004 bytes | |
| 46 | LL | | VoidVariant, | |
| 47 | LL | | StructLikeLittle { x: i32, y: i32 }, | |
| 48 | | | ----------------------------------- the second-largest variant contains at least 8 bytes | |
| 49 | LL | | } | |
| 50 | | |_^ the entire enum is at least 70008 bytes | |
| 51 | | | |
| 52 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 53 | | | |
| 54 | LL - ContainingMoreThanOneField(i32, [i32; 8000], [i32; 9500]), | |
| 55 | LL + ContainingMoreThanOneField(i32, Box<[i32; 8000]>, Box<[i32; 9500]>), | |
| 56 | | | |
| 57 | ||
| 58 | error: large size difference between variants | |
| 59 | --> tests/ui/large_enum_variant.rs:51:1 | |
| 60 | | | |
| 61 | LL | / enum LargeEnum4 { | |
| 62 | LL | | | |
| 63 | LL | | VariantOk(i32, u32), | |
| 64 | | | ------------------- the second-largest variant contains at least 8 bytes | |
| 65 | LL | | StructLikeLarge { x: [i32; 8000], y: i32 }, | |
| 66 | | | ------------------------------------------ the largest variant contains at least 32004 bytes | |
| 67 | LL | | } | |
| 68 | | |_^ the entire enum is at least 32008 bytes | |
| 69 | | | |
| 70 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 71 | | | |
| 72 | LL - StructLikeLarge { x: [i32; 8000], y: i32 }, | |
| 73 | LL + StructLikeLarge { x: Box<[i32; 8000]>, y: i32 }, | |
| 74 | | | |
| 75 | ||
| 76 | error: large size difference between variants | |
| 77 | --> tests/ui/large_enum_variant.rs:57:1 | |
| 78 | | | |
| 79 | LL | / enum LargeEnum5 { | |
| 80 | LL | | | |
| 81 | LL | | VariantOk(i32, u32), | |
| 82 | | | ------------------- the second-largest variant contains at least 8 bytes | |
| 83 | LL | | StructLikeLarge2 { x: [i32; 8000] }, | |
| 84 | | | ----------------------------------- the largest variant contains at least 32000 bytes | |
| 85 | LL | | } | |
| 86 | | |_^ the entire enum is at least 32004 bytes | |
| 87 | | | |
| 88 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 89 | | | |
| 90 | LL - StructLikeLarge2 { x: [i32; 8000] }, | |
| 91 | LL + StructLikeLarge2 { x: Box<[i32; 8000]> }, | |
| 92 | | | |
| 93 | ||
| 94 | error: large size difference between variants | |
| 95 | --> tests/ui/large_enum_variant.rs:74:1 | |
| 96 | | | |
| 97 | LL | / enum LargeEnum7 { | |
| 98 | LL | | | |
| 99 | LL | | A, | |
| 100 | LL | | B([u8; 1255]), | |
| 101 | | | ------------- the largest variant contains at least 1255 bytes | |
| 102 | LL | | C([u8; 200]), | |
| 103 | | | ------------ the second-largest variant contains at least 200 bytes | |
| 104 | LL | | } | |
| 105 | | |_^ the entire enum is at least 1256 bytes | |
| 106 | | | |
| 107 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 108 | | | |
| 109 | LL - B([u8; 1255]), | |
| 110 | LL + B(Box<[u8; 1255]>), | |
| 111 | | | |
| 112 | ||
| 113 | error: large size difference between variants | |
| 114 | --> tests/ui/large_enum_variant.rs:81:1 | |
| 115 | | | |
| 116 | LL | / enum LargeEnum8 { | |
| 117 | LL | | | |
| 118 | LL | | VariantOk(i32, u32), | |
| 119 | | | ------------------- the second-largest variant contains at least 8 bytes | |
| 120 | LL | | ContainingMoreThanOneField([i32; 8000], [i32; 2], [i32; 9500], [i32; 30]), | |
| 121 | | | ------------------------------------------------------------------------- the largest variant contains at least 70128 bytes | |
| 122 | LL | | } | |
| 123 | | |_^ the entire enum is at least 70132 bytes | |
| 124 | | | |
| 125 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 126 | | | |
| 127 | LL - ContainingMoreThanOneField([i32; 8000], [i32; 2], [i32; 9500], [i32; 30]), | |
| 128 | LL + ContainingMoreThanOneField(Box<[i32; 8000]>, [i32; 2], Box<[i32; 9500]>, [i32; 30]), | |
| 129 | | | |
| 130 | ||
| 131 | error: large size difference between variants | |
| 132 | --> tests/ui/large_enum_variant.rs:87:1 | |
| 133 | | | |
| 134 | LL | / enum LargeEnum9 { | |
| 135 | LL | | | |
| 136 | LL | | A(Struct<()>), | |
| 137 | | | ------------- the second-largest variant contains at least 4 bytes | |
| 138 | LL | | B(Struct2), | |
| 139 | | | ---------- the largest variant contains at least 32000 bytes | |
| 140 | LL | | } | |
| 141 | | |_^ the entire enum is at least 32004 bytes | |
| 142 | | | |
| 143 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 144 | | | |
| 145 | LL - B(Struct2), | |
| 146 | LL + B(Box<Struct2>), | |
| 147 | | | |
| 148 | ||
| 149 | error: large size difference between variants | |
| 150 | --> tests/ui/large_enum_variant.rs:93:1 | |
| 151 | | | |
| 152 | LL | / enum LargeEnumOk2<T> { | |
| 153 | LL | | | |
| 154 | LL | | A(T), | |
| 155 | | | ---- the second-largest variant contains at least 0 bytes | |
| 156 | LL | | B(Struct2), | |
| 157 | | | ---------- the largest variant contains at least 32000 bytes | |
| 158 | LL | | } | |
| 159 | | |_^ the entire enum is at least 32000 bytes | |
| 160 | | | |
| 161 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 162 | | | |
| 163 | LL - B(Struct2), | |
| 164 | LL + B(Box<Struct2>), | |
| 165 | | | |
| 166 | ||
| 167 | error: large size difference between variants | |
| 168 | --> tests/ui/large_enum_variant.rs:99:1 | |
| 169 | | | |
| 170 | LL | / enum LargeEnumOk3<T> { | |
| 171 | LL | | | |
| 172 | LL | | A(Struct<T>), | |
| 173 | | | ------------ the second-largest variant contains at least 4 bytes | |
| 174 | LL | | B(Struct2), | |
| 175 | | | ---------- the largest variant contains at least 32000 bytes | |
| 176 | LL | | } | |
| 177 | | |_^ the entire enum is at least 32000 bytes | |
| 178 | | | |
| 179 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 180 | | | |
| 181 | LL - B(Struct2), | |
| 182 | LL + B(Box<Struct2>), | |
| 183 | | | |
| 184 | ||
| 185 | error: large size difference between variants | |
| 186 | --> tests/ui/large_enum_variant.rs:115:1 | |
| 187 | | | |
| 188 | LL | / enum CopyableLargeEnum { | |
| 189 | LL | | | |
| 190 | LL | | A(bool), | |
| 191 | | | ------- the second-largest variant contains at least 1 bytes | |
| 192 | LL | | B([u64; 8000]), | |
| 193 | | | -------------- the largest variant contains at least 64000 bytes | |
| 194 | LL | | } | |
| 195 | | |_^ the entire enum is at least 64008 bytes | |
| 196 | | | |
| 197 | note: boxing a variant would require the type no longer be `Copy` | |
| 198 | --> tests/ui/large_enum_variant.rs:115:6 | |
| 199 | | | |
| 200 | LL | enum CopyableLargeEnum { | |
| 201 | | ^^^^^^^^^^^^^^^^^ | |
| 202 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 203 | --> tests/ui/large_enum_variant.rs:118:5 | |
| 204 | | | |
| 205 | LL | B([u64; 8000]), | |
| 206 | | ^^^^^^^^^^^^^^ | |
| 207 | ||
| 208 | error: large size difference between variants | |
| 209 | --> tests/ui/large_enum_variant.rs:121:1 | |
| 210 | | | |
| 211 | LL | / enum ManuallyCopyLargeEnum { | |
| 212 | LL | | | |
| 213 | LL | | A(bool), | |
| 214 | | | ------- the second-largest variant contains at least 1 bytes | |
| 215 | LL | | B([u64; 8000]), | |
| 216 | | | -------------- the largest variant contains at least 64000 bytes | |
| 217 | LL | | } | |
| 218 | | |_^ the entire enum is at least 64008 bytes | |
| 219 | | | |
| 220 | note: boxing a variant would require the type no longer be `Copy` | |
| 221 | --> tests/ui/large_enum_variant.rs:121:6 | |
| 222 | | | |
| 223 | LL | enum ManuallyCopyLargeEnum { | |
| 224 | | ^^^^^^^^^^^^^^^^^^^^^ | |
| 225 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 226 | --> tests/ui/large_enum_variant.rs:124:5 | |
| 227 | | | |
| 228 | LL | B([u64; 8000]), | |
| 229 | | ^^^^^^^^^^^^^^ | |
| 230 | ||
| 231 | error: large size difference between variants | |
| 232 | --> tests/ui/large_enum_variant.rs:135:1 | |
| 233 | | | |
| 234 | LL | / enum SomeGenericPossiblyCopyEnum<T> { | |
| 235 | LL | | | |
| 236 | LL | | A(bool, std::marker::PhantomData<T>), | |
| 237 | | | ------------------------------------ the second-largest variant contains at least 1 bytes | |
| 238 | LL | | B([u64; 4000]), | |
| 239 | | | -------------- the largest variant contains at least 32000 bytes | |
| 240 | LL | | } | |
| 241 | | |_^ the entire enum is at least 32008 bytes | |
| 242 | | | |
| 243 | note: boxing a variant would require the type no longer be `Copy` | |
| 244 | --> tests/ui/large_enum_variant.rs:135:6 | |
| 245 | | | |
| 246 | LL | enum SomeGenericPossiblyCopyEnum<T> { | |
| 247 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 248 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 249 | --> tests/ui/large_enum_variant.rs:138:5 | |
| 250 | | | |
| 251 | LL | B([u64; 4000]), | |
| 252 | | ^^^^^^^^^^^^^^ | |
| 253 | ||
| 254 | error: large size difference between variants | |
| 255 | --> tests/ui/large_enum_variant.rs:149:1 | |
| 256 | | | |
| 257 | LL | / enum LargeEnumWithGenerics<T> { | |
| 258 | LL | | | |
| 259 | LL | | Small, | |
| 260 | | | ----- the second-largest variant carries no data at all | |
| 261 | LL | | Large((T, [u8; 512])), | |
| 262 | | | --------------------- the largest variant contains at least 512 bytes | |
| 263 | LL | | } | |
| 264 | | |_^ the entire enum is at least 512 bytes | |
| 265 | | | |
| 266 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 267 | | | |
| 268 | LL - Large((T, [u8; 512])), | |
| 269 | LL + Large(Box<(T, [u8; 512])>), | |
| 270 | | | |
| 271 | ||
| 272 | error: large size difference between variants | |
| 273 | --> tests/ui/large_enum_variant.rs:159:1 | |
| 274 | | | |
| 275 | LL | / enum WithGenerics { | |
| 276 | LL | | | |
| 277 | LL | | Large([Foo<u64>; 64]), | |
| 278 | | | --------------------- the largest variant contains at least 512 bytes | |
| 279 | LL | | Small(u8), | |
| 280 | | | --------- the second-largest variant contains at least 1 bytes | |
| 281 | LL | | } | |
| 282 | | |_^ the entire enum is at least 520 bytes | |
| 283 | | | |
| 284 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 285 | | | |
| 286 | LL - Large([Foo<u64>; 64]), | |
| 287 | LL + Large(Box<[Foo<u64>; 64]>), | |
| 288 | | | |
| 289 | ||
| 290 | error: large size difference between variants | |
| 291 | --> tests/ui/large_enum_variant.rs:170:1 | |
| 292 | | | |
| 293 | LL | / enum LargeEnumOfConst { | |
| 294 | LL | | | |
| 295 | LL | | Ok, | |
| 296 | | | -- the second-largest variant carries no data at all | |
| 297 | LL | | Error(PossiblyLargeEnumWithConst<256>), | |
| 298 | | | -------------------------------------- the largest variant contains at least 514 bytes | |
| 299 | LL | | } | |
| 300 | | |_^ the entire enum is at least 514 bytes | |
| 301 | | | |
| 302 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 303 | | | |
| 304 | LL - Error(PossiblyLargeEnumWithConst<256>), | |
| 305 | LL + Error(Box<PossiblyLargeEnumWithConst<256>>), | |
| 306 | | | |
| 307 | ||
| 308 | error: large size difference between variants | |
| 309 | --> tests/ui/large_enum_variant.rs:176:1 | |
| 310 | | | |
| 311 | LL | / enum WithRecursion { | |
| 312 | LL | | | |
| 313 | LL | | Large([u64; 64]), | |
| 314 | | | ---------------- the largest variant contains at least 512 bytes | |
| 315 | LL | | Recursive(Box<WithRecursion>), | |
| 316 | | | ----------------------------- the second-largest variant contains at least 8 bytes | |
| 317 | LL | | } | |
| 318 | | |_^ the entire enum is at least 520 bytes | |
| 319 | | | |
| 320 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 321 | | | |
| 322 | LL - Large([u64; 64]), | |
| 323 | LL + Large(Box<[u64; 64]>), | |
| 324 | | | |
| 325 | ||
| 326 | error: large size difference between variants | |
| 327 | --> tests/ui/large_enum_variant.rs:187:1 | |
| 328 | | | |
| 329 | LL | / enum LargeEnumWithGenericsAndRecursive { | |
| 330 | LL | | | |
| 331 | LL | | Ok(), | |
| 332 | | | ---- the second-largest variant carries no data at all | |
| 333 | LL | | Error(WithRecursionAndGenerics<u64>), | |
| 334 | | | ------------------------------------ the largest variant contains at least 520 bytes | |
| 335 | LL | | } | |
| 336 | | |_^ the entire enum is at least 520 bytes | |
| 337 | | | |
| 338 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 339 | | | |
| 340 | LL - Error(WithRecursionAndGenerics<u64>), | |
| 341 | LL + Error(Box<WithRecursionAndGenerics<u64>>), | |
| 342 | | | |
| 343 | ||
| 344 | error: large size difference between variants | |
| 345 | --> tests/ui/large_enum_variant.rs:223:5 | |
| 346 | | | |
| 347 | LL | / enum NoWarnings { | |
| 348 | LL | | | |
| 349 | LL | | BigBoi(PublishWithBytes), | |
| 350 | | | ------------------------ the largest variant contains at least 296 bytes | |
| 351 | LL | | _SmallBoi(u8), | |
| 352 | | | ------------- the second-largest variant contains at least 1 bytes | |
| 353 | LL | | } | |
| 354 | | |_____^ the entire enum is at least 296 bytes | |
| 355 | | | |
| 356 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 357 | | | |
| 358 | LL - BigBoi(PublishWithBytes), | |
| 359 | LL + BigBoi(Box<PublishWithBytes>), | |
| 360 | | | |
| 361 | ||
| 362 | error: large size difference between variants | |
| 363 | --> tests/ui/large_enum_variant.rs:229:5 | |
| 364 | | | |
| 365 | LL | / enum MakesClippyAngry { | |
| 366 | LL | | | |
| 367 | LL | | BigBoi(PublishWithVec), | |
| 368 | | | ---------------------- the largest variant contains at least 224 bytes | |
| 369 | LL | | _SmallBoi(u8), | |
| 370 | | | ------------- the second-largest variant contains at least 1 bytes | |
| 371 | LL | | } | |
| 372 | | |_____^ the entire enum is at least 224 bytes | |
| 373 | | | |
| 374 | help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | |
| 375 | | | |
| 376 | LL - BigBoi(PublishWithVec), | |
| 377 | LL + BigBoi(Box<PublishWithVec>), | |
| 378 | | | |
| 379 | ||
| 380 | error: aborting due to 20 previous errors | |
| 381 |
src/tools/clippy/tests/ui/large_enum_variant.rs+5-5| ... | ... | @@ -1,8 +1,8 @@ |
| 1 | //@revisions: 32bit 64bit | |
| 1 | //@revisions: r32bit r64bit | |
| 2 | 2 | //@aux-build:proc_macros.rs |
| 3 | 3 | //@no-rustfix |
| 4 | //@[32bit]ignore-bitwidth: 64 | |
| 5 | //@[64bit]ignore-bitwidth: 32 | |
| 4 | //@[r32bit]ignore-bitwidth: 64 | |
| 5 | //@[r64bit]ignore-bitwidth: 32 | |
| 6 | 6 | #![allow(dead_code)] |
| 7 | 7 | #![allow(unused_variables)] |
| 8 | 8 | #![warn(clippy::large_enum_variant)] |
| ... | ... | @@ -221,13 +221,13 @@ mod issue11915 { |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | enum NoWarnings { |
| 224 | //~[64bit]^ large_enum_variant | |
| 224 | //~[r64bit]^ large_enum_variant | |
| 225 | 225 | BigBoi(PublishWithBytes), |
| 226 | 226 | _SmallBoi(u8), |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | enum MakesClippyAngry { |
| 230 | //~[64bit]^ large_enum_variant | |
| 230 | //~[r64bit]^ large_enum_variant | |
| 231 | 231 | BigBoi(PublishWithVec), |
| 232 | 232 | _SmallBoi(u8), |
| 233 | 233 | } |
src/tools/run-make-support/Cargo.toml+2| ... | ... | @@ -22,6 +22,8 @@ wasmparser = { version = "0.236", default-features = false, features = ["std", " |
| 22 | 22 | |
| 23 | 23 | # Shared with bootstrap and compiletest |
| 24 | 24 | build_helper = { path = "../../build_helper" } |
| 25 | # Shared with rustdoc | |
| 26 | rustdoc-json-types = { path = "../../rustdoc-json-types" } | |
| 25 | 27 | |
| 26 | 28 | [lib] |
| 27 | 29 | crate-type = ["lib", "dylib"] |
src/tools/run-make-support/src/lib.rs+1-1| ... | ... | @@ -34,7 +34,7 @@ pub mod rfs { |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | // Re-exports of third-party library crates. |
| 37 | pub use {bstr, gimli, libc, object, regex, serde_json, similar, wasmparser}; | |
| 37 | pub use {bstr, gimli, libc, object, regex, rustdoc_json_types, serde_json, similar, wasmparser}; | |
| 38 | 38 | |
| 39 | 39 | // Helpers for building names of output artifacts that are potentially target-specific. |
| 40 | 40 | pub use crate::artifact_names::{ |
tests/codegen-llvm/cf-protection.rs+5-5| ... | ... | @@ -1,12 +1,12 @@ |
| 1 | 1 | // Test that the correct module flags are emitted with different control-flow protection flags. |
| 2 | 2 | |
| 3 | 3 | //@ add-minicore |
| 4 | //@ revisions: undefined none branch return full | |
| 4 | //@ revisions: undefined none branch return_ full | |
| 5 | 5 | //@ needs-llvm-components: x86 |
| 6 | 6 | // [undefined] no extra compile-flags |
| 7 | 7 | //@ [none] compile-flags: -Z cf-protection=none |
| 8 | 8 | //@ [branch] compile-flags: -Z cf-protection=branch |
| 9 | //@ [return] compile-flags: -Z cf-protection=return | |
| 9 | //@ [return_] compile-flags: -Z cf-protection=return | |
| 10 | 10 | //@ [full] compile-flags: -Z cf-protection=full |
| 11 | 11 | //@ compile-flags: --target x86_64-unknown-linux-gnu |
| 12 | 12 | |
| ... | ... | @@ -30,9 +30,9 @@ pub fn test() {} |
| 30 | 30 | // branch: !"cf-protection-branch", i32 1 |
| 31 | 31 | // branch-NOT: !"cf-protection-return" |
| 32 | 32 | |
| 33 | // return-NOT: !"cf-protection-branch" | |
| 34 | // return: !"cf-protection-return", i32 1 | |
| 35 | // return-NOT: !"cf-protection-branch" | |
| 33 | // return_-NOT: !"cf-protection-branch" | |
| 34 | // return_: !"cf-protection-return", i32 1 | |
| 35 | // return_-NOT: !"cf-protection-branch" | |
| 36 | 36 | |
| 37 | 37 | // full: !"cf-protection-branch", i32 1 |
| 38 | 38 | // full: !"cf-protection-return", i32 1 |
tests/run-make/rustdoc-json-external-crate-path/dep.rs created+5| ... | ... | @@ -0,0 +1,5 @@ |
| 1 | #![no_std] | |
| 2 | ||
| 3 | pub struct S; | |
| 4 | ||
| 5 | pub use trans_dep::S as TransDep; |
tests/run-make/rustdoc-json-external-crate-path/entry.rs created+4| ... | ... | @@ -0,0 +1,4 @@ |
| 1 | #![no_std] | |
| 2 | ||
| 3 | pub type FromDep = dep::S; | |
| 4 | pub type FromTransDep = dep::TransDep; |
tests/run-make/rustdoc-json-external-crate-path/rmake.rs created+89| ... | ... | @@ -0,0 +1,89 @@ |
| 1 | use std::path; | |
| 2 | ||
| 3 | use run_make_support::rustdoc_json_types::{Crate, ItemEnum, Path, Type, TypeAlias}; | |
| 4 | use run_make_support::{cwd, rfs, rust_lib_name, rustc, rustdoc, serde_json}; | |
| 5 | ||
| 6 | #[track_caller] | |
| 7 | fn canonicalize(p: &path::Path) -> path::PathBuf { | |
| 8 | std::fs::canonicalize(p).expect("path should be canonicalizeable") | |
| 9 | } | |
| 10 | ||
| 11 | fn main() { | |
| 12 | rustc().input("trans_dep.rs").edition("2024").crate_type("lib").run(); | |
| 13 | ||
| 14 | rustc() | |
| 15 | .input("dep.rs") | |
| 16 | .edition("2024") | |
| 17 | .crate_type("lib") | |
| 18 | .extern_("trans_dep", rust_lib_name("trans_dep")) | |
| 19 | .run(); | |
| 20 | ||
| 21 | rustdoc() | |
| 22 | .input("entry.rs") | |
| 23 | .edition("2024") | |
| 24 | .output_format("json") | |
| 25 | .library_search_path(cwd()) | |
| 26 | .extern_("dep", rust_lib_name("dep")) | |
| 27 | .arg("-Zunstable-options") | |
| 28 | .run(); | |
| 29 | ||
| 30 | let bytes = rfs::read("doc/entry.json"); | |
| 31 | ||
| 32 | let krate: Crate = serde_json::from_slice(&bytes).expect("output should be valid json"); | |
| 33 | ||
| 34 | let root_item = &krate.index[&krate.root]; | |
| 35 | let ItemEnum::Module(root_mod) = &root_item.inner else { panic!("expected ItemEnum::Module") }; | |
| 36 | ||
| 37 | assert_eq!(root_mod.items.len(), 2); | |
| 38 | ||
| 39 | let items = root_mod.items.iter().map(|id| &krate.index[id]).collect::<Vec<_>>(); | |
| 40 | ||
| 41 | let from_dep = items | |
| 42 | .iter() | |
| 43 | .filter(|item| item.name.as_deref() == Some("FromDep")) | |
| 44 | .next() | |
| 45 | .expect("there should be en item called FromDep"); | |
| 46 | ||
| 47 | let from_trans_dep = items | |
| 48 | .iter() | |
| 49 | .filter(|item| item.name.as_deref() == Some("FromTransDep")) | |
| 50 | .next() | |
| 51 | .expect("there should be en item called FromDep"); | |
| 52 | ||
| 53 | let ItemEnum::TypeAlias(TypeAlias { | |
| 54 | type_: Type::ResolvedPath(Path { id: from_dep_id, .. }), | |
| 55 | .. | |
| 56 | }) = &from_dep.inner | |
| 57 | else { | |
| 58 | panic!("Expected FromDep to be a TypeAlias"); | |
| 59 | }; | |
| 60 | ||
| 61 | let ItemEnum::TypeAlias(TypeAlias { | |
| 62 | type_: Type::ResolvedPath(Path { id: from_trans_dep_id, .. }), | |
| 63 | .. | |
| 64 | }) = &from_trans_dep.inner | |
| 65 | else { | |
| 66 | panic!("Expected FromDep to be a TypeAlias"); | |
| 67 | }; | |
| 68 | ||
| 69 | assert_eq!(krate.index.get(from_dep_id), None); | |
| 70 | assert_eq!(krate.index.get(from_trans_dep_id), None); | |
| 71 | ||
| 72 | let from_dep_externalinfo = &krate.paths[from_dep_id]; | |
| 73 | let from_trans_dep_externalinfo = &krate.paths[from_trans_dep_id]; | |
| 74 | ||
| 75 | let dep_crate_id = from_dep_externalinfo.crate_id; | |
| 76 | let trans_dep_crate_id = from_trans_dep_externalinfo.crate_id; | |
| 77 | ||
| 78 | let dep = &krate.external_crates[&dep_crate_id]; | |
| 79 | let trans_dep = &krate.external_crates[&trans_dep_crate_id]; | |
| 80 | ||
| 81 | assert_eq!(dep.name, "dep"); | |
| 82 | assert_eq!(trans_dep.name, "trans_dep"); | |
| 83 | ||
| 84 | assert_eq!(canonicalize(&dep.path), canonicalize(&cwd().join(rust_lib_name("dep")))); | |
| 85 | assert_eq!( | |
| 86 | canonicalize(&trans_dep.path), | |
| 87 | canonicalize(&cwd().join(rust_lib_name("trans_dep"))) | |
| 88 | ); | |
| 89 | } |
tests/run-make/rustdoc-json-external-crate-path/trans_dep.rs created+3| ... | ... | @@ -0,0 +1,3 @@ |
| 1 | #![no_std] | |
| 2 | ||
| 3 | pub struct S; |
tests/ui/cfg/cmdline-false.rs+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /// Test that `--cfg false` doesn't cause `cfg(false)` to evaluate to `true` |
| 2 | //@ compile-flags: --cfg false | |
| 2 | //@ compile-flags: --cfg r#false | |
| 3 | 3 | |
| 4 | 4 | #[cfg(false)] |
| 5 | 5 | fn foo() {} |
tests/ui/cfg/path-kw-as-cfg-pred-cli-cfg.cfg_crate.stderr created+2| ... | ... | @@ -0,0 +1,2 @@ |
| 1 | error: invalid `--cfg` argument: `crate` (malformed `cfg` input, expected a valid identifier) | |
| 2 |
tests/ui/cfg/path-kw-as-cfg-pred-cli-cfg.cfg_priv.stderr created+2| ... | ... | @@ -0,0 +1,2 @@ |
| 1 | error: invalid `--cfg` argument: `priv` (expected `key` or `key="value"`) | |
| 2 |
tests/ui/cfg/path-kw-as-cfg-pred-cli-cfg.cfg_raw_crate.stderr created+6| ... | ... | @@ -0,0 +1,6 @@ |
| 1 | error: `crate` cannot be a raw identifier | |
| 2 | | | |
| 3 | = note: this occurred on the command line: `--cfg=r#crate` | |
| 4 | ||
| 5 | error: invalid `--cfg` argument: `r#crate` (expected `key` or `key="value"`) | |
| 6 |
tests/ui/cfg/path-kw-as-cfg-pred-cli-cfg.cfg_raw_self_lower.stderr created+6| ... | ... | @@ -0,0 +1,6 @@ |
| 1 | error: `self` cannot be a raw identifier | |
| 2 | | | |
| 3 | = note: this occurred on the command line: `--cfg=r#self` | |
| 4 | ||
| 5 | error: invalid `--cfg` argument: `r#self` (expected `key` or `key="value"`) | |
| 6 |
tests/ui/cfg/path-kw-as-cfg-pred-cli-cfg.cfg_raw_self_upper.stderr created+6| ... | ... | @@ -0,0 +1,6 @@ |
| 1 | error: `Self` cannot be a raw identifier | |
| 2 | | | |
| 3 | = note: this occurred on the command line: `--cfg=r#Self` | |
| 4 | ||
| 5 | error: invalid `--cfg` argument: `r#Self` (expected `key` or `key="value"`) | |
| 6 |
tests/ui/cfg/path-kw-as-cfg-pred-cli-cfg.cfg_raw_super.stderr created+6| ... | ... | @@ -0,0 +1,6 @@ |
| 1 | error: `super` cannot be a raw identifier | |
| 2 | | | |
| 3 | = note: this occurred on the command line: `--cfg=r#super` | |
| 4 | ||
| 5 | error: invalid `--cfg` argument: `r#super` (expected `key` or `key="value"`) | |
| 6 |
tests/ui/cfg/path-kw-as-cfg-pred-cli-cfg.cfg_raw_underscore.stderr created+6| ... | ... | @@ -0,0 +1,6 @@ |
| 1 | error: `_` cannot be a raw identifier | |
| 2 | | | |
| 3 | = note: this occurred on the command line: `--cfg=r#_` | |
| 4 | ||
| 5 | error: invalid `--cfg` argument: `r#_` (expected `key` or `key="value"`) | |
| 6 |
tests/ui/cfg/path-kw-as-cfg-pred-cli-cfg.cfg_self_lower.stderr created+2| ... | ... | @@ -0,0 +1,2 @@ |
| 1 | error: invalid `--cfg` argument: `self` (malformed `cfg` input, expected a valid identifier) | |
| 2 |
tests/ui/cfg/path-kw-as-cfg-pred-cli-cfg.cfg_self_upper.stderr created+2| ... | ... | @@ -0,0 +1,2 @@ |
| 1 | error: invalid `--cfg` argument: `Self` (malformed `cfg` input, expected a valid identifier) | |
| 2 |
tests/ui/cfg/path-kw-as-cfg-pred-cli-cfg.cfg_struct.stderr created+2| ... | ... | @@ -0,0 +1,2 @@ |
| 1 | error: invalid `--cfg` argument: `struct` (expected `key` or `key="value"`) | |
| 2 |
tests/ui/cfg/path-kw-as-cfg-pred-cli-cfg.cfg_super.stderr created+2| ... | ... | @@ -0,0 +1,2 @@ |
| 1 | error: invalid `--cfg` argument: `super` (malformed `cfg` input, expected a valid identifier) | |
| 2 |
tests/ui/cfg/path-kw-as-cfg-pred-cli-cfg.cfg_underscore.stderr created+2| ... | ... | @@ -0,0 +1,2 @@ |
| 1 | error: invalid `--cfg` argument: `_` (expected `key` or `key="value"`) | |
| 2 |
tests/ui/cfg/path-kw-as-cfg-pred-cli-cfg.rs created+24| ... | ... | @@ -0,0 +1,24 @@ |
| 1 | //@ edition: 2024 | |
| 2 | ||
| 3 | //@ revisions: cfg_crate cfg_super cfg_self_lower cfg_self_upper | |
| 4 | //@ revisions: cfg_raw_crate cfg_raw_super cfg_raw_self_lower cfg_raw_self_upper | |
| 5 | //@ revisions: cfg_struct cfg_priv cfg_underscore cfg_raw_underscore | |
| 6 | ||
| 7 | //@ [cfg_crate]compile-flags: --cfg crate | |
| 8 | //@ [cfg_super]compile-flags: --cfg super | |
| 9 | //@ [cfg_self_lower]compile-flags: --cfg self | |
| 10 | //@ [cfg_self_upper]compile-flags: --cfg Self | |
| 11 | ||
| 12 | //@ [cfg_raw_crate]compile-flags: --cfg r#crate | |
| 13 | //@ [cfg_raw_super]compile-flags: --cfg r#super | |
| 14 | //@ [cfg_raw_self_lower]compile-flags: --cfg r#self | |
| 15 | //@ [cfg_raw_self_upper]compile-flags: --cfg r#Self | |
| 16 | ||
| 17 | //@ [cfg_struct]compile-flags: --cfg struct | |
| 18 | //@ [cfg_priv]compile-flags: --cfg priv | |
| 19 | //@ [cfg_underscore]compile-flags: --cfg _ | |
| 20 | //@ [cfg_raw_underscore]compile-flags: --cfg r#_ | |
| 21 | ||
| 22 | fn main() {} | |
| 23 | ||
| 24 | //~? ERROR invalid `--cfg` argument |
tests/ui/cfg/path-kw-as-cfg-pred-cli-check-cfg.check_cfg_crate.stderr created+5| ... | ... | @@ -0,0 +1,5 @@ |
| 1 | error: invalid `--check-cfg` argument: `cfg(crate)` | |
| 2 | | | |
| 3 | = note: malformed `cfg` input, expected a valid identifier | |
| 4 | = note: visit <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more details | |
| 5 |
tests/ui/cfg/path-kw-as-cfg-pred-cli-check-cfg.check_cfg_priv.stderr created+5| ... | ... | @@ -0,0 +1,5 @@ |
| 1 | error: invalid `--check-cfg` argument: `cfg(priv)` | |
| 2 | | | |
| 3 | = note: expected `cfg(name, values("value1", "value2", ... "valueN"))` | |
| 4 | = note: visit <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more details | |
| 5 |
tests/ui/cfg/path-kw-as-cfg-pred-cli-check-cfg.check_cfg_raw_crate.stderr created+9| ... | ... | @@ -0,0 +1,9 @@ |
| 1 | error: `crate` cannot be a raw identifier | |
| 2 | | | |
| 3 | = note: this occurred on the command line: `--check-cfg=cfg(r#crate)` | |
| 4 | ||
| 5 | error: invalid `--check-cfg` argument: `cfg(r#crate)` | |
| 6 | | | |
| 7 | = note: expected `cfg(name, values("value1", "value2", ... "valueN"))` | |
| 8 | = note: visit <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more details | |
| 9 |
tests/ui/cfg/path-kw-as-cfg-pred-cli-check-cfg.check_cfg_raw_self_lower.stderr created+9| ... | ... | @@ -0,0 +1,9 @@ |
| 1 | error: `self` cannot be a raw identifier | |
| 2 | | | |
| 3 | = note: this occurred on the command line: `--check-cfg=cfg(r#self)` | |
| 4 | ||
| 5 | error: invalid `--check-cfg` argument: `cfg(r#self)` | |
| 6 | | | |
| 7 | = note: expected `cfg(name, values("value1", "value2", ... "valueN"))` | |
| 8 | = note: visit <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more details | |
| 9 |
tests/ui/cfg/path-kw-as-cfg-pred-cli-check-cfg.check_cfg_raw_self_upper.stderr created+9| ... | ... | @@ -0,0 +1,9 @@ |
| 1 | error: `Self` cannot be a raw identifier | |
| 2 | | | |
| 3 | = note: this occurred on the command line: `--check-cfg=cfg(r#Self)` | |
| 4 | ||
| 5 | error: invalid `--check-cfg` argument: `cfg(r#Self)` | |
| 6 | | | |
| 7 | = note: expected `cfg(name, values("value1", "value2", ... "valueN"))` | |
| 8 | = note: visit <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more details | |
| 9 |
tests/ui/cfg/path-kw-as-cfg-pred-cli-check-cfg.check_cfg_raw_super.stderr created+9| ... | ... | @@ -0,0 +1,9 @@ |
| 1 | error: `super` cannot be a raw identifier | |
| 2 | | | |
| 3 | = note: this occurred on the command line: `--check-cfg=cfg(r#super)` | |
| 4 | ||
| 5 | error: invalid `--check-cfg` argument: `cfg(r#super)` | |
| 6 | | | |
| 7 | = note: expected `cfg(name, values("value1", "value2", ... "valueN"))` | |
| 8 | = note: visit <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more details | |
| 9 |
tests/ui/cfg/path-kw-as-cfg-pred-cli-check-cfg.check_cfg_raw_underscore.stderr created+9| ... | ... | @@ -0,0 +1,9 @@ |
| 1 | error: `_` cannot be a raw identifier | |
| 2 | | | |
| 3 | = note: this occurred on the command line: `--check-cfg=cfg(r#_)` | |
| 4 | ||
| 5 | error: invalid `--check-cfg` argument: `cfg(r#_)` | |
| 6 | | | |
| 7 | = note: expected `cfg(name, values("value1", "value2", ... "valueN"))` | |
| 8 | = note: visit <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more details | |
| 9 |
tests/ui/cfg/path-kw-as-cfg-pred-cli-check-cfg.check_cfg_self_lower.stderr created+5| ... | ... | @@ -0,0 +1,5 @@ |
| 1 | error: invalid `--check-cfg` argument: `cfg(self)` | |
| 2 | | | |
| 3 | = note: malformed `cfg` input, expected a valid identifier | |
| 4 | = note: visit <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more details | |
| 5 |
tests/ui/cfg/path-kw-as-cfg-pred-cli-check-cfg.check_cfg_self_upper.stderr created+5| ... | ... | @@ -0,0 +1,5 @@ |
| 1 | error: invalid `--check-cfg` argument: `cfg(Self)` | |
| 2 | | | |
| 3 | = note: malformed `cfg` input, expected a valid identifier | |
| 4 | = note: visit <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more details | |
| 5 |
tests/ui/cfg/path-kw-as-cfg-pred-cli-check-cfg.check_cfg_struct.stderr created+5| ... | ... | @@ -0,0 +1,5 @@ |
| 1 | error: invalid `--check-cfg` argument: `cfg(struct)` | |
| 2 | | | |
| 3 | = note: expected `cfg(name, values("value1", "value2", ... "valueN"))` | |
| 4 | = note: visit <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more details | |
| 5 |
tests/ui/cfg/path-kw-as-cfg-pred-cli-check-cfg.check_cfg_super.stderr created+5| ... | ... | @@ -0,0 +1,5 @@ |
| 1 | error: invalid `--check-cfg` argument: `cfg(super)` | |
| 2 | | | |
| 3 | = note: malformed `cfg` input, expected a valid identifier | |
| 4 | = note: visit <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more details | |
| 5 |
tests/ui/cfg/path-kw-as-cfg-pred-cli-check-cfg.check_cfg_underscore.stderr created+5| ... | ... | @@ -0,0 +1,5 @@ |
| 1 | error: invalid `--check-cfg` argument: `cfg(_)` | |
| 2 | | | |
| 3 | = note: expected `cfg(name, values("value1", "value2", ... "valueN"))` | |
| 4 | = note: visit <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more details | |
| 5 |
tests/ui/cfg/path-kw-as-cfg-pred-cli-check-cfg.rs created+25| ... | ... | @@ -0,0 +1,25 @@ |
| 1 | //@ edition: 2021 | |
| 2 | ||
| 3 | //@ revisions: check_cfg_crate check_cfg_super check_cfg_self_lower check_cfg_self_upper | |
| 4 | //@ revisions: check_cfg_raw_crate check_cfg_raw_super check_cfg_raw_self_lower | |
| 5 | //@ revisions: check_cfg_raw_self_upper | |
| 6 | //@ revisions: check_cfg_struct check_cfg_priv check_cfg_underscore check_cfg_raw_underscore | |
| 7 | ||
| 8 | //@ [check_cfg_crate]compile-flags: --check-cfg 'cfg(crate)' | |
| 9 | //@ [check_cfg_super]compile-flags: --check-cfg 'cfg(super)' | |
| 10 | //@ [check_cfg_self_lower]compile-flags: --check-cfg 'cfg(self)' | |
| 11 | //@ [check_cfg_self_upper]compile-flags: --check-cfg 'cfg(Self)' | |
| 12 | ||
| 13 | //@ [check_cfg_raw_crate]compile-flags: --check-cfg 'cfg(r#crate)' | |
| 14 | //@ [check_cfg_raw_super]compile-flags: --check-cfg 'cfg(r#super)' | |
| 15 | //@ [check_cfg_raw_self_lower]compile-flags: --check-cfg 'cfg(r#self)' | |
| 16 | //@ [check_cfg_raw_self_upper]compile-flags: --check-cfg 'cfg(r#Self)' | |
| 17 | ||
| 18 | //@ [check_cfg_struct]compile-flags: --check-cfg 'cfg(struct)' | |
| 19 | //@ [check_cfg_priv]compile-flags: --check-cfg 'cfg(priv)' | |
| 20 | //@ [check_cfg_underscore]compile-flags: --check-cfg 'cfg(_)' | |
| 21 | //@ [check_cfg_raw_underscore]compile-flags: --check-cfg 'cfg(r#_)' | |
| 22 | ||
| 23 | fn main() {} | |
| 24 | ||
| 25 | //~? ERROR invalid `--check-cfg` argument |
tests/ui/cfg/path-kw-as-cfg-pred-cli-raw-allow.rs created+6| ... | ... | @@ -0,0 +1,6 @@ |
| 1 | //@ edition: 2024 | |
| 2 | //@ check-pass | |
| 3 | //@ compile-flags: --cfg r#struct --cfg r#priv | |
| 4 | //@ compile-flags: --check-cfg 'cfg(r#struct)' --check-cfg 'cfg(r#priv)' | |
| 5 | ||
| 6 | fn main() {} |
tests/ui/cfg/path-kw-as-cfg-pred.rs created+129| ... | ... | @@ -0,0 +1,129 @@ |
| 1 | //@ edition: 2024 | |
| 2 | ||
| 3 | #![allow(unexpected_cfgs)] | |
| 4 | ||
| 5 | macro_rules! foo { | |
| 6 | () => { | |
| 7 | #[cfg($crate)] //~ ERROR malformed `cfg` attribute input | |
| 8 | mod _cfg_dollar_crate {} | |
| 9 | #[cfg_attr($crate, path = "foo")] //~ ERROR malformed `cfg_attr` attribute input | |
| 10 | mod _cfg_attr_dollar_crate {} | |
| 11 | #[cfg_attr(true, cfg($crate))] //~ ERROR malformed `cfg` attribute input | |
| 12 | mod _cfg_attr_true_cfg_crate {} | |
| 13 | ||
| 14 | cfg!($crate); //~ ERROR malformed `cfg` macro input | |
| 15 | }; | |
| 16 | } | |
| 17 | ||
| 18 | #[cfg(crate)] //~ ERROR malformed `cfg` attribute input | |
| 19 | mod _cfg_crate {} | |
| 20 | #[cfg(super)] //~ ERROR malformed `cfg` attribute input | |
| 21 | mod _cfg_super {} | |
| 22 | #[cfg(self)] //~ ERROR malformed `cfg` attribute input | |
| 23 | mod _cfg_self_lower {} | |
| 24 | #[cfg(Self)] //~ ERROR malformed `cfg` attribute input | |
| 25 | mod _cfg_self_upper {} | |
| 26 | #[cfg_attr(crate, path = "foo")] //~ ERROR malformed `cfg_attr` attribute input | |
| 27 | mod _cfg_attr_crate {} | |
| 28 | #[cfg_attr(super, path = "foo")] //~ ERROR malformed `cfg_attr` attribute input | |
| 29 | mod _cfg_attr_super {} | |
| 30 | #[cfg_attr(self, path = "foo")] //~ ERROR malformed `cfg_attr` attribute input | |
| 31 | mod _cfg_attr_self_lower {} | |
| 32 | #[cfg_attr(Self, path = "foo")] //~ ERROR malformed `cfg_attr` attribute input | |
| 33 | mod _cfg_attr_self_upper {} | |
| 34 | #[cfg_attr(true, cfg(crate))] //~ ERROR malformed `cfg` attribute input | |
| 35 | mod _cfg_attr_true_cfg_crate {} | |
| 36 | #[cfg_attr(true, cfg(super))] //~ ERROR malformed `cfg` attribute input | |
| 37 | mod _cfg_attr_true_cfg_super {} | |
| 38 | #[cfg_attr(true, cfg(self))] //~ ERROR malformed `cfg` attribute input | |
| 39 | mod _cfg_attr_true_cfg_self_lower {} | |
| 40 | #[cfg_attr(true, cfg(Self))] //~ ERROR malformed `cfg` attribute input | |
| 41 | mod _cfg_attr_true_cfg_self_upper {} | |
| 42 | ||
| 43 | #[cfg(struct)] //~ ERROR expected identifier, found keyword | |
| 44 | mod _cfg_struct {} | |
| 45 | #[cfg(priv)] //~ ERROR expected identifier, found reserved keyword `priv` | |
| 46 | mod _cfg_priv {} | |
| 47 | #[cfg(_)] //~ ERROR expected identifier, found reserved identifier `_` | |
| 48 | mod _cfg_underscore {} | |
| 49 | #[cfg_attr(struct, path = "foo")] //~ ERROR expected identifier, found keyword | |
| 50 | mod _cfg_attr_struct {} | |
| 51 | #[cfg_attr(priv, path = "foo")] //~ ERROR expected identifier, found reserved keyword `priv` | |
| 52 | mod _cfg_attr_priv {} | |
| 53 | #[cfg_attr(_, path = "foo")] //~ ERROR expected identifier, found reserved identifier `_` | |
| 54 | mod _cfg_attr_underscore {} | |
| 55 | #[cfg_attr(true, cfg(struct))] //~ ERROR expected identifier, found keyword | |
| 56 | mod _cfg_attr_true_cfg_struct {} | |
| 57 | #[cfg_attr(true, cfg(priv))] //~ ERROR expected identifier, found reserved keyword `priv` | |
| 58 | mod _cfg_attr_true_cfg_priv {} | |
| 59 | #[cfg_attr(true, cfg(_))] //~ ERROR expected identifier, found reserved identifier `_` | |
| 60 | mod _cfg_attr_true_cfg_underscore {} | |
| 61 | ||
| 62 | fn main() { | |
| 63 | foo!(); | |
| 64 | ||
| 65 | cfg!(crate); //~ ERROR malformed `cfg` macro input | |
| 66 | cfg!(super); //~ ERROR malformed `cfg` macro input | |
| 67 | cfg!(self); //~ ERROR malformed `cfg` macro input | |
| 68 | cfg!(Self); //~ ERROR malformed `cfg` macro input | |
| 69 | ||
| 70 | cfg!(r#crate); //~ ERROR `crate` cannot be a raw identifier | |
| 71 | //~^ ERROR malformed `cfg` macro input | |
| 72 | cfg!(r#super); //~ ERROR `super` cannot be a raw identifier | |
| 73 | //~^ ERROR malformed `cfg` macro input | |
| 74 | cfg!(r#self); //~ ERROR `self` cannot be a raw identifier | |
| 75 | //~^ ERROR malformed `cfg` macro input | |
| 76 | cfg!(r#Self); //~ ERROR `Self` cannot be a raw identifier | |
| 77 | //~^ ERROR malformed `cfg` macro input | |
| 78 | ||
| 79 | cfg!(struct); //~ ERROR expected identifier, found keyword | |
| 80 | cfg!(priv); //~ ERROR expected identifier, found reserved keyword `priv` | |
| 81 | cfg!(_); //~ ERROR expected identifier, found reserved identifier `_` | |
| 82 | ||
| 83 | cfg!(r#struct); // Ok | |
| 84 | cfg!(r#priv); // Ok | |
| 85 | cfg!(r#_); //~ ERROR `_` cannot be a raw identifier | |
| 86 | } | |
| 87 | ||
| 88 | #[cfg(r#crate)] //~ ERROR malformed `cfg` attribute input | |
| 89 | //~^ ERROR `crate` cannot be a raw identifier | |
| 90 | mod _cfg_r_crate {} | |
| 91 | #[cfg(r#super)] //~ ERROR malformed `cfg` attribute input | |
| 92 | //~^ ERROR `super` cannot be a raw identifier | |
| 93 | mod _cfg_r_super {} | |
| 94 | #[cfg(r#self)] //~ ERROR malformed `cfg` attribute input | |
| 95 | //~^ ERROR `self` cannot be a raw identifier | |
| 96 | mod _cfg_r_self_lower {} | |
| 97 | #[cfg(r#Self)] //~ ERROR malformed `cfg` attribute input | |
| 98 | //~^ ERROR `Self` cannot be a raw identifier | |
| 99 | mod _cfg_r_self_upper {} | |
| 100 | #[cfg_attr(r#crate, cfg(r#crate))] //~ ERROR malformed `cfg_attr` attribute input | |
| 101 | //~^ ERROR `crate` cannot be a raw identifier | |
| 102 | //~^^ ERROR `crate` cannot be a raw identifier | |
| 103 | mod _cfg_attr_r_crate {} | |
| 104 | #[cfg_attr(r#super, cfg(r#super))] //~ ERROR malformed `cfg_attr` attribute input | |
| 105 | //~^ ERROR `super` cannot be a raw identifier | |
| 106 | //~^^ ERROR `super` cannot be a raw identifier | |
| 107 | mod _cfg_attr_r_super {} | |
| 108 | #[cfg_attr(r#self, cfg(r#self))] //~ ERROR malformed `cfg_attr` attribute input | |
| 109 | //~^ ERROR `self` cannot be a raw identifier | |
| 110 | //~^^ ERROR `self` cannot be a raw identifier | |
| 111 | mod _cfg_attr_r_self_lower {} | |
| 112 | #[cfg_attr(r#Self, cfg(r#Self))] //~ ERROR malformed `cfg_attr` attribute input | |
| 113 | //~^ ERROR `Self` cannot be a raw identifier | |
| 114 | //~^^ ERROR `Self` cannot be a raw identifier | |
| 115 | mod _cfg_attr_r_self_upper {} | |
| 116 | ||
| 117 | #[cfg(r#struct)] // Ok | |
| 118 | mod _cfg_r_struct {} | |
| 119 | #[cfg(r#priv)] // Ok | |
| 120 | mod _cfg_r_priv {} | |
| 121 | #[cfg(r#_)] //~ ERROR `_` cannot be a raw identifier | |
| 122 | mod _cfg_r_underscore {} | |
| 123 | #[cfg_attr(r#struct, cfg(r#struct))] // Ok | |
| 124 | mod _cfg_attr_r_struct {} | |
| 125 | #[cfg_attr(r#priv, cfg(r#priv))] // Ok | |
| 126 | mod _cfg_attr_r_priv {} | |
| 127 | #[cfg_attr(r#_, cfg(r#_))] //~ ERROR `_` cannot be a raw identifier | |
| 128 | //~^ ERROR `_` cannot be a raw identifier | |
| 129 | mod _cfg_attr_r_underscore {} |
tests/ui/cfg/path-kw-as-cfg-pred.stderr created+573| ... | ... | @@ -0,0 +1,573 @@ |
| 1 | error: `crate` cannot be a raw identifier | |
| 2 | --> $DIR/path-kw-as-cfg-pred.rs:70:10 | |
| 3 | | | |
| 4 | LL | cfg!(r#crate); | |
| 5 | | ^^^^^^^ | |
| 6 | ||
| 7 | error: `super` cannot be a raw identifier | |
| 8 | --> $DIR/path-kw-as-cfg-pred.rs:72:10 | |
| 9 | | | |
| 10 | LL | cfg!(r#super); | |
| 11 | | ^^^^^^^ | |
| 12 | ||
| 13 | error: `self` cannot be a raw identifier | |
| 14 | --> $DIR/path-kw-as-cfg-pred.rs:74:10 | |
| 15 | | | |
| 16 | LL | cfg!(r#self); | |
| 17 | | ^^^^^^ | |
| 18 | ||
| 19 | error: `Self` cannot be a raw identifier | |
| 20 | --> $DIR/path-kw-as-cfg-pred.rs:76:10 | |
| 21 | | | |
| 22 | LL | cfg!(r#Self); | |
| 23 | | ^^^^^^ | |
| 24 | ||
| 25 | error: `_` cannot be a raw identifier | |
| 26 | --> $DIR/path-kw-as-cfg-pred.rs:85:10 | |
| 27 | | | |
| 28 | LL | cfg!(r#_); | |
| 29 | | ^^^ | |
| 30 | ||
| 31 | error: `crate` cannot be a raw identifier | |
| 32 | --> $DIR/path-kw-as-cfg-pred.rs:88:7 | |
| 33 | | | |
| 34 | LL | #[cfg(r#crate)] | |
| 35 | | ^^^^^^^ | |
| 36 | ||
| 37 | error: `super` cannot be a raw identifier | |
| 38 | --> $DIR/path-kw-as-cfg-pred.rs:91:7 | |
| 39 | | | |
| 40 | LL | #[cfg(r#super)] | |
| 41 | | ^^^^^^^ | |
| 42 | ||
| 43 | error: `self` cannot be a raw identifier | |
| 44 | --> $DIR/path-kw-as-cfg-pred.rs:94:7 | |
| 45 | | | |
| 46 | LL | #[cfg(r#self)] | |
| 47 | | ^^^^^^ | |
| 48 | ||
| 49 | error: `Self` cannot be a raw identifier | |
| 50 | --> $DIR/path-kw-as-cfg-pred.rs:97:7 | |
| 51 | | | |
| 52 | LL | #[cfg(r#Self)] | |
| 53 | | ^^^^^^ | |
| 54 | ||
| 55 | error: `crate` cannot be a raw identifier | |
| 56 | --> $DIR/path-kw-as-cfg-pred.rs:100:12 | |
| 57 | | | |
| 58 | LL | #[cfg_attr(r#crate, cfg(r#crate))] | |
| 59 | | ^^^^^^^ | |
| 60 | ||
| 61 | error: `crate` cannot be a raw identifier | |
| 62 | --> $DIR/path-kw-as-cfg-pred.rs:100:25 | |
| 63 | | | |
| 64 | LL | #[cfg_attr(r#crate, cfg(r#crate))] | |
| 65 | | ^^^^^^^ | |
| 66 | ||
| 67 | error: `super` cannot be a raw identifier | |
| 68 | --> $DIR/path-kw-as-cfg-pred.rs:104:12 | |
| 69 | | | |
| 70 | LL | #[cfg_attr(r#super, cfg(r#super))] | |
| 71 | | ^^^^^^^ | |
| 72 | ||
| 73 | error: `super` cannot be a raw identifier | |
| 74 | --> $DIR/path-kw-as-cfg-pred.rs:104:25 | |
| 75 | | | |
| 76 | LL | #[cfg_attr(r#super, cfg(r#super))] | |
| 77 | | ^^^^^^^ | |
| 78 | ||
| 79 | error: `self` cannot be a raw identifier | |
| 80 | --> $DIR/path-kw-as-cfg-pred.rs:108:12 | |
| 81 | | | |
| 82 | LL | #[cfg_attr(r#self, cfg(r#self))] | |
| 83 | | ^^^^^^ | |
| 84 | ||
| 85 | error: `self` cannot be a raw identifier | |
| 86 | --> $DIR/path-kw-as-cfg-pred.rs:108:24 | |
| 87 | | | |
| 88 | LL | #[cfg_attr(r#self, cfg(r#self))] | |
| 89 | | ^^^^^^ | |
| 90 | ||
| 91 | error: `Self` cannot be a raw identifier | |
| 92 | --> $DIR/path-kw-as-cfg-pred.rs:112:12 | |
| 93 | | | |
| 94 | LL | #[cfg_attr(r#Self, cfg(r#Self))] | |
| 95 | | ^^^^^^ | |
| 96 | ||
| 97 | error: `Self` cannot be a raw identifier | |
| 98 | --> $DIR/path-kw-as-cfg-pred.rs:112:24 | |
| 99 | | | |
| 100 | LL | #[cfg_attr(r#Self, cfg(r#Self))] | |
| 101 | | ^^^^^^ | |
| 102 | ||
| 103 | error: `_` cannot be a raw identifier | |
| 104 | --> $DIR/path-kw-as-cfg-pred.rs:121:7 | |
| 105 | | | |
| 106 | LL | #[cfg(r#_)] | |
| 107 | | ^^^ | |
| 108 | ||
| 109 | error: `_` cannot be a raw identifier | |
| 110 | --> $DIR/path-kw-as-cfg-pred.rs:127:12 | |
| 111 | | | |
| 112 | LL | #[cfg_attr(r#_, cfg(r#_))] | |
| 113 | | ^^^ | |
| 114 | ||
| 115 | error: `_` cannot be a raw identifier | |
| 116 | --> $DIR/path-kw-as-cfg-pred.rs:127:21 | |
| 117 | | | |
| 118 | LL | #[cfg_attr(r#_, cfg(r#_))] | |
| 119 | | ^^^ | |
| 120 | ||
| 121 | error[E0539]: malformed `cfg` attribute input | |
| 122 | --> $DIR/path-kw-as-cfg-pred.rs:18:1 | |
| 123 | | | |
| 124 | LL | #[cfg(crate)] | |
| 125 | | ^^^^^^-----^^ | |
| 126 | | | | | |
| 127 | | | expected a valid identifier here | |
| 128 | | help: must be of the form: `#[cfg(predicate)]` | |
| 129 | | | |
| 130 | = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute> | |
| 131 | ||
| 132 | error[E0539]: malformed `cfg` attribute input | |
| 133 | --> $DIR/path-kw-as-cfg-pred.rs:20:1 | |
| 134 | | | |
| 135 | LL | #[cfg(super)] | |
| 136 | | ^^^^^^-----^^ | |
| 137 | | | | | |
| 138 | | | expected a valid identifier here | |
| 139 | | help: must be of the form: `#[cfg(predicate)]` | |
| 140 | | | |
| 141 | = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute> | |
| 142 | ||
| 143 | error[E0539]: malformed `cfg` attribute input | |
| 144 | --> $DIR/path-kw-as-cfg-pred.rs:22:1 | |
| 145 | | | |
| 146 | LL | #[cfg(self)] | |
| 147 | | ^^^^^^----^^ | |
| 148 | | | | | |
| 149 | | | expected a valid identifier here | |
| 150 | | help: must be of the form: `#[cfg(predicate)]` | |
| 151 | | | |
| 152 | = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute> | |
| 153 | ||
| 154 | error[E0539]: malformed `cfg` attribute input | |
| 155 | --> $DIR/path-kw-as-cfg-pred.rs:24:1 | |
| 156 | | | |
| 157 | LL | #[cfg(Self)] | |
| 158 | | ^^^^^^----^^ | |
| 159 | | | | | |
| 160 | | | expected a valid identifier here | |
| 161 | | help: must be of the form: `#[cfg(predicate)]` | |
| 162 | | | |
| 163 | = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute> | |
| 164 | ||
| 165 | error[E0539]: malformed `cfg_attr` attribute input | |
| 166 | --> $DIR/path-kw-as-cfg-pred.rs:26:1 | |
| 167 | | | |
| 168 | LL | #[cfg_attr(crate, path = "foo")] | |
| 169 | | ^^^^^^^^^^^-----^^^^^^^^^^^^^^^^ | |
| 170 | | | | | |
| 171 | | | expected a valid identifier here | |
| 172 | | help: must be of the form: `#[cfg_attr(predicate, attr1, attr2, ...)]` | |
| 173 | | | |
| 174 | = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute> | |
| 175 | ||
| 176 | error[E0539]: malformed `cfg_attr` attribute input | |
| 177 | --> $DIR/path-kw-as-cfg-pred.rs:28:1 | |
| 178 | | | |
| 179 | LL | #[cfg_attr(super, path = "foo")] | |
| 180 | | ^^^^^^^^^^^-----^^^^^^^^^^^^^^^^ | |
| 181 | | | | | |
| 182 | | | expected a valid identifier here | |
| 183 | | help: must be of the form: `#[cfg_attr(predicate, attr1, attr2, ...)]` | |
| 184 | | | |
| 185 | = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute> | |
| 186 | ||
| 187 | error[E0539]: malformed `cfg_attr` attribute input | |
| 188 | --> $DIR/path-kw-as-cfg-pred.rs:30:1 | |
| 189 | | | |
| 190 | LL | #[cfg_attr(self, path = "foo")] | |
| 191 | | ^^^^^^^^^^^----^^^^^^^^^^^^^^^^ | |
| 192 | | | | | |
| 193 | | | expected a valid identifier here | |
| 194 | | help: must be of the form: `#[cfg_attr(predicate, attr1, attr2, ...)]` | |
| 195 | | | |
| 196 | = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute> | |
| 197 | ||
| 198 | error[E0539]: malformed `cfg_attr` attribute input | |
| 199 | --> $DIR/path-kw-as-cfg-pred.rs:32:1 | |
| 200 | | | |
| 201 | LL | #[cfg_attr(Self, path = "foo")] | |
| 202 | | ^^^^^^^^^^^----^^^^^^^^^^^^^^^^ | |
| 203 | | | | | |
| 204 | | | expected a valid identifier here | |
| 205 | | help: must be of the form: `#[cfg_attr(predicate, attr1, attr2, ...)]` | |
| 206 | | | |
| 207 | = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute> | |
| 208 | ||
| 209 | error[E0539]: malformed `cfg` attribute input | |
| 210 | --> $DIR/path-kw-as-cfg-pred.rs:34:18 | |
| 211 | | | |
| 212 | LL | #[cfg_attr(true, cfg(crate))] | |
| 213 | | ^^^^-----^ | |
| 214 | | | | | |
| 215 | | | expected a valid identifier here | |
| 216 | | help: must be of the form: `cfg(predicate)` | |
| 217 | | | |
| 218 | = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute> | |
| 219 | ||
| 220 | error[E0539]: malformed `cfg` attribute input | |
| 221 | --> $DIR/path-kw-as-cfg-pred.rs:36:18 | |
| 222 | | | |
| 223 | LL | #[cfg_attr(true, cfg(super))] | |
| 224 | | ^^^^-----^ | |
| 225 | | | | | |
| 226 | | | expected a valid identifier here | |
| 227 | | help: must be of the form: `cfg(predicate)` | |
| 228 | | | |
| 229 | = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute> | |
| 230 | ||
| 231 | error[E0539]: malformed `cfg` attribute input | |
| 232 | --> $DIR/path-kw-as-cfg-pred.rs:38:18 | |
| 233 | | | |
| 234 | LL | #[cfg_attr(true, cfg(self))] | |
| 235 | | ^^^^----^ | |
| 236 | | | | | |
| 237 | | | expected a valid identifier here | |
| 238 | | help: must be of the form: `cfg(predicate)` | |
| 239 | | | |
| 240 | = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute> | |
| 241 | ||
| 242 | error[E0539]: malformed `cfg` attribute input | |
| 243 | --> $DIR/path-kw-as-cfg-pred.rs:40:18 | |
| 244 | | | |
| 245 | LL | #[cfg_attr(true, cfg(Self))] | |
| 246 | | ^^^^----^ | |
| 247 | | | | | |
| 248 | | | expected a valid identifier here | |
| 249 | | help: must be of the form: `cfg(predicate)` | |
| 250 | | | |
| 251 | = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute> | |
| 252 | ||
| 253 | error: expected identifier, found keyword `struct` | |
| 254 | --> $DIR/path-kw-as-cfg-pred.rs:43:7 | |
| 255 | | | |
| 256 | LL | #[cfg(struct)] | |
| 257 | | ^^^^^^ expected identifier, found keyword | |
| 258 | ||
| 259 | error: expected identifier, found reserved keyword `priv` | |
| 260 | --> $DIR/path-kw-as-cfg-pred.rs:45:7 | |
| 261 | | | |
| 262 | LL | #[cfg(priv)] | |
| 263 | | ^^^^ expected identifier, found reserved keyword | |
| 264 | ||
| 265 | error: expected identifier, found reserved identifier `_` | |
| 266 | --> $DIR/path-kw-as-cfg-pred.rs:47:7 | |
| 267 | | | |
| 268 | LL | #[cfg(_)] | |
| 269 | | ^ expected identifier, found reserved identifier | |
| 270 | ||
| 271 | error: expected identifier, found keyword `struct` | |
| 272 | --> $DIR/path-kw-as-cfg-pred.rs:49:12 | |
| 273 | | | |
| 274 | LL | #[cfg_attr(struct, path = "foo")] | |
| 275 | | ^^^^^^ expected identifier, found keyword | |
| 276 | | | |
| 277 | help: escape `struct` to use it as an identifier | |
| 278 | | | |
| 279 | LL | #[cfg_attr(r#struct, path = "foo")] | |
| 280 | | ++ | |
| 281 | ||
| 282 | error: expected identifier, found reserved keyword `priv` | |
| 283 | --> $DIR/path-kw-as-cfg-pred.rs:51:12 | |
| 284 | | | |
| 285 | LL | #[cfg_attr(priv, path = "foo")] | |
| 286 | | ^^^^ expected identifier, found reserved keyword | |
| 287 | | | |
| 288 | help: escape `priv` to use it as an identifier | |
| 289 | | | |
| 290 | LL | #[cfg_attr(r#priv, path = "foo")] | |
| 291 | | ++ | |
| 292 | ||
| 293 | error: expected identifier, found reserved identifier `_` | |
| 294 | --> $DIR/path-kw-as-cfg-pred.rs:53:12 | |
| 295 | | | |
| 296 | LL | #[cfg_attr(_, path = "foo")] | |
| 297 | | ^ expected identifier, found reserved identifier | |
| 298 | ||
| 299 | error: expected identifier, found keyword `struct` | |
| 300 | --> $DIR/path-kw-as-cfg-pred.rs:55:22 | |
| 301 | | | |
| 302 | LL | #[cfg_attr(true, cfg(struct))] | |
| 303 | | ^^^^^^ expected identifier, found keyword | |
| 304 | ||
| 305 | error: expected identifier, found reserved keyword `priv` | |
| 306 | --> $DIR/path-kw-as-cfg-pred.rs:57:22 | |
| 307 | | | |
| 308 | LL | #[cfg_attr(true, cfg(priv))] | |
| 309 | | ^^^^ expected identifier, found reserved keyword | |
| 310 | ||
| 311 | error: expected identifier, found reserved identifier `_` | |
| 312 | --> $DIR/path-kw-as-cfg-pred.rs:59:22 | |
| 313 | | | |
| 314 | LL | #[cfg_attr(true, cfg(_))] | |
| 315 | | ^ expected identifier, found reserved identifier | |
| 316 | ||
| 317 | error[E0539]: malformed `cfg` attribute input | |
| 318 | --> $DIR/path-kw-as-cfg-pred.rs:88:1 | |
| 319 | | | |
| 320 | LL | #[cfg(r#crate)] | |
| 321 | | ^^^^^^-------^^ | |
| 322 | | | | | |
| 323 | | | expected a valid identifier here | |
| 324 | | help: must be of the form: `#[cfg(predicate)]` | |
| 325 | | | |
| 326 | = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute> | |
| 327 | ||
| 328 | error[E0539]: malformed `cfg` attribute input | |
| 329 | --> $DIR/path-kw-as-cfg-pred.rs:91:1 | |
| 330 | | | |
| 331 | LL | #[cfg(r#super)] | |
| 332 | | ^^^^^^-------^^ | |
| 333 | | | | | |
| 334 | | | expected a valid identifier here | |
| 335 | | help: must be of the form: `#[cfg(predicate)]` | |
| 336 | | | |
| 337 | = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute> | |
| 338 | ||
| 339 | error[E0539]: malformed `cfg` attribute input | |
| 340 | --> $DIR/path-kw-as-cfg-pred.rs:94:1 | |
| 341 | | | |
| 342 | LL | #[cfg(r#self)] | |
| 343 | | ^^^^^^------^^ | |
| 344 | | | | | |
| 345 | | | expected a valid identifier here | |
| 346 | | help: must be of the form: `#[cfg(predicate)]` | |
| 347 | | | |
| 348 | = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute> | |
| 349 | ||
| 350 | error[E0539]: malformed `cfg` attribute input | |
| 351 | --> $DIR/path-kw-as-cfg-pred.rs:97:1 | |
| 352 | | | |
| 353 | LL | #[cfg(r#Self)] | |
| 354 | | ^^^^^^------^^ | |
| 355 | | | | | |
| 356 | | | expected a valid identifier here | |
| 357 | | help: must be of the form: `#[cfg(predicate)]` | |
| 358 | | | |
| 359 | = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute> | |
| 360 | ||
| 361 | error[E0539]: malformed `cfg_attr` attribute input | |
| 362 | --> $DIR/path-kw-as-cfg-pred.rs:100:1 | |
| 363 | | | |
| 364 | LL | #[cfg_attr(r#crate, cfg(r#crate))] | |
| 365 | | ^^^^^^^^^^^-------^^^^^^^^^^^^^^^^ | |
| 366 | | | | | |
| 367 | | | expected a valid identifier here | |
| 368 | | help: must be of the form: `#[cfg_attr(predicate, attr1, attr2, ...)]` | |
| 369 | | | |
| 370 | = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute> | |
| 371 | ||
| 372 | error[E0539]: malformed `cfg_attr` attribute input | |
| 373 | --> $DIR/path-kw-as-cfg-pred.rs:104:1 | |
| 374 | | | |
| 375 | LL | #[cfg_attr(r#super, cfg(r#super))] | |
| 376 | | ^^^^^^^^^^^-------^^^^^^^^^^^^^^^^ | |
| 377 | | | | | |
| 378 | | | expected a valid identifier here | |
| 379 | | help: must be of the form: `#[cfg_attr(predicate, attr1, attr2, ...)]` | |
| 380 | | | |
| 381 | = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute> | |
| 382 | ||
| 383 | error[E0539]: malformed `cfg_attr` attribute input | |
| 384 | --> $DIR/path-kw-as-cfg-pred.rs:108:1 | |
| 385 | | | |
| 386 | LL | #[cfg_attr(r#self, cfg(r#self))] | |
| 387 | | ^^^^^^^^^^^------^^^^^^^^^^^^^^^ | |
| 388 | | | | | |
| 389 | | | expected a valid identifier here | |
| 390 | | help: must be of the form: `#[cfg_attr(predicate, attr1, attr2, ...)]` | |
| 391 | | | |
| 392 | = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute> | |
| 393 | ||
| 394 | error[E0539]: malformed `cfg_attr` attribute input | |
| 395 | --> $DIR/path-kw-as-cfg-pred.rs:112:1 | |
| 396 | | | |
| 397 | LL | #[cfg_attr(r#Self, cfg(r#Self))] | |
| 398 | | ^^^^^^^^^^^------^^^^^^^^^^^^^^^ | |
| 399 | | | | | |
| 400 | | | expected a valid identifier here | |
| 401 | | help: must be of the form: `#[cfg_attr(predicate, attr1, attr2, ...)]` | |
| 402 | | | |
| 403 | = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute> | |
| 404 | ||
| 405 | error[E0539]: malformed `cfg` attribute input | |
| 406 | --> $DIR/path-kw-as-cfg-pred.rs:7:9 | |
| 407 | | | |
| 408 | LL | #[cfg($crate)] | |
| 409 | | ^^^^^^------^^ | |
| 410 | | | | | |
| 411 | | | expected a valid identifier here | |
| 412 | | help: must be of the form: `#[cfg(predicate)]` | |
| 413 | ... | |
| 414 | LL | foo!(); | |
| 415 | | ------ in this macro invocation | |
| 416 | | | |
| 417 | = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute> | |
| 418 | = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 419 | ||
| 420 | error[E0539]: malformed `cfg_attr` attribute input | |
| 421 | --> $DIR/path-kw-as-cfg-pred.rs:9:9 | |
| 422 | | | |
| 423 | LL | #[cfg_attr($crate, path = "foo")] | |
| 424 | | ^^^^^^^^^^^------^^^^^^^^^^^^^^^^ | |
| 425 | | | | | |
| 426 | | | expected a valid identifier here | |
| 427 | | help: must be of the form: `#[cfg_attr(predicate, attr1, attr2, ...)]` | |
| 428 | ... | |
| 429 | LL | foo!(); | |
| 430 | | ------ in this macro invocation | |
| 431 | | | |
| 432 | = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute> | |
| 433 | = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 434 | ||
| 435 | error[E0539]: malformed `cfg` attribute input | |
| 436 | --> $DIR/path-kw-as-cfg-pred.rs:11:26 | |
| 437 | | | |
| 438 | LL | #[cfg_attr(true, cfg($crate))] | |
| 439 | | ^^^^------^ | |
| 440 | | | | | |
| 441 | | | expected a valid identifier here | |
| 442 | | help: must be of the form: `cfg(predicate)` | |
| 443 | ... | |
| 444 | LL | foo!(); | |
| 445 | | ------ in this macro invocation | |
| 446 | | | |
| 447 | = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute> | |
| 448 | = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 449 | ||
| 450 | error[E0539]: malformed `cfg` macro input | |
| 451 | --> $DIR/path-kw-as-cfg-pred.rs:14:9 | |
| 452 | | | |
| 453 | LL | cfg!($crate); | |
| 454 | | ^^^^^------^ | |
| 455 | | | | | |
| 456 | | | expected a valid identifier here | |
| 457 | | help: must be of the form: `cfg!(predicate)` | |
| 458 | ... | |
| 459 | LL | foo!(); | |
| 460 | | ------ in this macro invocation | |
| 461 | | | |
| 462 | = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute> | |
| 463 | = note: this error originates in the macro `cfg` which comes from the expansion of the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 464 | ||
| 465 | error[E0539]: malformed `cfg` macro input | |
| 466 | --> $DIR/path-kw-as-cfg-pred.rs:65:5 | |
| 467 | | | |
| 468 | LL | cfg!(crate); | |
| 469 | | ^^^^^-----^ | |
| 470 | | | | | |
| 471 | | | expected a valid identifier here | |
| 472 | | help: must be of the form: `cfg!(predicate)` | |
| 473 | | | |
| 474 | = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute> | |
| 475 | ||
| 476 | error[E0539]: malformed `cfg` macro input | |
| 477 | --> $DIR/path-kw-as-cfg-pred.rs:66:5 | |
| 478 | | | |
| 479 | LL | cfg!(super); | |
| 480 | | ^^^^^-----^ | |
| 481 | | | | | |
| 482 | | | expected a valid identifier here | |
| 483 | | help: must be of the form: `cfg!(predicate)` | |
| 484 | | | |
| 485 | = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute> | |
| 486 | ||
| 487 | error[E0539]: malformed `cfg` macro input | |
| 488 | --> $DIR/path-kw-as-cfg-pred.rs:67:5 | |
| 489 | | | |
| 490 | LL | cfg!(self); | |
| 491 | | ^^^^^----^ | |
| 492 | | | | | |
| 493 | | | expected a valid identifier here | |
| 494 | | help: must be of the form: `cfg!(predicate)` | |
| 495 | | | |
| 496 | = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute> | |
| 497 | ||
| 498 | error[E0539]: malformed `cfg` macro input | |
| 499 | --> $DIR/path-kw-as-cfg-pred.rs:68:5 | |
| 500 | | | |
| 501 | LL | cfg!(Self); | |
| 502 | | ^^^^^----^ | |
| 503 | | | | | |
| 504 | | | expected a valid identifier here | |
| 505 | | help: must be of the form: `cfg!(predicate)` | |
| 506 | | | |
| 507 | = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute> | |
| 508 | ||
| 509 | error[E0539]: malformed `cfg` macro input | |
| 510 | --> $DIR/path-kw-as-cfg-pred.rs:70:5 | |
| 511 | | | |
| 512 | LL | cfg!(r#crate); | |
| 513 | | ^^^^^-------^ | |
| 514 | | | | | |
| 515 | | | expected a valid identifier here | |
| 516 | | help: must be of the form: `cfg!(predicate)` | |
| 517 | | | |
| 518 | = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute> | |
| 519 | ||
| 520 | error[E0539]: malformed `cfg` macro input | |
| 521 | --> $DIR/path-kw-as-cfg-pred.rs:72:5 | |
| 522 | | | |
| 523 | LL | cfg!(r#super); | |
| 524 | | ^^^^^-------^ | |
| 525 | | | | | |
| 526 | | | expected a valid identifier here | |
| 527 | | help: must be of the form: `cfg!(predicate)` | |
| 528 | | | |
| 529 | = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute> | |
| 530 | ||
| 531 | error[E0539]: malformed `cfg` macro input | |
| 532 | --> $DIR/path-kw-as-cfg-pred.rs:74:5 | |
| 533 | | | |
| 534 | LL | cfg!(r#self); | |
| 535 | | ^^^^^------^ | |
| 536 | | | | | |
| 537 | | | expected a valid identifier here | |
| 538 | | help: must be of the form: `cfg!(predicate)` | |
| 539 | | | |
| 540 | = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute> | |
| 541 | ||
| 542 | error[E0539]: malformed `cfg` macro input | |
| 543 | --> $DIR/path-kw-as-cfg-pred.rs:76:5 | |
| 544 | | | |
| 545 | LL | cfg!(r#Self); | |
| 546 | | ^^^^^------^ | |
| 547 | | | | | |
| 548 | | | expected a valid identifier here | |
| 549 | | help: must be of the form: `cfg!(predicate)` | |
| 550 | | | |
| 551 | = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute> | |
| 552 | ||
| 553 | error: expected identifier, found keyword `struct` | |
| 554 | --> $DIR/path-kw-as-cfg-pred.rs:79:10 | |
| 555 | | | |
| 556 | LL | cfg!(struct); | |
| 557 | | ^^^^^^ expected identifier, found keyword | |
| 558 | ||
| 559 | error: expected identifier, found reserved keyword `priv` | |
| 560 | --> $DIR/path-kw-as-cfg-pred.rs:80:10 | |
| 561 | | | |
| 562 | LL | cfg!(priv); | |
| 563 | | ^^^^ expected identifier, found reserved keyword | |
| 564 | ||
| 565 | error: expected identifier, found reserved identifier `_` | |
| 566 | --> $DIR/path-kw-as-cfg-pred.rs:81:10 | |
| 567 | | | |
| 568 | LL | cfg!(_); | |
| 569 | | ^ expected identifier, found reserved identifier | |
| 570 | ||
| 571 | error: aborting due to 64 previous errors | |
| 572 | ||
| 573 | For more information about this error, try `rustc --explain E0539`. |
tests/ui/cfg/raw-true-false.rs+1-5| ... | ... | @@ -1,9 +1,5 @@ |
| 1 | 1 | //@ check-pass |
| 2 | //@ revisions: r0x0 r0x1 r1x0 r1x1 | |
| 3 | //@[r0x0] compile-flags: --cfg false --check-cfg=cfg(false) | |
| 4 | //@[r0x1] compile-flags: --cfg false --check-cfg=cfg(r#false) | |
| 5 | //@[r1x0] compile-flags: --cfg r#false --check-cfg=cfg(false) | |
| 6 | //@[r1x1] compile-flags: --cfg r#false --check-cfg=cfg(r#false) | |
| 2 | //@ compile-flags: --cfg r#false --check-cfg=cfg(r#false) | |
| 7 | 3 | #![deny(unexpected_cfgs)] |
| 8 | 4 | fn main() { |
| 9 | 5 | #[cfg(not(r#false))] |
tests/ui/check-cfg/raw-keywords.rs+1-1| ... | ... | @@ -3,7 +3,7 @@ |
| 3 | 3 | // |
| 4 | 4 | //@ check-pass |
| 5 | 5 | //@ no-auto-check-cfg |
| 6 | //@ compile-flags: --cfg=true --cfg=async --check-cfg=cfg(r#true,r#async,edition2015,edition2021) | |
| 6 | //@ compile-flags: --cfg=r#true --cfg=r#async --check-cfg=cfg(r#true,r#async,edition2015,edition2021) | |
| 7 | 7 | // |
| 8 | 8 | //@ revisions: edition2015 edition2021 |
| 9 | 9 | //@ [edition2015] edition: 2015 |
tests/ui/conditional-compilation/cfg-arg-invalid-7.rs+1-1| ... | ... | @@ -3,4 +3,4 @@ |
| 3 | 3 | //@ compile-flags: --cfg a" |
| 4 | 4 | |
| 5 | 5 | //~? RAW unterminated double quote string |
| 6 | //~? RAW this error occurred on the command line | |
| 6 | //~? RAW this occurred on the command line |
tests/ui/conditional-compilation/cfg-arg-invalid-7.stderr+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | 1 | error[E0765]: unterminated double quote string |
| 2 | 2 | | |
| 3 | = note: this error occurred on the command line: `--cfg=a"` | |
| 3 | = note: this occurred on the command line: `--cfg=a"` | |
| 4 | 4 |
tests/ui/explicit-tail-calls/ctfe-id-unlimited.return.stderr deleted-25| ... | ... | @@ -1,25 +0,0 @@ |
| 1 | error[E0080]: reached the configured maximum number of stack frames | |
| 2 | --> $DIR/ctfe-id-unlimited.rs:28:20 | |
| 3 | | | |
| 4 | LL | const ID_ED: u32 = rec_id(ORIGINAL); | |
| 5 | | ^^^^^^^^^^^^^^^^ evaluation of `ID_ED` failed inside this call | |
| 6 | | | |
| 7 | note: inside `rec_id` | |
| 8 | --> $DIR/ctfe-id-unlimited.rs:21:5 | |
| 9 | | | |
| 10 | LL | inner(0, n) | |
| 11 | | ^^^^^^^^^^^ | |
| 12 | note: [... 125 additional calls inside `inner` ...] | |
| 13 | --> $DIR/ctfe-id-unlimited.rs:17:42 | |
| 14 | | | |
| 15 | LL | #[cfg(r#return)] _ => return inner(acc + 1, n - 1), | |
| 16 | | ^^^^^^^^^^^^^^^^^^^^^ | |
| 17 | note: inside `inner` | |
| 18 | --> $DIR/ctfe-id-unlimited.rs:17:42 | |
| 19 | | | |
| 20 | LL | #[cfg(r#return)] _ => return inner(acc + 1, n - 1), | |
| 21 | | ^^^^^^^^^^^^^^^^^^^^^ the failure occurred here | |
| 22 | ||
| 23 | error: aborting due to 1 previous error | |
| 24 | ||
| 25 | For more information about this error, try `rustc --explain E0080`. |
tests/ui/explicit-tail-calls/ctfe-id-unlimited.return_.stderr created+25| ... | ... | @@ -0,0 +1,25 @@ |
| 1 | error[E0080]: reached the configured maximum number of stack frames | |
| 2 | --> $DIR/ctfe-id-unlimited.rs:28:20 | |
| 3 | | | |
| 4 | LL | const ID_ED: u32 = rec_id(ORIGINAL); | |
| 5 | | ^^^^^^^^^^^^^^^^ evaluation of `ID_ED` failed inside this call | |
| 6 | | | |
| 7 | note: inside `rec_id` | |
| 8 | --> $DIR/ctfe-id-unlimited.rs:21:5 | |
| 9 | | | |
| 10 | LL | inner(0, n) | |
| 11 | | ^^^^^^^^^^^ | |
| 12 | note: [... 125 additional calls inside `inner` ...] | |
| 13 | --> $DIR/ctfe-id-unlimited.rs:17:41 | |
| 14 | | | |
| 15 | LL | #[cfg(return_)] _ => return inner(acc + 1, n - 1), | |
| 16 | | ^^^^^^^^^^^^^^^^^^^^^ | |
| 17 | note: inside `inner` | |
| 18 | --> $DIR/ctfe-id-unlimited.rs:17:41 | |
| 19 | | | |
| 20 | LL | #[cfg(return_)] _ => return inner(acc + 1, n - 1), | |
| 21 | | ^^^^^^^^^^^^^^^^^^^^^ the failure occurred here | |
| 22 | ||
| 23 | error: aborting due to 1 previous error | |
| 24 | ||
| 25 | For more information about this error, try `rustc --explain E0080`. |
tests/ui/explicit-tail-calls/ctfe-id-unlimited.rs+5-5| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | //@ revisions: become return | |
| 2 | //@ [become] run-pass | |
| 1 | //@ revisions: become_ return_ | |
| 2 | //@ [become_] run-pass | |
| 3 | 3 | #![expect(incomplete_features)] |
| 4 | 4 | #![feature(explicit_tail_calls)] |
| 5 | 5 | |
| ... | ... | @@ -13,8 +13,8 @@ const fn rec_id(n: u32) -> u32 { |
| 13 | 13 | const fn inner(acc: u32, n: u32) -> u32 { |
| 14 | 14 | match n { |
| 15 | 15 | 0 => acc, |
| 16 | #[cfg(r#become)] _ => become inner(acc + 1, n - 1), | |
| 17 | #[cfg(r#return)] _ => return inner(acc + 1, n - 1), | |
| 16 | #[cfg(become_)] _ => become inner(acc + 1, n - 1), | |
| 17 | #[cfg(return_)] _ => return inner(acc + 1, n - 1), | |
| 18 | 18 | } |
| 19 | 19 | } |
| 20 | 20 | |
| ... | ... | @@ -25,7 +25,7 @@ const fn rec_id(n: u32) -> u32 { |
| 25 | 25 | const ORIGINAL: u32 = 12345; |
| 26 | 26 | // Original number, but with identity function applied |
| 27 | 27 | // (this is the same, but requires execution of the recursion) |
| 28 | const ID_ED: u32 = rec_id(ORIGINAL); //[return]~ ERROR: reached the configured maximum number of stack frames | |
| 28 | const ID_ED: u32 = rec_id(ORIGINAL); //[return_]~ ERROR: reached the configured maximum number of stack frames | |
| 29 | 29 | // Assert to make absolutely sure the computation actually happens |
| 30 | 30 | const ASSERT: () = assert!(ORIGINAL == ID_ED); |
| 31 | 31 |
tests/ui/resolve/regression-struct-called-as-function-148919.rs created+10| ... | ... | @@ -0,0 +1,10 @@ |
| 1 | struct Bar {} | |
| 2 | ||
| 3 | impl Bar { | |
| 4 | fn into_self(self) -> Bar { | |
| 5 | Bar(self) | |
| 6 | //~^ ERROR expected function, tuple struct or tuple variant, found struct `Bar` [E0423] | |
| 7 | } | |
| 8 | } | |
| 9 | ||
| 10 | fn main() {} |
tests/ui/resolve/regression-struct-called-as-function-148919.stderr created+9| ... | ... | @@ -0,0 +1,9 @@ |
| 1 | error[E0423]: expected function, tuple struct or tuple variant, found struct `Bar` | |
| 2 | --> $DIR/regression-struct-called-as-function-148919.rs:5:9 | |
| 3 | | | |
| 4 | LL | Bar(self) | |
| 5 | | ^^^ | |
| 6 | ||
| 7 | error: aborting due to 1 previous error | |
| 8 | ||
| 9 | For more information about this error, try `rustc --explain E0423`. |
tests/ui/use/use-path-segment-kw.rs created+250| ... | ... | @@ -0,0 +1,250 @@ |
| 1 | //@ edition: 2021 | |
| 2 | ||
| 3 | macro_rules! macro_dollar_crate { | |
| 4 | () => { | |
| 5 | use $crate::*; | |
| 6 | use $crate::{}; | |
| 7 | ||
| 8 | type A1 = $crate; //~ ERROR expected type, found module `$crate` | |
| 9 | use $crate; //~ ERROR `$crate` may not be imported | |
| 10 | pub use $crate as _dollar_crate; //~ ERROR `$crate` may not be imported | |
| 11 | ||
| 12 | type A2 = ::$crate; //~ ERROR failed to resolve: global paths cannot start with `$crate` | |
| 13 | use ::$crate; //~ ERROR unresolved import `$crate` | |
| 14 | use ::$crate as _dollar_crate2; //~ ERROR unresolved import `$crate` | |
| 15 | use ::{$crate}; //~ ERROR unresolved import `$crate` | |
| 16 | use ::{$crate as _nested_dollar_crate2}; //~ ERROR unresolved import `$crate` | |
| 17 | ||
| 18 | type A3 = foobar::$crate; //~ ERROR failed to resolve: `$crate` in paths can only be used in start position | |
| 19 | use foobar::$crate; //~ ERROR unresolved import `foobar::$crate` | |
| 20 | use foobar::$crate as _dollar_crate3; //~ ERROR unresolved import `foobar::$crate` | |
| 21 | use foobar::{$crate}; //~ ERROR unresolved import `foobar::$crate` | |
| 22 | use foobar::{$crate as _nested_dollar_crate3}; //~ ERROR unresolved import `foobar::$crate` | |
| 23 | ||
| 24 | type A4 = crate::$crate; //~ ERROR failed to resolve: `$crate` in paths can only be used in start position | |
| 25 | use crate::$crate; //~ ERROR unresolved import `crate::$crate` | |
| 26 | use crate::$crate as _dollar_crate4; //~ ERROR unresolved import `crate::$crate` | |
| 27 | use crate::{$crate}; //~ ERROR unresolved import `crate::$crate` | |
| 28 | use crate::{$crate as _nested_dollar_crate4}; //~ ERROR unresolved import `crate::$crate` | |
| 29 | ||
| 30 | type A5 = super::$crate; //~ ERROR failed to resolve: `$crate` in paths can only be used in start position | |
| 31 | use super::$crate; //~ ERROR unresolved import `super::$crate` | |
| 32 | use super::$crate as _dollar_crate5; //~ ERROR unresolved import `super::$crate` | |
| 33 | use super::{$crate}; //~ ERROR unresolved import `super::$crate` | |
| 34 | use super::{$crate as _nested_dollar_crate5}; //~ ERROR unresolved import `super::$crate` | |
| 35 | ||
| 36 | type A6 = self::$crate; //~ ERROR failed to resolve: `$crate` in paths can only be used in start position | |
| 37 | use self::$crate; | |
| 38 | use self::$crate as _dollar_crate6; | |
| 39 | use self::{$crate}; | |
| 40 | use self::{$crate as _nested_dollar_crate6}; | |
| 41 | ||
| 42 | type A7 = $crate::$crate; //~ ERROR failed to resolve: `$crate` in paths can only be used in start position | |
| 43 | use $crate::$crate; //~ ERROR unresolved import `$crate::$crate` | |
| 44 | use $crate::$crate as _dollar_crate7; //~ ERROR unresolved import `$crate::$crate` | |
| 45 | use $crate::{$crate}; //~ ERROR unresolved import `$crate::$crate` | |
| 46 | use $crate::{$crate as _nested_dollar_crate7}; //~ ERROR unresolved import `$crate::$crate` | |
| 47 | ||
| 48 | type A8 = $crate::crate; //~ ERROR failed to resolve: `crate` in paths can only be used in start position | |
| 49 | use $crate::crate; //~ ERROR unresolved import `$crate::crate` | |
| 50 | //~^ ERROR crate root imports need to be explicitly named: `use crate as name;` | |
| 51 | use $crate::crate as _m_crate8; //~ ERROR unresolved import `$crate::crate` | |
| 52 | use $crate::{crate}; //~ ERROR unresolved import `$crate::crate` | |
| 53 | //~^ ERROR crate root imports need to be explicitly named: `use crate as name;` | |
| 54 | use $crate::{crate as _m_nested_crate8}; //~ ERROR unresolved import `$crate::crate` | |
| 55 | ||
| 56 | type A9 = $crate::super; //~ ERROR failed to resolve: `super` in paths can only be used in start position | |
| 57 | use $crate::super; //~ ERROR unresolved import `$crate::super` | |
| 58 | use $crate::super as _m_super8; //~ ERROR unresolved import `$crate::super` | |
| 59 | use $crate::{super}; //~ ERROR unresolved import `$crate::super` | |
| 60 | use $crate::{super as _m_nested_super8}; //~ ERROR unresolved import `$crate::super` | |
| 61 | ||
| 62 | type A10 = $crate::self; //~ ERROR failed to resolve: `self` in paths can only be used in start position | |
| 63 | use $crate::self; //~ ERROR `$crate` may not be imported | |
| 64 | //~^ ERROR `self` imports are only allowed within a { } list | |
| 65 | //~^^ ERROR the name `<!dummy!>` is defined multiple times | |
| 66 | pub use $crate::self as _m_self8; //~ ERROR `self` imports are only allowed within a { } list | |
| 67 | //~^ ERROR `$crate` may not be imported | |
| 68 | use $crate::{self}; | |
| 69 | //~^ ERROR the name `$crate` is defined multiple times | |
| 70 | pub use $crate::{self as _m_nested_self8}; // Good | |
| 71 | } | |
| 72 | } | |
| 73 | ||
| 74 | fn outer() {} | |
| 75 | ||
| 76 | mod foo { | |
| 77 | pub mod bar { | |
| 78 | pub mod foobar { | |
| 79 | pub mod qux { | |
| 80 | pub use super::inner; | |
| 81 | } | |
| 82 | ||
| 83 | pub mod baz { | |
| 84 | pub use super::inner; | |
| 85 | } | |
| 86 | ||
| 87 | pub fn inner() {} | |
| 88 | } | |
| 89 | ||
| 90 | // --- $crate --- | |
| 91 | macro_dollar_crate!(); | |
| 92 | ||
| 93 | // --- crate --- | |
| 94 | use crate::*; | |
| 95 | use crate::{}; | |
| 96 | ||
| 97 | type B1 = crate; //~ ERROR expected type, found module `crate` | |
| 98 | use crate; //~ ERROR crate root imports need to be explicitly named: `use crate as name;` | |
| 99 | pub use crate as _crate; // Good | |
| 100 | ||
| 101 | type B2 = ::crate; //~ ERROR failed to resolve: global paths cannot start with `crate` | |
| 102 | use ::crate; //~ ERROR crate root imports need to be explicitly named: `use crate as name;` | |
| 103 | //~^ ERROR unresolved import `crate` | |
| 104 | use ::crate as _crate2; //~ ERROR unresolved import `crate` | |
| 105 | use ::{crate}; //~ ERROR crate root imports need to be explicitly named: `use crate as name;` | |
| 106 | //~^ ERROR unresolved import `crate` | |
| 107 | use ::{crate as _nested_crate2}; //~ ERROR unresolved import `crate` | |
| 108 | ||
| 109 | type B3 = foobar::crate; //~ ERROR failed to resolve: `crate` in paths can only be used in start position | |
| 110 | use foobar::crate; //~ ERROR unresolved import `foobar::crate` | |
| 111 | //~^ ERROR crate root imports need to be explicitly named: `use crate as name;` | |
| 112 | use foobar::crate as _crate3; //~ ERROR unresolved import `foobar::crate` | |
| 113 | use foobar::{crate}; //~ ERROR unresolved import `foobar::crate` | |
| 114 | //~^ ERROR crate root imports need to be explicitly named: `use crate as name;` | |
| 115 | use foobar::{crate as _nested_crate3}; //~ ERROR unresolved import `foobar::crate` | |
| 116 | ||
| 117 | type B4 = crate::crate; //~ ERROR failed to resolve: `crate` in paths can only be used in start position | |
| 118 | use crate::crate; //~ ERROR unresolved import `crate::crate` | |
| 119 | //~^ ERROR crate root imports need to be explicitly named: `use crate as name;` | |
| 120 | use crate::crate as _crate4; //~ ERROR unresolved import `crate::crate` | |
| 121 | use crate::{crate}; //~ ERROR unresolved import `crate::crate` | |
| 122 | //~^ ERROR crate root imports need to be explicitly named: `use crate as name;` | |
| 123 | use crate::{crate as _nested_crate4}; //~ ERROR unresolved import `crate::crate` | |
| 124 | ||
| 125 | type B5 = super::crate; //~ ERROR failed to resolve: `crate` in paths can only be used in start position | |
| 126 | use super::crate; //~ ERROR unresolved import `super::crate` | |
| 127 | //~^ ERROR crate root imports need to be explicitly named: `use crate as name;` | |
| 128 | use super::crate as _crate5; //~ ERROR unresolved import `super::crate` | |
| 129 | use super::{crate}; //~ ERROR unresolved import `super::crate` | |
| 130 | //~^ ERROR crate root imports need to be explicitly named: `use crate as name;` | |
| 131 | use super::{crate as _nested_crate5}; //~ ERROR unresolved import `super::crate` | |
| 132 | ||
| 133 | type B6 = self::crate; //~ ERROR failed to resolve: `crate` in paths can only be used in start position | |
| 134 | use self::crate; //~ ERROR crate root imports need to be explicitly named: `use crate as name;` | |
| 135 | //~^ ERROR the name `crate` is defined multiple times | |
| 136 | use self::crate as _crate6; | |
| 137 | use self::{crate}; //~ ERROR crate root imports need to be explicitly named: `use crate as name;` | |
| 138 | //~^ ERROR the name `crate` is defined multiple times | |
| 139 | use self::{crate as _nested_crate6}; | |
| 140 | ||
| 141 | // --- super --- | |
| 142 | use super::*; | |
| 143 | use super::{}; //~ ERROR unresolved import `super` | |
| 144 | ||
| 145 | type C1 = super; //~ ERROR expected type, found module `super` | |
| 146 | use super; //~ ERROR unresolved import `super` | |
| 147 | pub use super as _super; //~ ERROR unresolved import `super` | |
| 148 | ||
| 149 | type C2 = ::super; //~ ERROR failed to resolve: global paths cannot start with `super` | |
| 150 | use ::super; //~ ERROR unresolved import `super` | |
| 151 | use ::super as _super2; //~ ERROR unresolved import `super` | |
| 152 | use ::{super}; //~ ERROR unresolved import `super` | |
| 153 | use ::{super as _nested_super2}; //~ ERROR unresolved import `super` | |
| 154 | ||
| 155 | type C3 = foobar::super; //~ ERROR failed to resolve: `super` in paths can only be used in start position | |
| 156 | use foobar::super; //~ ERROR unresolved import `foobar::super` | |
| 157 | use foobar::super as _super3; //~ ERROR unresolved import `foobar::super` | |
| 158 | use foobar::{super}; //~ ERROR unresolved import `foobar::super` | |
| 159 | use foobar::{super as _nested_super3}; //~ ERROR unresolved import `foobar::super` | |
| 160 | ||
| 161 | type C4 = crate::super; //~ ERROR failed to resolve: `super` in paths can only be used in start position | |
| 162 | use crate::super; //~ ERROR unresolved import `crate::super` | |
| 163 | use crate::super as _super4; //~ ERROR unresolved import `crate::super` | |
| 164 | use crate::{super}; //~ ERROR unresolved import `crate::super` | |
| 165 | use crate::{super as _nested_super4}; //~ ERROR unresolved import `crate::super` | |
| 166 | ||
| 167 | type C5 = super::super; //~ ERROR expected type, found module `super::super` | |
| 168 | use super::super; //~ ERROR unresolved import `super::super` | |
| 169 | pub use super::super as _super5; //~ ERROR unresolved import `super::super` | |
| 170 | use super::{super}; //~ ERROR unresolved import `super::super` | |
| 171 | pub use super::{super as _nested_super5}; //~ ERROR unresolved import `super::super` | |
| 172 | ||
| 173 | type C6 = self::super; //~ ERROR expected type, found module `self::super` | |
| 174 | use self::super; | |
| 175 | use self::super as _super6; | |
| 176 | use self::{super}; | |
| 177 | use self::{super as _nested_super6}; | |
| 178 | ||
| 179 | // --- self --- | |
| 180 | // use self::*; // Suppress other errors | |
| 181 | use self::{}; //~ ERROR unresolved import `self` | |
| 182 | ||
| 183 | type D1 = self; //~ ERROR expected type, found module `self` | |
| 184 | use self; //~ ERROR `self` imports are only allowed within a { } list | |
| 185 | pub use self as _self; //~ ERROR `self` imports are only allowed within a { } list | |
| 186 | ||
| 187 | type D2 = ::self; //~ ERROR failed to resolve: global paths cannot start with `self` | |
| 188 | use ::self; //~ ERROR `self` imports are only allowed within a { } list | |
| 189 | //~^ ERROR unresolved import `{{root}}` | |
| 190 | use ::self as _self2; //~ ERROR `self` imports are only allowed within a { } list | |
| 191 | //~^ ERROR unresolved import `{{root}}` | |
| 192 | use ::{self}; //~ ERROR `self` import can only appear in an import list with a non-empty prefix | |
| 193 | use ::{self as _nested_self2}; //~ ERROR `self` import can only appear in an import list with a non-empty prefix | |
| 194 | ||
| 195 | type D3 = foobar::self; //~ ERROR failed to resolve: `self` in paths can only be used in start position | |
| 196 | pub use foobar::qux::self; //~ ERROR `self` imports are only allowed within a { } list | |
| 197 | pub use foobar::self as _self3; //~ ERROR `self` imports are only allowed within a { } list | |
| 198 | pub use foobar::baz::{self}; // Good | |
| 199 | pub use foobar::{self as _nested_self3}; // Good | |
| 200 | ||
| 201 | type D4 = crate::self; //~ ERROR failed to resolve: `self` in paths can only be used in start position | |
| 202 | use crate::self; //~ ERROR crate root imports need to be explicitly named: `use crate as name;` | |
| 203 | //~^ ERROR `self` imports are only allowed within a { } list | |
| 204 | //~^^ ERROR the name `crate` is defined multiple times | |
| 205 | pub use crate::self as _self4; //~ ERROR `self` imports are only allowed within a { } list | |
| 206 | use crate::{self}; //~ ERROR crate root imports need to be explicitly named: `use crate as name;` | |
| 207 | //~^ ERROR the name `crate` is defined multiple times | |
| 208 | pub use crate::{self as _nested_self4}; // Good | |
| 209 | ||
| 210 | type D5 = super::self; //~ ERROR failed to resolve: `self` in paths can only be used in start position | |
| 211 | use super::self; //~ ERROR unresolved import `super` | |
| 212 | //~^ ERROR `self` imports are only allowed within a { } list | |
| 213 | pub use super::self as _self5; //~ ERROR `self` imports are only allowed within a { } list | |
| 214 | //~^ ERROR unresolved import `super` | |
| 215 | use super::{self}; //~ ERROR unresolved import `super` | |
| 216 | pub use super::{self as _nested_self5}; //~ ERROR unresolved import `super` | |
| 217 | ||
| 218 | type D6 = self::self; //~ ERROR failed to resolve: `self` in paths can only be used in start position | |
| 219 | use self::self; //~ ERROR `self` imports are only allowed within a { } list | |
| 220 | pub use self::self as _self6; //~ ERROR `self` imports are only allowed within a { } list | |
| 221 | use self::{self}; //~ ERROR unresolved import `self` | |
| 222 | pub use self::{self as _nested_self6}; //~ ERROR unresolved import `self` | |
| 223 | } | |
| 224 | } | |
| 225 | ||
| 226 | fn main() { | |
| 227 | foo::bar::_dollar_crate::outer(); | |
| 228 | foo::bar::_m_self8::outer(); | |
| 229 | foo::bar::_dollar_crate::foo::bar::foobar::inner(); | |
| 230 | foo::bar::_m_self8::foo::bar::foobar::inner(); | |
| 231 | ||
| 232 | foo::bar::_crate::outer(); | |
| 233 | foo::bar::_crate::foo::bar::foobar::inner(); | |
| 234 | ||
| 235 | foo::bar::_super::bar::foobar::inner(); | |
| 236 | foo::bar::_super5::outer(); | |
| 237 | foo::bar::_nested_super5::outer(); | |
| 238 | ||
| 239 | foo::bar::_self::foobar::inner(); | |
| 240 | foo::bar::qux::inner(); // Works after recovery | |
| 241 | foo::bar::baz::inner(); | |
| 242 | foo::bar::_self3::inner(); // Works after recovery | |
| 243 | foo::bar::_nested_self3::inner(); | |
| 244 | foo::bar::_self4::outer(); // Works after recovery | |
| 245 | foo::bar::_nested_self4::outer(); | |
| 246 | foo::bar::_self5::bar::foobar::inner(); // Works after recovery | |
| 247 | foo::bar::_nested_self5::bar::foobar::inner(); | |
| 248 | foo::bar::_self6::foobar::inner(); // Works after recovery | |
| 249 | foo::bar::_nested_self6::foobar::inner(); | |
| 250 | } |
tests/ui/use/use-path-segment-kw.stderr created+1245| ... | ... | @@ -0,0 +1,1245 @@ |
| 1 | error: crate root imports need to be explicitly named: `use crate as name;` | |
| 2 | --> $DIR/use-path-segment-kw.rs:98:13 | |
| 3 | | | |
| 4 | LL | use crate; | |
| 5 | | ^^^^^ | |
| 6 | ||
| 7 | error: crate root imports need to be explicitly named: `use crate as name;` | |
| 8 | --> $DIR/use-path-segment-kw.rs:102:15 | |
| 9 | | | |
| 10 | LL | use ::crate; | |
| 11 | | ^^^^^ | |
| 12 | ||
| 13 | error: crate root imports need to be explicitly named: `use crate as name;` | |
| 14 | --> $DIR/use-path-segment-kw.rs:105:16 | |
| 15 | | | |
| 16 | LL | use ::{crate}; | |
| 17 | | ^^^^^ | |
| 18 | ||
| 19 | error: crate root imports need to be explicitly named: `use crate as name;` | |
| 20 | --> $DIR/use-path-segment-kw.rs:110:21 | |
| 21 | | | |
| 22 | LL | use foobar::crate; | |
| 23 | | ^^^^^ | |
| 24 | ||
| 25 | error: crate root imports need to be explicitly named: `use crate as name;` | |
| 26 | --> $DIR/use-path-segment-kw.rs:113:22 | |
| 27 | | | |
| 28 | LL | use foobar::{crate}; | |
| 29 | | ^^^^^ | |
| 30 | ||
| 31 | error: crate root imports need to be explicitly named: `use crate as name;` | |
| 32 | --> $DIR/use-path-segment-kw.rs:118:20 | |
| 33 | | | |
| 34 | LL | use crate::crate; | |
| 35 | | ^^^^^ | |
| 36 | ||
| 37 | error: crate root imports need to be explicitly named: `use crate as name;` | |
| 38 | --> $DIR/use-path-segment-kw.rs:121:21 | |
| 39 | | | |
| 40 | LL | use crate::{crate}; | |
| 41 | | ^^^^^ | |
| 42 | ||
| 43 | error: crate root imports need to be explicitly named: `use crate as name;` | |
| 44 | --> $DIR/use-path-segment-kw.rs:126:20 | |
| 45 | | | |
| 46 | LL | use super::crate; | |
| 47 | | ^^^^^ | |
| 48 | ||
| 49 | error: crate root imports need to be explicitly named: `use crate as name;` | |
| 50 | --> $DIR/use-path-segment-kw.rs:129:21 | |
| 51 | | | |
| 52 | LL | use super::{crate}; | |
| 53 | | ^^^^^ | |
| 54 | ||
| 55 | error: crate root imports need to be explicitly named: `use crate as name;` | |
| 56 | --> $DIR/use-path-segment-kw.rs:134:19 | |
| 57 | | | |
| 58 | LL | use self::crate; | |
| 59 | | ^^^^^ | |
| 60 | ||
| 61 | error: crate root imports need to be explicitly named: `use crate as name;` | |
| 62 | --> $DIR/use-path-segment-kw.rs:137:20 | |
| 63 | | | |
| 64 | LL | use self::{crate}; | |
| 65 | | ^^^^^ | |
| 66 | ||
| 67 | error[E0429]: `self` imports are only allowed within a { } list | |
| 68 | --> $DIR/use-path-segment-kw.rs:184:13 | |
| 69 | | | |
| 70 | LL | use self; | |
| 71 | | ^^^^ | |
| 72 | ||
| 73 | error[E0429]: `self` imports are only allowed within a { } list | |
| 74 | --> $DIR/use-path-segment-kw.rs:185:17 | |
| 75 | | | |
| 76 | LL | pub use self as _self; | |
| 77 | | ^^^^ | |
| 78 | ||
| 79 | error[E0429]: `self` imports are only allowed within a { } list | |
| 80 | --> $DIR/use-path-segment-kw.rs:188:13 | |
| 81 | | | |
| 82 | LL | use ::self; | |
| 83 | | ^^^^^^ | |
| 84 | | | |
| 85 | help: consider importing the module directly | |
| 86 | | | |
| 87 | LL - use ::self; | |
| 88 | LL + use ; | |
| 89 | | | |
| 90 | help: alternatively, use the multi-path `use` syntax to import `self` | |
| 91 | | | |
| 92 | LL | use ::{self}; | |
| 93 | | + + | |
| 94 | ||
| 95 | error[E0429]: `self` imports are only allowed within a { } list | |
| 96 | --> $DIR/use-path-segment-kw.rs:190:13 | |
| 97 | | | |
| 98 | LL | use ::self as _self2; | |
| 99 | | ^^^^^^ | |
| 100 | | | |
| 101 | help: consider importing the module directly | |
| 102 | | | |
| 103 | LL - use ::self as _self2; | |
| 104 | LL + use as _self2; | |
| 105 | | | |
| 106 | help: alternatively, use the multi-path `use` syntax to import `self` | |
| 107 | | | |
| 108 | LL | use ::{self as _self2}; | |
| 109 | | + + | |
| 110 | ||
| 111 | error[E0431]: `self` import can only appear in an import list with a non-empty prefix | |
| 112 | --> $DIR/use-path-segment-kw.rs:192:16 | |
| 113 | | | |
| 114 | LL | use ::{self}; | |
| 115 | | ^^^^ can only appear in an import list with a non-empty prefix | |
| 116 | ||
| 117 | error[E0431]: `self` import can only appear in an import list with a non-empty prefix | |
| 118 | --> $DIR/use-path-segment-kw.rs:193:16 | |
| 119 | | | |
| 120 | LL | use ::{self as _nested_self2}; | |
| 121 | | ^^^^^^^^^^^^^^^^^^^^^ can only appear in an import list with a non-empty prefix | |
| 122 | ||
| 123 | error[E0429]: `self` imports are only allowed within a { } list | |
| 124 | --> $DIR/use-path-segment-kw.rs:196:28 | |
| 125 | | | |
| 126 | LL | pub use foobar::qux::self; | |
| 127 | | ^^^^^^ | |
| 128 | | | |
| 129 | help: consider importing the module directly | |
| 130 | | | |
| 131 | LL - pub use foobar::qux::self; | |
| 132 | LL + pub use foobar::qux; | |
| 133 | | | |
| 134 | help: alternatively, use the multi-path `use` syntax to import `self` | |
| 135 | | | |
| 136 | LL | pub use foobar::qux::{self}; | |
| 137 | | + + | |
| 138 | ||
| 139 | error[E0429]: `self` imports are only allowed within a { } list | |
| 140 | --> $DIR/use-path-segment-kw.rs:197:23 | |
| 141 | | | |
| 142 | LL | pub use foobar::self as _self3; | |
| 143 | | ^^^^^^ | |
| 144 | | | |
| 145 | help: consider importing the module directly | |
| 146 | | | |
| 147 | LL - pub use foobar::self as _self3; | |
| 148 | LL + pub use foobar as _self3; | |
| 149 | | | |
| 150 | help: alternatively, use the multi-path `use` syntax to import `self` | |
| 151 | | | |
| 152 | LL | pub use foobar::{self as _self3}; | |
| 153 | | + + | |
| 154 | ||
| 155 | error[E0429]: `self` imports are only allowed within a { } list | |
| 156 | --> $DIR/use-path-segment-kw.rs:202:18 | |
| 157 | | | |
| 158 | LL | use crate::self; | |
| 159 | | ^^^^^^ | |
| 160 | | | |
| 161 | help: consider importing the module directly | |
| 162 | | | |
| 163 | LL - use crate::self; | |
| 164 | LL + use crate; | |
| 165 | | | |
| 166 | help: alternatively, use the multi-path `use` syntax to import `self` | |
| 167 | | | |
| 168 | LL | use crate::{self}; | |
| 169 | | + + | |
| 170 | ||
| 171 | error: crate root imports need to be explicitly named: `use crate as name;` | |
| 172 | --> $DIR/use-path-segment-kw.rs:202:13 | |
| 173 | | | |
| 174 | LL | use crate::self; | |
| 175 | | ^^^^^ | |
| 176 | ||
| 177 | error[E0429]: `self` imports are only allowed within a { } list | |
| 178 | --> $DIR/use-path-segment-kw.rs:205:22 | |
| 179 | | | |
| 180 | LL | pub use crate::self as _self4; | |
| 181 | | ^^^^^^ | |
| 182 | | | |
| 183 | help: consider importing the module directly | |
| 184 | | | |
| 185 | LL - pub use crate::self as _self4; | |
| 186 | LL + pub use crate as _self4; | |
| 187 | | | |
| 188 | help: alternatively, use the multi-path `use` syntax to import `self` | |
| 189 | | | |
| 190 | LL | pub use crate::{self as _self4}; | |
| 191 | | + + | |
| 192 | ||
| 193 | error: crate root imports need to be explicitly named: `use crate as name;` | |
| 194 | --> $DIR/use-path-segment-kw.rs:206:21 | |
| 195 | | | |
| 196 | LL | use crate::{self}; | |
| 197 | | ^^^^ | |
| 198 | ||
| 199 | error[E0429]: `self` imports are only allowed within a { } list | |
| 200 | --> $DIR/use-path-segment-kw.rs:211:18 | |
| 201 | | | |
| 202 | LL | use super::self; | |
| 203 | | ^^^^^^ | |
| 204 | | | |
| 205 | help: consider importing the module directly | |
| 206 | | | |
| 207 | LL - use super::self; | |
| 208 | LL + use super; | |
| 209 | | | |
| 210 | help: alternatively, use the multi-path `use` syntax to import `self` | |
| 211 | | | |
| 212 | LL | use super::{self}; | |
| 213 | | + + | |
| 214 | ||
| 215 | error[E0429]: `self` imports are only allowed within a { } list | |
| 216 | --> $DIR/use-path-segment-kw.rs:213:22 | |
| 217 | | | |
| 218 | LL | pub use super::self as _self5; | |
| 219 | | ^^^^^^ | |
| 220 | | | |
| 221 | help: consider importing the module directly | |
| 222 | | | |
| 223 | LL - pub use super::self as _self5; | |
| 224 | LL + pub use super as _self5; | |
| 225 | | | |
| 226 | help: alternatively, use the multi-path `use` syntax to import `self` | |
| 227 | | | |
| 228 | LL | pub use super::{self as _self5}; | |
| 229 | | + + | |
| 230 | ||
| 231 | error[E0429]: `self` imports are only allowed within a { } list | |
| 232 | --> $DIR/use-path-segment-kw.rs:219:17 | |
| 233 | | | |
| 234 | LL | use self::self; | |
| 235 | | ^^^^^^ | |
| 236 | | | |
| 237 | help: consider importing the module directly | |
| 238 | | | |
| 239 | LL - use self::self; | |
| 240 | LL + use self; | |
| 241 | | | |
| 242 | help: alternatively, use the multi-path `use` syntax to import `self` | |
| 243 | | | |
| 244 | LL | use self::{self}; | |
| 245 | | + + | |
| 246 | ||
| 247 | error[E0429]: `self` imports are only allowed within a { } list | |
| 248 | --> $DIR/use-path-segment-kw.rs:220:21 | |
| 249 | | | |
| 250 | LL | pub use self::self as _self6; | |
| 251 | | ^^^^^^ | |
| 252 | | | |
| 253 | help: consider importing the module directly | |
| 254 | | | |
| 255 | LL - pub use self::self as _self6; | |
| 256 | LL + pub use self as _self6; | |
| 257 | | | |
| 258 | help: alternatively, use the multi-path `use` syntax to import `self` | |
| 259 | | | |
| 260 | LL | pub use self::{self as _self6}; | |
| 261 | | + + | |
| 262 | ||
| 263 | error[E0252]: the name `crate` is defined multiple times | |
| 264 | --> $DIR/use-path-segment-kw.rs:134:13 | |
| 265 | | | |
| 266 | LL | use crate; | |
| 267 | | ----- previous import of the module `crate` here | |
| 268 | ... | |
| 269 | LL | use self::crate; | |
| 270 | | ^^^^^^^^^^^ `crate` reimported here | |
| 271 | | | |
| 272 | = note: `crate` must be defined only once in the type namespace of this module | |
| 273 | ||
| 274 | error[E0252]: the name `crate` is defined multiple times | |
| 275 | --> $DIR/use-path-segment-kw.rs:137:20 | |
| 276 | | | |
| 277 | LL | use crate; | |
| 278 | | ----- previous import of the module `crate` here | |
| 279 | ... | |
| 280 | LL | use self::{crate}; | |
| 281 | | -----------^^^^^-- | |
| 282 | | | | | |
| 283 | | | `crate` reimported here | |
| 284 | | help: remove unnecessary import | |
| 285 | | | |
| 286 | = note: `crate` must be defined only once in the type namespace of this module | |
| 287 | ||
| 288 | error[E0252]: the name `crate` is defined multiple times | |
| 289 | --> $DIR/use-path-segment-kw.rs:202:13 | |
| 290 | | | |
| 291 | LL | use crate; | |
| 292 | | ----- previous import of the module `crate` here | |
| 293 | ... | |
| 294 | LL | use crate::self; | |
| 295 | | ^^^^^^^^^^^ `crate` reimported here | |
| 296 | | | |
| 297 | = note: `crate` must be defined only once in the type namespace of this module | |
| 298 | ||
| 299 | error[E0252]: the name `crate` is defined multiple times | |
| 300 | --> $DIR/use-path-segment-kw.rs:206:21 | |
| 301 | | | |
| 302 | LL | use crate; | |
| 303 | | ----- previous import of the module `crate` here | |
| 304 | ... | |
| 305 | LL | use crate::{self}; | |
| 306 | | ------------^^^^-- | |
| 307 | | | | | |
| 308 | | | `crate` reimported here | |
| 309 | | help: remove unnecessary import | |
| 310 | | | |
| 311 | = note: `crate` must be defined only once in the type namespace of this module | |
| 312 | ||
| 313 | error: `$crate` may not be imported | |
| 314 | --> $DIR/use-path-segment-kw.rs:9:9 | |
| 315 | | | |
| 316 | LL | use $crate; | |
| 317 | | ^^^^^^^^^^^ | |
| 318 | ... | |
| 319 | LL | macro_dollar_crate!(); | |
| 320 | | --------------------- in this macro invocation | |
| 321 | | | |
| 322 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 323 | ||
| 324 | error: `$crate` may not be imported | |
| 325 | --> $DIR/use-path-segment-kw.rs:10:9 | |
| 326 | | | |
| 327 | LL | pub use $crate as _dollar_crate; | |
| 328 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 329 | ... | |
| 330 | LL | macro_dollar_crate!(); | |
| 331 | | --------------------- in this macro invocation | |
| 332 | | | |
| 333 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 334 | ||
| 335 | error: crate root imports need to be explicitly named: `use crate as name;` | |
| 336 | --> $DIR/use-path-segment-kw.rs:49:21 | |
| 337 | | | |
| 338 | LL | use $crate::crate; | |
| 339 | | ^^^^^ | |
| 340 | ... | |
| 341 | LL | macro_dollar_crate!(); | |
| 342 | | --------------------- in this macro invocation | |
| 343 | | | |
| 344 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 345 | ||
| 346 | error: crate root imports need to be explicitly named: `use crate as name;` | |
| 347 | --> $DIR/use-path-segment-kw.rs:52:22 | |
| 348 | | | |
| 349 | LL | use $crate::{crate}; | |
| 350 | | ^^^^^ | |
| 351 | ... | |
| 352 | LL | macro_dollar_crate!(); | |
| 353 | | --------------------- in this macro invocation | |
| 354 | | | |
| 355 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 356 | ||
| 357 | error[E0429]: `self` imports are only allowed within a { } list | |
| 358 | --> $DIR/use-path-segment-kw.rs:63:19 | |
| 359 | | | |
| 360 | LL | use $crate::self; | |
| 361 | | ^^^^^^ | |
| 362 | ... | |
| 363 | LL | macro_dollar_crate!(); | |
| 364 | | --------------------- in this macro invocation | |
| 365 | | | |
| 366 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 367 | help: consider importing the module directly | |
| 368 | | | |
| 369 | LL - use $crate::self; | |
| 370 | LL + use $crate; | |
| 371 | | | |
| 372 | help: alternatively, use the multi-path `use` syntax to import `self` | |
| 373 | | | |
| 374 | LL | use $crate::{self}; | |
| 375 | | + + | |
| 376 | ||
| 377 | error: `$crate` may not be imported | |
| 378 | --> $DIR/use-path-segment-kw.rs:63:9 | |
| 379 | | | |
| 380 | LL | use $crate::self; | |
| 381 | | ^^^^^^^^^^^^^^^^^ | |
| 382 | ... | |
| 383 | LL | macro_dollar_crate!(); | |
| 384 | | --------------------- in this macro invocation | |
| 385 | | | |
| 386 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 387 | ||
| 388 | error[E0429]: `self` imports are only allowed within a { } list | |
| 389 | --> $DIR/use-path-segment-kw.rs:66:23 | |
| 390 | | | |
| 391 | LL | pub use $crate::self as _m_self8; | |
| 392 | | ^^^^^^ | |
| 393 | ... | |
| 394 | LL | macro_dollar_crate!(); | |
| 395 | | --------------------- in this macro invocation | |
| 396 | | | |
| 397 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 398 | help: consider importing the module directly | |
| 399 | | | |
| 400 | LL - pub use $crate::self as _m_self8; | |
| 401 | LL + pub use $crate as _m_self8; | |
| 402 | | | |
| 403 | help: alternatively, use the multi-path `use` syntax to import `self` | |
| 404 | | | |
| 405 | LL | pub use $crate::{self as _m_self8}; | |
| 406 | | + + | |
| 407 | ||
| 408 | error: `$crate` may not be imported | |
| 409 | --> $DIR/use-path-segment-kw.rs:66:9 | |
| 410 | | | |
| 411 | LL | pub use $crate::self as _m_self8; | |
| 412 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 413 | ... | |
| 414 | LL | macro_dollar_crate!(); | |
| 415 | | --------------------- in this macro invocation | |
| 416 | | | |
| 417 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 418 | ||
| 419 | error[E0252]: the name `<!dummy!>` is defined multiple times | |
| 420 | --> $DIR/use-path-segment-kw.rs:63:13 | |
| 421 | | | |
| 422 | LL | use $crate; | |
| 423 | | ------ previous import of the module `<!dummy!>` here | |
| 424 | ... | |
| 425 | LL | use $crate::self; | |
| 426 | | ^^^^^^^^^^^^ `<!dummy!>` reimported here | |
| 427 | ... | |
| 428 | LL | macro_dollar_crate!(); | |
| 429 | | --------------------- in this macro invocation | |
| 430 | | | |
| 431 | = note: `<!dummy!>` must be defined only once in the type namespace of this module | |
| 432 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 433 | ||
| 434 | error[E0252]: the name `$crate` is defined multiple times | |
| 435 | --> $DIR/use-path-segment-kw.rs:68:22 | |
| 436 | | | |
| 437 | LL | use self::$crate; | |
| 438 | | ------------ previous import of the module `$crate` here | |
| 439 | ... | |
| 440 | LL | use $crate::{self}; | |
| 441 | | -------------^^^^-- | |
| 442 | | | | | |
| 443 | | | `$crate` reimported here | |
| 444 | | help: remove unnecessary import | |
| 445 | ... | |
| 446 | LL | macro_dollar_crate!(); | |
| 447 | | --------------------- in this macro invocation | |
| 448 | | | |
| 449 | = note: `$crate` must be defined only once in the type namespace of this module | |
| 450 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 451 | ||
| 452 | error[E0432]: unresolved import `crate` | |
| 453 | --> $DIR/use-path-segment-kw.rs:102:13 | |
| 454 | | | |
| 455 | LL | use ::crate; | |
| 456 | | ^^^^^^^ no `crate` in the root | |
| 457 | ||
| 458 | error[E0432]: unresolved import `crate` | |
| 459 | --> $DIR/use-path-segment-kw.rs:104:13 | |
| 460 | | | |
| 461 | LL | use ::crate as _crate2; | |
| 462 | | ^^^^^^^^^^^^^^^^^^ no `crate` in the root | |
| 463 | ||
| 464 | error[E0432]: unresolved import `crate` | |
| 465 | --> $DIR/use-path-segment-kw.rs:105:16 | |
| 466 | | | |
| 467 | LL | use ::{crate}; | |
| 468 | | ^^^^^ no `crate` in the root | |
| 469 | ||
| 470 | error[E0432]: unresolved import `crate` | |
| 471 | --> $DIR/use-path-segment-kw.rs:107:16 | |
| 472 | | | |
| 473 | LL | use ::{crate as _nested_crate2}; | |
| 474 | | ^^^^^^^^^^^^^^^^^^^^^^^ no `crate` in the root | |
| 475 | ||
| 476 | error[E0432]: unresolved import `foobar::crate` | |
| 477 | --> $DIR/use-path-segment-kw.rs:110:13 | |
| 478 | | | |
| 479 | LL | use foobar::crate; | |
| 480 | | ^^^^^^^^^^^^^ no `crate` in `foo::bar::foobar` | |
| 481 | ||
| 482 | error[E0432]: unresolved import `foobar::crate` | |
| 483 | --> $DIR/use-path-segment-kw.rs:112:13 | |
| 484 | | | |
| 485 | LL | use foobar::crate as _crate3; | |
| 486 | | ^^^^^^^^^^^^^^^^^^^^^^^^ no `crate` in `foo::bar::foobar` | |
| 487 | ||
| 488 | error[E0432]: unresolved import `foobar::crate` | |
| 489 | --> $DIR/use-path-segment-kw.rs:113:22 | |
| 490 | | | |
| 491 | LL | use foobar::{crate}; | |
| 492 | | ^^^^^ no `crate` in `foo::bar::foobar` | |
| 493 | ||
| 494 | error[E0432]: unresolved import `foobar::crate` | |
| 495 | --> $DIR/use-path-segment-kw.rs:115:22 | |
| 496 | | | |
| 497 | LL | use foobar::{crate as _nested_crate3}; | |
| 498 | | ^^^^^^^^^^^^^^^^^^^^^^^ no `crate` in `foo::bar::foobar` | |
| 499 | ||
| 500 | error[E0432]: unresolved import `crate::crate` | |
| 501 | --> $DIR/use-path-segment-kw.rs:118:13 | |
| 502 | | | |
| 503 | LL | use crate::crate; | |
| 504 | | ^^^^^^^^^^^^ no `crate` in the root | |
| 505 | ||
| 506 | error[E0432]: unresolved import `crate::crate` | |
| 507 | --> $DIR/use-path-segment-kw.rs:120:13 | |
| 508 | | | |
| 509 | LL | use crate::crate as _crate4; | |
| 510 | | ^^^^^^^^^^^^^^^^^^^^^^^ no `crate` in the root | |
| 511 | ||
| 512 | error[E0432]: unresolved import `crate::crate` | |
| 513 | --> $DIR/use-path-segment-kw.rs:121:21 | |
| 514 | | | |
| 515 | LL | use crate::{crate}; | |
| 516 | | ^^^^^ no `crate` in the root | |
| 517 | ||
| 518 | error[E0432]: unresolved import `crate::crate` | |
| 519 | --> $DIR/use-path-segment-kw.rs:123:21 | |
| 520 | | | |
| 521 | LL | use crate::{crate as _nested_crate4}; | |
| 522 | | ^^^^^^^^^^^^^^^^^^^^^^^ no `crate` in the root | |
| 523 | ||
| 524 | error[E0432]: unresolved import `super::crate` | |
| 525 | --> $DIR/use-path-segment-kw.rs:126:13 | |
| 526 | | | |
| 527 | LL | use super::crate; | |
| 528 | | ^^^^^^^^^^^^ no `crate` in `foo` | |
| 529 | ||
| 530 | error[E0432]: unresolved import `super::crate` | |
| 531 | --> $DIR/use-path-segment-kw.rs:128:13 | |
| 532 | | | |
| 533 | LL | use super::crate as _crate5; | |
| 534 | | ^^^^^^^^^^^^^^^^^^^^^^^ no `crate` in `foo` | |
| 535 | ||
| 536 | error[E0432]: unresolved import `super::crate` | |
| 537 | --> $DIR/use-path-segment-kw.rs:129:21 | |
| 538 | | | |
| 539 | LL | use super::{crate}; | |
| 540 | | ^^^^^ no `crate` in `foo` | |
| 541 | ||
| 542 | error[E0432]: unresolved import `super::crate` | |
| 543 | --> $DIR/use-path-segment-kw.rs:131:21 | |
| 544 | | | |
| 545 | LL | use super::{crate as _nested_crate5}; | |
| 546 | | ^^^^^^^^^^^^^^^^^^^^^^^ no `crate` in `foo` | |
| 547 | ||
| 548 | error[E0432]: unresolved import `super` | |
| 549 | --> $DIR/use-path-segment-kw.rs:143:13 | |
| 550 | | | |
| 551 | LL | use super::{}; | |
| 552 | | ^^^^^^^^^ no `super` in the root | |
| 553 | ||
| 554 | error[E0432]: unresolved import `super` | |
| 555 | --> $DIR/use-path-segment-kw.rs:146:13 | |
| 556 | | | |
| 557 | LL | use super; | |
| 558 | | ^^^^^ no `super` in the root | |
| 559 | ||
| 560 | error[E0432]: unresolved import `super` | |
| 561 | --> $DIR/use-path-segment-kw.rs:147:17 | |
| 562 | | | |
| 563 | LL | pub use super as _super; | |
| 564 | | ^^^^^^^^^^^^^^^ no `super` in the root | |
| 565 | ||
| 566 | error[E0432]: unresolved import `super` | |
| 567 | --> $DIR/use-path-segment-kw.rs:150:13 | |
| 568 | | | |
| 569 | LL | use ::super; | |
| 570 | | ^^^^^^^ no `super` in the root | |
| 571 | ||
| 572 | error[E0432]: unresolved import `super` | |
| 573 | --> $DIR/use-path-segment-kw.rs:151:13 | |
| 574 | | | |
| 575 | LL | use ::super as _super2; | |
| 576 | | ^^^^^^^^^^^^^^^^^^ no `super` in the root | |
| 577 | ||
| 578 | error[E0432]: unresolved import `super` | |
| 579 | --> $DIR/use-path-segment-kw.rs:152:16 | |
| 580 | | | |
| 581 | LL | use ::{super}; | |
| 582 | | ^^^^^ no `super` in the root | |
| 583 | ||
| 584 | error[E0432]: unresolved import `super` | |
| 585 | --> $DIR/use-path-segment-kw.rs:153:16 | |
| 586 | | | |
| 587 | LL | use ::{super as _nested_super2}; | |
| 588 | | ^^^^^^^^^^^^^^^^^^^^^^^ no `super` in the root | |
| 589 | ||
| 590 | error[E0432]: unresolved import `foobar::super` | |
| 591 | --> $DIR/use-path-segment-kw.rs:156:13 | |
| 592 | | | |
| 593 | LL | use foobar::super; | |
| 594 | | ^^^^^^^^^^^^^ no `super` in `foo::bar::foobar` | |
| 595 | ||
| 596 | error[E0432]: unresolved import `foobar::super` | |
| 597 | --> $DIR/use-path-segment-kw.rs:157:13 | |
| 598 | | | |
| 599 | LL | use foobar::super as _super3; | |
| 600 | | ^^^^^^^^^^^^^^^^^^^^^^^^ no `super` in `foo::bar::foobar` | |
| 601 | ||
| 602 | error[E0432]: unresolved import `foobar::super` | |
| 603 | --> $DIR/use-path-segment-kw.rs:158:22 | |
| 604 | | | |
| 605 | LL | use foobar::{super}; | |
| 606 | | ^^^^^ no `super` in `foo::bar::foobar` | |
| 607 | ||
| 608 | error[E0432]: unresolved import `foobar::super` | |
| 609 | --> $DIR/use-path-segment-kw.rs:159:22 | |
| 610 | | | |
| 611 | LL | use foobar::{super as _nested_super3}; | |
| 612 | | ^^^^^^^^^^^^^^^^^^^^^^^ no `super` in `foo::bar::foobar` | |
| 613 | ||
| 614 | error[E0432]: unresolved import `crate::super` | |
| 615 | --> $DIR/use-path-segment-kw.rs:162:13 | |
| 616 | | | |
| 617 | LL | use crate::super; | |
| 618 | | ^^^^^^^^^^^^ no `super` in the root | |
| 619 | ||
| 620 | error[E0432]: unresolved import `crate::super` | |
| 621 | --> $DIR/use-path-segment-kw.rs:163:13 | |
| 622 | | | |
| 623 | LL | use crate::super as _super4; | |
| 624 | | ^^^^^^^^^^^^^^^^^^^^^^^ no `super` in the root | |
| 625 | ||
| 626 | error[E0432]: unresolved import `crate::super` | |
| 627 | --> $DIR/use-path-segment-kw.rs:164:21 | |
| 628 | | | |
| 629 | LL | use crate::{super}; | |
| 630 | | ^^^^^ no `super` in the root | |
| 631 | ||
| 632 | error[E0432]: unresolved import `crate::super` | |
| 633 | --> $DIR/use-path-segment-kw.rs:165:21 | |
| 634 | | | |
| 635 | LL | use crate::{super as _nested_super4}; | |
| 636 | | ^^^^^^^^^^^^^^^^^^^^^^^ no `super` in the root | |
| 637 | ||
| 638 | error[E0432]: unresolved import `super::super` | |
| 639 | --> $DIR/use-path-segment-kw.rs:168:13 | |
| 640 | | | |
| 641 | LL | use super::super; | |
| 642 | | ^^^^^^^^^^^^ no `super` in `foo` | |
| 643 | ||
| 644 | error[E0432]: unresolved import `super::super` | |
| 645 | --> $DIR/use-path-segment-kw.rs:169:17 | |
| 646 | | | |
| 647 | LL | pub use super::super as _super5; | |
| 648 | | ^^^^^^^^^^^^^^^^^^^^^^^ no `super` in `foo` | |
| 649 | ||
| 650 | error[E0432]: unresolved import `super::super` | |
| 651 | --> $DIR/use-path-segment-kw.rs:170:21 | |
| 652 | | | |
| 653 | LL | use super::{super}; | |
| 654 | | ^^^^^ no `super` in `foo` | |
| 655 | ||
| 656 | error[E0432]: unresolved import `super::super` | |
| 657 | --> $DIR/use-path-segment-kw.rs:171:25 | |
| 658 | | | |
| 659 | LL | pub use super::{super as _nested_super5}; | |
| 660 | | ^^^^^^^^^^^^^^^^^^^^^^^ no `super` in `foo` | |
| 661 | ||
| 662 | error[E0432]: unresolved import `self` | |
| 663 | --> $DIR/use-path-segment-kw.rs:181:13 | |
| 664 | | | |
| 665 | LL | use self::{}; | |
| 666 | | ^^^^^^^^ no `self` in the root | |
| 667 | ||
| 668 | error[E0432]: unresolved import `{{root}}` | |
| 669 | --> $DIR/use-path-segment-kw.rs:188:13 | |
| 670 | | | |
| 671 | LL | use ::self; | |
| 672 | | ^^^^^^ no `{{root}}` in the root | |
| 673 | ||
| 674 | error[E0432]: unresolved import `{{root}}` | |
| 675 | --> $DIR/use-path-segment-kw.rs:190:13 | |
| 676 | | | |
| 677 | LL | use ::self as _self2; | |
| 678 | | ^^^^^^^^^^^^^^^^ no `{{root}}` in the root | |
| 679 | ||
| 680 | error[E0432]: unresolved import `super` | |
| 681 | --> $DIR/use-path-segment-kw.rs:211:13 | |
| 682 | | | |
| 683 | LL | use super::self; | |
| 684 | | ^^^^^^^^^^^ no `super` in the root | |
| 685 | ||
| 686 | error[E0432]: unresolved import `super` | |
| 687 | --> $DIR/use-path-segment-kw.rs:213:17 | |
| 688 | | | |
| 689 | LL | pub use super::self as _self5; | |
| 690 | | ^^^^^^^^^^^^^^^^^^^^^ no `super` in the root | |
| 691 | ||
| 692 | error[E0432]: unresolved import `super` | |
| 693 | --> $DIR/use-path-segment-kw.rs:215:21 | |
| 694 | | | |
| 695 | LL | use super::{self}; | |
| 696 | | ^^^^ no `super` in the root | |
| 697 | ||
| 698 | error[E0432]: unresolved import `super` | |
| 699 | --> $DIR/use-path-segment-kw.rs:216:25 | |
| 700 | | | |
| 701 | LL | pub use super::{self as _nested_self5}; | |
| 702 | | ^^^^^^^^^^^^^^^^^^^^^ no `super` in the root | |
| 703 | ||
| 704 | error[E0432]: unresolved import `self` | |
| 705 | --> $DIR/use-path-segment-kw.rs:221:20 | |
| 706 | | | |
| 707 | LL | use self::{self}; | |
| 708 | | ^^^^ no `self` in the root | |
| 709 | ||
| 710 | error[E0432]: unresolved import `self` | |
| 711 | --> $DIR/use-path-segment-kw.rs:222:24 | |
| 712 | | | |
| 713 | LL | pub use self::{self as _nested_self6}; | |
| 714 | | ^^^^^^^^^^^^^^^^^^^^^ no `self` in the root | |
| 715 | ||
| 716 | error[E0432]: unresolved import `$crate` | |
| 717 | --> $DIR/use-path-segment-kw.rs:13:13 | |
| 718 | | | |
| 719 | LL | use ::$crate; | |
| 720 | | ^^^^^^^^ no `$crate` in the root | |
| 721 | ... | |
| 722 | LL | macro_dollar_crate!(); | |
| 723 | | --------------------- in this macro invocation | |
| 724 | | | |
| 725 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 726 | ||
| 727 | error[E0432]: unresolved import `$crate` | |
| 728 | --> $DIR/use-path-segment-kw.rs:14:13 | |
| 729 | | | |
| 730 | LL | use ::$crate as _dollar_crate2; | |
| 731 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^ no `$crate` in the root | |
| 732 | ... | |
| 733 | LL | macro_dollar_crate!(); | |
| 734 | | --------------------- in this macro invocation | |
| 735 | | | |
| 736 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 737 | ||
| 738 | error[E0432]: unresolved import `$crate` | |
| 739 | --> $DIR/use-path-segment-kw.rs:15:16 | |
| 740 | | | |
| 741 | LL | use ::{$crate}; | |
| 742 | | ^^^^^^ no `$crate` in the root | |
| 743 | ... | |
| 744 | LL | macro_dollar_crate!(); | |
| 745 | | --------------------- in this macro invocation | |
| 746 | | | |
| 747 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 748 | ||
| 749 | error[E0432]: unresolved import `$crate` | |
| 750 | --> $DIR/use-path-segment-kw.rs:16:16 | |
| 751 | | | |
| 752 | LL | use ::{$crate as _nested_dollar_crate2}; | |
| 753 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `$crate` in the root | |
| 754 | ... | |
| 755 | LL | macro_dollar_crate!(); | |
| 756 | | --------------------- in this macro invocation | |
| 757 | | | |
| 758 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 759 | ||
| 760 | error[E0432]: unresolved import `foobar::$crate` | |
| 761 | --> $DIR/use-path-segment-kw.rs:19:13 | |
| 762 | | | |
| 763 | LL | use foobar::$crate; | |
| 764 | | ^^^^^^^^^^^^^^ no `$crate` in `foo::bar::foobar` | |
| 765 | ... | |
| 766 | LL | macro_dollar_crate!(); | |
| 767 | | --------------------- in this macro invocation | |
| 768 | | | |
| 769 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 770 | ||
| 771 | error[E0432]: unresolved import `foobar::$crate` | |
| 772 | --> $DIR/use-path-segment-kw.rs:20:13 | |
| 773 | | | |
| 774 | LL | use foobar::$crate as _dollar_crate3; | |
| 775 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `$crate` in `foo::bar::foobar` | |
| 776 | ... | |
| 777 | LL | macro_dollar_crate!(); | |
| 778 | | --------------------- in this macro invocation | |
| 779 | | | |
| 780 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 781 | ||
| 782 | error[E0432]: unresolved import `foobar::$crate` | |
| 783 | --> $DIR/use-path-segment-kw.rs:21:22 | |
| 784 | | | |
| 785 | LL | use foobar::{$crate}; | |
| 786 | | ^^^^^^ no `$crate` in `foo::bar::foobar` | |
| 787 | ... | |
| 788 | LL | macro_dollar_crate!(); | |
| 789 | | --------------------- in this macro invocation | |
| 790 | | | |
| 791 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 792 | ||
| 793 | error[E0432]: unresolved import `foobar::$crate` | |
| 794 | --> $DIR/use-path-segment-kw.rs:22:22 | |
| 795 | | | |
| 796 | LL | use foobar::{$crate as _nested_dollar_crate3}; | |
| 797 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `$crate` in `foo::bar::foobar` | |
| 798 | ... | |
| 799 | LL | macro_dollar_crate!(); | |
| 800 | | --------------------- in this macro invocation | |
| 801 | | | |
| 802 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 803 | ||
| 804 | error[E0432]: unresolved import `crate::$crate` | |
| 805 | --> $DIR/use-path-segment-kw.rs:25:13 | |
| 806 | | | |
| 807 | LL | use crate::$crate; | |
| 808 | | ^^^^^^^^^^^^^ no `$crate` in the root | |
| 809 | ... | |
| 810 | LL | macro_dollar_crate!(); | |
| 811 | | --------------------- in this macro invocation | |
| 812 | | | |
| 813 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 814 | ||
| 815 | error[E0432]: unresolved import `crate::$crate` | |
| 816 | --> $DIR/use-path-segment-kw.rs:26:13 | |
| 817 | | | |
| 818 | LL | use crate::$crate as _dollar_crate4; | |
| 819 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `$crate` in the root | |
| 820 | ... | |
| 821 | LL | macro_dollar_crate!(); | |
| 822 | | --------------------- in this macro invocation | |
| 823 | | | |
| 824 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 825 | ||
| 826 | error[E0432]: unresolved import `crate::$crate` | |
| 827 | --> $DIR/use-path-segment-kw.rs:27:21 | |
| 828 | | | |
| 829 | LL | use crate::{$crate}; | |
| 830 | | ^^^^^^ no `$crate` in the root | |
| 831 | ... | |
| 832 | LL | macro_dollar_crate!(); | |
| 833 | | --------------------- in this macro invocation | |
| 834 | | | |
| 835 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 836 | ||
| 837 | error[E0432]: unresolved import `crate::$crate` | |
| 838 | --> $DIR/use-path-segment-kw.rs:28:21 | |
| 839 | | | |
| 840 | LL | use crate::{$crate as _nested_dollar_crate4}; | |
| 841 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `$crate` in the root | |
| 842 | ... | |
| 843 | LL | macro_dollar_crate!(); | |
| 844 | | --------------------- in this macro invocation | |
| 845 | | | |
| 846 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 847 | ||
| 848 | error[E0432]: unresolved import `super::$crate` | |
| 849 | --> $DIR/use-path-segment-kw.rs:31:13 | |
| 850 | | | |
| 851 | LL | use super::$crate; | |
| 852 | | ^^^^^^^^^^^^^ no `$crate` in `foo` | |
| 853 | ... | |
| 854 | LL | macro_dollar_crate!(); | |
| 855 | | --------------------- in this macro invocation | |
| 856 | | | |
| 857 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 858 | ||
| 859 | error[E0432]: unresolved import `super::$crate` | |
| 860 | --> $DIR/use-path-segment-kw.rs:32:13 | |
| 861 | | | |
| 862 | LL | use super::$crate as _dollar_crate5; | |
| 863 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `$crate` in `foo` | |
| 864 | ... | |
| 865 | LL | macro_dollar_crate!(); | |
| 866 | | --------------------- in this macro invocation | |
| 867 | | | |
| 868 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 869 | ||
| 870 | error[E0432]: unresolved import `super::$crate` | |
| 871 | --> $DIR/use-path-segment-kw.rs:33:21 | |
| 872 | | | |
| 873 | LL | use super::{$crate}; | |
| 874 | | ^^^^^^ no `$crate` in `foo` | |
| 875 | ... | |
| 876 | LL | macro_dollar_crate!(); | |
| 877 | | --------------------- in this macro invocation | |
| 878 | | | |
| 879 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 880 | ||
| 881 | error[E0432]: unresolved import `super::$crate` | |
| 882 | --> $DIR/use-path-segment-kw.rs:34:21 | |
| 883 | | | |
| 884 | LL | use super::{$crate as _nested_dollar_crate5}; | |
| 885 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `$crate` in `foo` | |
| 886 | ... | |
| 887 | LL | macro_dollar_crate!(); | |
| 888 | | --------------------- in this macro invocation | |
| 889 | | | |
| 890 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 891 | ||
| 892 | error[E0432]: unresolved import `$crate::$crate` | |
| 893 | --> $DIR/use-path-segment-kw.rs:43:13 | |
| 894 | | | |
| 895 | LL | use $crate::$crate; | |
| 896 | | ^^^^^^^^^^^^^^ no `$crate` in the root | |
| 897 | ... | |
| 898 | LL | macro_dollar_crate!(); | |
| 899 | | --------------------- in this macro invocation | |
| 900 | | | |
| 901 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 902 | ||
| 903 | error[E0432]: unresolved import `$crate::$crate` | |
| 904 | --> $DIR/use-path-segment-kw.rs:44:13 | |
| 905 | | | |
| 906 | LL | use $crate::$crate as _dollar_crate7; | |
| 907 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `$crate` in the root | |
| 908 | ... | |
| 909 | LL | macro_dollar_crate!(); | |
| 910 | | --------------------- in this macro invocation | |
| 911 | | | |
| 912 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 913 | ||
| 914 | error[E0432]: unresolved import `$crate::$crate` | |
| 915 | --> $DIR/use-path-segment-kw.rs:45:22 | |
| 916 | | | |
| 917 | LL | use $crate::{$crate}; | |
| 918 | | ^^^^^^ no `$crate` in the root | |
| 919 | ... | |
| 920 | LL | macro_dollar_crate!(); | |
| 921 | | --------------------- in this macro invocation | |
| 922 | | | |
| 923 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 924 | ||
| 925 | error[E0432]: unresolved import `$crate::$crate` | |
| 926 | --> $DIR/use-path-segment-kw.rs:46:22 | |
| 927 | | | |
| 928 | LL | use $crate::{$crate as _nested_dollar_crate7}; | |
| 929 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `$crate` in the root | |
| 930 | ... | |
| 931 | LL | macro_dollar_crate!(); | |
| 932 | | --------------------- in this macro invocation | |
| 933 | | | |
| 934 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 935 | ||
| 936 | error[E0432]: unresolved import `$crate::crate` | |
| 937 | --> $DIR/use-path-segment-kw.rs:49:13 | |
| 938 | | | |
| 939 | LL | use $crate::crate; | |
| 940 | | ^^^^^^^^^^^^^ no `crate` in the root | |
| 941 | ... | |
| 942 | LL | macro_dollar_crate!(); | |
| 943 | | --------------------- in this macro invocation | |
| 944 | | | |
| 945 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 946 | ||
| 947 | error[E0432]: unresolved import `$crate::crate` | |
| 948 | --> $DIR/use-path-segment-kw.rs:51:13 | |
| 949 | | | |
| 950 | LL | use $crate::crate as _m_crate8; | |
| 951 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^ no `crate` in the root | |
| 952 | ... | |
| 953 | LL | macro_dollar_crate!(); | |
| 954 | | --------------------- in this macro invocation | |
| 955 | | | |
| 956 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 957 | ||
| 958 | error[E0432]: unresolved import `$crate::crate` | |
| 959 | --> $DIR/use-path-segment-kw.rs:52:22 | |
| 960 | | | |
| 961 | LL | use $crate::{crate}; | |
| 962 | | ^^^^^ no `crate` in the root | |
| 963 | ... | |
| 964 | LL | macro_dollar_crate!(); | |
| 965 | | --------------------- in this macro invocation | |
| 966 | | | |
| 967 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 968 | ||
| 969 | error[E0432]: unresolved import `$crate::crate` | |
| 970 | --> $DIR/use-path-segment-kw.rs:54:22 | |
| 971 | | | |
| 972 | LL | use $crate::{crate as _m_nested_crate8}; | |
| 973 | | ^^^^^^^^^^^^^^^^^^^^^^^^^ no `crate` in the root | |
| 974 | ... | |
| 975 | LL | macro_dollar_crate!(); | |
| 976 | | --------------------- in this macro invocation | |
| 977 | | | |
| 978 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 979 | ||
| 980 | error[E0432]: unresolved import `$crate::super` | |
| 981 | --> $DIR/use-path-segment-kw.rs:57:13 | |
| 982 | | | |
| 983 | LL | use $crate::super; | |
| 984 | | ^^^^^^^^^^^^^ no `super` in the root | |
| 985 | ... | |
| 986 | LL | macro_dollar_crate!(); | |
| 987 | | --------------------- in this macro invocation | |
| 988 | | | |
| 989 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 990 | ||
| 991 | error[E0432]: unresolved import `$crate::super` | |
| 992 | --> $DIR/use-path-segment-kw.rs:58:13 | |
| 993 | | | |
| 994 | LL | use $crate::super as _m_super8; | |
| 995 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^ no `super` in the root | |
| 996 | ... | |
| 997 | LL | macro_dollar_crate!(); | |
| 998 | | --------------------- in this macro invocation | |
| 999 | | | |
| 1000 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 1001 | ||
| 1002 | error[E0432]: unresolved import `$crate::super` | |
| 1003 | --> $DIR/use-path-segment-kw.rs:59:22 | |
| 1004 | | | |
| 1005 | LL | use $crate::{super}; | |
| 1006 | | ^^^^^ no `super` in the root | |
| 1007 | ... | |
| 1008 | LL | macro_dollar_crate!(); | |
| 1009 | | --------------------- in this macro invocation | |
| 1010 | | | |
| 1011 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 1012 | ||
| 1013 | error[E0432]: unresolved import `$crate::super` | |
| 1014 | --> $DIR/use-path-segment-kw.rs:60:22 | |
| 1015 | | | |
| 1016 | LL | use $crate::{super as _m_nested_super8}; | |
| 1017 | | ^^^^^^^^^^^^^^^^^^^^^^^^^ no `super` in the root | |
| 1018 | ... | |
| 1019 | LL | macro_dollar_crate!(); | |
| 1020 | | --------------------- in this macro invocation | |
| 1021 | | | |
| 1022 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 1023 | ||
| 1024 | error[E0573]: expected type, found module `$crate` | |
| 1025 | --> $DIR/use-path-segment-kw.rs:8:19 | |
| 1026 | | | |
| 1027 | LL | type A1 = $crate; | |
| 1028 | | ^^^^^^ not a type | |
| 1029 | ... | |
| 1030 | LL | macro_dollar_crate!(); | |
| 1031 | | --------------------- in this macro invocation | |
| 1032 | | | |
| 1033 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 1034 | ||
| 1035 | error[E0573]: expected type, found module `crate` | |
| 1036 | --> $DIR/use-path-segment-kw.rs:97:19 | |
| 1037 | | | |
| 1038 | LL | type B1 = crate; | |
| 1039 | | ^^^^^ not a type | |
| 1040 | ||
| 1041 | error[E0573]: expected type, found module `super` | |
| 1042 | --> $DIR/use-path-segment-kw.rs:145:19 | |
| 1043 | | | |
| 1044 | LL | type C1 = super; | |
| 1045 | | ^^^^^ not a type | |
| 1046 | ||
| 1047 | error[E0573]: expected type, found module `super::super` | |
| 1048 | --> $DIR/use-path-segment-kw.rs:167:19 | |
| 1049 | | | |
| 1050 | LL | type C5 = super::super; | |
| 1051 | | ^^^^^^^^^^^^ not a type | |
| 1052 | ||
| 1053 | error[E0573]: expected type, found module `self::super` | |
| 1054 | --> $DIR/use-path-segment-kw.rs:173:19 | |
| 1055 | | | |
| 1056 | LL | type C6 = self::super; | |
| 1057 | | ^^^^^^^^^^^ not a type | |
| 1058 | ||
| 1059 | error[E0573]: expected type, found module `self` | |
| 1060 | --> $DIR/use-path-segment-kw.rs:183:19 | |
| 1061 | | | |
| 1062 | LL | type D1 = self; | |
| 1063 | | ^^^^ not a type | |
| 1064 | ||
| 1065 | error[E0433]: failed to resolve: global paths cannot start with `$crate` | |
| 1066 | --> $DIR/use-path-segment-kw.rs:12:21 | |
| 1067 | | | |
| 1068 | LL | type A2 = ::$crate; | |
| 1069 | | ^^^^^^ global paths cannot start with `$crate` | |
| 1070 | ... | |
| 1071 | LL | macro_dollar_crate!(); | |
| 1072 | | --------------------- in this macro invocation | |
| 1073 | | | |
| 1074 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 1075 | ||
| 1076 | error[E0433]: failed to resolve: `$crate` in paths can only be used in start position | |
| 1077 | --> $DIR/use-path-segment-kw.rs:18:27 | |
| 1078 | | | |
| 1079 | LL | type A3 = foobar::$crate; | |
| 1080 | | ^^^^^^ `$crate` in paths can only be used in start position | |
| 1081 | ... | |
| 1082 | LL | macro_dollar_crate!(); | |
| 1083 | | --------------------- in this macro invocation | |
| 1084 | | | |
| 1085 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 1086 | ||
| 1087 | error[E0433]: failed to resolve: `$crate` in paths can only be used in start position | |
| 1088 | --> $DIR/use-path-segment-kw.rs:24:26 | |
| 1089 | | | |
| 1090 | LL | type A4 = crate::$crate; | |
| 1091 | | ^^^^^^ `$crate` in paths can only be used in start position | |
| 1092 | ... | |
| 1093 | LL | macro_dollar_crate!(); | |
| 1094 | | --------------------- in this macro invocation | |
| 1095 | | | |
| 1096 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 1097 | ||
| 1098 | error[E0433]: failed to resolve: `$crate` in paths can only be used in start position | |
| 1099 | --> $DIR/use-path-segment-kw.rs:30:26 | |
| 1100 | | | |
| 1101 | LL | type A5 = super::$crate; | |
| 1102 | | ^^^^^^ `$crate` in paths can only be used in start position | |
| 1103 | ... | |
| 1104 | LL | macro_dollar_crate!(); | |
| 1105 | | --------------------- in this macro invocation | |
| 1106 | | | |
| 1107 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 1108 | ||
| 1109 | error[E0433]: failed to resolve: `$crate` in paths can only be used in start position | |
| 1110 | --> $DIR/use-path-segment-kw.rs:36:25 | |
| 1111 | | | |
| 1112 | LL | type A6 = self::$crate; | |
| 1113 | | ^^^^^^ `$crate` in paths can only be used in start position | |
| 1114 | ... | |
| 1115 | LL | macro_dollar_crate!(); | |
| 1116 | | --------------------- in this macro invocation | |
| 1117 | | | |
| 1118 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 1119 | ||
| 1120 | error[E0433]: failed to resolve: `$crate` in paths can only be used in start position | |
| 1121 | --> $DIR/use-path-segment-kw.rs:42:27 | |
| 1122 | | | |
| 1123 | LL | type A7 = $crate::$crate; | |
| 1124 | | ^^^^^^ `$crate` in paths can only be used in start position | |
| 1125 | ... | |
| 1126 | LL | macro_dollar_crate!(); | |
| 1127 | | --------------------- in this macro invocation | |
| 1128 | | | |
| 1129 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 1130 | ||
| 1131 | error[E0433]: failed to resolve: `crate` in paths can only be used in start position | |
| 1132 | --> $DIR/use-path-segment-kw.rs:48:27 | |
| 1133 | | | |
| 1134 | LL | type A8 = $crate::crate; | |
| 1135 | | ^^^^^ `crate` in paths can only be used in start position | |
| 1136 | ... | |
| 1137 | LL | macro_dollar_crate!(); | |
| 1138 | | --------------------- in this macro invocation | |
| 1139 | | | |
| 1140 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 1141 | ||
| 1142 | error[E0433]: failed to resolve: `super` in paths can only be used in start position | |
| 1143 | --> $DIR/use-path-segment-kw.rs:56:27 | |
| 1144 | | | |
| 1145 | LL | type A9 = $crate::super; | |
| 1146 | | ^^^^^ `super` in paths can only be used in start position | |
| 1147 | ... | |
| 1148 | LL | macro_dollar_crate!(); | |
| 1149 | | --------------------- in this macro invocation | |
| 1150 | | | |
| 1151 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 1152 | ||
| 1153 | error[E0433]: failed to resolve: `self` in paths can only be used in start position | |
| 1154 | --> $DIR/use-path-segment-kw.rs:62:28 | |
| 1155 | | | |
| 1156 | LL | type A10 = $crate::self; | |
| 1157 | | ^^^^ `self` in paths can only be used in start position | |
| 1158 | ... | |
| 1159 | LL | macro_dollar_crate!(); | |
| 1160 | | --------------------- in this macro invocation | |
| 1161 | | | |
| 1162 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 1163 | ||
| 1164 | error[E0433]: failed to resolve: global paths cannot start with `crate` | |
| 1165 | --> $DIR/use-path-segment-kw.rs:101:21 | |
| 1166 | | | |
| 1167 | LL | type B2 = ::crate; | |
| 1168 | | ^^^^^ global paths cannot start with `crate` | |
| 1169 | ||
| 1170 | error[E0433]: failed to resolve: `crate` in paths can only be used in start position | |
| 1171 | --> $DIR/use-path-segment-kw.rs:109:27 | |
| 1172 | | | |
| 1173 | LL | type B3 = foobar::crate; | |
| 1174 | | ^^^^^ `crate` in paths can only be used in start position | |
| 1175 | ||
| 1176 | error[E0433]: failed to resolve: `crate` in paths can only be used in start position | |
| 1177 | --> $DIR/use-path-segment-kw.rs:117:26 | |
| 1178 | | | |
| 1179 | LL | type B4 = crate::crate; | |
| 1180 | | ^^^^^ `crate` in paths can only be used in start position | |
| 1181 | ||
| 1182 | error[E0433]: failed to resolve: `crate` in paths can only be used in start position | |
| 1183 | --> $DIR/use-path-segment-kw.rs:125:26 | |
| 1184 | | | |
| 1185 | LL | type B5 = super::crate; | |
| 1186 | | ^^^^^ `crate` in paths can only be used in start position | |
| 1187 | ||
| 1188 | error[E0433]: failed to resolve: `crate` in paths can only be used in start position | |
| 1189 | --> $DIR/use-path-segment-kw.rs:133:25 | |
| 1190 | | | |
| 1191 | LL | type B6 = self::crate; | |
| 1192 | | ^^^^^ `crate` in paths can only be used in start position | |
| 1193 | ||
| 1194 | error[E0433]: failed to resolve: global paths cannot start with `super` | |
| 1195 | --> $DIR/use-path-segment-kw.rs:149:21 | |
| 1196 | | | |
| 1197 | LL | type C2 = ::super; | |
| 1198 | | ^^^^^ global paths cannot start with `super` | |
| 1199 | ||
| 1200 | error[E0433]: failed to resolve: `super` in paths can only be used in start position | |
| 1201 | --> $DIR/use-path-segment-kw.rs:155:27 | |
| 1202 | | | |
| 1203 | LL | type C3 = foobar::super; | |
| 1204 | | ^^^^^ `super` in paths can only be used in start position | |
| 1205 | ||
| 1206 | error[E0433]: failed to resolve: `super` in paths can only be used in start position | |
| 1207 | --> $DIR/use-path-segment-kw.rs:161:26 | |
| 1208 | | | |
| 1209 | LL | type C4 = crate::super; | |
| 1210 | | ^^^^^ `super` in paths can only be used in start position | |
| 1211 | ||
| 1212 | error[E0433]: failed to resolve: global paths cannot start with `self` | |
| 1213 | --> $DIR/use-path-segment-kw.rs:187:21 | |
| 1214 | | | |
| 1215 | LL | type D2 = ::self; | |
| 1216 | | ^^^^ global paths cannot start with `self` | |
| 1217 | ||
| 1218 | error[E0433]: failed to resolve: `self` in paths can only be used in start position | |
| 1219 | --> $DIR/use-path-segment-kw.rs:195:27 | |
| 1220 | | | |
| 1221 | LL | type D3 = foobar::self; | |
| 1222 | | ^^^^ `self` in paths can only be used in start position | |
| 1223 | ||
| 1224 | error[E0433]: failed to resolve: `self` in paths can only be used in start position | |
| 1225 | --> $DIR/use-path-segment-kw.rs:201:26 | |
| 1226 | | | |
| 1227 | LL | type D4 = crate::self; | |
| 1228 | | ^^^^ `self` in paths can only be used in start position | |
| 1229 | ||
| 1230 | error[E0433]: failed to resolve: `self` in paths can only be used in start position | |
| 1231 | --> $DIR/use-path-segment-kw.rs:210:26 | |
| 1232 | | | |
| 1233 | LL | type D5 = super::self; | |
| 1234 | | ^^^^ `self` in paths can only be used in start position | |
| 1235 | ||
| 1236 | error[E0433]: failed to resolve: `self` in paths can only be used in start position | |
| 1237 | --> $DIR/use-path-segment-kw.rs:218:25 | |
| 1238 | | | |
| 1239 | LL | type D6 = self::self; | |
| 1240 | | ^^^^ `self` in paths can only be used in start position | |
| 1241 | ||
| 1242 | error: aborting due to 141 previous errors | |
| 1243 | ||
| 1244 | Some errors have detailed explanations: E0252, E0429, E0431, E0432, E0433, E0573. | |
| 1245 | For more information about an error, try `rustc --explain E0252`. |