| author | bors <bors@rust-lang.org> 2026-02-21 02:52:40 UTC |
| committer | bors <bors@rust-lang.org> 2026-02-21 02:52:40 UTC |
| log | 1c00e989ca032d57e815e930fad00b61e65a1826 |
| tree | 83fd9571a27e8e3d994126a34ac3f5a41a8eb969 |
| parent | 0376d43d443cba463a0b6a6ec9140ea17d7b7130 |
| parent | 7655d9370d3ddd99f6c7ad79a3accd0a709784b8 |
Rollup of 9 pull requests
Successful merges:
- rust-lang/rust#146832 (Not linting irrefutable_let_patterns on let chains)
- rust-lang/rust#146972 (Support importing path-segment keyword with renaming)
- rust-lang/rust#152241 (For panic=unwind on Wasm targets, define __cpp_exception tag)
- rust-lang/rust#152527 (Remove -Zemit-thin-lto flag)
- rust-lang/rust#152769 (Do not cancel try builds after first job failure)
- rust-lang/rust#152907 (Add tests for delegation generics)
- rust-lang/rust#152455 (Remove the translation `-Z` options and the `Translator` type. )
- rust-lang/rust#152813 (Skip the `use_existential_projection_new_instead` field in the `Debug` impl)
- rust-lang/rust#152912 (Expose Span for all DefIds in rustc_public)114 files changed, 9132 insertions(+), 2784 deletions(-)
.github/workflows/ci.yml+4| ... | ... | @@ -94,6 +94,10 @@ jobs: |
| 94 | 94 | CACHE_DOMAIN: ci-caches.rust-lang.org |
| 95 | 95 | continue-on-error: ${{ matrix.continue_on_error || false }} |
| 96 | 96 | strategy: |
| 97 | # If the user starts multiple jobs in a try build, let them all finish. | |
| 98 | # Try builds are sometimes used to test several jobs at once, and it is useful to know which | |
| 99 | # of them would succeed or not. | |
| 100 | fail-fast: ${{ needs.calculate_matrix.outputs.run_type != 'try' }} | |
| 97 | 101 | matrix: |
| 98 | 102 | # Check the `calculate_matrix` job to see how is the matrix defined. |
| 99 | 103 | include: ${{ fromJSON(needs.calculate_matrix.outputs.jobs) }} |
Cargo.lock-2| ... | ... | @@ -3807,7 +3807,6 @@ name = "rustc_error_messages" |
| 3807 | 3807 | version = "0.0.0" |
| 3808 | 3808 | dependencies = [ |
| 3809 | 3809 | "fluent-bundle", |
| 3810 | "fluent-syntax", | |
| 3811 | 3810 | "icu_list", |
| 3812 | 3811 | "icu_locale", |
| 3813 | 3812 | "intl-memoizer", |
| ... | ... | @@ -3818,7 +3817,6 @@ dependencies = [ |
| 3818 | 3817 | "rustc_macros", |
| 3819 | 3818 | "rustc_serialize", |
| 3820 | 3819 | "rustc_span", |
| 3821 | "tracing", | |
| 3822 | 3820 | "unic-langid", |
| 3823 | 3821 | ] |
| 3824 | 3822 |
compiler/rustc_codegen_llvm/src/back/write.rs+1-2| ... | ... | @@ -786,7 +786,6 @@ pub(crate) unsafe fn llvm_optimize( |
| 786 | 786 | config.verify_llvm_ir, |
| 787 | 787 | config.lint_llvm_ir, |
| 788 | 788 | thin_lto_buffer, |
| 789 | config.emit_thin_lto, | |
| 790 | 789 | config.emit_thin_lto_summary, |
| 791 | 790 | merge_functions, |
| 792 | 791 | unroll_loops, |
| ... | ... | @@ -1033,7 +1032,7 @@ pub(crate) fn codegen( |
| 1033 | 1032 | "LLVM_module_codegen_make_bitcode", |
| 1034 | 1033 | &*module.name, |
| 1035 | 1034 | ); |
| 1036 | ThinBuffer::new(llmod, config.emit_thin_lto) | |
| 1035 | ThinBuffer::new(llmod, cgcx.lto != Lto::Fat) | |
| 1037 | 1036 | }; |
| 1038 | 1037 | let data = thin.data(); |
| 1039 | 1038 | let _timer = prof |
compiler/rustc_codegen_llvm/src/llvm/ffi.rs-1| ... | ... | @@ -2376,7 +2376,6 @@ unsafe extern "C" { |
| 2376 | 2376 | VerifyIR: bool, |
| 2377 | 2377 | LintIR: bool, |
| 2378 | 2378 | ThinLTOBuffer: Option<&mut *mut ThinLTOBuffer>, |
| 2379 | EmitThinLTO: bool, | |
| 2380 | 2379 | EmitThinLTOSummary: bool, |
| 2381 | 2380 | MergeFunctions: bool, |
| 2382 | 2381 | UnrollLoops: bool, |
compiler/rustc_codegen_ssa/src/back/write.rs-9| ... | ... | @@ -12,7 +12,6 @@ use rustc_data_structures::jobserver::{self, Acquired}; |
| 12 | 12 | use rustc_data_structures::memmap::Mmap; |
| 13 | 13 | use rustc_data_structures::profiling::{SelfProfilerRef, VerboseTimingGuard}; |
| 14 | 14 | use rustc_errors::emitter::Emitter; |
| 15 | use rustc_errors::translation::Translator; | |
| 16 | 15 | use rustc_errors::{ |
| 17 | 16 | Diag, DiagArgMap, DiagCtxt, DiagCtxtHandle, DiagMessage, ErrCode, FatalError, FatalErrorMarker, |
| 18 | 17 | Level, MultiSpan, Style, Suggestions, catch_fatal_errors, |
| ... | ... | @@ -100,7 +99,6 @@ pub struct ModuleConfig { |
| 100 | 99 | pub emit_ir: bool, |
| 101 | 100 | pub emit_asm: bool, |
| 102 | 101 | pub emit_obj: EmitObj, |
| 103 | pub emit_thin_lto: bool, | |
| 104 | 102 | pub emit_thin_lto_summary: bool, |
| 105 | 103 | |
| 106 | 104 | // Miscellaneous flags. These are mostly copied from command-line |
| ... | ... | @@ -211,9 +209,6 @@ impl ModuleConfig { |
| 211 | 209 | false |
| 212 | 210 | ), |
| 213 | 211 | emit_obj, |
| 214 | // thin lto summaries prevent fat lto, so do not emit them if fat | |
| 215 | // lto is requested. See PR #136840 for background information. | |
| 216 | emit_thin_lto: sess.opts.unstable_opts.emit_thin_lto && sess.lto() != Lto::Fat, | |
| 217 | 212 | emit_thin_lto_summary: if_regular!( |
| 218 | 213 | sess.opts.output_types.contains_key(&OutputType::ThinLinkBitcode), |
| 219 | 214 | false |
| ... | ... | @@ -2040,10 +2035,6 @@ impl Emitter for SharedEmitter { |
| 2040 | 2035 | fn source_map(&self) -> Option<&SourceMap> { |
| 2041 | 2036 | None |
| 2042 | 2037 | } |
| 2043 | ||
| 2044 | fn translator(&self) -> &Translator { | |
| 2045 | panic!("shared emitter attempted to translate a diagnostic"); | |
| 2046 | } | |
| 2047 | 2038 | } |
| 2048 | 2039 | |
| 2049 | 2040 | impl SharedEmitterMain { |
compiler/rustc_driver_impl/src/lib.rs-7| ... | ... | @@ -34,7 +34,6 @@ use rustc_data_structures::profiling::{ |
| 34 | 34 | }; |
| 35 | 35 | pub use rustc_errors::catch_fatal_errors; |
| 36 | 36 | use rustc_errors::emitter::stderr_destination; |
| 37 | use rustc_errors::translation::Translator; | |
| 38 | 37 | use rustc_errors::{ColorConfig, DiagCtxt, ErrCode, PResult, markdown}; |
| 39 | 38 | use rustc_feature::find_gated_cfg; |
| 40 | 39 | // This avoids a false positive with `-Wunused_crate_dependencies`. |
| ... | ... | @@ -107,10 +106,6 @@ use crate::session_diagnostics::{ |
| 107 | 106 | RLinkWrongFileType, RlinkCorruptFile, RlinkNotAFile, RlinkUnableToRead, UnstableFeatureUsage, |
| 108 | 107 | }; |
| 109 | 108 | |
| 110 | pub fn default_translator() -> Translator { | |
| 111 | Translator::new() | |
| 112 | } | |
| 113 | ||
| 114 | 109 | /// Exit status code used for successful compilation and help output. |
| 115 | 110 | pub const EXIT_SUCCESS: i32 = 0; |
| 116 | 111 | |
| ... | ... | @@ -1525,11 +1520,9 @@ fn report_ice( |
| 1525 | 1520 | extra_info: fn(&DiagCtxt), |
| 1526 | 1521 | using_internal_features: &AtomicBool, |
| 1527 | 1522 | ) { |
| 1528 | let translator = Translator::new(); | |
| 1529 | 1523 | let emitter = |
| 1530 | 1524 | Box::new(rustc_errors::annotate_snippet_emitter_writer::AnnotateSnippetEmitter::new( |
| 1531 | 1525 | stderr_destination(rustc_errors::ColorConfig::Auto), |
| 1532 | translator, | |
| 1533 | 1526 | )); |
| 1534 | 1527 | let dcx = rustc_errors::DiagCtxt::new(emitter); |
| 1535 | 1528 | let dcx = dcx.handle(); |
compiler/rustc_error_codes/src/error_codes/E0430.md+3-1| ... | ... | @@ -1,8 +1,10 @@ |
| 1 | #### Note: this error code is no longer emitted by the compiler. | |
| 2 | ||
| 1 | 3 | The `self` import appears more than once in the list. |
| 2 | 4 | |
| 3 | 5 | Erroneous code example: |
| 4 | 6 | |
| 5 | ```compile_fail,E0430 | |
| 7 | ```ignore (error is no longer emitted) | |
| 6 | 8 | use something::{self, self}; // error: `self` import can only appear once in |
| 7 | 9 | // the list |
| 8 | 10 | ``` |
compiler/rustc_error_codes/src/error_codes/E0431.md+3-1| ... | ... | @@ -1,8 +1,10 @@ |
| 1 | #### Note: this error code is no longer emitted by the compiler. | |
| 2 | ||
| 1 | 3 | An invalid `self` import was made. |
| 2 | 4 | |
| 3 | 5 | Erroneous code example: |
| 4 | 6 | |
| 5 | ```compile_fail,E0431 | |
| 7 | ```ignore (error is no longer emitted) | |
| 6 | 8 | use {self}; // error: `self` import can only appear in an import list with a |
| 7 | 9 | // non-empty prefix |
| 8 | 10 | ``` |
compiler/rustc_error_messages/Cargo.toml-2| ... | ... | @@ -6,7 +6,6 @@ edition = "2024" |
| 6 | 6 | [dependencies] |
| 7 | 7 | # tidy-alphabetical-start |
| 8 | 8 | fluent-bundle = "0.16" |
| 9 | fluent-syntax = "0.12" | |
| 10 | 9 | icu_list = { version = "2.0", default-features = false, features = ["alloc"] } |
| 11 | 10 | icu_locale = { version = "2.0", default-features = false } |
| 12 | 11 | intl-memoizer = "0.5.1" |
| ... | ... | @@ -17,6 +16,5 @@ rustc_data_structures = { path = "../rustc_data_structures" } |
| 17 | 16 | rustc_macros = { path = "../rustc_macros" } |
| 18 | 17 | rustc_serialize = { path = "../rustc_serialize" } |
| 19 | 18 | rustc_span = { path = "../rustc_span" } |
| 20 | tracing = "0.1" | |
| 21 | 19 | unic-langid = { version = "0.9.0", features = ["macros"] } |
| 22 | 20 | # tidy-alphabetical-end |
compiler/rustc_error_messages/src/lib.rs-207| ... | ... | @@ -4,194 +4,16 @@ |
| 4 | 4 | // tidy-alphabetical-end |
| 5 | 5 | |
| 6 | 6 | use std::borrow::Cow; |
| 7 | use std::error::Error; | |
| 8 | use std::path::Path; | |
| 9 | use std::sync::{Arc, LazyLock}; | |
| 10 | use std::{fmt, fs, io}; | |
| 11 | 7 | |
| 12 | use fluent_bundle::FluentResource; | |
| 13 | 8 | pub use fluent_bundle::types::FluentType; |
| 14 | 9 | pub use fluent_bundle::{self, FluentArgs, FluentError, FluentValue}; |
| 15 | use fluent_syntax::parser::ParserError; | |
| 16 | use intl_memoizer::concurrent::IntlLangMemoizer; | |
| 17 | use rustc_data_structures::sync::{DynSend, IntoDynSyncSend}; | |
| 18 | 10 | use rustc_macros::{Decodable, Encodable}; |
| 19 | 11 | use rustc_span::Span; |
| 20 | use tracing::{instrument, trace}; | |
| 21 | 12 | pub use unic_langid::{LanguageIdentifier, langid}; |
| 22 | 13 | |
| 23 | 14 | mod diagnostic_impls; |
| 24 | 15 | pub use diagnostic_impls::DiagArgFromDisplay; |
| 25 | 16 | |
| 26 | pub type FluentBundle = | |
| 27 | IntoDynSyncSend<fluent_bundle::bundle::FluentBundle<FluentResource, IntlLangMemoizer>>; | |
| 28 | ||
| 29 | fn new_bundle(locales: Vec<LanguageIdentifier>) -> FluentBundle { | |
| 30 | IntoDynSyncSend(fluent_bundle::bundle::FluentBundle::new_concurrent(locales)) | |
| 31 | } | |
| 32 | ||
| 33 | #[derive(Debug)] | |
| 34 | pub enum TranslationBundleError { | |
| 35 | /// Failed to read from `.ftl` file. | |
| 36 | ReadFtl(io::Error), | |
| 37 | /// Failed to parse contents of `.ftl` file. | |
| 38 | ParseFtl(ParserError), | |
| 39 | /// Failed to add `FluentResource` to `FluentBundle`. | |
| 40 | AddResource(FluentError), | |
| 41 | /// `$sysroot/share/locale/$locale` does not exist. | |
| 42 | MissingLocale, | |
| 43 | /// Cannot read directory entries of `$sysroot/share/locale/$locale`. | |
| 44 | ReadLocalesDir(io::Error), | |
| 45 | /// Cannot read directory entry of `$sysroot/share/locale/$locale`. | |
| 46 | ReadLocalesDirEntry(io::Error), | |
| 47 | /// `$sysroot/share/locale/$locale` is not a directory. | |
| 48 | LocaleIsNotDir, | |
| 49 | } | |
| 50 | ||
| 51 | impl fmt::Display for TranslationBundleError { | |
| 52 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | |
| 53 | match self { | |
| 54 | TranslationBundleError::ReadFtl(e) => write!(f, "could not read ftl file: {e}"), | |
| 55 | TranslationBundleError::ParseFtl(e) => { | |
| 56 | write!(f, "could not parse ftl file: {e}") | |
| 57 | } | |
| 58 | TranslationBundleError::AddResource(e) => write!(f, "failed to add resource: {e}"), | |
| 59 | TranslationBundleError::MissingLocale => write!(f, "missing locale directory"), | |
| 60 | TranslationBundleError::ReadLocalesDir(e) => { | |
| 61 | write!(f, "could not read locales dir: {e}") | |
| 62 | } | |
| 63 | TranslationBundleError::ReadLocalesDirEntry(e) => { | |
| 64 | write!(f, "could not read locales dir entry: {e}") | |
| 65 | } | |
| 66 | TranslationBundleError::LocaleIsNotDir => { | |
| 67 | write!(f, "`$sysroot/share/locales/$locale` is not a directory") | |
| 68 | } | |
| 69 | } | |
| 70 | } | |
| 71 | } | |
| 72 | ||
| 73 | impl Error for TranslationBundleError { | |
| 74 | fn source(&self) -> Option<&(dyn Error + 'static)> { | |
| 75 | match self { | |
| 76 | TranslationBundleError::ReadFtl(e) => Some(e), | |
| 77 | TranslationBundleError::ParseFtl(e) => Some(e), | |
| 78 | TranslationBundleError::AddResource(e) => Some(e), | |
| 79 | TranslationBundleError::MissingLocale => None, | |
| 80 | TranslationBundleError::ReadLocalesDir(e) => Some(e), | |
| 81 | TranslationBundleError::ReadLocalesDirEntry(e) => Some(e), | |
| 82 | TranslationBundleError::LocaleIsNotDir => None, | |
| 83 | } | |
| 84 | } | |
| 85 | } | |
| 86 | ||
| 87 | impl From<(FluentResource, Vec<ParserError>)> for TranslationBundleError { | |
| 88 | fn from((_, mut errs): (FluentResource, Vec<ParserError>)) -> Self { | |
| 89 | TranslationBundleError::ParseFtl(errs.pop().expect("failed ftl parse with no errors")) | |
| 90 | } | |
| 91 | } | |
| 92 | ||
| 93 | impl From<Vec<FluentError>> for TranslationBundleError { | |
| 94 | fn from(mut errs: Vec<FluentError>) -> Self { | |
| 95 | TranslationBundleError::AddResource( | |
| 96 | errs.pop().expect("failed adding resource to bundle with no errors"), | |
| 97 | ) | |
| 98 | } | |
| 99 | } | |
| 100 | ||
| 101 | /// Returns Fluent bundle with the user's locale resources from | |
| 102 | /// `$sysroot/share/locale/$requested_locale/*.ftl`. | |
| 103 | /// | |
| 104 | /// If `-Z additional-ftl-path` was provided, load that resource and add it to the bundle | |
| 105 | /// (overriding any conflicting messages). | |
| 106 | #[instrument(level = "trace")] | |
| 107 | pub fn fluent_bundle( | |
| 108 | sysroot_candidates: &[&Path], | |
| 109 | requested_locale: Option<LanguageIdentifier>, | |
| 110 | additional_ftl_path: Option<&Path>, | |
| 111 | with_directionality_markers: bool, | |
| 112 | ) -> Result<Option<Arc<FluentBundle>>, TranslationBundleError> { | |
| 113 | if requested_locale.is_none() && additional_ftl_path.is_none() { | |
| 114 | return Ok(None); | |
| 115 | } | |
| 116 | ||
| 117 | let fallback_locale = langid!("en-US"); | |
| 118 | let requested_fallback_locale = requested_locale.as_ref() == Some(&fallback_locale); | |
| 119 | trace!(?requested_fallback_locale); | |
| 120 | if requested_fallback_locale && additional_ftl_path.is_none() { | |
| 121 | return Ok(None); | |
| 122 | } | |
| 123 | // If there is only `-Z additional-ftl-path`, assume locale is "en-US", otherwise use user | |
| 124 | // provided locale. | |
| 125 | let locale = requested_locale.clone().unwrap_or(fallback_locale); | |
| 126 | trace!(?locale); | |
| 127 | let mut bundle = new_bundle(vec![locale]); | |
| 128 | ||
| 129 | // Add convenience functions available to ftl authors. | |
| 130 | register_functions(&mut bundle); | |
| 131 | ||
| 132 | // Fluent diagnostics can insert directionality isolation markers around interpolated variables | |
| 133 | // indicating that there may be a shift from right-to-left to left-to-right text (or | |
| 134 | // vice-versa). These are disabled because they are sometimes visible in the error output, but | |
| 135 | // may be worth investigating in future (for example: if type names are left-to-right and the | |
| 136 | // surrounding diagnostic messages are right-to-left, then these might be helpful). | |
| 137 | bundle.set_use_isolating(with_directionality_markers); | |
| 138 | ||
| 139 | // If the user requests the default locale then don't try to load anything. | |
| 140 | if let Some(requested_locale) = requested_locale { | |
| 141 | let mut found_resources = false; | |
| 142 | for sysroot in sysroot_candidates { | |
| 143 | let mut sysroot = sysroot.to_path_buf(); | |
| 144 | sysroot.push("share"); | |
| 145 | sysroot.push("locale"); | |
| 146 | sysroot.push(requested_locale.to_string()); | |
| 147 | trace!(?sysroot); | |
| 148 | ||
| 149 | if !sysroot.exists() { | |
| 150 | trace!("skipping"); | |
| 151 | continue; | |
| 152 | } | |
| 153 | ||
| 154 | if !sysroot.is_dir() { | |
| 155 | return Err(TranslationBundleError::LocaleIsNotDir); | |
| 156 | } | |
| 157 | ||
| 158 | for entry in sysroot.read_dir().map_err(TranslationBundleError::ReadLocalesDir)? { | |
| 159 | let entry = entry.map_err(TranslationBundleError::ReadLocalesDirEntry)?; | |
| 160 | let path = entry.path(); | |
| 161 | trace!(?path); | |
| 162 | if path.extension().and_then(|s| s.to_str()) != Some("ftl") { | |
| 163 | trace!("skipping"); | |
| 164 | continue; | |
| 165 | } | |
| 166 | ||
| 167 | let resource_str = | |
| 168 | fs::read_to_string(path).map_err(TranslationBundleError::ReadFtl)?; | |
| 169 | let resource = | |
| 170 | FluentResource::try_new(resource_str).map_err(TranslationBundleError::from)?; | |
| 171 | trace!(?resource); | |
| 172 | bundle.add_resource(resource).map_err(TranslationBundleError::from)?; | |
| 173 | found_resources = true; | |
| 174 | } | |
| 175 | } | |
| 176 | ||
| 177 | if !found_resources { | |
| 178 | return Err(TranslationBundleError::MissingLocale); | |
| 179 | } | |
| 180 | } | |
| 181 | ||
| 182 | if let Some(additional_ftl_path) = additional_ftl_path { | |
| 183 | let resource_str = | |
| 184 | fs::read_to_string(additional_ftl_path).map_err(TranslationBundleError::ReadFtl)?; | |
| 185 | let resource = | |
| 186 | FluentResource::try_new(resource_str).map_err(TranslationBundleError::from)?; | |
| 187 | trace!(?resource); | |
| 188 | bundle.add_resource_overriding(resource); | |
| 189 | } | |
| 190 | ||
| 191 | let bundle = Arc::new(bundle); | |
| 192 | Ok(Some(bundle)) | |
| 193 | } | |
| 194 | ||
| 195 | 17 | pub fn register_functions<R, M>(bundle: &mut fluent_bundle::bundle::FluentBundle<R, M>) { |
| 196 | 18 | bundle |
| 197 | 19 | .add_function("STREQ", |positional, _named| match positional { |
| ... | ... | @@ -201,35 +23,6 @@ pub fn register_functions<R, M>(bundle: &mut fluent_bundle::bundle::FluentBundle |
| 201 | 23 | .expect("Failed to add a function to the bundle."); |
| 202 | 24 | } |
| 203 | 25 | |
| 204 | /// Type alias for the result of `fallback_fluent_bundle` - a reference-counted pointer to a lazily | |
| 205 | /// evaluated fluent bundle. | |
| 206 | pub type LazyFallbackBundle = | |
| 207 | Arc<LazyLock<FluentBundle, Box<dyn FnOnce() -> FluentBundle + DynSend>>>; | |
| 208 | ||
| 209 | /// Return the default `FluentBundle` with standard "en-US" diagnostic messages. | |
| 210 | #[instrument(level = "trace", skip(resources))] | |
| 211 | pub fn fallback_fluent_bundle( | |
| 212 | resources: Vec<&'static str>, | |
| 213 | with_directionality_markers: bool, | |
| 214 | ) -> LazyFallbackBundle { | |
| 215 | Arc::new(LazyLock::new(Box::new(move || { | |
| 216 | let mut fallback_bundle = new_bundle(vec![langid!("en-US")]); | |
| 217 | ||
| 218 | register_functions(&mut fallback_bundle); | |
| 219 | ||
| 220 | // See comment in `fluent_bundle`. | |
| 221 | fallback_bundle.set_use_isolating(with_directionality_markers); | |
| 222 | ||
| 223 | for resource in resources { | |
| 224 | let resource = FluentResource::try_new(resource.to_string()) | |
| 225 | .expect("failed to parse fallback fluent resource"); | |
| 226 | fallback_bundle.add_resource_overriding(resource); | |
| 227 | } | |
| 228 | ||
| 229 | fallback_bundle | |
| 230 | }))) | |
| 231 | } | |
| 232 | ||
| 233 | 26 | /// Abstraction over a message in a diagnostic to support both translatable and non-translatable |
| 234 | 27 | /// diagnostic messages. |
| 235 | 28 | /// |
compiler/rustc_errors/src/annotate_snippet_emitter_writer.rs+14-25| ... | ... | @@ -27,7 +27,7 @@ use crate::emitter::{ |
| 27 | 27 | ConfusionType, Destination, MAX_SUGGESTIONS, OutputTheme, detect_confusion_type, is_different, |
| 28 | 28 | normalize_whitespace, should_show_source_code, |
| 29 | 29 | }; |
| 30 | use crate::translation::{Translator, to_fluent_args}; | |
| 30 | use crate::translation::{format_diag_message, format_diag_messages, to_fluent_args}; | |
| 31 | 31 | use crate::{ |
| 32 | 32 | CodeSuggestion, DiagInner, DiagMessage, Emitter, ErrCode, Level, MultiSpan, Style, Subdiag, |
| 33 | 33 | SuggestionStyle, TerminalUrl, |
| ... | ... | @@ -39,8 +39,6 @@ pub struct AnnotateSnippetEmitter { |
| 39 | 39 | #[setters(skip)] |
| 40 | 40 | dst: IntoDynSyncSend<Destination>, |
| 41 | 41 | sm: Option<Arc<SourceMap>>, |
| 42 | #[setters(skip)] | |
| 43 | translator: Translator, | |
| 44 | 42 | short_message: bool, |
| 45 | 43 | ui_testing: bool, |
| 46 | 44 | ignored_directories_in_source_blocks: Vec<String>, |
| ... | ... | @@ -108,10 +106,6 @@ impl Emitter for AnnotateSnippetEmitter { |
| 108 | 106 | !self.short_message |
| 109 | 107 | } |
| 110 | 108 | |
| 111 | fn translator(&self) -> &Translator { | |
| 112 | &self.translator | |
| 113 | } | |
| 114 | ||
| 115 | 109 | fn supports_color(&self) -> bool { |
| 116 | 110 | false |
| 117 | 111 | } |
| ... | ... | @@ -133,11 +127,10 @@ fn annotation_level_for_level(level: Level) -> annotate_snippets::level::Level<' |
| 133 | 127 | } |
| 134 | 128 | |
| 135 | 129 | impl AnnotateSnippetEmitter { |
| 136 | pub fn new(dst: Destination, translator: Translator) -> Self { | |
| 130 | pub fn new(dst: Destination) -> Self { | |
| 137 | 131 | Self { |
| 138 | 132 | dst: IntoDynSyncSend(dst), |
| 139 | 133 | sm: None, |
| 140 | translator, | |
| 141 | 134 | short_message: false, |
| 142 | 135 | ui_testing: false, |
| 143 | 136 | ignored_directories_in_source_blocks: Vec::new(), |
| ... | ... | @@ -169,7 +162,7 @@ impl AnnotateSnippetEmitter { |
| 169 | 162 | .clone() |
| 170 | 163 | .secondary_title(Cow::Owned(self.pre_style_msgs(msgs, *level, args))) |
| 171 | 164 | } else { |
| 172 | annotation_level.clone().primary_title(self.translator.translate_messages(msgs, args)) | |
| 165 | annotation_level.clone().primary_title(format_diag_messages(msgs, args)) | |
| 173 | 166 | }; |
| 174 | 167 | |
| 175 | 168 | if let Some(c) = code { |
| ... | ... | @@ -185,7 +178,7 @@ impl AnnotateSnippetEmitter { |
| 185 | 178 | // If we don't have span information, emit and exit |
| 186 | 179 | let Some(sm) = self.sm.as_ref() else { |
| 187 | 180 | group = group.elements(children.iter().map(|c| { |
| 188 | let msg = self.translator.translate_messages(&c.messages, args).to_string(); | |
| 181 | let msg = format_diag_messages(&c.messages, args).to_string(); | |
| 189 | 182 | let level = annotation_level_for_level(c.level); |
| 190 | 183 | level.message(msg) |
| 191 | 184 | })); |
| ... | ... | @@ -202,7 +195,7 @@ impl AnnotateSnippetEmitter { |
| 202 | 195 | return; |
| 203 | 196 | }; |
| 204 | 197 | |
| 205 | let mut file_ann = collect_annotations(args, msp, sm, &self.translator); | |
| 198 | let mut file_ann = collect_annotations(args, msp, sm); | |
| 206 | 199 | |
| 207 | 200 | // Make sure our primary file comes first |
| 208 | 201 | let primary_span = msp.primary_span().unwrap_or_default(); |
| ... | ... | @@ -256,7 +249,7 @@ impl AnnotateSnippetEmitter { |
| 256 | 249 | let msg = if c.messages.iter().any(|(_, style)| style != &crate::Style::NoStyle) { |
| 257 | 250 | Cow::Owned(self.pre_style_msgs(&c.messages, c.level, args)) |
| 258 | 251 | } else { |
| 259 | self.translator.translate_messages(&c.messages, args) | |
| 252 | format_diag_messages(&c.messages, args) | |
| 260 | 253 | }; |
| 261 | 254 | |
| 262 | 255 | // This is a secondary message with no span info |
| ... | ... | @@ -270,7 +263,7 @@ impl AnnotateSnippetEmitter { |
| 270 | 263 | Group::with_title(level.clone().secondary_title(msg)), |
| 271 | 264 | )); |
| 272 | 265 | |
| 273 | let mut file_ann = collect_annotations(args, &c.span, sm, &self.translator); | |
| 266 | let mut file_ann = collect_annotations(args, &c.span, sm); | |
| 274 | 267 | let primary_span = c.span.primary_span().unwrap_or_default(); |
| 275 | 268 | if !primary_span.is_dummy() { |
| 276 | 269 | let primary_lo = sm.lookup_char_pos(primary_span.lo()); |
| ... | ... | @@ -308,9 +301,10 @@ impl AnnotateSnippetEmitter { |
| 308 | 301 | // do not display this suggestion, it is meant only for tools |
| 309 | 302 | } |
| 310 | 303 | SuggestionStyle::HideCodeAlways => { |
| 311 | let msg = self | |
| 312 | .translator | |
| 313 | .translate_messages(&[(suggestion.msg.to_owned(), Style::HeaderMsg)], args); | |
| 304 | let msg = format_diag_messages( | |
| 305 | &[(suggestion.msg.to_owned(), Style::HeaderMsg)], | |
| 306 | args, | |
| 307 | ); | |
| 314 | 308 | group = group.element(annotate_snippets::Level::HELP.message(msg)); |
| 315 | 309 | } |
| 316 | 310 | SuggestionStyle::HideCodeInline |
| ... | ... | @@ -367,9 +361,7 @@ impl AnnotateSnippetEmitter { |
| 367 | 361 | if substitutions.is_empty() { |
| 368 | 362 | continue; |
| 369 | 363 | } |
| 370 | let mut msg = self | |
| 371 | .translator | |
| 372 | .translate_message(&suggestion.msg, args) | |
| 364 | let mut msg = format_diag_message(&suggestion.msg, args) | |
| 373 | 365 | .map_err(Report::new) |
| 374 | 366 | .unwrap() |
| 375 | 367 | .to_string(); |
| ... | ... | @@ -555,7 +547,7 @@ impl AnnotateSnippetEmitter { |
| 555 | 547 | ) -> String { |
| 556 | 548 | msgs.iter() |
| 557 | 549 | .filter_map(|(m, style)| { |
| 558 | let text = self.translator.translate_message(m, args).map_err(Report::new).unwrap(); | |
| 550 | let text = format_diag_message(m, args).map_err(Report::new).unwrap(); | |
| 559 | 551 | let style = style.anstyle(level); |
| 560 | 552 | if text.is_empty() { None } else { Some(format!("{style}{text}{style:#}")) } |
| 561 | 553 | }) |
| ... | ... | @@ -688,7 +680,6 @@ fn collect_annotations( |
| 688 | 680 | args: &FluentArgs<'_>, |
| 689 | 681 | msp: &MultiSpan, |
| 690 | 682 | sm: &Arc<SourceMap>, |
| 691 | translator: &Translator, | |
| 692 | 683 | ) -> Vec<(Arc<SourceFile>, Vec<Annotation>)> { |
| 693 | 684 | let mut output: Vec<(Arc<SourceFile>, Vec<Annotation>)> = vec![]; |
| 694 | 685 | |
| ... | ... | @@ -704,9 +695,7 @@ fn collect_annotations( |
| 704 | 695 | let kind = if is_primary { AnnotationKind::Primary } else { AnnotationKind::Context }; |
| 705 | 696 | |
| 706 | 697 | let label = label.as_ref().map(|m| { |
| 707 | normalize_whitespace( | |
| 708 | &translator.translate_message(m, args).map_err(Report::new).unwrap(), | |
| 709 | ) | |
| 698 | normalize_whitespace(&format_diag_message(m, args).map_err(Report::new).unwrap()) | |
| 710 | 699 | }); |
| 711 | 700 | |
| 712 | 701 | let ann = Annotation { kind, span, label }; |
compiler/rustc_errors/src/emitter.rs+3-19| ... | ... | @@ -25,7 +25,7 @@ use rustc_span::{FileName, SourceFile, Span}; |
| 25 | 25 | use tracing::{debug, warn}; |
| 26 | 26 | |
| 27 | 27 | use crate::timings::TimingRecord; |
| 28 | use crate::translation::Translator; | |
| 28 | use crate::translation::format_diag_message; | |
| 29 | 29 | use crate::{ |
| 30 | 30 | CodeSuggestion, DiagInner, DiagMessage, Level, MultiSpan, Style, Subdiag, SuggestionStyle, |
| 31 | 31 | }; |
| ... | ... | @@ -88,8 +88,6 @@ pub trait Emitter { |
| 88 | 88 | |
| 89 | 89 | fn source_map(&self) -> Option<&SourceMap>; |
| 90 | 90 | |
| 91 | fn translator(&self) -> &Translator; | |
| 92 | ||
| 93 | 91 | /// Formats the substitutions of the primary_span |
| 94 | 92 | /// |
| 95 | 93 | /// There are a lot of conditions to this method, but in short: |
| ... | ... | @@ -108,11 +106,7 @@ pub trait Emitter { |
| 108 | 106 | fluent_args: &FluentArgs<'_>, |
| 109 | 107 | ) { |
| 110 | 108 | if let Some((sugg, rest)) = suggestions.split_first() { |
| 111 | let msg = self | |
| 112 | .translator() | |
| 113 | .translate_message(&sugg.msg, fluent_args) | |
| 114 | .map_err(Report::new) | |
| 115 | .unwrap(); | |
| 109 | let msg = format_diag_message(&sugg.msg, fluent_args).map_err(Report::new).unwrap(); | |
| 116 | 110 | if rest.is_empty() |
| 117 | 111 | // ^ if there is only one suggestion |
| 118 | 112 | // don't display multi-suggestions as labels |
| ... | ... | @@ -383,15 +377,9 @@ impl Emitter for EmitterWithNote { |
| 383 | 377 | diag.sub(Level::Note, self.note.clone(), MultiSpan::new()); |
| 384 | 378 | self.emitter.emit_diagnostic(diag); |
| 385 | 379 | } |
| 386 | ||
| 387 | fn translator(&self) -> &Translator { | |
| 388 | self.emitter.translator() | |
| 389 | } | |
| 390 | 380 | } |
| 391 | 381 | |
| 392 | pub struct SilentEmitter { | |
| 393 | pub translator: Translator, | |
| 394 | } | |
| 382 | pub struct SilentEmitter; | |
| 395 | 383 | |
| 396 | 384 | impl Emitter for SilentEmitter { |
| 397 | 385 | fn source_map(&self) -> Option<&SourceMap> { |
| ... | ... | @@ -399,10 +387,6 @@ impl Emitter for SilentEmitter { |
| 399 | 387 | } |
| 400 | 388 | |
| 401 | 389 | fn emit_diagnostic(&mut self, _diag: DiagInner) {} |
| 402 | ||
| 403 | fn translator(&self) -> &Translator { | |
| 404 | &self.translator | |
| 405 | } | |
| 406 | 390 | } |
| 407 | 391 | |
| 408 | 392 | /// Maximum number of suggestions to be shown |
compiler/rustc_errors/src/json.rs+6-14| ... | ... | @@ -32,7 +32,7 @@ use crate::emitter::{ |
| 32 | 32 | should_show_source_code, |
| 33 | 33 | }; |
| 34 | 34 | use crate::timings::{TimingRecord, TimingSection}; |
| 35 | use crate::translation::{Translator, to_fluent_args}; | |
| 35 | use crate::translation::{format_diag_message, format_diag_messages, to_fluent_args}; | |
| 36 | 36 | use crate::{CodeSuggestion, MultiSpan, SpanLabel, Subdiag, Suggestions, TerminalUrl}; |
| 37 | 37 | |
| 38 | 38 | #[cfg(test)] |
| ... | ... | @@ -45,8 +45,6 @@ pub struct JsonEmitter { |
| 45 | 45 | #[setters(skip)] |
| 46 | 46 | sm: Option<Arc<SourceMap>>, |
| 47 | 47 | #[setters(skip)] |
| 48 | translator: Translator, | |
| 49 | #[setters(skip)] | |
| 50 | 48 | pretty: bool, |
| 51 | 49 | ui_testing: bool, |
| 52 | 50 | ignored_directories_in_source_blocks: Vec<String>, |
| ... | ... | @@ -63,7 +61,6 @@ impl JsonEmitter { |
| 63 | 61 | pub fn new( |
| 64 | 62 | dst: Box<dyn Write + Send>, |
| 65 | 63 | sm: Option<Arc<SourceMap>>, |
| 66 | translator: Translator, | |
| 67 | 64 | pretty: bool, |
| 68 | 65 | json_rendered: HumanReadableErrorType, |
| 69 | 66 | color_config: ColorConfig, |
| ... | ... | @@ -71,7 +68,6 @@ impl JsonEmitter { |
| 71 | 68 | JsonEmitter { |
| 72 | 69 | dst: IntoDynSyncSend(dst), |
| 73 | 70 | sm, |
| 74 | translator, | |
| 75 | 71 | pretty, |
| 76 | 72 | ui_testing: false, |
| 77 | 73 | ignored_directories_in_source_blocks: Vec::new(), |
| ... | ... | @@ -180,10 +176,6 @@ impl Emitter for JsonEmitter { |
| 180 | 176 | fn should_show_explain(&self) -> bool { |
| 181 | 177 | !self.json_rendered.short() |
| 182 | 178 | } |
| 183 | ||
| 184 | fn translator(&self) -> &Translator { | |
| 185 | &self.translator | |
| 186 | } | |
| 187 | 179 | } |
| 188 | 180 | |
| 189 | 181 | // The following data types are provided just for serialisation. |
| ... | ... | @@ -310,7 +302,7 @@ impl Diagnostic { |
| 310 | 302 | let args = to_fluent_args(diag.args.iter()); |
| 311 | 303 | let sugg_to_diag = |sugg: &CodeSuggestion| { |
| 312 | 304 | let translated_message = |
| 313 | je.translator.translate_message(&sugg.msg, &args).map_err(Report::new).unwrap(); | |
| 305 | format_diag_message(&sugg.msg, &args).map_err(Report::new).unwrap(); | |
| 314 | 306 | Diagnostic { |
| 315 | 307 | message: translated_message.to_string(), |
| 316 | 308 | code: None, |
| ... | ... | @@ -341,7 +333,7 @@ impl Diagnostic { |
| 341 | 333 | } |
| 342 | 334 | } |
| 343 | 335 | |
| 344 | let translated_message = je.translator.translate_messages(&diag.messages, &args); | |
| 336 | let translated_message = format_diag_messages(&diag.messages, &args); | |
| 345 | 337 | |
| 346 | 338 | let code = if let Some(code) = diag.code { |
| 347 | 339 | Some(DiagnosticCode { |
| ... | ... | @@ -373,7 +365,7 @@ impl Diagnostic { |
| 373 | 365 | choice => choice, |
| 374 | 366 | }, |
| 375 | 367 | ); |
| 376 | AnnotateSnippetEmitter::new(dst, je.translator.clone()) | |
| 368 | AnnotateSnippetEmitter::new(dst) | |
| 377 | 369 | .short_message(je.json_rendered.short) |
| 378 | 370 | .sm(je.sm.clone()) |
| 379 | 371 | .diagnostic_width(je.diagnostic_width) |
| ... | ... | @@ -403,7 +395,7 @@ impl Diagnostic { |
| 403 | 395 | args: &FluentArgs<'_>, |
| 404 | 396 | je: &JsonEmitter, |
| 405 | 397 | ) -> Diagnostic { |
| 406 | let translated_message = je.translator.translate_messages(&subdiag.messages, args); | |
| 398 | let translated_message = format_diag_messages(&subdiag.messages, args); | |
| 407 | 399 | Diagnostic { |
| 408 | 400 | message: translated_message.to_string(), |
| 409 | 401 | code: None, |
| ... | ... | @@ -427,7 +419,7 @@ impl DiagnosticSpan { |
| 427 | 419 | span.is_primary, |
| 428 | 420 | span.label |
| 429 | 421 | .as_ref() |
| 430 | .map(|m| je.translator.translate_message(m, args).unwrap()) | |
| 422 | .map(|m| format_diag_message(m, args).unwrap()) | |
| 431 | 423 | .map(|m| m.to_string()), |
| 432 | 424 | suggestion, |
| 433 | 425 | je, |
compiler/rustc_errors/src/json/tests.rs-2| ... | ... | @@ -45,13 +45,11 @@ fn test_positions(code: &str, span: (u32, u32), expected_output: SpanTestData) { |
| 45 | 45 | rustc_span::create_default_session_globals_then(|| { |
| 46 | 46 | let sm = Arc::new(SourceMap::new(FilePathMapping::empty())); |
| 47 | 47 | sm.new_source_file(filename(&sm, "test.rs"), code.to_owned()); |
| 48 | let translator = Translator::new(); | |
| 49 | 48 | |
| 50 | 49 | let output = Arc::new(Mutex::new(Vec::new())); |
| 51 | 50 | let je = JsonEmitter::new( |
| 52 | 51 | Box::new(Shared { data: output.clone() }), |
| 53 | 52 | Some(sm), |
| 54 | translator, | |
| 55 | 53 | true, // pretty |
| 56 | 54 | HumanReadableErrorType { short: true, unicode: false }, |
| 57 | 55 | ColorConfig::Never, |
compiler/rustc_errors/src/lib.rs+5-11| ... | ... | @@ -54,9 +54,8 @@ use rustc_data_structures::stable_hasher::StableHasher; |
| 54 | 54 | use rustc_data_structures::sync::{DynSend, Lock}; |
| 55 | 55 | use rustc_data_structures::{AtomicRef, assert_matches}; |
| 56 | 56 | pub use rustc_error_messages::{ |
| 57 | DiagArg, DiagArgFromDisplay, DiagArgName, DiagArgValue, DiagMessage, FluentBundle, IntoDiagArg, | |
| 58 | LanguageIdentifier, LazyFallbackBundle, MultiSpan, SpanLabel, fallback_fluent_bundle, | |
| 59 | fluent_bundle, into_diag_arg_using_display, | |
| 57 | DiagArg, DiagArgFromDisplay, DiagArgName, DiagArgValue, DiagMessage, IntoDiagArg, | |
| 58 | LanguageIdentifier, MultiSpan, SpanLabel, fluent_bundle, into_diag_arg_using_display, | |
| 60 | 59 | }; |
| 61 | 60 | use rustc_hashes::Hash128; |
| 62 | 61 | use rustc_lint_defs::LintExpectationId; |
| ... | ... | @@ -71,6 +70,7 @@ use tracing::debug; |
| 71 | 70 | |
| 72 | 71 | use crate::emitter::TimingEvent; |
| 73 | 72 | use crate::timings::TimingRecord; |
| 73 | use crate::translation::format_diag_message; | |
| 74 | 74 | |
| 75 | 75 | pub mod annotate_snippet_emitter_writer; |
| 76 | 76 | pub mod codes; |
| ... | ... | @@ -479,8 +479,7 @@ impl DiagCtxt { |
| 479 | 479 | |
| 480 | 480 | pub fn make_silent(&self) { |
| 481 | 481 | let mut inner = self.inner.borrow_mut(); |
| 482 | let translator = inner.emitter.translator().clone(); | |
| 483 | inner.emitter = Box::new(emitter::SilentEmitter { translator }); | |
| 482 | inner.emitter = Box::new(emitter::SilentEmitter {}); | |
| 484 | 483 | } |
| 485 | 484 | |
| 486 | 485 | pub fn set_emitter(&self, emitter: Box<dyn Emitter + DynSend>) { |
| ... | ... | @@ -1438,12 +1437,7 @@ impl DiagCtxtInner { |
| 1438 | 1437 | args: impl Iterator<Item = DiagArg<'a>>, |
| 1439 | 1438 | ) -> String { |
| 1440 | 1439 | let args = crate::translation::to_fluent_args(args); |
| 1441 | self.emitter | |
| 1442 | .translator() | |
| 1443 | .translate_message(&message, &args) | |
| 1444 | .map_err(Report::new) | |
| 1445 | .unwrap() | |
| 1446 | .to_string() | |
| 1440 | format_diag_message(&message, &args).map_err(Report::new).unwrap().to_string() | |
| 1447 | 1441 | } |
| 1448 | 1442 | |
| 1449 | 1443 | fn eagerly_translate_for_subdiag( |
compiler/rustc_errors/src/translation.rs+41-57| ... | ... | @@ -1,14 +1,13 @@ |
| 1 | 1 | use std::borrow::Cow; |
| 2 | 2 | use std::error::Report; |
| 3 | use std::sync::Arc; | |
| 4 | 3 | |
| 5 | pub use rustc_error_messages::{FluentArgs, LazyFallbackBundle}; | |
| 4 | pub use rustc_error_messages::FluentArgs; | |
| 6 | 5 | use rustc_error_messages::{langid, register_functions}; |
| 7 | 6 | use tracing::{debug, trace}; |
| 8 | 7 | |
| 9 | 8 | use crate::error::TranslateError; |
| 10 | 9 | use crate::fluent_bundle::FluentResource; |
| 11 | use crate::{DiagArg, DiagMessage, FluentBundle, Style, fluent_bundle}; | |
| 10 | use crate::{DiagArg, DiagMessage, Style, fluent_bundle}; | |
| 12 | 11 | |
| 13 | 12 | /// Convert diagnostic arguments (a rustc internal type that exists to implement |
| 14 | 13 | /// `Encodable`/`Decodable`) into `FluentArgs` which is necessary to perform translation. |
| ... | ... | @@ -29,63 +28,48 @@ pub fn to_fluent_args<'iter>(iter: impl Iterator<Item = DiagArg<'iter>>) -> Flue |
| 29 | 28 | args |
| 30 | 29 | } |
| 31 | 30 | |
| 32 | #[derive(Clone)] | |
| 33 | pub struct Translator { | |
| 34 | /// Localized diagnostics for the locale requested by the user. If no language was requested by | |
| 35 | /// the user then this will be `None` and `fallback_fluent_bundle` should be used. | |
| 36 | pub fluent_bundle: Option<Arc<FluentBundle>>, | |
| 31 | /// Convert `DiagMessage`s to a string | |
| 32 | pub fn format_diag_messages( | |
| 33 | messages: &[(DiagMessage, Style)], | |
| 34 | args: &FluentArgs<'_>, | |
| 35 | ) -> Cow<'static, str> { | |
| 36 | Cow::Owned( | |
| 37 | messages | |
| 38 | .iter() | |
| 39 | .map(|(m, _)| format_diag_message(m, args).map_err(Report::new).unwrap()) | |
| 40 | .collect::<String>(), | |
| 41 | ) | |
| 37 | 42 | } |
| 38 | 43 | |
| 39 | impl Translator { | |
| 40 | pub fn new() -> Translator { | |
| 41 | Translator { fluent_bundle: None } | |
| 42 | } | |
| 43 | ||
| 44 | /// Convert `DiagMessage`s to a string, performing translation if necessary. | |
| 45 | pub fn translate_messages( | |
| 46 | &self, | |
| 47 | messages: &[(DiagMessage, Style)], | |
| 48 | args: &FluentArgs<'_>, | |
| 49 | ) -> Cow<'_, str> { | |
| 50 | Cow::Owned( | |
| 51 | messages | |
| 52 | .iter() | |
| 53 | .map(|(m, _)| self.translate_message(m, args).map_err(Report::new).unwrap()) | |
| 54 | .collect::<String>(), | |
| 55 | ) | |
| 56 | } | |
| 57 | ||
| 58 | /// Convert a `DiagMessage` to a string, performing translation if necessary. | |
| 59 | pub fn translate_message<'a>( | |
| 60 | &'a self, | |
| 61 | message: &'a DiagMessage, | |
| 62 | args: &'a FluentArgs<'_>, | |
| 63 | ) -> Result<Cow<'a, str>, TranslateError<'a>> { | |
| 64 | trace!(?message, ?args); | |
| 65 | match message { | |
| 66 | DiagMessage::Str(msg) => Ok(Cow::Borrowed(msg)), | |
| 67 | // This translates an inline fluent diagnostic message | |
| 68 | // It does this by creating a new `FluentBundle` with only one message, | |
| 69 | // and then translating using this bundle. | |
| 70 | DiagMessage::Inline(msg) => { | |
| 71 | const GENERATED_MSG_ID: &str = "generated_msg"; | |
| 72 | let resource = | |
| 73 | FluentResource::try_new(format!("{GENERATED_MSG_ID} = {msg}\n")).unwrap(); | |
| 74 | let mut bundle = fluent_bundle::FluentBundle::new(vec![langid!("en-US")]); | |
| 75 | bundle.set_use_isolating(false); | |
| 76 | bundle.add_resource(resource).unwrap(); | |
| 77 | register_functions(&mut bundle); | |
| 78 | let message = bundle.get_message(GENERATED_MSG_ID).unwrap(); | |
| 79 | let value = message.value().unwrap(); | |
| 44 | /// Convert a `DiagMessage` to a string | |
| 45 | pub fn format_diag_message<'a>( | |
| 46 | message: &'a DiagMessage, | |
| 47 | args: &'a FluentArgs<'_>, | |
| 48 | ) -> Result<Cow<'a, str>, TranslateError<'a>> { | |
| 49 | trace!(?message, ?args); | |
| 50 | match message { | |
| 51 | DiagMessage::Str(msg) => Ok(Cow::Borrowed(msg)), | |
| 52 | // This translates an inline fluent diagnostic message | |
| 53 | // It does this by creating a new `FluentBundle` with only one message, | |
| 54 | // and then translating using this bundle. | |
| 55 | DiagMessage::Inline(msg) => { | |
| 56 | const GENERATED_MSG_ID: &str = "generated_msg"; | |
| 57 | let resource = | |
| 58 | FluentResource::try_new(format!("{GENERATED_MSG_ID} = {msg}\n")).unwrap(); | |
| 59 | let mut bundle = fluent_bundle::FluentBundle::new(vec![langid!("en-US")]); | |
| 60 | bundle.set_use_isolating(false); | |
| 61 | bundle.add_resource(resource).unwrap(); | |
| 62 | register_functions(&mut bundle); | |
| 63 | let message = bundle.get_message(GENERATED_MSG_ID).unwrap(); | |
| 64 | let value = message.value().unwrap(); | |
| 80 | 65 | |
| 81 | let mut errs = vec![]; | |
| 82 | let translated = bundle.format_pattern(value, Some(args), &mut errs).to_string(); | |
| 83 | debug!(?translated, ?errs); | |
| 84 | if errs.is_empty() { | |
| 85 | Ok(Cow::Owned(translated)) | |
| 86 | } else { | |
| 87 | Err(TranslateError::fluent(&Cow::Borrowed(GENERATED_MSG_ID), args, errs)) | |
| 88 | } | |
| 66 | let mut errs = vec![]; | |
| 67 | let translated = bundle.format_pattern(value, Some(args), &mut errs).to_string(); | |
| 68 | debug!(?translated, ?errs); | |
| 69 | if errs.is_empty() { | |
| 70 | Ok(Cow::Owned(translated)) | |
| 71 | } else { | |
| 72 | Err(TranslateError::fluent(&Cow::Borrowed(GENERATED_MSG_ID), args, errs)) | |
| 89 | 73 | } |
| 90 | 74 | } |
| 91 | 75 | } |
compiler/rustc_interface/src/interface.rs-11| ... | ... | @@ -435,16 +435,6 @@ pub fn run_compiler<R: Send>(config: Config, f: impl FnOnce(&Compiler) -> R + Se |
| 435 | 435 | |
| 436 | 436 | let temps_dir = config.opts.unstable_opts.temps_dir.as_deref().map(PathBuf::from); |
| 437 | 437 | |
| 438 | let bundle = match rustc_errors::fluent_bundle( | |
| 439 | &config.opts.sysroot.all_paths().collect::<Vec<_>>(), | |
| 440 | config.opts.unstable_opts.translate_lang.clone(), | |
| 441 | config.opts.unstable_opts.translate_additional_ftl.as_deref(), | |
| 442 | config.opts.unstable_opts.translate_directionality_markers, | |
| 443 | ) { | |
| 444 | Ok(bundle) => bundle, | |
| 445 | Err(e) => early_dcx.early_fatal(format!("failed to load fluent bundle: {e}")), | |
| 446 | }; | |
| 447 | ||
| 448 | 438 | let mut sess = rustc_session::build_session( |
| 449 | 439 | config.opts, |
| 450 | 440 | CompilerIO { |
| ... | ... | @@ -453,7 +443,6 @@ pub fn run_compiler<R: Send>(config: Config, f: impl FnOnce(&Compiler) -> R + Se |
| 453 | 443 | output_file: config.output_file, |
| 454 | 444 | temps_dir, |
| 455 | 445 | }, |
| 456 | bundle, | |
| 457 | 446 | config.lint_caps, |
| 458 | 447 | target, |
| 459 | 448 | util::rustc_version_str().unwrap_or("unknown"), |
compiler/rustc_interface/src/tests.rs-2| ... | ... | @@ -71,7 +71,6 @@ where |
| 71 | 71 | let sess = build_session( |
| 72 | 72 | sessopts, |
| 73 | 73 | io, |
| 74 | None, | |
| 75 | 74 | Default::default(), |
| 76 | 75 | target, |
| 77 | 76 | "", |
| ... | ... | @@ -796,7 +795,6 @@ fn test_unstable_options_tracking_hash() { |
| 796 | 795 | tracked!(dwarf_version, Some(5)); |
| 797 | 796 | tracked!(embed_metadata, false); |
| 798 | 797 | tracked!(embed_source, true); |
| 799 | tracked!(emit_thin_lto, false); | |
| 800 | 798 | tracked!(emscripten_wasm_eh, false); |
| 801 | 799 | tracked!(export_executable_symbols, true); |
| 802 | 800 | tracked!(fewer_names, Some(true)); |
compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp+14-20| ... | ... | @@ -566,7 +566,7 @@ extern "C" LLVMRustResult LLVMRustOptimize( |
| 566 | 566 | LLVMModuleRef ModuleRef, LLVMTargetMachineRef TMRef, |
| 567 | 567 | LLVMRustPassBuilderOptLevel OptLevelRust, LLVMRustOptStage OptStage, |
| 568 | 568 | bool IsLinkerPluginLTO, bool NoPrepopulatePasses, bool VerifyIR, |
| 569 | bool LintIR, LLVMRustThinLTOBuffer **ThinLTOBufferRef, bool EmitThinLTO, | |
| 569 | bool LintIR, LLVMRustThinLTOBuffer **ThinLTOBufferRef, | |
| 570 | 570 | bool EmitThinLTOSummary, bool MergeFunctions, bool UnrollLoops, |
| 571 | 571 | bool SLPVectorize, bool LoopVectorize, bool DisableSimplifyLibCalls, |
| 572 | 572 | bool EmitLifetimeMarkers, registerEnzymeAndPassPipelineFn EnzymePtr, |
| ... | ... | @@ -808,31 +808,26 @@ extern "C" LLVMRustResult LLVMRustOptimize( |
| 808 | 808 | } |
| 809 | 809 | |
| 810 | 810 | ModulePassManager MPM; |
| 811 | bool NeedThinLTOBufferPasses = EmitThinLTO; | |
| 811 | bool NeedThinLTOBufferPasses = true; | |
| 812 | 812 | auto ThinLTOBuffer = std::make_unique<LLVMRustThinLTOBuffer>(); |
| 813 | 813 | raw_string_ostream ThinLTODataOS(ThinLTOBuffer->data); |
| 814 | 814 | raw_string_ostream ThinLinkDataOS(ThinLTOBuffer->thin_link_data); |
| 815 | 815 | bool IsLTO = OptStage == LLVMRustOptStage::ThinLTO || |
| 816 | 816 | OptStage == LLVMRustOptStage::FatLTO; |
| 817 | 817 | if (!NoPrepopulatePasses) { |
| 818 | for (const auto &C : PipelineStartEPCallbacks) | |
| 819 | PB.registerPipelineStartEPCallback(C); | |
| 820 | for (const auto &C : OptimizerLastEPCallbacks) | |
| 821 | PB.registerOptimizerLastEPCallback(C); | |
| 822 | ||
| 818 | 823 | // The pre-link pipelines don't support O0 and require using |
| 819 | 824 | // buildO0DefaultPipeline() instead. At the same time, the LTO pipelines do |
| 820 | 825 | // support O0 and using them is required. |
| 821 | 826 | if (OptLevel == OptimizationLevel::O0 && !IsLTO) { |
| 822 | for (const auto &C : PipelineStartEPCallbacks) | |
| 823 | PB.registerPipelineStartEPCallback(C); | |
| 824 | for (const auto &C : OptimizerLastEPCallbacks) | |
| 825 | PB.registerOptimizerLastEPCallback(C); | |
| 826 | ||
| 827 | 827 | // We manually schedule ThinLTOBufferPasses below, so don't pass the value |
| 828 | 828 | // to enable it here. |
| 829 | 829 | MPM = PB.buildO0DefaultPipeline(OptLevel); |
| 830 | 830 | } else { |
| 831 | for (const auto &C : PipelineStartEPCallbacks) | |
| 832 | PB.registerPipelineStartEPCallback(C); | |
| 833 | for (const auto &C : OptimizerLastEPCallbacks) | |
| 834 | PB.registerOptimizerLastEPCallback(C); | |
| 835 | ||
| 836 | 831 | switch (OptStage) { |
| 837 | 832 | case LLVMRustOptStage::PreLinkNoLTO: |
| 838 | 833 | if (ThinLTOBufferRef) { |
| ... | ... | @@ -840,12 +835,8 @@ extern "C" LLVMRustResult LLVMRustOptimize( |
| 840 | 835 | // bitcode for embedding is obtained after performing |
| 841 | 836 | // `ThinLTOPreLinkDefaultPipeline`. |
| 842 | 837 | MPM.addPass(PB.buildThinLTOPreLinkDefaultPipeline(OptLevel)); |
| 843 | if (EmitThinLTO) { | |
| 844 | MPM.addPass(ThinLTOBitcodeWriterPass( | |
| 845 | ThinLTODataOS, EmitThinLTOSummary ? &ThinLinkDataOS : nullptr)); | |
| 846 | } else { | |
| 847 | MPM.addPass(BitcodeWriterPass(ThinLTODataOS)); | |
| 848 | } | |
| 838 | MPM.addPass(ThinLTOBitcodeWriterPass( | |
| 839 | ThinLTODataOS, EmitThinLTOSummary ? &ThinLinkDataOS : nullptr)); | |
| 849 | 840 | *ThinLTOBufferRef = ThinLTOBuffer.release(); |
| 850 | 841 | MPM.addPass(PB.buildModuleOptimizationPipeline( |
| 851 | 842 | OptLevel, ThinOrFullLTOPhase::None)); |
| ... | ... | @@ -870,6 +861,7 @@ extern "C" LLVMRustResult LLVMRustOptimize( |
| 870 | 861 | break; |
| 871 | 862 | case LLVMRustOptStage::FatLTO: |
| 872 | 863 | MPM = PB.buildLTODefaultPipeline(OptLevel, nullptr); |
| 864 | NeedThinLTOBufferPasses = false; | |
| 873 | 865 | break; |
| 874 | 866 | } |
| 875 | 867 | } |
| ... | ... | @@ -895,9 +887,11 @@ extern "C" LLVMRustResult LLVMRustOptimize( |
| 895 | 887 | MPM.addPass(CanonicalizeAliasesPass()); |
| 896 | 888 | MPM.addPass(NameAnonGlobalPass()); |
| 897 | 889 | } |
| 898 | // For `-Copt-level=0`, ThinLTO, or LTO. | |
| 890 | // For `-Copt-level=0`, and the pre-link fat/thin LTO stages. | |
| 899 | 891 | if (ThinLTOBufferRef && *ThinLTOBufferRef == nullptr) { |
| 900 | if (EmitThinLTO) { | |
| 892 | // thin lto summaries prevent fat lto, so do not emit them if fat | |
| 893 | // lto is requested. See PR #136840 for background information. | |
| 894 | if (OptStage != LLVMRustOptStage::PreLinkFatLTO) { | |
| 901 | 895 | MPM.addPass(ThinLTOBitcodeWriterPass( |
| 902 | 896 | ThinLTODataOS, EmitThinLTOSummary ? &ThinLinkDataOS : nullptr)); |
| 903 | 897 | } else { |
compiler/rustc_mir_build/src/errors.rs-46| ... | ... | @@ -874,52 +874,6 @@ pub(crate) struct UpperRangeBoundCannotBeMin { |
| 874 | 874 | pub(crate) span: Span, |
| 875 | 875 | } |
| 876 | 876 | |
| 877 | #[derive(LintDiagnostic)] | |
| 878 | #[diag( | |
| 879 | "leading irrefutable {$count -> | |
| 880 | [one] pattern | |
| 881 | *[other] patterns | |
| 882 | } in let chain" | |
| 883 | )] | |
| 884 | #[note( | |
| 885 | "{$count -> | |
| 886 | [one] this pattern | |
| 887 | *[other] these patterns | |
| 888 | } will always match" | |
| 889 | )] | |
| 890 | #[help( | |
| 891 | "consider moving {$count -> | |
| 892 | [one] it | |
| 893 | *[other] them | |
| 894 | } outside of the construct" | |
| 895 | )] | |
| 896 | pub(crate) struct LeadingIrrefutableLetPatterns { | |
| 897 | pub(crate) count: usize, | |
| 898 | } | |
| 899 | ||
| 900 | #[derive(LintDiagnostic)] | |
| 901 | #[diag( | |
| 902 | "trailing irrefutable {$count -> | |
| 903 | [one] pattern | |
| 904 | *[other] patterns | |
| 905 | } in let chain" | |
| 906 | )] | |
| 907 | #[note( | |
| 908 | "{$count -> | |
| 909 | [one] this pattern | |
| 910 | *[other] these patterns | |
| 911 | } will always match" | |
| 912 | )] | |
| 913 | #[help( | |
| 914 | "consider moving {$count -> | |
| 915 | [one] it | |
| 916 | *[other] them | |
| 917 | } into the body" | |
| 918 | )] | |
| 919 | pub(crate) struct TrailingIrrefutableLetPatterns { | |
| 920 | pub(crate) count: usize, | |
| 921 | } | |
| 922 | ||
| 923 | 877 | #[derive(LintDiagnostic)] |
| 924 | 878 | #[diag("pattern binding `{$name}` is named the same as one of the variants of the type `{$ty_path}`", code = E0170)] |
| 925 | 879 | pub(crate) struct BindingsWithVariantName { |
compiler/rustc_mir_build/src/thir/pattern/check_match.rs+8-83| ... | ... | @@ -167,9 +167,9 @@ impl<'p, 'tcx> Visitor<'p, 'tcx> for MatchVisitor<'p, 'tcx> { |
| 167 | 167 | { |
| 168 | 168 | let mut chain_refutabilities = Vec::new(); |
| 169 | 169 | let Ok(()) = self.visit_land(ex, &mut chain_refutabilities) else { return }; |
| 170 | // If at least one of the operands is a `let ... = ...`. | |
| 171 | if chain_refutabilities.iter().any(|x| x.is_some()) { | |
| 172 | self.check_let_chain(chain_refutabilities, ex.span); | |
| 170 | // Lint only single irrefutable let binding. | |
| 171 | if let [Some((_, Irrefutable))] = chain_refutabilities[..] { | |
| 172 | self.lint_single_let(ex.span); | |
| 173 | 173 | } |
| 174 | 174 | return; |
| 175 | 175 | } |
| ... | ... | @@ -430,18 +430,9 @@ impl<'p, 'tcx> MatchVisitor<'p, 'tcx> { |
| 430 | 430 | assert!(self.let_source != LetSource::None); |
| 431 | 431 | let scrut = scrutinee.map(|id| &self.thir[id]); |
| 432 | 432 | if let LetSource::PlainLet = self.let_source { |
| 433 | self.check_binding_is_irrefutable(pat, "local binding", scrut, Some(span)) | |
| 434 | } else { | |
| 435 | let Ok(refutability) = self.is_let_irrefutable(pat, scrut) else { return }; | |
| 436 | if matches!(refutability, Irrefutable) { | |
| 437 | report_irrefutable_let_patterns( | |
| 438 | self.tcx, | |
| 439 | self.hir_source, | |
| 440 | self.let_source, | |
| 441 | 1, | |
| 442 | span, | |
| 443 | ); | |
| 444 | } | |
| 433 | self.check_binding_is_irrefutable(pat, "local binding", scrut, Some(span)); | |
| 434 | } else if let Ok(Irrefutable) = self.is_let_irrefutable(pat, scrut) { | |
| 435 | self.lint_single_let(span); | |
| 445 | 436 | } |
| 446 | 437 | } |
| 447 | 438 | |
| ... | ... | @@ -549,74 +540,8 @@ impl<'p, 'tcx> MatchVisitor<'p, 'tcx> { |
| 549 | 540 | } |
| 550 | 541 | |
| 551 | 542 | #[instrument(level = "trace", skip(self))] |
| 552 | fn check_let_chain( | |
| 553 | &mut self, | |
| 554 | chain_refutabilities: Vec<Option<(Span, RefutableFlag)>>, | |
| 555 | whole_chain_span: Span, | |
| 556 | ) { | |
| 557 | assert!(self.let_source != LetSource::None); | |
| 558 | ||
| 559 | if chain_refutabilities.iter().all(|r| matches!(*r, Some((_, Irrefutable)))) { | |
| 560 | // The entire chain is made up of irrefutable `let` statements | |
| 561 | report_irrefutable_let_patterns( | |
| 562 | self.tcx, | |
| 563 | self.hir_source, | |
| 564 | self.let_source, | |
| 565 | chain_refutabilities.len(), | |
| 566 | whole_chain_span, | |
| 567 | ); | |
| 568 | return; | |
| 569 | } | |
| 570 | ||
| 571 | if let Some(until) = | |
| 572 | chain_refutabilities.iter().position(|r| !matches!(*r, Some((_, Irrefutable)))) | |
| 573 | && until > 0 | |
| 574 | { | |
| 575 | // The chain has a non-zero prefix of irrefutable `let` statements. | |
| 576 | ||
| 577 | // Check if the let source is while, for there is no alternative place to put a prefix, | |
| 578 | // and we shouldn't lint. | |
| 579 | // For let guards inside a match, prefixes might use bindings of the match pattern, | |
| 580 | // so can't always be moved out. | |
| 581 | // For `else if let`, an extra indentation level would be required to move the bindings. | |
| 582 | // FIXME: Add checking whether the bindings are actually used in the prefix, | |
| 583 | // and lint if they are not. | |
| 584 | if !matches!( | |
| 585 | self.let_source, | |
| 586 | LetSource::WhileLet | LetSource::IfLetGuard | LetSource::ElseIfLet | |
| 587 | ) { | |
| 588 | // Emit the lint | |
| 589 | let prefix = &chain_refutabilities[..until]; | |
| 590 | let span_start = prefix[0].unwrap().0; | |
| 591 | let span_end = prefix.last().unwrap().unwrap().0; | |
| 592 | let span = span_start.to(span_end); | |
| 593 | let count = prefix.len(); | |
| 594 | self.tcx.emit_node_span_lint( | |
| 595 | IRREFUTABLE_LET_PATTERNS, | |
| 596 | self.hir_source, | |
| 597 | span, | |
| 598 | LeadingIrrefutableLetPatterns { count }, | |
| 599 | ); | |
| 600 | } | |
| 601 | } | |
| 602 | ||
| 603 | if let Some(from) = | |
| 604 | chain_refutabilities.iter().rposition(|r| !matches!(*r, Some((_, Irrefutable)))) | |
| 605 | && from != (chain_refutabilities.len() - 1) | |
| 606 | { | |
| 607 | // The chain has a non-empty suffix of irrefutable `let` statements | |
| 608 | let suffix = &chain_refutabilities[from + 1..]; | |
| 609 | let span_start = suffix[0].unwrap().0; | |
| 610 | let span_end = suffix.last().unwrap().unwrap().0; | |
| 611 | let span = span_start.to(span_end); | |
| 612 | let count = suffix.len(); | |
| 613 | self.tcx.emit_node_span_lint( | |
| 614 | IRREFUTABLE_LET_PATTERNS, | |
| 615 | self.hir_source, | |
| 616 | span, | |
| 617 | TrailingIrrefutableLetPatterns { count }, | |
| 618 | ); | |
| 619 | } | |
| 543 | fn lint_single_let(&mut self, let_span: Span) { | |
| 544 | report_irrefutable_let_patterns(self.tcx, self.hir_source, self.let_source, 1, let_span); | |
| 620 | 545 | } |
| 621 | 546 | |
| 622 | 547 | fn analyze_binding( |
compiler/rustc_mir_transform/src/check_alignment.rs+1-1| ... | ... | @@ -82,7 +82,7 @@ fn insert_alignment_check<'tcx>( |
| 82 | 82 | |
| 83 | 83 | // If this target does not have reliable alignment, further limit the mask by anding it with |
| 84 | 84 | // the mask for the highest reliable alignment. |
| 85 | #[allow(irrefutable_let_patterns)] | |
| 85 | #[cfg_attr(bootstrap, expect(irrefutable_let_patterns))] | |
| 86 | 86 | if let max_align = tcx.sess.target.max_reliable_alignment() |
| 87 | 87 | && max_align < Align::MAX |
| 88 | 88 | { |
compiler/rustc_parse/src/parser/tests.rs+1-3| ... | ... | @@ -13,7 +13,6 @@ use rustc_ast_pretty::pprust::item_to_string; |
| 13 | 13 | use rustc_data_structures::assert_matches; |
| 14 | 14 | use rustc_errors::annotate_snippet_emitter_writer::AnnotateSnippetEmitter; |
| 15 | 15 | use rustc_errors::emitter::OutputTheme; |
| 16 | use rustc_errors::translation::Translator; | |
| 17 | 16 | use rustc_errors::{AutoStream, DiagCtxt, MultiSpan, PResult}; |
| 18 | 17 | use rustc_session::parse::ParseSess; |
| 19 | 18 | use rustc_span::source_map::{FilePathMapping, SourceMap}; |
| ... | ... | @@ -42,11 +41,10 @@ fn string_to_parser(psess: &ParseSess, source_str: String) -> Parser<'_> { |
| 42 | 41 | fn create_test_handler(theme: OutputTheme) -> (DiagCtxt, Arc<SourceMap>, Arc<Mutex<Vec<u8>>>) { |
| 43 | 42 | let output = Arc::new(Mutex::new(Vec::new())); |
| 44 | 43 | let source_map = Arc::new(SourceMap::new(FilePathMapping::empty())); |
| 45 | let translator = Translator::new(); | |
| 46 | 44 | let shared: Box<dyn Write + Send> = Box::new(Shared { data: output.clone() }); |
| 47 | 45 | let auto_stream = AutoStream::never(shared); |
| 48 | 46 | let dcx = DiagCtxt::new(Box::new( |
| 49 | AnnotateSnippetEmitter::new(auto_stream, translator) | |
| 47 | AnnotateSnippetEmitter::new(auto_stream) | |
| 50 | 48 | .sm(Some(source_map.clone())) |
| 51 | 49 | .diagnostic_width(Some(140)) |
| 52 | 50 | .theme(theme), |
compiler/rustc_public/src/compiler_interface.rs+3-3| ... | ... | @@ -562,12 +562,12 @@ impl<'tcx> CompilerInterface<'tcx> { |
| 562 | 562 | cnst.internal(&mut *tables, cx.tcx).to_string() |
| 563 | 563 | } |
| 564 | 564 | |
| 565 | /// `Span` of an item. | |
| 566 | pub(crate) fn span_of_an_item(&self, def_id: DefId) -> Span { | |
| 565 | /// `Span` of a `DefId`. | |
| 566 | pub(crate) fn span_of_a_def(&self, def_id: DefId) -> Span { | |
| 567 | 567 | let mut tables = self.tables.borrow_mut(); |
| 568 | 568 | let cx = &*self.cx.borrow(); |
| 569 | 569 | let did = tables[def_id]; |
| 570 | cx.span_of_an_item(did).stable(&mut *tables, cx) | |
| 570 | cx.span_of_a_def(did).stable(&mut *tables, cx) | |
| 571 | 571 | } |
| 572 | 572 | |
| 573 | 573 | pub(crate) fn ty_const_pretty(&self, ct: TyConstId) -> String { |
compiler/rustc_public/src/crate_def.rs+5-2| ... | ... | @@ -34,6 +34,10 @@ impl DefId { |
| 34 | 34 | pub fn parent(&self) -> Option<DefId> { |
| 35 | 35 | with(|cx| cx.def_parent(*self)) |
| 36 | 36 | } |
| 37 | ||
| 38 | pub fn span(&self) -> Span { | |
| 39 | with(|cx| cx.span_of_a_def(*self)) | |
| 40 | } | |
| 37 | 41 | } |
| 38 | 42 | |
| 39 | 43 | /// A trait for retrieving information about a particular definition. |
| ... | ... | @@ -68,8 +72,7 @@ pub trait CrateDef { |
| 68 | 72 | |
| 69 | 73 | /// Return the span of this definition. |
| 70 | 74 | fn span(&self) -> Span { |
| 71 | let def_id = self.def_id(); | |
| 72 | with(|cx| cx.span_of_an_item(def_id)) | |
| 75 | self.def_id().span() | |
| 73 | 76 | } |
| 74 | 77 | |
| 75 | 78 | /// Return registered tool attributes with the given attribute name. |
compiler/rustc_public/src/lib.rs+1-1| ... | ... | @@ -155,7 +155,7 @@ impl CrateItem { |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | pub fn span(&self) -> Span { |
| 158 | with(|cx| cx.span_of_an_item(self.0)) | |
| 158 | self.0.span() | |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | pub fn kind(&self) -> ItemKind { |
compiler/rustc_public/src/unstable/convert/stable/mod.rs+12| ... | ... | @@ -82,6 +82,18 @@ impl<'tcx> Stable<'tcx> for rustc_span::Symbol { |
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | impl<'tcx> Stable<'tcx> for rustc_span::def_id::DefId { | |
| 86 | type T = crate::DefId; | |
| 87 | ||
| 88 | fn stable<'cx>( | |
| 89 | &self, | |
| 90 | tables: &mut Tables<'cx, BridgeTys>, | |
| 91 | _: &CompilerCtxt<'cx, BridgeTys>, | |
| 92 | ) -> Self::T { | |
| 93 | tables.create_def_id(*self) | |
| 94 | } | |
| 95 | } | |
| 96 | ||
| 85 | 97 | impl<'tcx> Stable<'tcx> for rustc_span::Span { |
| 86 | 98 | type T = crate::ty::Span; |
| 87 | 99 |
compiler/rustc_public_bridge/src/context/impls.rs+2-2| ... | ... | @@ -554,8 +554,8 @@ impl<'tcx, B: Bridge> CompilerCtxt<'tcx, B> { |
| 554 | 554 | ) |
| 555 | 555 | } |
| 556 | 556 | |
| 557 | /// `Span` of an item. | |
| 558 | pub fn span_of_an_item(&self, def_id: DefId) -> Span { | |
| 557 | /// `Span` of a `DefId`. | |
| 558 | pub fn span_of_a_def(&self, def_id: DefId) -> Span { | |
| 559 | 559 | self.tcx.def_span(def_id) |
| 560 | 560 | } |
| 561 | 561 |
compiler/rustc_resolve/src/build_reduced_graph.rs+80-97| ... | ... | @@ -620,97 +620,103 @@ impl<'a, 'ra, 'tcx> BuildReducedGraphVisitor<'a, 'ra, 'tcx> { |
| 620 | 620 | let prefix = crate_root.into_iter().chain(prefix_iter).collect::<Vec<_>>(); |
| 621 | 621 | debug!("build_reduced_graph_for_use_tree: prefix={:?}", prefix); |
| 622 | 622 | |
| 623 | let empty_for_self = |prefix: &[Segment]| { | |
| 624 | prefix.is_empty() || prefix.len() == 1 && prefix[0].ident.name == kw::PathRoot | |
| 625 | }; | |
| 626 | 623 | match use_tree.kind { |
| 627 | 624 | ast::UseTreeKind::Simple(rename) => { |
| 628 | 625 | let mut ident = use_tree.ident(); |
| 629 | 626 | let mut module_path = prefix; |
| 630 | 627 | let mut source = module_path.pop().unwrap(); |
| 631 | let mut type_ns_only = false; | |
| 632 | 628 | |
| 633 | if nested { | |
| 634 | // Correctly handle `self` | |
| 635 | if source.ident.name == kw::SelfLower { | |
| 636 | type_ns_only = true; | |
| 629 | // `true` for `...::{self [as target]}` imports, `false` otherwise. | |
| 630 | let type_ns_only = nested && source.ident.name == kw::SelfLower; | |
| 637 | 631 | |
| 638 | if empty_for_self(&module_path) { | |
| 639 | self.r.report_error( | |
| 640 | use_tree.span, | |
| 641 | ResolutionError::SelfImportOnlyInImportListWithNonEmptyPrefix, | |
| 632 | match source.ident.name { | |
| 633 | kw::DollarCrate => { | |
| 634 | if !module_path.is_empty() { | |
| 635 | self.r.dcx().span_err( | |
| 636 | source.ident.span, | |
| 637 | "`$crate` in paths can only be used in start position", | |
| 642 | 638 | ); |
| 643 | 639 | return; |
| 644 | 640 | } |
| 645 | ||
| 646 | // Replace `use foo::{ self };` with `use foo;` | |
| 647 | let self_span = source.ident.span; | |
| 648 | source = module_path.pop().unwrap(); | |
| 649 | if rename.is_none() { | |
| 650 | // Keep the span of `self`, but the name of `foo` | |
| 651 | ident = Ident::new(source.ident.name, self_span); | |
| 641 | } | |
| 642 | kw::Crate => { | |
| 643 | if !module_path.is_empty() { | |
| 644 | self.r.dcx().span_err( | |
| 645 | source.ident.span, | |
| 646 | "`crate` in paths can only be used in start position", | |
| 647 | ); | |
| 648 | return; | |
| 652 | 649 | } |
| 653 | 650 | } |
| 654 | } else { | |
| 655 | // Disallow `self` | |
| 656 | if source.ident.name == kw::SelfLower { | |
| 657 | let parent = module_path.last(); | |
| 658 | ||
| 659 | let span = match parent { | |
| 660 | // only `::self` from `use foo::self as bar` | |
| 661 | Some(seg) => seg.ident.span.shrink_to_hi().to(source.ident.span), | |
| 662 | None => source.ident.span, | |
| 663 | }; | |
| 664 | let span_with_rename = match rename { | |
| 665 | // only `self as bar` from `use foo::self as bar` | |
| 666 | Some(rename) => source.ident.span.to(rename.span), | |
| 667 | None => source.ident.span, | |
| 668 | }; | |
| 669 | self.r.report_error( | |
| 670 | span, | |
| 671 | ResolutionError::SelfImportsOnlyAllowedWithin { | |
| 672 | root: parent.is_none(), | |
| 673 | span_with_rename, | |
| 674 | }, | |
| 675 | ); | |
| 676 | ||
| 677 | // Error recovery: replace `use foo::self;` with `use foo;` | |
| 651 | kw::Super => { | |
| 652 | // Allow `self::super` as a valid prefix - `self` at position 0 | |
| 653 | // followed by any number of `super` segments. | |
| 654 | let valid_prefix = module_path.iter().enumerate().all(|(i, seg)| { | |
| 655 | let name = seg.ident.name; | |
| 656 | name == kw::Super || (name == kw::SelfLower && i == 0) | |
| 657 | }); | |
| 658 | ||
| 659 | if !valid_prefix { | |
| 660 | self.r.dcx().span_err( | |
| 661 | source.ident.span, | |
| 662 | "`super` in paths can only be used in start position, after `self`, or after another `super`", | |
| 663 | ); | |
| 664 | return; | |
| 665 | } | |
| 666 | } | |
| 667 | kw::SelfLower => { | |
| 678 | 668 | if let Some(parent) = module_path.pop() { |
| 669 | // Suggest `use prefix::{self};` for `use prefix::self;` | |
| 670 | if !type_ns_only | |
| 671 | && (parent.ident.name != kw::PathRoot | |
| 672 | || self.r.path_root_is_crate_root(parent.ident)) | |
| 673 | { | |
| 674 | let span_with_rename = match rename { | |
| 675 | Some(rename) => source.ident.span.to(rename.span), | |
| 676 | None => source.ident.span, | |
| 677 | }; | |
| 678 | ||
| 679 | self.r.report_error( | |
| 680 | parent.ident.span.shrink_to_hi().to(source.ident.span), | |
| 681 | ResolutionError::SelfImportsOnlyAllowedWithin { | |
| 682 | root: parent.ident.name == kw::PathRoot, | |
| 683 | span_with_rename, | |
| 684 | }, | |
| 685 | ); | |
| 686 | } | |
| 687 | ||
| 688 | let self_span = source.ident.span; | |
| 679 | 689 | source = parent; |
| 680 | 690 | if rename.is_none() { |
| 681 | ident = source.ident; | |
| 691 | ident = Ident::new(source.ident.name, self_span); | |
| 682 | 692 | } |
| 683 | 693 | } |
| 684 | 694 | } |
| 695 | _ => {} | |
| 696 | } | |
| 685 | 697 | |
| 686 | // Disallow `use $crate;` | |
| 687 | if source.ident.name == kw::DollarCrate && module_path.is_empty() { | |
| 688 | let crate_root = self.r.resolve_crate_root(source.ident); | |
| 689 | let crate_name = match crate_root.kind { | |
| 690 | ModuleKind::Def(.., name) => name, | |
| 691 | ModuleKind::Block => unreachable!(), | |
| 692 | }; | |
| 693 | // HACK(eddyb) unclear how good this is, but keeping `$crate` | |
| 694 | // in `source` breaks `tests/ui/imports/import-crate-var.rs`, | |
| 695 | // while the current crate doesn't have a valid `crate_name`. | |
| 696 | if let Some(crate_name) = crate_name { | |
| 697 | // `crate_name` should not be interpreted as relative. | |
| 698 | module_path.push(Segment::from_ident_and_id( | |
| 699 | Ident::new(kw::PathRoot, source.ident.span), | |
| 700 | self.r.next_node_id(), | |
| 701 | )); | |
| 702 | source.ident.name = crate_name; | |
| 703 | } | |
| 704 | if rename.is_none() { | |
| 705 | ident.name = sym::dummy; | |
| 706 | } | |
| 707 | ||
| 708 | self.r.dcx().emit_err(errors::CrateImported { span: item.span }); | |
| 709 | } | |
| 698 | // Deny `use ::{self};` after edition 2015 | |
| 699 | if source.ident.name == kw::PathRoot | |
| 700 | && !self.r.path_root_is_crate_root(source.ident) | |
| 701 | { | |
| 702 | self.r.dcx().span_err(use_tree.span, "extern prelude cannot be imported"); | |
| 703 | return; | |
| 710 | 704 | } |
| 711 | 705 | |
| 712 | if ident.name == kw::Crate { | |
| 713 | self.r.dcx().emit_err(errors::UnnamedCrateRootImport { span: ident.span }); | |
| 706 | // Deny importing path-kw without renaming | |
| 707 | if rename.is_none() && ident.is_path_segment_keyword() { | |
| 708 | let ident = use_tree.ident(); | |
| 709 | ||
| 710 | // Don't suggest `use xx::self as name;` for `use xx::self;` | |
| 711 | // But it's OK to suggest `use xx::{self as name};` for `use xx::{self};` | |
| 712 | let sugg = if !type_ns_only && ident.name == kw::SelfLower { | |
| 713 | None | |
| 714 | } else { | |
| 715 | Some(errors::UnnamedImportSugg { span: ident.span, ident }) | |
| 716 | }; | |
| 717 | ||
| 718 | self.r.dcx().emit_err(errors::UnnamedImport { span: ident.span, sugg }); | |
| 719 | return; | |
| 714 | 720 | } |
| 715 | 721 | |
| 716 | 722 | let kind = ImportKind::Single { |
| ... | ... | @@ -740,32 +746,6 @@ impl<'a, 'ra, 'tcx> BuildReducedGraphVisitor<'a, 'ra, 'tcx> { |
| 740 | 746 | } |
| 741 | 747 | } |
| 742 | 748 | ast::UseTreeKind::Nested { ref items, .. } => { |
| 743 | // Ensure there is at most one `self` in the list | |
| 744 | let self_spans = items | |
| 745 | .iter() | |
| 746 | .filter_map(|(use_tree, _)| { | |
| 747 | if let ast::UseTreeKind::Simple(..) = use_tree.kind | |
| 748 | && use_tree.ident().name == kw::SelfLower | |
| 749 | { | |
| 750 | return Some(use_tree.span); | |
| 751 | } | |
| 752 | ||
| 753 | None | |
| 754 | }) | |
| 755 | .collect::<Vec<_>>(); | |
| 756 | if self_spans.len() > 1 { | |
| 757 | let mut e = self.r.into_struct_error( | |
| 758 | self_spans[0], | |
| 759 | ResolutionError::SelfImportCanOnlyAppearOnceInTheList, | |
| 760 | ); | |
| 761 | ||
| 762 | for other_span in self_spans.iter().skip(1) { | |
| 763 | e.span_label(*other_span, "another `self` import appears here"); | |
| 764 | } | |
| 765 | ||
| 766 | e.emit(); | |
| 767 | } | |
| 768 | ||
| 769 | 749 | for &(ref tree, id) in items { |
| 770 | 750 | self.build_reduced_graph_for_use_tree( |
| 771 | 751 | // This particular use tree |
| ... | ... | @@ -777,7 +757,10 @@ impl<'a, 'ra, 'tcx> BuildReducedGraphVisitor<'a, 'ra, 'tcx> { |
| 777 | 757 | // Empty groups `a::b::{}` are turned into synthetic `self` imports |
| 778 | 758 | // `a::b::c::{self as _}`, so that their prefixes are correctly |
| 779 | 759 | // resolved and checked for privacy/stability/etc. |
| 780 | if items.is_empty() && !empty_for_self(&prefix) { | |
| 760 | if items.is_empty() | |
| 761 | && !prefix.is_empty() | |
| 762 | && (prefix.len() > 1 || prefix[0].ident.name != kw::PathRoot) | |
| 763 | { | |
| 781 | 764 | let new_span = prefix[prefix.len() - 1].ident.span; |
| 782 | 765 | let tree = ast::UseTree { |
| 783 | 766 | prefix: ast::Path::from_ident(Ident::new(kw::SelfLower, new_span)), |
compiler/rustc_resolve/src/diagnostics.rs-6| ... | ... | @@ -893,12 +893,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { |
| 893 | 893 | mpart_suggestion, |
| 894 | 894 | }) |
| 895 | 895 | } |
| 896 | ResolutionError::SelfImportCanOnlyAppearOnceInTheList => { | |
| 897 | self.dcx().create_err(errs::SelfImportCanOnlyAppearOnceInTheList { span }) | |
| 898 | } | |
| 899 | ResolutionError::SelfImportOnlyInImportListWithNonEmptyPrefix => { | |
| 900 | self.dcx().create_err(errs::SelfImportOnlyInImportListWithNonEmptyPrefix { span }) | |
| 901 | } | |
| 902 | 896 | ResolutionError::FailedToResolve { segment, label, suggestion, module, message } => { |
| 903 | 897 | let mut err = struct_span_code_err!(self.dcx(), span, E0433, "{message}"); |
| 904 | 898 | err.span_label(span, label); |
compiler/rustc_resolve/src/errors.rs+16-25| ... | ... | @@ -248,22 +248,6 @@ pub(crate) struct UnreachableLabelWithSimilarNameExists { |
| 248 | 248 | pub(crate) ident_span: Span, |
| 249 | 249 | } |
| 250 | 250 | |
| 251 | #[derive(Diagnostic)] | |
| 252 | #[diag("`self` import can only appear once in an import list", code = E0430)] | |
| 253 | pub(crate) struct SelfImportCanOnlyAppearOnceInTheList { | |
| 254 | #[primary_span] | |
| 255 | #[label("can only appear once in an import list")] | |
| 256 | pub(crate) span: Span, | |
| 257 | } | |
| 258 | ||
| 259 | #[derive(Diagnostic)] | |
| 260 | #[diag("`self` import can only appear in an import list with a non-empty prefix", code = E0431)] | |
| 261 | pub(crate) struct SelfImportOnlyInImportListWithNonEmptyPrefix { | |
| 262 | #[primary_span] | |
| 263 | #[label("can only appear in an import list with a non-empty prefix")] | |
| 264 | pub(crate) span: Span, | |
| 265 | } | |
| 266 | ||
| 267 | 251 | #[derive(Diagnostic)] |
| 268 | 252 | #[diag("can't capture dynamic environment in a fn item", code = E0434)] |
| 269 | 253 | #[help("use the `|| {\"{\"} ... {\"}\"}` closure form instead")] |
| ... | ... | @@ -638,13 +622,6 @@ pub(crate) struct MacroExpandedMacroExportsAccessedByAbsolutePaths { |
| 638 | 622 | pub definition: Span, |
| 639 | 623 | } |
| 640 | 624 | |
| 641 | #[derive(Diagnostic)] | |
| 642 | #[diag("`$crate` may not be imported")] | |
| 643 | pub(crate) struct CrateImported { | |
| 644 | #[primary_span] | |
| 645 | pub(crate) span: Span, | |
| 646 | } | |
| 647 | ||
| 648 | 625 | #[derive(Diagnostic)] |
| 649 | 626 | #[diag("`#[macro_use]` is not supported on `extern crate self`")] |
| 650 | 627 | pub(crate) struct MacroUseExternCrateSelf { |
| ... | ... | @@ -973,11 +950,25 @@ pub(crate) struct ArgumentsMacroUseNotAllowed { |
| 973 | 950 | pub(crate) span: Span, |
| 974 | 951 | } |
| 975 | 952 | |
| 953 | #[derive(Subdiagnostic)] | |
| 954 | #[multipart_suggestion( | |
| 955 | "try renaming it with a name", | |
| 956 | applicability = "maybe-incorrect", | |
| 957 | style = "verbose" | |
| 958 | )] | |
| 959 | pub(crate) struct UnnamedImportSugg { | |
| 960 | #[suggestion_part(code = "{ident} as name")] | |
| 961 | pub(crate) span: Span, | |
| 962 | pub(crate) ident: Ident, | |
| 963 | } | |
| 964 | ||
| 976 | 965 | #[derive(Diagnostic)] |
| 977 | #[diag("crate root imports need to be explicitly named: `use crate as name;`")] | |
| 978 | pub(crate) struct UnnamedCrateRootImport { | |
| 966 | #[diag("imports need to be explicitly named")] | |
| 967 | pub(crate) struct UnnamedImport { | |
| 979 | 968 | #[primary_span] |
| 980 | 969 | pub(crate) span: Span, |
| 970 | #[subdiagnostic] | |
| 971 | pub(crate) sugg: Option<UnnamedImportSugg>, | |
| 981 | 972 | } |
| 982 | 973 | |
| 983 | 974 | #[derive(Diagnostic)] |
compiler/rustc_resolve/src/ident.rs+48-13| ... | ... | @@ -923,6 +923,23 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { |
| 923 | 923 | self.resolve_ident_in_module(module, ident, ns, parent_scope, None, None, ignore_import) |
| 924 | 924 | } |
| 925 | 925 | |
| 926 | fn resolve_super_in_module( | |
| 927 | &self, | |
| 928 | ident: Ident, | |
| 929 | module: Option<Module<'ra>>, | |
| 930 | parent_scope: &ParentScope<'ra>, | |
| 931 | ) -> Option<Module<'ra>> { | |
| 932 | let mut ctxt = ident.span.ctxt().normalize_to_macros_2_0(); | |
| 933 | module | |
| 934 | .unwrap_or_else(|| self.resolve_self(&mut ctxt, parent_scope.module)) | |
| 935 | .parent | |
| 936 | .map(|parent| self.resolve_self(&mut ctxt, parent)) | |
| 937 | } | |
| 938 | ||
| 939 | pub(crate) fn path_root_is_crate_root(&self, ident: Ident) -> bool { | |
| 940 | ident.name == kw::PathRoot && ident.span.is_rust_2015() && self.tcx.sess.is_rust_2015() | |
| 941 | } | |
| 942 | ||
| 926 | 943 | #[instrument(level = "debug", skip(self))] |
| 927 | 944 | pub(crate) fn resolve_ident_in_module<'r>( |
| 928 | 945 | self: CmResolver<'r, 'ra, 'tcx>, |
| ... | ... | @@ -936,6 +953,14 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { |
| 936 | 953 | ) -> Result<Decl<'ra>, Determinacy> { |
| 937 | 954 | match module { |
| 938 | 955 | ModuleOrUniformRoot::Module(module) => { |
| 956 | if ns == TypeNS | |
| 957 | && ident.name == kw::Super | |
| 958 | && let Some(module) = | |
| 959 | self.resolve_super_in_module(ident, Some(module), parent_scope) | |
| 960 | { | |
| 961 | return Ok(module.self_decl.unwrap()); | |
| 962 | } | |
| 963 | ||
| 939 | 964 | let (ident_key, def) = IdentKey::new_adjusted(ident, module.expansion); |
| 940 | 965 | let adjusted_parent_scope = match def { |
| 941 | 966 | Some(def) => ParentScope { module: self.expn_def_scope(def), ..*parent_scope }, |
| ... | ... | @@ -976,7 +1001,21 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { |
| 976 | 1001 | } |
| 977 | 1002 | ModuleOrUniformRoot::CurrentScope => { |
| 978 | 1003 | if ns == TypeNS { |
| 979 | if ident.name == kw::Crate || ident.name == kw::DollarCrate { | |
| 1004 | if ident.name == kw::SelfLower { | |
| 1005 | let mut ctxt = ident.span.ctxt().normalize_to_macros_2_0(); | |
| 1006 | let module = self.resolve_self(&mut ctxt, parent_scope.module); | |
| 1007 | return Ok(module.self_decl.unwrap()); | |
| 1008 | } | |
| 1009 | if ident.name == kw::Super | |
| 1010 | && let Some(module) = | |
| 1011 | self.resolve_super_in_module(ident, None, parent_scope) | |
| 1012 | { | |
| 1013 | return Ok(module.self_decl.unwrap()); | |
| 1014 | } | |
| 1015 | if ident.name == kw::Crate | |
| 1016 | || ident.name == kw::DollarCrate | |
| 1017 | || self.path_root_is_crate_root(ident) | |
| 1018 | { | |
| 980 | 1019 | let module = self.resolve_crate_root(ident); |
| 981 | 1020 | return Ok(module.self_decl.unwrap()); |
| 982 | 1021 | } else if ident.name == kw::Super || ident.name == kw::SelfLower { |
| ... | ... | @@ -1754,19 +1793,15 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { |
| 1754 | 1793 | |
| 1755 | 1794 | if ns == TypeNS { |
| 1756 | 1795 | if allow_super && name == kw::Super { |
| 1757 | let mut ctxt = ident.span.ctxt().normalize_to_macros_2_0(); | |
| 1758 | let self_module = match segment_idx { | |
| 1759 | 0 => Some(self.resolve_self(&mut ctxt, parent_scope.module)), | |
| 1760 | _ => match module { | |
| 1761 | Some(ModuleOrUniformRoot::Module(module)) => Some(module), | |
| 1762 | _ => None, | |
| 1763 | }, | |
| 1796 | let parent = if segment_idx == 0 { | |
| 1797 | self.resolve_super_in_module(ident, None, parent_scope) | |
| 1798 | } else if let Some(ModuleOrUniformRoot::Module(module)) = module { | |
| 1799 | self.resolve_super_in_module(ident, Some(module), parent_scope) | |
| 1800 | } else { | |
| 1801 | None | |
| 1764 | 1802 | }; |
| 1765 | if let Some(self_module) = self_module | |
| 1766 | && let Some(parent) = self_module.parent | |
| 1767 | { | |
| 1768 | module = | |
| 1769 | Some(ModuleOrUniformRoot::Module(self.resolve_self(&mut ctxt, parent))); | |
| 1803 | if let Some(parent) = parent { | |
| 1804 | module = Some(ModuleOrUniformRoot::Module(parent)); | |
| 1770 | 1805 | continue; |
| 1771 | 1806 | } |
| 1772 | 1807 | return PathResult::failed( |
compiler/rustc_resolve/src/lib.rs-14| ... | ... | @@ -274,10 +274,6 @@ enum ResolutionError<'ra> { |
| 274 | 274 | UndeclaredLabel { name: Symbol, suggestion: Option<LabelSuggestion> }, |
| 275 | 275 | /// Error E0429: `self` imports are only allowed within a `{ }` list. |
| 276 | 276 | SelfImportsOnlyAllowedWithin { root: bool, span_with_rename: Span }, |
| 277 | /// Error E0430: `self` import can only appear once in the list. | |
| 278 | SelfImportCanOnlyAppearOnceInTheList, | |
| 279 | /// Error E0431: `self` import can only appear in an import list with a non-empty prefix. | |
| 280 | SelfImportOnlyInImportListWithNonEmptyPrefix, | |
| 281 | 277 | /// Error E0433: failed to resolve. |
| 282 | 278 | FailedToResolve { |
| 283 | 279 | segment: Symbol, |
| ... | ... | @@ -378,16 +374,6 @@ impl Segment { |
| 378 | 374 | } |
| 379 | 375 | } |
| 380 | 376 | |
| 381 | fn from_ident_and_id(ident: Ident, id: NodeId) -> Segment { | |
| 382 | Segment { | |
| 383 | ident, | |
| 384 | id: Some(id), | |
| 385 | has_generic_args: false, | |
| 386 | has_lifetime_args: false, | |
| 387 | args_span: DUMMY_SP, | |
| 388 | } | |
| 389 | } | |
| 390 | ||
| 391 | 377 | fn names_to_string(segments: &[Segment]) -> String { |
| 392 | 378 | names_to_string(segments.iter().map(|seg| seg.ident.name)) |
| 393 | 379 | } |
compiler/rustc_session/src/options.rs+1-24| ... | ... | @@ -7,7 +7,7 @@ use rustc_abi::Align; |
| 7 | 7 | use rustc_data_structures::fx::FxIndexMap; |
| 8 | 8 | use rustc_data_structures::profiling::TimePassesFormat; |
| 9 | 9 | use rustc_data_structures::stable_hasher::StableHasher; |
| 10 | use rustc_errors::{ColorConfig, LanguageIdentifier, TerminalUrl}; | |
| 10 | use rustc_errors::{ColorConfig, TerminalUrl}; | |
| 11 | 11 | use rustc_feature::UnstableFeatures; |
| 12 | 12 | use rustc_hashes::Hash64; |
| 13 | 13 | use rustc_hir::attrs::CollapseMacroDebuginfo; |
| ... | ... | @@ -790,7 +790,6 @@ mod desc { |
| 790 | 790 | pub(crate) const parse_string: &str = "a string"; |
| 791 | 791 | pub(crate) const parse_opt_string: &str = parse_string; |
| 792 | 792 | pub(crate) const parse_string_push: &str = parse_string; |
| 793 | pub(crate) const parse_opt_langid: &str = "a language identifier"; | |
| 794 | 793 | pub(crate) const parse_opt_pathbuf: &str = "a path"; |
| 795 | 794 | pub(crate) const parse_list: &str = "a space-separated list of strings"; |
| 796 | 795 | pub(crate) const parse_list_with_polarity: &str = |
| ... | ... | @@ -998,17 +997,6 @@ pub mod parse { |
| 998 | 997 | } |
| 999 | 998 | } |
| 1000 | 999 | |
| 1001 | /// Parse an optional language identifier, e.g. `en-US` or `zh-CN`. | |
| 1002 | pub(crate) fn parse_opt_langid(slot: &mut Option<LanguageIdentifier>, v: Option<&str>) -> bool { | |
| 1003 | match v { | |
| 1004 | Some(s) => { | |
| 1005 | *slot = rustc_errors::LanguageIdentifier::from_str(s).ok(); | |
| 1006 | true | |
| 1007 | } | |
| 1008 | None => false, | |
| 1009 | } | |
| 1010 | } | |
| 1011 | ||
| 1012 | 1000 | pub(crate) fn parse_opt_pathbuf(slot: &mut Option<PathBuf>, v: Option<&str>) -> bool { |
| 1013 | 1001 | match v { |
| 1014 | 1002 | Some(s) => { |
| ... | ... | @@ -2335,8 +2323,6 @@ options! { |
| 2335 | 2323 | "embed source text in DWARF debug sections (default: no)"), |
| 2336 | 2324 | emit_stack_sizes: bool = (false, parse_bool, [UNTRACKED], |
| 2337 | 2325 | "emit a section containing stack size metadata (default: no)"), |
| 2338 | emit_thin_lto: bool = (true, parse_bool, [TRACKED], | |
| 2339 | "emit the bc module with thin LTO info (default: yes)"), | |
| 2340 | 2326 | emscripten_wasm_eh: bool = (true, parse_bool, [TRACKED], |
| 2341 | 2327 | "Use WebAssembly error handling for wasm32-unknown-emscripten"), |
| 2342 | 2328 | enforce_type_length_limit: bool = (false, parse_bool, [TRACKED], |
| ... | ... | @@ -2713,15 +2699,6 @@ written to standard error output)"), |
| 2713 | 2699 | "for every macro invocation, print its name and arguments (default: no)"), |
| 2714 | 2700 | track_diagnostics: bool = (false, parse_bool, [UNTRACKED], |
| 2715 | 2701 | "tracks where in rustc a diagnostic was emitted"), |
| 2716 | // Diagnostics are considered side-effects of a query (see `QuerySideEffect`) and are saved | |
| 2717 | // alongside query results and changes to translation options can affect diagnostics - so | |
| 2718 | // translation options should be tracked. | |
| 2719 | translate_additional_ftl: Option<PathBuf> = (None, parse_opt_pathbuf, [TRACKED], | |
| 2720 | "additional fluent translation to preferentially use (for testing translation)"), | |
| 2721 | translate_directionality_markers: bool = (false, parse_bool, [TRACKED], | |
| 2722 | "emit directionality isolation markers in translated diagnostics"), | |
| 2723 | translate_lang: Option<LanguageIdentifier> = (None, parse_opt_langid, [TRACKED], | |
| 2724 | "language identifier for diagnostic output"), | |
| 2725 | 2702 | translate_remapped_path_to_local_path: bool = (true, parse_bool, [TRACKED], |
| 2726 | 2703 | "translate remapped paths into local paths when possible (default: yes)"), |
| 2727 | 2704 | trap_unreachable: Option<bool> = (None, parse_opt_bool, [TRACKED], |
compiler/rustc_session/src/parse.rs+2-8| ... | ... | @@ -10,7 +10,6 @@ use rustc_data_structures::fx::{FxHashMap, FxIndexMap, FxIndexSet}; |
| 10 | 10 | use rustc_data_structures::sync::{AppendOnlyVec, Lock}; |
| 11 | 11 | use rustc_errors::annotate_snippet_emitter_writer::AnnotateSnippetEmitter; |
| 12 | 12 | use rustc_errors::emitter::{EmitterWithNote, stderr_destination}; |
| 13 | use rustc_errors::translation::Translator; | |
| 14 | 13 | use rustc_errors::{ |
| 15 | 14 | BufferedEarlyLint, ColorConfig, DecorateDiagCompat, Diag, DiagCtxt, DiagCtxtHandle, |
| 16 | 15 | DiagMessage, EmissionGuarantee, MultiSpan, StashKey, |
| ... | ... | @@ -281,10 +280,9 @@ pub struct ParseSess { |
| 281 | 280 | impl ParseSess { |
| 282 | 281 | /// Used for testing. |
| 283 | 282 | pub fn new() -> Self { |
| 284 | let translator = Translator::new(); | |
| 285 | 283 | let sm = Arc::new(SourceMap::new(FilePathMapping::empty())); |
| 286 | 284 | let emitter = Box::new( |
| 287 | AnnotateSnippetEmitter::new(stderr_destination(ColorConfig::Auto), translator) | |
| 285 | AnnotateSnippetEmitter::new(stderr_destination(ColorConfig::Auto)) | |
| 288 | 286 | .sm(Some(Arc::clone(&sm))), |
| 289 | 287 | ); |
| 290 | 288 | let dcx = DiagCtxt::new(emitter); |
| ... | ... | @@ -314,12 +312,8 @@ impl ParseSess { |
| 314 | 312 | } |
| 315 | 313 | |
| 316 | 314 | pub fn emitter_with_note(note: String) -> Self { |
| 317 | let translator = Translator::new(); | |
| 318 | 315 | let sm = Arc::new(SourceMap::new(FilePathMapping::empty())); |
| 319 | let emitter = Box::new(AnnotateSnippetEmitter::new( | |
| 320 | stderr_destination(ColorConfig::Auto), | |
| 321 | translator, | |
| 322 | )); | |
| 316 | let emitter = Box::new(AnnotateSnippetEmitter::new(stderr_destination(ColorConfig::Auto))); | |
| 323 | 317 | let dcx = DiagCtxt::new(Box::new(EmitterWithNote { emitter, note })); |
| 324 | 318 | ParseSess::with_dcx(dcx, sm) |
| 325 | 319 | } |
compiler/rustc_session/src/session.rs+14-30| ... | ... | @@ -16,7 +16,6 @@ use rustc_errors::codes::*; |
| 16 | 16 | use rustc_errors::emitter::{DynEmitter, HumanReadableErrorType, OutputTheme, stderr_destination}; |
| 17 | 17 | use rustc_errors::json::JsonEmitter; |
| 18 | 18 | use rustc_errors::timings::TimingSectionHandler; |
| 19 | use rustc_errors::translation::Translator; | |
| 20 | 19 | use rustc_errors::{ |
| 21 | 20 | Diag, DiagCtxt, DiagCtxtHandle, DiagMessage, Diagnostic, ErrorGuaranteed, FatalAbort, |
| 22 | 21 | TerminalUrl, |
| ... | ... | @@ -914,11 +913,7 @@ impl Session { |
| 914 | 913 | |
| 915 | 914 | // JUSTIFICATION: part of session construction |
| 916 | 915 | #[allow(rustc::bad_opt_access)] |
| 917 | fn default_emitter( | |
| 918 | sopts: &config::Options, | |
| 919 | source_map: Arc<SourceMap>, | |
| 920 | translator: Translator, | |
| 921 | ) -> Box<DynEmitter> { | |
| 916 | fn default_emitter(sopts: &config::Options, source_map: Arc<SourceMap>) -> Box<DynEmitter> { | |
| 922 | 917 | let macro_backtrace = sopts.unstable_opts.macro_backtrace; |
| 923 | 918 | let track_diagnostics = sopts.unstable_opts.track_diagnostics; |
| 924 | 919 | let terminal_url = match sopts.unstable_opts.terminal_urls { |
| ... | ... | @@ -940,21 +935,17 @@ fn default_emitter( |
| 940 | 935 | match sopts.error_format { |
| 941 | 936 | config::ErrorOutputType::HumanReadable { kind, color_config } => match kind { |
| 942 | 937 | HumanReadableErrorType { short, unicode } => { |
| 943 | let emitter = | |
| 944 | AnnotateSnippetEmitter::new(stderr_destination(color_config), translator) | |
| 945 | .sm(source_map) | |
| 946 | .short_message(short) | |
| 947 | .diagnostic_width(sopts.diagnostic_width) | |
| 948 | .macro_backtrace(macro_backtrace) | |
| 949 | .track_diagnostics(track_diagnostics) | |
| 950 | .terminal_url(terminal_url) | |
| 951 | .theme(if unicode { OutputTheme::Unicode } else { OutputTheme::Ascii }) | |
| 952 | .ignored_directories_in_source_blocks( | |
| 953 | sopts | |
| 954 | .unstable_opts | |
| 955 | .ignore_directory_in_diagnostics_source_blocks | |
| 956 | .clone(), | |
| 957 | ); | |
| 938 | let emitter = AnnotateSnippetEmitter::new(stderr_destination(color_config)) | |
| 939 | .sm(source_map) | |
| 940 | .short_message(short) | |
| 941 | .diagnostic_width(sopts.diagnostic_width) | |
| 942 | .macro_backtrace(macro_backtrace) | |
| 943 | .track_diagnostics(track_diagnostics) | |
| 944 | .terminal_url(terminal_url) | |
| 945 | .theme(if unicode { OutputTheme::Unicode } else { OutputTheme::Ascii }) | |
| 946 | .ignored_directories_in_source_blocks( | |
| 947 | sopts.unstable_opts.ignore_directory_in_diagnostics_source_blocks.clone(), | |
| 948 | ); | |
| 958 | 949 | Box::new(emitter.ui_testing(sopts.unstable_opts.ui_testing)) |
| 959 | 950 | } |
| 960 | 951 | }, |
| ... | ... | @@ -962,7 +953,6 @@ fn default_emitter( |
| 962 | 953 | JsonEmitter::new( |
| 963 | 954 | Box::new(io::BufWriter::new(io::stderr())), |
| 964 | 955 | source_map, |
| 965 | translator, | |
| 966 | 956 | pretty, |
| 967 | 957 | json_rendered, |
| 968 | 958 | color_config, |
| ... | ... | @@ -984,7 +974,6 @@ fn default_emitter( |
| 984 | 974 | pub fn build_session( |
| 985 | 975 | sopts: config::Options, |
| 986 | 976 | io: CompilerIO, |
| 987 | fluent_bundle: Option<Arc<rustc_errors::FluentBundle>>, | |
| 988 | 977 | driver_lint_caps: FxHashMap<lint::LintId, lint::Level>, |
| 989 | 978 | target: Target, |
| 990 | 979 | cfg_version: &'static str, |
| ... | ... | @@ -1002,9 +991,8 @@ pub fn build_session( |
| 1002 | 991 | let cap_lints_allow = sopts.lint_cap.is_some_and(|cap| cap == lint::Allow); |
| 1003 | 992 | let can_emit_warnings = !(warnings_allow || cap_lints_allow); |
| 1004 | 993 | |
| 1005 | let translator = Translator { fluent_bundle }; | |
| 1006 | 994 | let source_map = rustc_span::source_map::get_source_map().unwrap(); |
| 1007 | let emitter = default_emitter(&sopts, Arc::clone(&source_map), translator); | |
| 995 | let emitter = default_emitter(&sopts, Arc::clone(&source_map)); | |
| 1008 | 996 | |
| 1009 | 997 | let mut dcx = |
| 1010 | 998 | DiagCtxt::new(emitter).with_flags(sopts.unstable_opts.dcx_flags(can_emit_warnings)); |
| ... | ... | @@ -1441,13 +1429,10 @@ impl EarlyDiagCtxt { |
| 1441 | 1429 | } |
| 1442 | 1430 | |
| 1443 | 1431 | fn mk_emitter(output: ErrorOutputType) -> Box<DynEmitter> { |
| 1444 | // FIXME(#100717): early errors aren't translated at the moment, so this is fine, but it will | |
| 1445 | // need to reference every crate that might emit an early error for translation to work. | |
| 1446 | let translator = Translator::new(); | |
| 1447 | 1432 | let emitter: Box<DynEmitter> = match output { |
| 1448 | 1433 | config::ErrorOutputType::HumanReadable { kind, color_config } => match kind { |
| 1449 | 1434 | HumanReadableErrorType { short, unicode } => Box::new( |
| 1450 | AnnotateSnippetEmitter::new(stderr_destination(color_config), translator) | |
| 1435 | AnnotateSnippetEmitter::new(stderr_destination(color_config)) | |
| 1451 | 1436 | .theme(if unicode { OutputTheme::Unicode } else { OutputTheme::Ascii }) |
| 1452 | 1437 | .short_message(short), |
| 1453 | 1438 | ), |
| ... | ... | @@ -1456,7 +1441,6 @@ fn mk_emitter(output: ErrorOutputType) -> Box<DynEmitter> { |
| 1456 | 1441 | Box::new(JsonEmitter::new( |
| 1457 | 1442 | Box::new(io::BufWriter::new(io::stderr())), |
| 1458 | 1443 | Some(Arc::new(SourceMap::new(FilePathMapping::empty()))), |
| 1459 | translator, | |
| 1460 | 1444 | pretty, |
| 1461 | 1445 | json_rendered, |
| 1462 | 1446 | color_config, |
compiler/rustc_type_ir/src/predicate.rs+1| ... | ... | @@ -420,6 +420,7 @@ pub struct ExistentialProjection<I: Interner> { |
| 420 | 420 | |
| 421 | 421 | /// This field exists to prevent the creation of `ExistentialProjection` |
| 422 | 422 | /// without using [`ExistentialProjection::new_from_args`]. |
| 423 | #[derive_where(skip(Debug))] | |
| 423 | 424 | use_existential_projection_new_instead: (), |
| 424 | 425 | } |
| 425 | 426 |
library/unwind/src/lib.rs+1-1| ... | ... | @@ -6,7 +6,7 @@ |
| 6 | 6 | #![feature(staged_api)] |
| 7 | 7 | #![cfg_attr( |
| 8 | 8 | all(target_family = "wasm", any(not(target_os = "emscripten"), emscripten_wasm_eh)), |
| 9 | feature(link_llvm_intrinsics, simd_wasm64) | |
| 9 | feature(link_llvm_intrinsics, simd_wasm64, asm_experimental_arch) | |
| 10 | 10 | )] |
| 11 | 11 | #![allow(internal_features)] |
| 12 | 12 | #![allow(unused_features)] |
library/unwind/src/wasm.rs+24| ... | ... | @@ -2,6 +2,30 @@ |
| 2 | 2 | |
| 3 | 3 | #![allow(nonstandard_style)] |
| 4 | 4 | |
| 5 | // Define the __cpp_exception tag that LLVM's wasm exception handling requires. | |
| 6 | // In particular it is required to use either of: | |
| 7 | // 1. the wasm_throw llvm intrinsic, or | |
| 8 | // 2. the Rust try intrinsic. | |
| 9 | // | |
| 10 | // This must be provided since LLVM commit | |
| 11 | // aee99e8015daa9f53ab1fd4e5b24cc4c694bdc4a which changed the tag from being | |
| 12 | // weakly defined in each object file to being an external reference that must | |
| 13 | // be linked from somewhere. | |
| 14 | // | |
| 15 | // We only define this for wasm32-unknown-unknown because on Emscripten/WASI | |
| 16 | // targets, this symbol should be defined by the external toolchain. In | |
| 17 | // particular, defining this on Emscripten would break Emscripten dynamic | |
| 18 | // libraries. | |
| 19 | #[cfg(all(target_os = "unknown", panic = "unwind"))] | |
| 20 | core::arch::global_asm!( | |
| 21 | ".globl __cpp_exception", | |
| 22 | #[cfg(target_pointer_width = "64")] | |
| 23 | ".tagtype __cpp_exception i64", | |
| 24 | #[cfg(target_pointer_width = "32")] | |
| 25 | ".tagtype __cpp_exception i32", | |
| 26 | "__cpp_exception:", | |
| 27 | ); | |
| 28 | ||
| 5 | 29 | #[repr(C)] |
| 6 | 30 | #[derive(Debug, Copy, Clone, PartialEq)] |
| 7 | 31 | pub enum _Unwind_Reason_Code { |
src/doc/rustc-dev-guide/src/diagnostics/translation.md-42| ... | ... | @@ -159,48 +159,6 @@ have such implementations. |
| 159 | 159 | `set_arg` calls are handled transparently by diagnostic derives but need to be |
| 160 | 160 | added manually when using diagnostic builder APIs. |
| 161 | 161 | |
| 162 | ### Loading | |
| 163 | ||
| 164 | rustc makes a distinction between the "fallback bundle" for `en-US` that is used | |
| 165 | by default and when another locale is missing a message; and the primary fluent | |
| 166 | bundle which is requested by the user. | |
| 167 | ||
| 168 | Diagnostic emitters implement the `Emitter` trait which has two functions for | |
| 169 | accessing the fallback and primary fluent bundles (`fallback_fluent_bundle` and | |
| 170 | `fluent_bundle` respectively). | |
| 171 | ||
| 172 | `Emitter` also has member functions with default implementations for performing | |
| 173 | translation of a `DiagMessage` using the results of | |
| 174 | `fallback_fluent_bundle` and `fluent_bundle`. | |
| 175 | ||
| 176 | All of the emitters in rustc load the fallback Fluent bundle lazily, only | |
| 177 | reading Fluent resources and parsing them when an error message is first being | |
| 178 | translated (for performance reasons - it doesn't make sense to do this if no | |
| 179 | error is being emitted). `rustc_error_messages::fallback_fluent_bundle` returns | |
| 180 | a `std::lazy::Lazy<FluentBundle>` which is provided to emitters and evaluated | |
| 181 | in the first call to `Emitter::fallback_fluent_bundle`. | |
| 182 | ||
| 183 | The primary Fluent bundle (for the user's desired locale) is expected to be | |
| 184 | returned by `Emitter::fluent_bundle`. This bundle is used preferentially when | |
| 185 | translating messages, the fallback bundle is only used if the primary bundle is | |
| 186 | missing a message or not provided. | |
| 187 | ||
| 188 | There are no locale bundles distributed with the compiler, | |
| 189 | but mechanisms are implemented for loading them. | |
| 190 | ||
| 191 | - `-Ztranslate-additional-ftl` can be used to load a specific resource as the | |
| 192 | primary bundle for testing purposes. | |
| 193 | - `-Ztranslate-lang` can be provided a language identifier (something like | |
| 194 | `en-US`) and will load any Fluent resources found in | |
| 195 | `$sysroot/share/locale/$locale/` directory (both the user provided | |
| 196 | sysroot and any sysroot candidates). | |
| 197 | ||
| 198 | Primary bundles are not currently loaded lazily and if requested will be loaded | |
| 199 | at the start of compilation regardless of whether an error occurs. Lazily | |
| 200 | loading primary bundles is possible if it can be assumed that loading a bundle | |
| 201 | won't fail. Bundle loading can fail if a requested locale is missing, Fluent | |
| 202 | files are malformed, or a message is duplicated in multiple resources. | |
| 203 | ||
| 204 | 162 | [Fluent]: https://projectfluent.org |
| 205 | 163 | [`compiler/rustc_borrowck/messages.ftl`]: https://github.com/rust-lang/rust/blob/HEAD/compiler/rustc_borrowck/messages.ftl |
| 206 | 164 | [`compiler/rustc_parse/messages.ftl`]: https://github.com/rust-lang/rust/blob/HEAD/compiler/rustc_parse/messages.ftl |
src/doc/rustc/src/platform-support/wasm32-unknown-unknown.md+15| ... | ... | @@ -267,3 +267,18 @@ the meantime using `-Cpanic=unwind` will require using [`-Zbuild-std`] and |
| 267 | 267 | passing the appropriate flags to rustc. |
| 268 | 268 | |
| 269 | 269 | [`-Zbuild-std`]: ../../cargo/reference/unstable.html#build-std |
| 270 | ||
| 271 | ### The exception tag for panics | |
| 272 | ||
| 273 | Rust panics are currently implemented as a specific class of C++ exceptions. | |
| 274 | This is because llvm only supports throwing and catching the C++ exception tag | |
| 275 | from `wasm_throw` intrinsic and the lowering for the catchpads emitted by the | |
| 276 | Rust try intrinsic. | |
| 277 | ||
| 278 | In particular, llvm throw and catch blocks expect a `WebAssembly.Tag` symbol | |
| 279 | called `__cpp_exception`. If it is not defined somewhere, llvm will generate an | |
| 280 | Emscripten style import from `env.__cpp_exception`. We don't want this, so we | |
| 281 | define the symbol in `libunwind` but only for wasm32-unknown-unknown. WASI | |
| 282 | doesn't currently support unwinding at all, and the Emscripten linker provides | |
| 283 | the tag in an appropriate manner depending on what sort of binary is being | |
| 284 | linked. |
src/librustdoc/core.rs+1-3| ... | ... | @@ -157,11 +157,10 @@ pub(crate) fn new_dcx( |
| 157 | 157 | diagnostic_width: Option<usize>, |
| 158 | 158 | unstable_opts: &UnstableOptions, |
| 159 | 159 | ) -> rustc_errors::DiagCtxt { |
| 160 | let translator = rustc_driver::default_translator(); | |
| 161 | 160 | let emitter: Box<DynEmitter> = match error_format { |
| 162 | 161 | ErrorOutputType::HumanReadable { kind, color_config } => match kind { |
| 163 | 162 | HumanReadableErrorType { short, unicode } => Box::new( |
| 164 | AnnotateSnippetEmitter::new(stderr_destination(color_config), translator) | |
| 163 | AnnotateSnippetEmitter::new(stderr_destination(color_config)) | |
| 165 | 164 | .sm(source_map.map(|sm| sm as _)) |
| 166 | 165 | .short_message(short) |
| 167 | 166 | .diagnostic_width(diagnostic_width) |
| ... | ... | @@ -178,7 +177,6 @@ pub(crate) fn new_dcx( |
| 178 | 177 | JsonEmitter::new( |
| 179 | 178 | Box::new(io::BufWriter::new(io::stderr())), |
| 180 | 179 | Some(source_map), |
| 181 | translator, | |
| 182 | 180 | pretty, |
| 183 | 181 | json_rendered, |
| 184 | 182 | color_config, |
src/librustdoc/doctest/make.rs+1-2| ... | ... | @@ -467,7 +467,6 @@ fn parse_source( |
| 467 | 467 | let filename = FileName::anon_source_code(&wrapped_source); |
| 468 | 468 | |
| 469 | 469 | let sm = Arc::new(SourceMap::new(FilePathMapping::empty())); |
| 470 | let translator = rustc_driver::default_translator(); | |
| 471 | 470 | let supports_color = match get_stderr_color_choice(ColorConfig::Auto, &std::io::stderr()) { |
| 472 | 471 | ColorChoice::Auto => unreachable!(), |
| 473 | 472 | ColorChoice::AlwaysAnsi | ColorChoice::Always => true, |
| ... | ... | @@ -476,7 +475,7 @@ fn parse_source( |
| 476 | 475 | info.supports_color = supports_color; |
| 477 | 476 | // Any errors in parsing should also appear when the doctest is compiled for real, so just |
| 478 | 477 | // send all the errors that the parser emits directly into a `Sink` instead of stderr. |
| 479 | let emitter = AnnotateSnippetEmitter::new(AutoStream::never(Box::new(io::sink())), translator); | |
| 478 | let emitter = AnnotateSnippetEmitter::new(AutoStream::never(Box::new(io::sink()))); | |
| 480 | 479 | |
| 481 | 480 | // FIXME(misdreavus): pass `-Z treat-err-as-bug` to the doctest parser |
| 482 | 481 | let dcx = DiagCtxt::new(Box::new(emitter)).disable_warnings(); |
src/librustdoc/passes/lint/check_code_block_syntax.rs+3-11| ... | ... | @@ -5,7 +5,7 @@ use std::sync::Arc; |
| 5 | 5 | |
| 6 | 6 | use rustc_data_structures::sync::Lock; |
| 7 | 7 | use rustc_errors::emitter::Emitter; |
| 8 | use rustc_errors::translation::{Translator, to_fluent_args}; | |
| 8 | use rustc_errors::translation::{format_diag_message, to_fluent_args}; | |
| 9 | 9 | use rustc_errors::{Applicability, DiagCtxt, DiagInner}; |
| 10 | 10 | use rustc_parse::{source_str_to_stream, unwrap_or_emit_fatal}; |
| 11 | 11 | use rustc_resolve::rustdoc::source_span_for_markdown_range; |
| ... | ... | @@ -35,8 +35,7 @@ fn check_rust_syntax( |
| 35 | 35 | code_block: RustCodeBlock, |
| 36 | 36 | ) { |
| 37 | 37 | let buffer = Arc::new(Lock::new(Buffer::default())); |
| 38 | let translator = rustc_driver::default_translator(); | |
| 39 | let emitter = BufferEmitter { buffer: Arc::clone(&buffer), translator }; | |
| 38 | let emitter = BufferEmitter { buffer: Arc::clone(&buffer) }; | |
| 40 | 39 | |
| 41 | 40 | let sm = Arc::new(SourceMap::new(FilePathMapping::empty())); |
| 42 | 41 | let dcx = DiagCtxt::new(Box::new(emitter)).disable_warnings(); |
| ... | ... | @@ -145,7 +144,6 @@ struct Buffer { |
| 145 | 144 | |
| 146 | 145 | struct BufferEmitter { |
| 147 | 146 | buffer: Arc<Lock<Buffer>>, |
| 148 | translator: Translator, | |
| 149 | 147 | } |
| 150 | 148 | |
| 151 | 149 | impl Emitter for BufferEmitter { |
| ... | ... | @@ -153,9 +151,7 @@ impl Emitter for BufferEmitter { |
| 153 | 151 | let mut buffer = self.buffer.borrow_mut(); |
| 154 | 152 | |
| 155 | 153 | let fluent_args = to_fluent_args(diag.args.iter()); |
| 156 | let translated_main_message = self | |
| 157 | .translator | |
| 158 | .translate_message(&diag.messages[0].0, &fluent_args) | |
| 154 | let translated_main_message = format_diag_message(&diag.messages[0].0, &fluent_args) | |
| 159 | 155 | .unwrap_or_else(|e| panic!("{e}")); |
| 160 | 156 | |
| 161 | 157 | buffer.messages.push(format!("error from rustc: {translated_main_message}")); |
| ... | ... | @@ -167,8 +163,4 @@ impl Emitter for BufferEmitter { |
| 167 | 163 | fn source_map(&self) -> Option<&SourceMap> { |
| 168 | 164 | None |
| 169 | 165 | } |
| 170 | ||
| 171 | fn translator(&self) -> &Translator { | |
| 172 | &self.translator | |
| 173 | } | |
| 174 | 166 | } |
src/tools/miri/src/shims/foreign_items.rs+1-1| ... | ... | @@ -851,7 +851,7 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> { |
| 851 | 851 | // Fallback to shims in submodules. |
| 852 | 852 | _ => { |
| 853 | 853 | // Math shims |
| 854 | #[expect(irrefutable_let_patterns)] | |
| 854 | #[cfg_attr(bootstrap, expect(irrefutable_let_patterns))] | |
| 855 | 855 | if let res = shims::math::EvalContextExt::emulate_foreign_item_inner( |
| 856 | 856 | this, link_name, abi, args, dest, |
| 857 | 857 | )? && !matches!(res, EmulateItemResult::NotSupported) |
src/tools/rustfmt/src/parse/session.rs+2-13| ... | ... | @@ -5,7 +5,6 @@ use std::sync::atomic::{AtomicBool, Ordering}; |
| 5 | 5 | use rustc_data_structures::sync::IntoDynSyncSend; |
| 6 | 6 | use rustc_errors::annotate_snippet_emitter_writer::AnnotateSnippetEmitter; |
| 7 | 7 | use rustc_errors::emitter::{DynEmitter, Emitter, SilentEmitter, stderr_destination}; |
| 8 | use rustc_errors::translation::Translator; | |
| 9 | 8 | use rustc_errors::{ColorConfig, Diag, DiagCtxt, DiagInner, Level as DiagnosticLevel}; |
| 10 | 9 | use rustc_session::parse::ParseSess as RawParseSess; |
| 11 | 10 | use rustc_span::{ |
| ... | ... | @@ -74,10 +73,6 @@ impl Emitter for SilentOnIgnoredFilesEmitter { |
| 74 | 73 | } |
| 75 | 74 | self.handle_non_ignoreable_error(diag); |
| 76 | 75 | } |
| 77 | ||
| 78 | fn translator(&self) -> &Translator { | |
| 79 | self.emitter.translator() | |
| 80 | } | |
| 81 | 76 | } |
| 82 | 77 | |
| 83 | 78 | impl From<Color> for ColorConfig { |
| ... | ... | @@ -104,15 +99,13 @@ fn default_dcx( |
| 104 | 99 | ColorConfig::Never |
| 105 | 100 | }; |
| 106 | 101 | |
| 107 | let translator = rustc_driver::default_translator(); | |
| 108 | ||
| 109 | 102 | let emitter: Box<DynEmitter> = if show_parse_errors { |
| 110 | 103 | Box::new( |
| 111 | AnnotateSnippetEmitter::new(stderr_destination(emit_color), translator) | |
| 104 | AnnotateSnippetEmitter::new(stderr_destination(emit_color)) | |
| 112 | 105 | .sm(Some(source_map.clone())), |
| 113 | 106 | ) |
| 114 | 107 | } else { |
| 115 | Box::new(SilentEmitter { translator }) | |
| 108 | Box::new(SilentEmitter) | |
| 116 | 109 | }; |
| 117 | 110 | DiagCtxt::new(Box::new(SilentOnIgnoredFilesEmitter { |
| 118 | 111 | has_non_ignorable_parser_errors: false, |
| ... | ... | @@ -342,10 +335,6 @@ mod tests { |
| 342 | 335 | fn emit_diagnostic(&mut self, _diag: DiagInner) { |
| 343 | 336 | self.num_emitted_errors.fetch_add(1, Ordering::Release); |
| 344 | 337 | } |
| 345 | ||
| 346 | fn translator(&self) -> &Translator { | |
| 347 | panic!("test emitter attempted to translate a diagnostic"); | |
| 348 | } | |
| 349 | 338 | } |
| 350 | 339 | |
| 351 | 340 | fn build_diagnostic(level: DiagnosticLevel, span: Option<MultiSpan>) -> DiagInner { |
tests/run-make/issue-84395-lto-embed-bitcode/rmake.rs+1-1| ... | ... | @@ -18,7 +18,7 @@ fn main() { |
| 18 | 18 | .arg("-Clinker-plugin-lto") |
| 19 | 19 | .arg(format!("-Clinker={}", env_var("CLANG"))) |
| 20 | 20 | .arg("-Clink-arg=-Wl,--plugin-opt=-lto-embed-bitcode=optimized") |
| 21 | .arg("-Zemit-thin-lto=no") | |
| 21 | .arg("-Clto=fat") | |
| 22 | 22 | .run(); |
| 23 | 23 | |
| 24 | 24 | llvm_objcopy().dump_section(".llvmbc", "test.bc").arg("test").run(); |
tests/run-make/translation/broken.ftl deleted-3| ... | ... | @@ -1,3 +0,0 @@ |
| 1 | # `foo` isn't provided by this diagnostic so it is expected that the fallback message is used. | |
| 2 | parse_struct_literal_body_without_path = this is a {$foo} message | |
| 3 | .suggestion = this is a test suggestion |
tests/run-make/translation/missing.ftl deleted-3| ... | ... | @@ -1,3 +0,0 @@ |
| 1 | # `parse_struct_literal_body_without_path` isn't provided by this resource at all, so the | |
| 2 | # fallback should be used. | |
| 3 | foo = bar |
tests/run-make/translation/rmake.rs deleted-197| ... | ... | @@ -1,197 +0,0 @@ |
| 1 | //! Smoke test for the rustc diagnostics translation infrastructure. | |
| 2 | //! | |
| 3 | //! # References | |
| 4 | //! | |
| 5 | //! - Current tracking issue: <https://github.com/rust-lang/rust/issues/132181>. | |
| 6 | //! - Old tracking issue: <https://github.com/rust-lang/rust/issues/100717> | |
| 7 | //! - Initial translation infra implementation: <https://github.com/rust-lang/rust/pull/95512>. | |
| 8 | ||
| 9 | // This test uses symbolic links to stub out a fake sysroot to save testing time. | |
| 10 | //@ needs-symlink | |
| 11 | //@ needs-subprocess | |
| 12 | ||
| 13 | // FIXME(151366) Currently `-Ztranslate-additional-ftl` is currently broken | |
| 14 | //@ ignore-test | |
| 15 | ||
| 16 | #![deny(warnings)] | |
| 17 | ||
| 18 | use std::path::{Path, PathBuf}; | |
| 19 | ||
| 20 | use run_make_support::rustc::sysroot; | |
| 21 | use run_make_support::{cwd, rfs, run_in_tmpdir, rustc}; | |
| 22 | ||
| 23 | fn main() { | |
| 24 | builtin_fallback_bundle(); | |
| 25 | additional_primary_bundle(); | |
| 26 | missing_slug_prefers_fallback_bundle(); | |
| 27 | broken_primary_bundle_prefers_fallback_bundle(); | |
| 28 | locale_sysroot(); | |
| 29 | missing_sysroot(); | |
| 30 | file_sysroot(); | |
| 31 | } | |
| 32 | ||
| 33 | /// Check that the test works normally, using the built-in fallback bundle. | |
| 34 | fn builtin_fallback_bundle() { | |
| 35 | rustc().input("test.rs").run_fail().assert_stderr_contains("struct literal body without path"); | |
| 36 | } | |
| 37 | ||
| 38 | /// Check that a primary bundle can be loaded and will be preferentially used where possible. | |
| 39 | fn additional_primary_bundle() { | |
| 40 | rustc() | |
| 41 | .input("test.rs") | |
| 42 | .arg("-Ztranslate-additional-ftl=working.ftl") | |
| 43 | .run_fail() | |
| 44 | .assert_stderr_contains("this is a test message"); | |
| 45 | } | |
| 46 | ||
| 47 | /// Check that a primary bundle without the desired message will use the fallback bundle. | |
| 48 | fn missing_slug_prefers_fallback_bundle() { | |
| 49 | rustc() | |
| 50 | .input("test.rs") | |
| 51 | .arg("-Ztranslate-additional-ftl=missing.ftl") | |
| 52 | .run_fail() | |
| 53 | .assert_stderr_contains("struct literal body without path"); | |
| 54 | } | |
| 55 | ||
| 56 | /// Check that a primary bundle with a broken message (e.g. an interpolated variable is not | |
| 57 | /// provided) will use the fallback bundle. | |
| 58 | fn broken_primary_bundle_prefers_fallback_bundle() { | |
| 59 | // FIXME(#135817): as of the rmake.rs port, the compiler actually ICEs on the additional | |
| 60 | // `broken.ftl`, even though the original intention seems to be that it should gracefully | |
| 61 | // failover to the fallback bundle. On `aarch64-apple-darwin`, somehow it *doesn't* ICE. | |
| 62 | ||
| 63 | rustc() | |
| 64 | .env("RUSTC_ICE", "0") // disable ICE dump file, not needed | |
| 65 | .input("test.rs") | |
| 66 | .arg("-Ztranslate-additional-ftl=broken.ftl") | |
| 67 | .run_fail(); | |
| 68 | } | |
| 69 | ||
| 70 | #[track_caller] | |
| 71 | fn shallow_symlink_dir_entries(src_dir: &Path, dst_dir: &Path) { | |
| 72 | for entry in rfs::read_dir(src_dir) { | |
| 73 | let entry = entry.unwrap(); | |
| 74 | let src_entry_path = entry.path(); | |
| 75 | let src_filename = src_entry_path.file_name().unwrap(); | |
| 76 | let meta = rfs::symlink_metadata(&src_entry_path); | |
| 77 | if meta.is_symlink() || meta.is_file() { | |
| 78 | rfs::symlink_file(&src_entry_path, dst_dir.join(src_filename)); | |
| 79 | } else if meta.is_dir() { | |
| 80 | rfs::symlink_dir(&src_entry_path, dst_dir.join(src_filename)); | |
| 81 | } else { | |
| 82 | unreachable!() | |
| 83 | } | |
| 84 | } | |
| 85 | } | |
| 86 | ||
| 87 | #[track_caller] | |
| 88 | fn shallow_symlink_dir_entries_materialize_single_dir( | |
| 89 | src_dir: &Path, | |
| 90 | dst_dir: &Path, | |
| 91 | dir_filename: &str, | |
| 92 | ) { | |
| 93 | shallow_symlink_dir_entries(src_dir, dst_dir); | |
| 94 | ||
| 95 | let dst_symlink_meta = rfs::symlink_metadata(dst_dir.join(dir_filename)); | |
| 96 | ||
| 97 | if dst_symlink_meta.is_file() || dst_symlink_meta.is_dir() { | |
| 98 | unreachable!(); | |
| 99 | } | |
| 100 | ||
| 101 | #[cfg(windows)] | |
| 102 | { | |
| 103 | use std::os::windows::fs::FileTypeExt as _; | |
| 104 | if dst_symlink_meta.file_type().is_symlink_file() { | |
| 105 | rfs::remove_file(dst_dir.join(dir_filename)); | |
| 106 | } else if dst_symlink_meta.file_type().is_symlink_dir() { | |
| 107 | rfs::remove_dir(dst_dir.join(dir_filename)); | |
| 108 | } else { | |
| 109 | unreachable!(); | |
| 110 | } | |
| 111 | } | |
| 112 | #[cfg(not(windows))] | |
| 113 | { | |
| 114 | rfs::remove_file(dst_dir.join(dir_filename)); | |
| 115 | } | |
| 116 | ||
| 117 | rfs::create_dir_all(dst_dir.join(dir_filename)); | |
| 118 | } | |
| 119 | ||
| 120 | #[track_caller] | |
| 121 | fn setup_fakeroot_parents() -> PathBuf { | |
| 122 | let sysroot = sysroot(); | |
| 123 | let fakeroot = cwd().join("fakeroot"); | |
| 124 | rfs::create_dir_all(&fakeroot); | |
| 125 | shallow_symlink_dir_entries_materialize_single_dir(&sysroot, &fakeroot, "lib"); | |
| 126 | shallow_symlink_dir_entries_materialize_single_dir( | |
| 127 | &sysroot.join("lib"), | |
| 128 | &fakeroot.join("lib"), | |
| 129 | "rustlib", | |
| 130 | ); | |
| 131 | shallow_symlink_dir_entries_materialize_single_dir( | |
| 132 | &sysroot.join("lib").join("rustlib"), | |
| 133 | &fakeroot.join("lib").join("rustlib"), | |
| 134 | "src", | |
| 135 | ); | |
| 136 | shallow_symlink_dir_entries( | |
| 137 | &sysroot.join("lib").join("rustlib").join("src"), | |
| 138 | &fakeroot.join("lib").join("rustlib").join("src"), | |
| 139 | ); | |
| 140 | fakeroot | |
| 141 | } | |
| 142 | ||
| 143 | /// Check that a locale can be loaded from the sysroot given a language identifier by making a local | |
| 144 | /// copy of the sysroot and adding the custom locale to it. | |
| 145 | fn locale_sysroot() { | |
| 146 | run_in_tmpdir(|| { | |
| 147 | let fakeroot = setup_fakeroot_parents(); | |
| 148 | ||
| 149 | // When download-rustc is enabled, real sysroot will have a share directory. Delete the link | |
| 150 | // to it. | |
| 151 | let _ = std::fs::remove_file(fakeroot.join("share")); | |
| 152 | ||
| 153 | let fake_locale_path = fakeroot.join("share").join("locale").join("zh-CN"); | |
| 154 | rfs::create_dir_all(&fake_locale_path); | |
| 155 | rfs::symlink_file( | |
| 156 | cwd().join("working.ftl"), | |
| 157 | fake_locale_path.join("basic-translation.ftl"), | |
| 158 | ); | |
| 159 | ||
| 160 | rustc() | |
| 161 | .env("RUSTC_ICE", "0") | |
| 162 | .input("test.rs") | |
| 163 | .sysroot(&fakeroot) | |
| 164 | .arg("-Ztranslate-lang=zh-CN") | |
| 165 | .run_fail() | |
| 166 | .assert_stderr_contains("this is a test message"); | |
| 167 | }); | |
| 168 | } | |
| 169 | ||
| 170 | /// Check that the compiler errors out when the sysroot requested cannot be found. This test might | |
| 171 | /// start failing if there actually exists a Klingon translation of rustc's error messages. | |
| 172 | fn missing_sysroot() { | |
| 173 | run_in_tmpdir(|| { | |
| 174 | rustc() | |
| 175 | .input("test.rs") | |
| 176 | .arg("-Ztranslate-lang=tlh") | |
| 177 | .run_fail() | |
| 178 | .assert_stderr_contains("missing locale directory"); | |
| 179 | }); | |
| 180 | } | |
| 181 | ||
| 182 | /// Check that the compiler errors out when the directory for the locale in the sysroot is actually | |
| 183 | /// a file. | |
| 184 | fn file_sysroot() { | |
| 185 | run_in_tmpdir(|| { | |
| 186 | let fakeroot = setup_fakeroot_parents(); | |
| 187 | rfs::create_dir_all(fakeroot.join("share").join("locale")); | |
| 188 | rfs::write(fakeroot.join("share").join("locale").join("zh-CN"), b"not a dir"); | |
| 189 | ||
| 190 | rustc() | |
| 191 | .input("test.rs") | |
| 192 | .sysroot(&fakeroot) | |
| 193 | .arg("-Ztranslate-lang=zh-CN") | |
| 194 | .run_fail() | |
| 195 | .assert_stderr_contains("is not a directory"); | |
| 196 | }); | |
| 197 | } |
tests/run-make/translation/test.rs deleted-18| ... | ... | @@ -1,18 +0,0 @@ |
| 1 | // Exact error being tested isn't relevant, it just needs to be known that it uses Fluent-backed | |
| 2 | // diagnostics. | |
| 3 | ||
| 4 | struct Foo { | |
| 5 | val: (), | |
| 6 | } | |
| 7 | ||
| 8 | fn foo() -> Foo { | |
| 9 | val: (), | |
| 10 | } | |
| 11 | ||
| 12 | fn main() { | |
| 13 | let x = foo(); | |
| 14 | x.val == 42; | |
| 15 | let x = { | |
| 16 | val: (), | |
| 17 | }; | |
| 18 | } |
tests/run-make/translation/working.ftl deleted-2| ... | ... | @@ -1,2 +0,0 @@ |
| 1 | parse_struct_literal_body_without_path = this is a test message | |
| 2 | .suggestion = this is a test suggestion |
tests/ui/README.md-4| ... | ... | @@ -440,10 +440,6 @@ Everything to do with `--diagnostic-width`. |
| 440 | 440 | |
| 441 | 441 | Exercises `#[diagnostic::*]` namespaced attributes. See [RFC 3368 Diagnostic attribute namespace](https://github.com/rust-lang/rfcs/blob/master/text/3368-diagnostic-attribute-namespace.md). |
| 442 | 442 | |
| 443 | ## `tests/ui/diagnostics-infra` | |
| 444 | ||
| 445 | This directory contains tests and infrastructure related to the diagnostics system, including support for translatable diagnostics | |
| 446 | ||
| 447 | 443 | ## `tests/ui/did_you_mean/` |
| 448 | 444 | |
| 449 | 445 | Tests for miscellaneous suggestions. |
tests/ui/binding/irrefutable-in-let-chains.rs created+120| ... | ... | @@ -0,0 +1,120 @@ |
| 1 | // https://github.com/rust-lang/rust/issues/139369 | |
| 2 | // Test that the lint `irrefutable_let_patterns` now | |
| 3 | // only checks single let binding. | |
| 4 | //@ edition: 2024 | |
| 5 | //@ check-pass | |
| 6 | ||
| 7 | use std::ops::Range; | |
| 8 | ||
| 9 | fn main() { | |
| 10 | let opt = Some(None..Some(1)); | |
| 11 | ||
| 12 | // test `if let` | |
| 13 | if let first = &opt {} | |
| 14 | //~^ WARN irrefutable `if let` pattern | |
| 15 | ||
| 16 | if let first = &opt && let Some(second) = first {} | |
| 17 | ||
| 18 | if let first = &opt && let (a, b) = (1, 2) {} | |
| 19 | ||
| 20 | if let first = &opt && let None = Some(1) {} | |
| 21 | ||
| 22 | if 4 * 2 == 0 && let first = &opt {} | |
| 23 | ||
| 24 | if let first = &opt | |
| 25 | && let Some(second) = first | |
| 26 | && let None = second.start | |
| 27 | && let v = 0 | |
| 28 | {} | |
| 29 | ||
| 30 | if let Range { start: local_start, end: _ } = (None..Some(1)) {} | |
| 31 | //~^ WARN irrefutable `if let` pattern | |
| 32 | ||
| 33 | if let Range { start: local_start, end: _ } = (None..Some(1)) | |
| 34 | && let None = local_start | |
| 35 | {} | |
| 36 | ||
| 37 | if let (a, b, c) = (Some(1), Some(1), Some(1)) {} | |
| 38 | //~^ WARN irrefutable `if let` pattern | |
| 39 | ||
| 40 | if let (a, b, c) = (Some(1), Some(1), Some(1)) && let None = Some(1) {} | |
| 41 | ||
| 42 | if let Some(ref first) = opt | |
| 43 | && let Range { start: local_start, end: _ } = first | |
| 44 | && let None = local_start | |
| 45 | {} | |
| 46 | ||
| 47 | // test `else if let` | |
| 48 | if opt == Some(None..None) { | |
| 49 | } else if let x = opt.clone().map(|_| 1) { | |
| 50 | //~^ WARN irrefutable `if let` pattern | |
| 51 | } | |
| 52 | ||
| 53 | if opt == Some(None..None) { | |
| 54 | } else if let x = opt.clone().map(|_| 1) | |
| 55 | && x == Some(1) | |
| 56 | {} | |
| 57 | ||
| 58 | if opt == Some(None..None) { | |
| 59 | } else if opt.is_some() && let x = &opt | |
| 60 | {} | |
| 61 | ||
| 62 | if opt == Some(None..None) { | |
| 63 | } else { | |
| 64 | if let x = opt.clone().map(|_| 1) && x == Some(1) | |
| 65 | {} | |
| 66 | } | |
| 67 | ||
| 68 | // test `if let guard` | |
| 69 | match opt { | |
| 70 | Some(ref first) if let second = first => {} | |
| 71 | //~^ WARN irrefutable `if let` guard pattern | |
| 72 | _ => {} | |
| 73 | } | |
| 74 | ||
| 75 | match opt { | |
| 76 | Some(ref first) | |
| 77 | if let second = first | |
| 78 | && let _third = second | |
| 79 | && let v = 4 + 4 => {} | |
| 80 | _ => {} | |
| 81 | } | |
| 82 | ||
| 83 | match opt { | |
| 84 | Some(ref first) | |
| 85 | if let Range { start: local_start, end: _ } = first | |
| 86 | && let None = local_start => {} | |
| 87 | _ => {} | |
| 88 | } | |
| 89 | ||
| 90 | match opt { | |
| 91 | Some(ref first) | |
| 92 | if let Range { start: Some(_), end: local_end } = first | |
| 93 | && let v = local_end | |
| 94 | && let w = v => {} | |
| 95 | _ => {} | |
| 96 | } | |
| 97 | ||
| 98 | // test `while let` | |
| 99 | while let first = &opt {} | |
| 100 | //~^ WARN irrefutable `while let` pattern | |
| 101 | ||
| 102 | while let first = &opt | |
| 103 | && let (a, b) = (1, 2) | |
| 104 | {} | |
| 105 | ||
| 106 | while let first = &opt | |
| 107 | && let Some(second) = first | |
| 108 | && let None = second.start | |
| 109 | {} | |
| 110 | ||
| 111 | while let Some(ref first) = opt | |
| 112 | && let second = first | |
| 113 | && let _third = second | |
| 114 | {} | |
| 115 | ||
| 116 | while let Some(ref first) = opt | |
| 117 | && let Range { start: local_start, end: _ } = first | |
| 118 | && let None = local_start | |
| 119 | {} | |
| 120 | } |
tests/ui/binding/irrefutable-in-let-chains.stderr created+57| ... | ... | @@ -0,0 +1,57 @@ |
| 1 | warning: irrefutable `if let` pattern | |
| 2 | --> $DIR/irrefutable-in-let-chains.rs:13:8 | |
| 3 | | | |
| 4 | LL | if let first = &opt {} | |
| 5 | | ^^^^^^^^^^^^^^^^ | |
| 6 | | | |
| 7 | = note: this pattern will always match, so the `if let` is useless | |
| 8 | = help: consider replacing the `if let` with a `let` | |
| 9 | = note: `#[warn(irrefutable_let_patterns)]` on by default | |
| 10 | ||
| 11 | warning: irrefutable `if let` pattern | |
| 12 | --> $DIR/irrefutable-in-let-chains.rs:30:8 | |
| 13 | | | |
| 14 | LL | if let Range { start: local_start, end: _ } = (None..Some(1)) {} | |
| 15 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 16 | | | |
| 17 | = note: this pattern will always match, so the `if let` is useless | |
| 18 | = help: consider replacing the `if let` with a `let` | |
| 19 | ||
| 20 | warning: irrefutable `if let` pattern | |
| 21 | --> $DIR/irrefutable-in-let-chains.rs:37:8 | |
| 22 | | | |
| 23 | LL | if let (a, b, c) = (Some(1), Some(1), Some(1)) {} | |
| 24 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 25 | | | |
| 26 | = note: this pattern will always match, so the `if let` is useless | |
| 27 | = help: consider replacing the `if let` with a `let` | |
| 28 | ||
| 29 | warning: irrefutable `if let` pattern | |
| 30 | --> $DIR/irrefutable-in-let-chains.rs:49:15 | |
| 31 | | | |
| 32 | LL | } else if let x = opt.clone().map(|_| 1) { | |
| 33 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 34 | | | |
| 35 | = note: this pattern will always match, so the `if let` is useless | |
| 36 | = help: consider replacing the `if let` with a `let` | |
| 37 | ||
| 38 | warning: irrefutable `if let` guard pattern | |
| 39 | --> $DIR/irrefutable-in-let-chains.rs:70:28 | |
| 40 | | | |
| 41 | LL | Some(ref first) if let second = first => {} | |
| 42 | | ^^^^^^^^^^^^^^^^^^ | |
| 43 | | | |
| 44 | = note: this pattern will always match, so the guard is useless | |
| 45 | = help: consider removing the guard and adding a `let` inside the match arm | |
| 46 | ||
| 47 | warning: irrefutable `while let` pattern | |
| 48 | --> $DIR/irrefutable-in-let-chains.rs:99:11 | |
| 49 | | | |
| 50 | LL | while let first = &opt {} | |
| 51 | | ^^^^^^^^^^^^^^^^ | |
| 52 | | | |
| 53 | = note: this pattern will always match, so the loop will never exit | |
| 54 | = help: consider instead using a `loop { ... }` with a `let` inside it | |
| 55 | ||
| 56 | warning: 6 warnings emitted | |
| 57 |
tests/ui/delegation/generics/generic-params-defaults.rs created+14| ... | ... | @@ -0,0 +1,14 @@ |
| 1 | #![feature(fn_delegation)] | |
| 2 | #![allow(incomplete_features)] | |
| 3 | ||
| 4 | trait Trait<'a, 'b, 'c, A = usize, B = u32, C = String, const N: usize = 123> { | |
| 5 | fn foo<T = usize>(&self) { | |
| 6 | //~^ ERROR: defaults for generic parameters are not allowed here | |
| 7 | //~| WARN: this was previously accepted by the compiler but is being phased out | |
| 8 | } | |
| 9 | } | |
| 10 | ||
| 11 | reuse Trait::foo; | |
| 12 | //~^ ERROR: type annotations needed | |
| 13 | ||
| 14 | fn main() {} |
tests/ui/delegation/generics/generic-params-defaults.stderr created+35| ... | ... | @@ -0,0 +1,35 @@ |
| 1 | error: defaults for generic parameters are not allowed here | |
| 2 | --> $DIR/generic-params-defaults.rs:5:12 | |
| 3 | | | |
| 4 | LL | fn foo<T = usize>(&self) { | |
| 5 | | ^^^^^^^^^ | |
| 6 | | | |
| 7 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | |
| 8 | = note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887> | |
| 9 | = note: `#[deny(invalid_type_param_default)]` (part of `#[deny(future_incompatible)]`) on by default | |
| 10 | ||
| 11 | error[E0282]: type annotations needed | |
| 12 | --> $DIR/generic-params-defaults.rs:11:14 | |
| 13 | | | |
| 14 | LL | reuse Trait::foo; | |
| 15 | | ^^^ cannot infer type of the type parameter `T` declared on the method `foo` | |
| 16 | | | |
| 17 | help: consider specifying the generic argument | |
| 18 | | | |
| 19 | LL | reuse Trait::foo::<T>; | |
| 20 | | +++++ | |
| 21 | ||
| 22 | error: aborting due to 2 previous errors | |
| 23 | ||
| 24 | For more information about this error, try `rustc --explain E0282`. | |
| 25 | Future incompatibility report: Future breakage diagnostic: | |
| 26 | error: defaults for generic parameters are not allowed here | |
| 27 | --> $DIR/generic-params-defaults.rs:5:12 | |
| 28 | | | |
| 29 | LL | fn foo<T = usize>(&self) { | |
| 30 | | ^^^^^^^^^ | |
| 31 | | | |
| 32 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | |
| 33 | = note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887> | |
| 34 | = note: `#[deny(invalid_type_param_default)]` (part of `#[deny(future_incompatible)]`) on by default | |
| 35 |
tests/ui/delegation/generics/generic-params-same-names.rs created+19| ... | ... | @@ -0,0 +1,19 @@ |
| 1 | #![feature(fn_delegation)] | |
| 2 | #![allow(incomplete_features)] | |
| 3 | ||
| 4 | trait Trait<'a, 'b, 'c, A, B, C, const N: usize> { | |
| 5 | fn foo<'a, 'b, 'c, A, B, C, const N: usize>(&self) { | |
| 6 | //~^ ERROR: lifetime name `'a` shadows a lifetime name that is already in scope | |
| 7 | //~| ERROR: lifetime name `'b` shadows a lifetime name that is already in scope | |
| 8 | //~| ERROR: lifetime name `'c` shadows a lifetime name that is already in scope | |
| 9 | //~| ERROR: the name `A` is already used for a generic parameter in this item's generic parameters | |
| 10 | //~| ERROR: the name `B` is already used for a generic parameter in this item's generic parameters | |
| 11 | //~| ERROR: the name `C` is already used for a generic parameter in this item's generic parameters | |
| 12 | //~| ERROR: the name `N` is already used for a generic parameter in this item's generic parameters | |
| 13 | } | |
| 14 | } | |
| 15 | ||
| 16 | reuse Trait::foo; | |
| 17 | //~^ ERROR: type annotations needed | |
| 18 | ||
| 19 | fn main() {} |
tests/ui/delegation/generics/generic-params-same-names.stderr created+76| ... | ... | @@ -0,0 +1,76 @@ |
| 1 | error[E0496]: lifetime name `'a` shadows a lifetime name that is already in scope | |
| 2 | --> $DIR/generic-params-same-names.rs:5:12 | |
| 3 | | | |
| 4 | LL | trait Trait<'a, 'b, 'c, A, B, C, const N: usize> { | |
| 5 | | -- first declared here | |
| 6 | LL | fn foo<'a, 'b, 'c, A, B, C, const N: usize>(&self) { | |
| 7 | | ^^ lifetime `'a` already in scope | |
| 8 | ||
| 9 | error[E0496]: lifetime name `'b` shadows a lifetime name that is already in scope | |
| 10 | --> $DIR/generic-params-same-names.rs:5:16 | |
| 11 | | | |
| 12 | LL | trait Trait<'a, 'b, 'c, A, B, C, const N: usize> { | |
| 13 | | -- first declared here | |
| 14 | LL | fn foo<'a, 'b, 'c, A, B, C, const N: usize>(&self) { | |
| 15 | | ^^ lifetime `'b` already in scope | |
| 16 | ||
| 17 | error[E0496]: lifetime name `'c` shadows a lifetime name that is already in scope | |
| 18 | --> $DIR/generic-params-same-names.rs:5:20 | |
| 19 | | | |
| 20 | LL | trait Trait<'a, 'b, 'c, A, B, C, const N: usize> { | |
| 21 | | -- first declared here | |
| 22 | LL | fn foo<'a, 'b, 'c, A, B, C, const N: usize>(&self) { | |
| 23 | | ^^ lifetime `'c` already in scope | |
| 24 | ||
| 25 | error[E0403]: the name `A` is already used for a generic parameter in this item's generic parameters | |
| 26 | --> $DIR/generic-params-same-names.rs:5:24 | |
| 27 | | | |
| 28 | LL | trait Trait<'a, 'b, 'c, A, B, C, const N: usize> { | |
| 29 | | - first use of `A` | |
| 30 | LL | fn foo<'a, 'b, 'c, A, B, C, const N: usize>(&self) { | |
| 31 | | ^ already used | |
| 32 | ||
| 33 | error[E0403]: the name `B` is already used for a generic parameter in this item's generic parameters | |
| 34 | --> $DIR/generic-params-same-names.rs:5:27 | |
| 35 | | | |
| 36 | LL | trait Trait<'a, 'b, 'c, A, B, C, const N: usize> { | |
| 37 | | - first use of `B` | |
| 38 | LL | fn foo<'a, 'b, 'c, A, B, C, const N: usize>(&self) { | |
| 39 | | ^ already used | |
| 40 | ||
| 41 | error[E0403]: the name `C` is already used for a generic parameter in this item's generic parameters | |
| 42 | --> $DIR/generic-params-same-names.rs:5:30 | |
| 43 | | | |
| 44 | LL | trait Trait<'a, 'b, 'c, A, B, C, const N: usize> { | |
| 45 | | - first use of `C` | |
| 46 | LL | fn foo<'a, 'b, 'c, A, B, C, const N: usize>(&self) { | |
| 47 | | ^ already used | |
| 48 | ||
| 49 | error[E0403]: the name `N` is already used for a generic parameter in this item's generic parameters | |
| 50 | --> $DIR/generic-params-same-names.rs:5:39 | |
| 51 | | | |
| 52 | LL | trait Trait<'a, 'b, 'c, A, B, C, const N: usize> { | |
| 53 | | - first use of `N` | |
| 54 | LL | fn foo<'a, 'b, 'c, A, B, C, const N: usize>(&self) { | |
| 55 | | ^ already used | |
| 56 | ||
| 57 | error[E0284]: type annotations needed | |
| 58 | --> $DIR/generic-params-same-names.rs:16:14 | |
| 59 | | | |
| 60 | LL | reuse Trait::foo; | |
| 61 | | ^^^ cannot infer the value of the const parameter `N` declared on the method `foo` | |
| 62 | | | |
| 63 | note: required by a const generic parameter in `Trait::foo` | |
| 64 | --> $DIR/generic-params-same-names.rs:5:33 | |
| 65 | | | |
| 66 | LL | fn foo<'a, 'b, 'c, A, B, C, const N: usize>(&self) { | |
| 67 | | ^^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo` | |
| 68 | help: consider specifying the generic arguments | |
| 69 | | | |
| 70 | LL | reuse Trait::foo::<A, B, C, N>; | |
| 71 | | ++++++++++++++ | |
| 72 | ||
| 73 | error: aborting due to 8 previous errors | |
| 74 | ||
| 75 | Some errors have detailed explanations: E0284, E0403, E0496. | |
| 76 | For more information about an error, try `rustc --explain E0284`. |
tests/ui/delegation/generics/generics-gen-args-errors.rs created+114| ... | ... | @@ -0,0 +1,114 @@ |
| 1 | //@ compile-flags: -Z deduplicate-diagnostics=yes | |
| 2 | ||
| 3 | #![feature(fn_delegation)] | |
| 4 | #![allow(incomplete_features)] | |
| 5 | ||
| 6 | mod test_1 { | |
| 7 | fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {} | |
| 8 | reuse foo as bar; | |
| 9 | //~^ ERROR: type annotations needed | |
| 10 | ||
| 11 | fn check<A, B, C>() { | |
| 12 | bar::<1, 2, 3, 4, 5, 6>(); | |
| 13 | //~^ ERROR: function takes 3 generic arguments but 6 generic arguments were supplied | |
| 14 | ||
| 15 | bar::<String, String, { String }>(); | |
| 16 | //~^ ERROR: expected value, found struct `String` [E0423] | |
| 17 | ||
| 18 | bar::<'static, 'static, 'static, 'static, 'static>(); | |
| 19 | //~^ ERROR: function takes 2 lifetime arguments but 5 lifetime arguments were supplied | |
| 20 | ||
| 21 | bar::<String, 1, 'static, i32, 'static>(); | |
| 22 | //~^ ERROR: constant provided when a type was expected | |
| 23 | ||
| 24 | bar(); | |
| 25 | ||
| 26 | bar::<_, _, _, _, _>(); | |
| 27 | //~^ ERROR: function takes 3 generic arguments but 5 generic arguments were supplied | |
| 28 | ||
| 29 | bar::<asd, asd, asd>(); | |
| 30 | //~^ ERROR: cannot find type `asd` in this scope | |
| 31 | //~| ERROR: cannot find type `asd` in this scope | |
| 32 | //~| ERROR: cannot find type `asd` in this scope | |
| 33 | //~| ERROR: unresolved item provided when a constant was expected | |
| 34 | ||
| 35 | reuse foo::<A, B, C> as xd; | |
| 36 | //~^ ERROR can't use generic parameters from outer item | |
| 37 | //~| ERROR can't use generic parameters from outer item | |
| 38 | //~| ERROR can't use generic parameters from outer item | |
| 39 | //~| ERROR: unresolved item provided when a constant was expected | |
| 40 | } | |
| 41 | } | |
| 42 | ||
| 43 | mod test_2 { | |
| 44 | fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {} | |
| 45 | ||
| 46 | reuse foo::<> as bar1; | |
| 47 | //~^ ERROR: type annotations needed | |
| 48 | ||
| 49 | reuse foo::<String, String> as bar2; | |
| 50 | //~^ ERROR: function takes 3 generic arguments but 2 generic arguments were supplied | |
| 51 | ||
| 52 | reuse foo::<'static, _, 'asdasd, 'static, 'static, 'static, _> as bar3; | |
| 53 | //~^ ERROR: use of undeclared lifetime name `'asdasd` | |
| 54 | //~| ERROR: function takes 2 lifetime arguments but 5 lifetime arguments were supplied | |
| 55 | //~| ERROR: function takes 3 generic arguments but 2 generic arguments were supplied | |
| 56 | reuse foo::<String, 'static, 123, asdasd> as bar4; | |
| 57 | //~^ ERROR: cannot find type `asdasd` in this scope | |
| 58 | //~| ERROR: function takes 2 lifetime arguments but 1 lifetime argument was supplied | |
| 59 | ||
| 60 | reuse foo::<1, 2, _, 4, 5, _> as bar5; | |
| 61 | //~^ ERROR: function takes 3 generic arguments but 6 generic arguments were supplied | |
| 62 | ||
| 63 | reuse foo::<1, 2,asd,String, { let x = 0; }> as bar6; | |
| 64 | //~^ ERROR: cannot find type `asd` in this scope | |
| 65 | //~| ERROR: function takes 3 generic arguments but 5 generic arguments were supplied | |
| 66 | ||
| 67 | reuse foo::<"asdasd", asd, "askdn", 'static, 'a> as bar7; | |
| 68 | //~^ ERROR: use of undeclared lifetime name `'a` | |
| 69 | //~| ERROR: cannot find type `asd` in this scope | |
| 70 | //~| ERROR: constant provided when a type was expected | |
| 71 | ||
| 72 | reuse foo::<{}, {}, {}> as bar8; | |
| 73 | //~^ ERROR: constant provided when a type was expected | |
| 74 | } | |
| 75 | ||
| 76 | mod test_3 { | |
| 77 | trait Trait<'b, 'c, 'a, T, const N: usize>: Sized { | |
| 78 | fn foo<'d: 'd, U, const M: bool>(self) {} | |
| 79 | } | |
| 80 | ||
| 81 | reuse Trait::<asd, asd, asd, asd, asd, asdasa>::foo as bar1; | |
| 82 | //~^ ERROR: cannot find type `asd` in this scope | |
| 83 | //~| ERROR: cannot find type `asd` in this scope | |
| 84 | //~| ERROR: cannot find type `asd` in this scope | |
| 85 | //~| ERROR: cannot find type `asd` in this scope | |
| 86 | //~| ERROR: cannot find type `asd` in this scope | |
| 87 | //~| ERROR: cannot find type `asdasa` in this scope | |
| 88 | //~| ERROR: trait takes 2 generic arguments but 6 generic arguments were supplied | |
| 89 | ||
| 90 | reuse Trait::<'static, 'static>::foo as bar2; | |
| 91 | //~^ ERROR: trait takes 3 lifetime arguments but 2 lifetime arguments were supplied | |
| 92 | reuse Trait::<1, 2, 3, 4, 5>::foo as bar3; | |
| 93 | //~^ ERROR: trait takes 2 generic arguments but 5 generic arguments were supplied | |
| 94 | ||
| 95 | reuse Trait::<1, 2, true>::foo as bar4; | |
| 96 | //~^ ERROR: trait takes 2 generic arguments but 3 generic arguments were supplied | |
| 97 | ||
| 98 | reuse Trait::<'static>::foo as bar5; | |
| 99 | //~^ ERROR: trait takes 3 lifetime arguments but 1 lifetime argument was supplied | |
| 100 | ||
| 101 | reuse Trait::<1, 2, 'static, DDDD>::foo::<1, 2, 3, 4, 5, 6> as bar6; | |
| 102 | //~^ ERROR: cannot find type `DDDD` in this scope [E0425] | |
| 103 | //~| ERROR: trait takes 3 lifetime arguments but 1 lifetime argument was supplied | |
| 104 | //~| ERROR: trait takes 2 generic arguments but 3 generic arguments were supplied | |
| 105 | //~| ERROR: method takes 2 generic arguments but 6 generic arguments were supplied | |
| 106 | ||
| 107 | reuse Trait::<Trait, Clone, _, 'static, dyn Send, _>::foo::<1, 2, 3, _, 6> as bar7; | |
| 108 | //~^ ERROR: missing lifetime specifiers [E0106] | |
| 109 | //~| ERROR: trait takes 3 lifetime arguments but 1 lifetime argument was supplied | |
| 110 | //~| ERROR: trait takes 2 generic arguments but 5 generic arguments were supplied | |
| 111 | //~| ERROR: method takes 2 generic arguments but 5 generic arguments were supplied | |
| 112 | } | |
| 113 | ||
| 114 | fn main() {} |
tests/ui/delegation/generics/generics-gen-args-errors.stderr created+563| ... | ... | @@ -0,0 +1,563 @@ |
| 1 | error[E0401]: can't use generic parameters from outer item | |
| 2 | --> $DIR/generics-gen-args-errors.rs:35:21 | |
| 3 | | | |
| 4 | LL | fn check<A, B, C>() { | |
| 5 | | - type parameter from outer item | |
| 6 | ... | |
| 7 | LL | reuse foo::<A, B, C> as xd; | |
| 8 | | ^ -- generic parameter used in this inner delegated function | |
| 9 | | | | |
| 10 | | use of generic parameter from outer item | |
| 11 | | | |
| 12 | = note: nested items are independent from their parent item for everything except for privacy and name resolution | |
| 13 | ||
| 14 | error[E0401]: can't use generic parameters from outer item | |
| 15 | --> $DIR/generics-gen-args-errors.rs:35:24 | |
| 16 | | | |
| 17 | LL | fn check<A, B, C>() { | |
| 18 | | - type parameter from outer item | |
| 19 | ... | |
| 20 | LL | reuse foo::<A, B, C> as xd; | |
| 21 | | ^ -- generic parameter used in this inner delegated function | |
| 22 | | | | |
| 23 | | use of generic parameter from outer item | |
| 24 | | | |
| 25 | = note: nested items are independent from their parent item for everything except for privacy and name resolution | |
| 26 | ||
| 27 | error[E0401]: can't use generic parameters from outer item | |
| 28 | --> $DIR/generics-gen-args-errors.rs:35:27 | |
| 29 | | | |
| 30 | LL | fn check<A, B, C>() { | |
| 31 | | - type parameter from outer item | |
| 32 | ... | |
| 33 | LL | reuse foo::<A, B, C> as xd; | |
| 34 | | ^ -- generic parameter used in this inner delegated function | |
| 35 | | | | |
| 36 | | use of generic parameter from outer item | |
| 37 | | | |
| 38 | = note: nested items are independent from their parent item for everything except for privacy and name resolution | |
| 39 | ||
| 40 | error[E0261]: use of undeclared lifetime name `'asdasd` | |
| 41 | --> $DIR/generics-gen-args-errors.rs:52:29 | |
| 42 | | | |
| 43 | LL | reuse foo::<'static, _, 'asdasd, 'static, 'static, 'static, _> as bar3; | |
| 44 | | ^^^^^^^ undeclared lifetime | |
| 45 | | | |
| 46 | help: consider introducing lifetime `'asdasd` here | |
| 47 | | | |
| 48 | LL | reuse foo'asdasd, ::<'static, _, 'asdasd, 'static, 'static, 'static, _> as bar3; | |
| 49 | | ++++++++ | |
| 50 | ||
| 51 | error[E0261]: use of undeclared lifetime name `'a` | |
| 52 | --> $DIR/generics-gen-args-errors.rs:67:50 | |
| 53 | | | |
| 54 | LL | reuse foo::<"asdasd", asd, "askdn", 'static, 'a> as bar7; | |
| 55 | | ^^ undeclared lifetime | |
| 56 | | | |
| 57 | help: consider introducing lifetime `'a` here | |
| 58 | | | |
| 59 | LL | reuse foo'a, ::<"asdasd", asd, "askdn", 'static, 'a> as bar7; | |
| 60 | | +++ | |
| 61 | ||
| 62 | error[E0106]: missing lifetime specifiers | |
| 63 | --> $DIR/generics-gen-args-errors.rs:107:19 | |
| 64 | | | |
| 65 | LL | reuse Trait::<Trait, Clone, _, 'static, dyn Send, _>::foo::<1, 2, 3, _, 6> as bar7; | |
| 66 | | ^^^^^ expected 3 lifetime parameters | |
| 67 | | | |
| 68 | help: consider introducing a named lifetime parameter | |
| 69 | | | |
| 70 | LL | reuse Trait::<Trait<'a, 'a, 'a>, Clone, _, 'static, dyn Send, _>::foo'a, ::<1, 2, 3, _, 6> as bar7; | |
| 71 | | ++++++++++++ +++ | |
| 72 | ||
| 73 | error[E0423]: expected value, found struct `String` | |
| 74 | --> $DIR/generics-gen-args-errors.rs:15:33 | |
| 75 | | | |
| 76 | LL | bar::<String, String, { String }>(); | |
| 77 | | ^^^^^^ | |
| 78 | | | |
| 79 | --> $SRC_DIR/alloc/src/string.rs:LL:COL | |
| 80 | | | |
| 81 | = note: `String` defined here | |
| 82 | ||
| 83 | error[E0425]: cannot find type `asd` in this scope | |
| 84 | --> $DIR/generics-gen-args-errors.rs:29:15 | |
| 85 | | | |
| 86 | LL | bar::<asd, asd, asd>(); | |
| 87 | | ^^^ not found in this scope | |
| 88 | | | |
| 89 | help: you might be missing a type parameter | |
| 90 | | | |
| 91 | LL | fn check<A, B, C, asd>() { | |
| 92 | | +++++ | |
| 93 | ||
| 94 | error[E0425]: cannot find type `asd` in this scope | |
| 95 | --> $DIR/generics-gen-args-errors.rs:29:20 | |
| 96 | | | |
| 97 | LL | bar::<asd, asd, asd>(); | |
| 98 | | ^^^ not found in this scope | |
| 99 | | | |
| 100 | help: you might be missing a type parameter | |
| 101 | | | |
| 102 | LL | fn check<A, B, C, asd>() { | |
| 103 | | +++++ | |
| 104 | ||
| 105 | error[E0425]: cannot find type `asd` in this scope | |
| 106 | --> $DIR/generics-gen-args-errors.rs:29:25 | |
| 107 | | | |
| 108 | LL | bar::<asd, asd, asd>(); | |
| 109 | | ^^^ not found in this scope | |
| 110 | | | |
| 111 | help: you might be missing a type parameter | |
| 112 | | | |
| 113 | LL | fn check<A, B, C, asd>() { | |
| 114 | | +++++ | |
| 115 | ||
| 116 | error[E0425]: cannot find type `asdasd` in this scope | |
| 117 | --> $DIR/generics-gen-args-errors.rs:56:39 | |
| 118 | | | |
| 119 | LL | reuse foo::<String, 'static, 123, asdasd> as bar4; | |
| 120 | | ^^^^^^ not found in this scope | |
| 121 | ||
| 122 | error[E0425]: cannot find type `asd` in this scope | |
| 123 | --> $DIR/generics-gen-args-errors.rs:63:22 | |
| 124 | | | |
| 125 | LL | reuse foo::<1, 2,asd,String, { let x = 0; }> as bar6; | |
| 126 | | ^^^ not found in this scope | |
| 127 | ||
| 128 | error[E0425]: cannot find type `asd` in this scope | |
| 129 | --> $DIR/generics-gen-args-errors.rs:67:27 | |
| 130 | | | |
| 131 | LL | reuse foo::<"asdasd", asd, "askdn", 'static, 'a> as bar7; | |
| 132 | | ^^^ not found in this scope | |
| 133 | ||
| 134 | error[E0425]: cannot find type `asd` in this scope | |
| 135 | --> $DIR/generics-gen-args-errors.rs:81:19 | |
| 136 | | | |
| 137 | LL | reuse Trait::<asd, asd, asd, asd, asd, asdasa>::foo as bar1; | |
| 138 | | ^^^ not found in this scope | |
| 139 | ||
| 140 | error[E0425]: cannot find type `asd` in this scope | |
| 141 | --> $DIR/generics-gen-args-errors.rs:81:24 | |
| 142 | | | |
| 143 | LL | reuse Trait::<asd, asd, asd, asd, asd, asdasa>::foo as bar1; | |
| 144 | | ^^^ not found in this scope | |
| 145 | ||
| 146 | error[E0425]: cannot find type `asd` in this scope | |
| 147 | --> $DIR/generics-gen-args-errors.rs:81:29 | |
| 148 | | | |
| 149 | LL | reuse Trait::<asd, asd, asd, asd, asd, asdasa>::foo as bar1; | |
| 150 | | ^^^ not found in this scope | |
| 151 | ||
| 152 | error[E0425]: cannot find type `asd` in this scope | |
| 153 | --> $DIR/generics-gen-args-errors.rs:81:34 | |
| 154 | | | |
| 155 | LL | reuse Trait::<asd, asd, asd, asd, asd, asdasa>::foo as bar1; | |
| 156 | | ^^^ not found in this scope | |
| 157 | ||
| 158 | error[E0425]: cannot find type `asd` in this scope | |
| 159 | --> $DIR/generics-gen-args-errors.rs:81:39 | |
| 160 | | | |
| 161 | LL | reuse Trait::<asd, asd, asd, asd, asd, asdasa>::foo as bar1; | |
| 162 | | ^^^ not found in this scope | |
| 163 | ||
| 164 | error[E0425]: cannot find type `asdasa` in this scope | |
| 165 | --> $DIR/generics-gen-args-errors.rs:81:44 | |
| 166 | | | |
| 167 | LL | reuse Trait::<asd, asd, asd, asd, asd, asdasa>::foo as bar1; | |
| 168 | | ^^^^^^ not found in this scope | |
| 169 | ||
| 170 | error[E0425]: cannot find type `DDDD` in this scope | |
| 171 | --> $DIR/generics-gen-args-errors.rs:101:34 | |
| 172 | | | |
| 173 | LL | reuse Trait::<1, 2, 'static, DDDD>::foo::<1, 2, 3, 4, 5, 6> as bar6; | |
| 174 | | ^^^^ not found in this scope | |
| 175 | ||
| 176 | error[E0284]: type annotations needed | |
| 177 | --> $DIR/generics-gen-args-errors.rs:8:11 | |
| 178 | | | |
| 179 | LL | reuse foo as bar; | |
| 180 | | ^^^ cannot infer the value of the const parameter `N` declared on the function `foo` | |
| 181 | | | |
| 182 | note: required by a const generic parameter in `test_1::foo` | |
| 183 | --> $DIR/generics-gen-args-errors.rs:7:48 | |
| 184 | | | |
| 185 | LL | fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {} | |
| 186 | | ^^^^^^^^^^^^^^ required by this const generic parameter in `foo` | |
| 187 | help: consider specifying the generic arguments | |
| 188 | | | |
| 189 | LL | reuse foo::<T, U, N> as bar; | |
| 190 | | +++++++++++ | |
| 191 | ||
| 192 | error[E0107]: function takes 3 generic arguments but 6 generic arguments were supplied | |
| 193 | --> $DIR/generics-gen-args-errors.rs:12:9 | |
| 194 | | | |
| 195 | LL | bar::<1, 2, 3, 4, 5, 6>(); | |
| 196 | | ^^^ --------- help: remove the unnecessary generic arguments | |
| 197 | | | | |
| 198 | | expected 3 generic arguments | |
| 199 | | | |
| 200 | note: function defined here, with 3 generic parameters: `T`, `U`, `N` | |
| 201 | --> $DIR/generics-gen-args-errors.rs:8:18 | |
| 202 | | | |
| 203 | LL | fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {} | |
| 204 | | - - -------------- | |
| 205 | LL | reuse foo as bar; | |
| 206 | | ^^^ | |
| 207 | ||
| 208 | error[E0107]: function takes 2 lifetime arguments but 5 lifetime arguments were supplied | |
| 209 | --> $DIR/generics-gen-args-errors.rs:18:9 | |
| 210 | | | |
| 211 | LL | bar::<'static, 'static, 'static, 'static, 'static>(); | |
| 212 | | ^^^ --------------------------- help: remove the lifetime arguments | |
| 213 | | | | |
| 214 | | expected 2 lifetime arguments | |
| 215 | | | |
| 216 | note: function defined here, with 2 lifetime parameters: `'a`, `'b` | |
| 217 | --> $DIR/generics-gen-args-errors.rs:8:18 | |
| 218 | | | |
| 219 | LL | fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {} | |
| 220 | | -- -- | |
| 221 | LL | reuse foo as bar; | |
| 222 | | ^^^ | |
| 223 | ||
| 224 | error[E0747]: constant provided when a type was expected | |
| 225 | --> $DIR/generics-gen-args-errors.rs:21:23 | |
| 226 | | | |
| 227 | LL | bar::<String, 1, 'static, i32, 'static>(); | |
| 228 | | ^ | |
| 229 | ||
| 230 | error[E0107]: function takes 3 generic arguments but 5 generic arguments were supplied | |
| 231 | --> $DIR/generics-gen-args-errors.rs:26:9 | |
| 232 | | | |
| 233 | LL | bar::<_, _, _, _, _>(); | |
| 234 | | ^^^ ------ help: remove the unnecessary generic arguments | |
| 235 | | | | |
| 236 | | expected 3 generic arguments | |
| 237 | | | |
| 238 | note: function defined here, with 3 generic parameters: `T`, `U`, `N` | |
| 239 | --> $DIR/generics-gen-args-errors.rs:8:18 | |
| 240 | | | |
| 241 | LL | fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {} | |
| 242 | | - - -------------- | |
| 243 | LL | reuse foo as bar; | |
| 244 | | ^^^ | |
| 245 | ||
| 246 | error[E0747]: unresolved item provided when a constant was expected | |
| 247 | --> $DIR/generics-gen-args-errors.rs:29:25 | |
| 248 | | | |
| 249 | LL | bar::<asd, asd, asd>(); | |
| 250 | | ^^^ | |
| 251 | | | |
| 252 | help: if this generic argument was intended as a const parameter, surround it with braces | |
| 253 | | | |
| 254 | LL | bar::<asd, asd, { asd }>(); | |
| 255 | | + + | |
| 256 | ||
| 257 | error[E0747]: unresolved item provided when a constant was expected | |
| 258 | --> $DIR/generics-gen-args-errors.rs:35:27 | |
| 259 | | | |
| 260 | LL | reuse foo::<A, B, C> as xd; | |
| 261 | | ^ | |
| 262 | | | |
| 263 | help: if this generic argument was intended as a const parameter, surround it with braces | |
| 264 | | | |
| 265 | LL | reuse foo::<A, B, { C }> as xd; | |
| 266 | | + + | |
| 267 | ||
| 268 | error[E0284]: type annotations needed | |
| 269 | --> $DIR/generics-gen-args-errors.rs:46:11 | |
| 270 | | | |
| 271 | LL | reuse foo::<> as bar1; | |
| 272 | | ^^^ cannot infer the value of the const parameter `N` declared on the function `foo` | |
| 273 | | | |
| 274 | note: required by a const generic parameter in `test_2::foo` | |
| 275 | --> $DIR/generics-gen-args-errors.rs:44:48 | |
| 276 | | | |
| 277 | LL | fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {} | |
| 278 | | ^^^^^^^^^^^^^^ required by this const generic parameter in `foo` | |
| 279 | help: consider specifying the generic arguments | |
| 280 | | | |
| 281 | LL | reuse foo::<T, U, N> as bar1; | |
| 282 | | +++++++ | |
| 283 | ||
| 284 | error[E0107]: function takes 3 generic arguments but 2 generic arguments were supplied | |
| 285 | --> $DIR/generics-gen-args-errors.rs:49:11 | |
| 286 | | | |
| 287 | LL | reuse foo::<String, String> as bar2; | |
| 288 | | ^^^ ------ ------ supplied 2 generic arguments | |
| 289 | | | | |
| 290 | | expected 3 generic arguments | |
| 291 | | | |
| 292 | note: function defined here, with 3 generic parameters: `T`, `U`, `N` | |
| 293 | --> $DIR/generics-gen-args-errors.rs:44:8 | |
| 294 | | | |
| 295 | LL | fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {} | |
| 296 | | ^^^ - - -------------- | |
| 297 | help: add missing generic argument | |
| 298 | | | |
| 299 | LL | reuse foo::<String, String, N> as bar2; | |
| 300 | | +++ | |
| 301 | ||
| 302 | error[E0107]: function takes 2 lifetime arguments but 5 lifetime arguments were supplied | |
| 303 | --> $DIR/generics-gen-args-errors.rs:52:11 | |
| 304 | | | |
| 305 | LL | reuse foo::<'static, _, 'asdasd, 'static, 'static, 'static, _> as bar3; | |
| 306 | | ^^^ --------------------------- help: remove the lifetime arguments | |
| 307 | | | | |
| 308 | | expected 2 lifetime arguments | |
| 309 | | | |
| 310 | note: function defined here, with 2 lifetime parameters: `'a`, `'b` | |
| 311 | --> $DIR/generics-gen-args-errors.rs:44:8 | |
| 312 | | | |
| 313 | LL | fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {} | |
| 314 | | ^^^ -- -- | |
| 315 | ||
| 316 | error[E0107]: function takes 3 generic arguments but 2 generic arguments were supplied | |
| 317 | --> $DIR/generics-gen-args-errors.rs:52:11 | |
| 318 | | | |
| 319 | LL | reuse foo::<'static, _, 'asdasd, 'static, 'static, 'static, _> as bar3; | |
| 320 | | ^^^ expected 3 generic arguments ------- - supplied 2 generic arguments | |
| 321 | | | |
| 322 | note: function defined here, with 3 generic parameters: `T`, `U`, `N` | |
| 323 | --> $DIR/generics-gen-args-errors.rs:44:8 | |
| 324 | | | |
| 325 | LL | fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {} | |
| 326 | | ^^^ - - -------------- | |
| 327 | help: add missing generic argument | |
| 328 | | | |
| 329 | LL | reuse foo::<'static, _, 'asdasd, 'static, 'static, 'static, _, N> as bar3; | |
| 330 | | +++ | |
| 331 | ||
| 332 | error[E0107]: function takes 2 lifetime arguments but 1 lifetime argument was supplied | |
| 333 | --> $DIR/generics-gen-args-errors.rs:56:11 | |
| 334 | | | |
| 335 | LL | reuse foo::<String, 'static, 123, asdasd> as bar4; | |
| 336 | | ^^^ ------ supplied 1 lifetime argument | |
| 337 | | | | |
| 338 | | expected 2 lifetime arguments | |
| 339 | | | |
| 340 | note: function defined here, with 2 lifetime parameters: `'a`, `'b` | |
| 341 | --> $DIR/generics-gen-args-errors.rs:44:8 | |
| 342 | | | |
| 343 | LL | fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {} | |
| 344 | | ^^^ -- -- | |
| 345 | help: add missing lifetime argument | |
| 346 | | | |
| 347 | LL | reuse foo::<String, 'static, 'static, 123, asdasd> as bar4; | |
| 348 | | +++++++++ | |
| 349 | ||
| 350 | error[E0107]: function takes 3 generic arguments but 6 generic arguments were supplied | |
| 351 | --> $DIR/generics-gen-args-errors.rs:60:11 | |
| 352 | | | |
| 353 | LL | reuse foo::<1, 2, _, 4, 5, _> as bar5; | |
| 354 | | ^^^ --------- help: remove the unnecessary generic arguments | |
| 355 | | | | |
| 356 | | expected 3 generic arguments | |
| 357 | | | |
| 358 | note: function defined here, with 3 generic parameters: `T`, `U`, `N` | |
| 359 | --> $DIR/generics-gen-args-errors.rs:44:8 | |
| 360 | | | |
| 361 | LL | fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {} | |
| 362 | | ^^^ - - -------------- | |
| 363 | ||
| 364 | error[E0107]: function takes 3 generic arguments but 5 generic arguments were supplied | |
| 365 | --> $DIR/generics-gen-args-errors.rs:63:11 | |
| 366 | | | |
| 367 | LL | reuse foo::<1, 2,asd,String, { let x = 0; }> as bar6; | |
| 368 | | ^^^ ----------------------- help: remove the unnecessary generic arguments | |
| 369 | | | | |
| 370 | | expected 3 generic arguments | |
| 371 | | | |
| 372 | note: function defined here, with 3 generic parameters: `T`, `U`, `N` | |
| 373 | --> $DIR/generics-gen-args-errors.rs:44:8 | |
| 374 | | | |
| 375 | LL | fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {} | |
| 376 | | ^^^ - - -------------- | |
| 377 | ||
| 378 | error[E0747]: constant provided when a type was expected | |
| 379 | --> $DIR/generics-gen-args-errors.rs:67:17 | |
| 380 | | | |
| 381 | LL | reuse foo::<"asdasd", asd, "askdn", 'static, 'a> as bar7; | |
| 382 | | ^^^^^^^^ | |
| 383 | ||
| 384 | error[E0747]: constant provided when a type was expected | |
| 385 | --> $DIR/generics-gen-args-errors.rs:72:17 | |
| 386 | | | |
| 387 | LL | reuse foo::<{}, {}, {}> as bar8; | |
| 388 | | ^^ | |
| 389 | ||
| 390 | error[E0107]: trait takes 2 generic arguments but 6 generic arguments were supplied | |
| 391 | --> $DIR/generics-gen-args-errors.rs:81:11 | |
| 392 | | | |
| 393 | LL | reuse Trait::<asd, asd, asd, asd, asd, asdasa>::foo as bar1; | |
| 394 | | ^^^^^ ----------------------- help: remove the unnecessary generic arguments | |
| 395 | | | | |
| 396 | | expected 2 generic arguments | |
| 397 | | | |
| 398 | note: trait defined here, with 2 generic parameters: `T`, `N` | |
| 399 | --> $DIR/generics-gen-args-errors.rs:77:11 | |
| 400 | | | |
| 401 | LL | trait Trait<'b, 'c, 'a, T, const N: usize>: Sized { | |
| 402 | | ^^^^^ - -------------- | |
| 403 | ||
| 404 | error[E0107]: trait takes 3 lifetime arguments but 2 lifetime arguments were supplied | |
| 405 | --> $DIR/generics-gen-args-errors.rs:90:11 | |
| 406 | | | |
| 407 | LL | reuse Trait::<'static, 'static>::foo as bar2; | |
| 408 | | ^^^^^ ------- ------- supplied 2 lifetime arguments | |
| 409 | | | | |
| 410 | | expected 3 lifetime arguments | |
| 411 | | | |
| 412 | note: trait defined here, with 3 lifetime parameters: `'b`, `'c`, `'a` | |
| 413 | --> $DIR/generics-gen-args-errors.rs:77:11 | |
| 414 | | | |
| 415 | LL | trait Trait<'b, 'c, 'a, T, const N: usize>: Sized { | |
| 416 | | ^^^^^ -- -- -- | |
| 417 | help: add missing lifetime argument | |
| 418 | | | |
| 419 | LL | reuse Trait::<'static, 'static, 'static>::foo as bar2; | |
| 420 | | +++++++++ | |
| 421 | ||
| 422 | error[E0107]: trait takes 2 generic arguments but 5 generic arguments were supplied | |
| 423 | --> $DIR/generics-gen-args-errors.rs:92:11 | |
| 424 | | | |
| 425 | LL | reuse Trait::<1, 2, 3, 4, 5>::foo as bar3; | |
| 426 | | ^^^^^ --------- help: remove the unnecessary generic arguments | |
| 427 | | | | |
| 428 | | expected 2 generic arguments | |
| 429 | | | |
| 430 | note: trait defined here, with 2 generic parameters: `T`, `N` | |
| 431 | --> $DIR/generics-gen-args-errors.rs:77:11 | |
| 432 | | | |
| 433 | LL | trait Trait<'b, 'c, 'a, T, const N: usize>: Sized { | |
| 434 | | ^^^^^ - -------------- | |
| 435 | ||
| 436 | error[E0107]: trait takes 2 generic arguments but 3 generic arguments were supplied | |
| 437 | --> $DIR/generics-gen-args-errors.rs:95:11 | |
| 438 | | | |
| 439 | LL | reuse Trait::<1, 2, true>::foo as bar4; | |
| 440 | | ^^^^^ ------ help: remove the unnecessary generic argument | |
| 441 | | | | |
| 442 | | expected 2 generic arguments | |
| 443 | | | |
| 444 | note: trait defined here, with 2 generic parameters: `T`, `N` | |
| 445 | --> $DIR/generics-gen-args-errors.rs:77:11 | |
| 446 | | | |
| 447 | LL | trait Trait<'b, 'c, 'a, T, const N: usize>: Sized { | |
| 448 | | ^^^^^ - -------------- | |
| 449 | ||
| 450 | error[E0107]: trait takes 3 lifetime arguments but 1 lifetime argument was supplied | |
| 451 | --> $DIR/generics-gen-args-errors.rs:98:11 | |
| 452 | | | |
| 453 | LL | reuse Trait::<'static>::foo as bar5; | |
| 454 | | ^^^^^ ------- supplied 1 lifetime argument | |
| 455 | | | | |
| 456 | | expected 3 lifetime arguments | |
| 457 | | | |
| 458 | note: trait defined here, with 3 lifetime parameters: `'b`, `'c`, `'a` | |
| 459 | --> $DIR/generics-gen-args-errors.rs:77:11 | |
| 460 | | | |
| 461 | LL | trait Trait<'b, 'c, 'a, T, const N: usize>: Sized { | |
| 462 | | ^^^^^ -- -- -- | |
| 463 | help: add missing lifetime arguments | |
| 464 | | | |
| 465 | LL | reuse Trait::<'static, 'static, 'static>::foo as bar5; | |
| 466 | | ++++++++++++++++++ | |
| 467 | ||
| 468 | error[E0107]: trait takes 3 lifetime arguments but 1 lifetime argument was supplied | |
| 469 | --> $DIR/generics-gen-args-errors.rs:101:11 | |
| 470 | | | |
| 471 | LL | reuse Trait::<1, 2, 'static, DDDD>::foo::<1, 2, 3, 4, 5, 6> as bar6; | |
| 472 | | ^^^^^ - supplied 1 lifetime argument | |
| 473 | | | | |
| 474 | | expected 3 lifetime arguments | |
| 475 | | | |
| 476 | note: trait defined here, with 3 lifetime parameters: `'b`, `'c`, `'a` | |
| 477 | --> $DIR/generics-gen-args-errors.rs:77:11 | |
| 478 | | | |
| 479 | LL | trait Trait<'b, 'c, 'a, T, const N: usize>: Sized { | |
| 480 | | ^^^^^ -- -- -- | |
| 481 | help: add missing lifetime arguments | |
| 482 | | | |
| 483 | LL | reuse Trait::<1, 'static, 'static, 2, 'static, DDDD>::foo::<1, 2, 3, 4, 5, 6> as bar6; | |
| 484 | | ++++++++++++++++++ | |
| 485 | ||
| 486 | error[E0107]: trait takes 2 generic arguments but 3 generic arguments were supplied | |
| 487 | --> $DIR/generics-gen-args-errors.rs:101:11 | |
| 488 | | | |
| 489 | LL | reuse Trait::<1, 2, 'static, DDDD>::foo::<1, 2, 3, 4, 5, 6> as bar6; | |
| 490 | | ^^^^^ --------------- help: remove the unnecessary generic argument | |
| 491 | | | | |
| 492 | | expected 2 generic arguments | |
| 493 | | | |
| 494 | note: trait defined here, with 2 generic parameters: `T`, `N` | |
| 495 | --> $DIR/generics-gen-args-errors.rs:77:11 | |
| 496 | | | |
| 497 | LL | trait Trait<'b, 'c, 'a, T, const N: usize>: Sized { | |
| 498 | | ^^^^^ - -------------- | |
| 499 | ||
| 500 | error[E0107]: method takes 2 generic arguments but 6 generic arguments were supplied | |
| 501 | --> $DIR/generics-gen-args-errors.rs:101:41 | |
| 502 | | | |
| 503 | LL | reuse Trait::<1, 2, 'static, DDDD>::foo::<1, 2, 3, 4, 5, 6> as bar6; | |
| 504 | | ^^^ ------------ help: remove the unnecessary generic arguments | |
| 505 | | | | |
| 506 | | expected 2 generic arguments | |
| 507 | | | |
| 508 | note: method defined here, with 2 generic parameters: `U`, `M` | |
| 509 | --> $DIR/generics-gen-args-errors.rs:78:12 | |
| 510 | | | |
| 511 | LL | fn foo<'d: 'd, U, const M: bool>(self) {} | |
| 512 | | ^^^ - ------------- | |
| 513 | ||
| 514 | error[E0107]: trait takes 3 lifetime arguments but 1 lifetime argument was supplied | |
| 515 | --> $DIR/generics-gen-args-errors.rs:107:11 | |
| 516 | | | |
| 517 | LL | reuse Trait::<Trait, Clone, _, 'static, dyn Send, _>::foo::<1, 2, 3, _, 6> as bar7; | |
| 518 | | ^^^^^ ----- supplied 1 lifetime argument | |
| 519 | | | | |
| 520 | | expected 3 lifetime arguments | |
| 521 | | | |
| 522 | note: trait defined here, with 3 lifetime parameters: `'b`, `'c`, `'a` | |
| 523 | --> $DIR/generics-gen-args-errors.rs:77:11 | |
| 524 | | | |
| 525 | LL | trait Trait<'b, 'c, 'a, T, const N: usize>: Sized { | |
| 526 | | ^^^^^ -- -- -- | |
| 527 | help: add missing lifetime arguments | |
| 528 | | | |
| 529 | LL | reuse Trait::<Trait, 'static, 'static, Clone, _, 'static, dyn Send, _>::foo::<1, 2, 3, _, 6> as bar7; | |
| 530 | | ++++++++++++++++++ | |
| 531 | ||
| 532 | error[E0107]: trait takes 2 generic arguments but 5 generic arguments were supplied | |
| 533 | --> $DIR/generics-gen-args-errors.rs:107:11 | |
| 534 | | | |
| 535 | LL | reuse Trait::<Trait, Clone, _, 'static, dyn Send, _>::foo::<1, 2, 3, _, 6> as bar7; | |
| 536 | | ^^^^^ --- help: remove the unnecessary generic argument | |
| 537 | | | | |
| 538 | | expected 2 generic arguments | |
| 539 | | | |
| 540 | note: trait defined here, with 2 generic parameters: `T`, `N` | |
| 541 | --> $DIR/generics-gen-args-errors.rs:77:11 | |
| 542 | | | |
| 543 | LL | trait Trait<'b, 'c, 'a, T, const N: usize>: Sized { | |
| 544 | | ^^^^^ - -------------- | |
| 545 | ||
| 546 | error[E0107]: method takes 2 generic arguments but 5 generic arguments were supplied | |
| 547 | --> $DIR/generics-gen-args-errors.rs:107:59 | |
| 548 | | | |
| 549 | LL | reuse Trait::<Trait, Clone, _, 'static, dyn Send, _>::foo::<1, 2, 3, _, 6> as bar7; | |
| 550 | | ^^^ --------- help: remove the unnecessary generic arguments | |
| 551 | | | | |
| 552 | | expected 2 generic arguments | |
| 553 | | | |
| 554 | note: method defined here, with 2 generic parameters: `U`, `M` | |
| 555 | --> $DIR/generics-gen-args-errors.rs:78:12 | |
| 556 | | | |
| 557 | LL | fn foo<'d: 'd, U, const M: bool>(self) {} | |
| 558 | | ^^^ - ------------- | |
| 559 | ||
| 560 | error: aborting due to 47 previous errors | |
| 561 | ||
| 562 | Some errors have detailed explanations: E0106, E0107, E0261, E0284, E0401, E0423, E0425, E0747. | |
| 563 | For more information about an error, try `rustc --explain E0106`. |
tests/ui/delegation/generics/impl-trait-wrong-args-count.rs created+38| ... | ... | @@ -0,0 +1,38 @@ |
| 1 | #![feature(fn_delegation)] | |
| 2 | #![allow(incomplete_features)] | |
| 3 | ||
| 4 | mod to_reuse { | |
| 5 | pub fn bar<'a: 'a, 'b: 'b, A, B>(x: &super::XX) {} | |
| 6 | pub fn bar1(x: &super::XX) {} | |
| 7 | pub fn bar2<A, B, C, D, E, F, const X: usize, const Y: bool>(x: &super::XX) {} | |
| 8 | } | |
| 9 | ||
| 10 | trait Trait<'a, 'b, 'c, A, B, const N: usize>: Sized { | |
| 11 | fn bar<'x: 'x, 'y: 'y, AA, BB, const NN: usize>(&self) {} | |
| 12 | fn bar1<'x: 'x, 'y: 'y, AA, BB, const NN: usize>(&self) {} | |
| 13 | fn bar2(&self) {} | |
| 14 | fn bar3(&self) {} | |
| 15 | fn bar4<X, Y, Z>(&self) {} | |
| 16 | } | |
| 17 | ||
| 18 | struct X<'x1, 'x2, 'x3, 'x4, X1, X2, const X3: usize>( | |
| 19 | &'x1 X1, &'x2 X2, &'x3 X1, &'x4 [usize; X3]); | |
| 20 | type XX = X::<'static, 'static, 'static, 'static, i32, i32, 3>; | |
| 21 | ||
| 22 | impl<'a, 'b, 'c, A, B, const N: usize> Trait<'a, 'b, 'c, A, B, N> for XX { | |
| 23 | reuse to_reuse::bar; | |
| 24 | //~^ ERROR: type annotations needed | |
| 25 | ||
| 26 | reuse to_reuse::bar1; | |
| 27 | ||
| 28 | reuse to_reuse::bar2; | |
| 29 | //~^ ERROR: type annotations needed | |
| 30 | //~| ERROR: type annotations needed | |
| 31 | ||
| 32 | reuse to_reuse::bar2::<i32, i32, i32, i32, i32, i32, 123, true> as bar3; | |
| 33 | ||
| 34 | reuse to_reuse::bar2::<i32, i32, i32, i32, i32, i32, 123, true> as bar4; | |
| 35 | } | |
| 36 | ||
| 37 | fn main() { | |
| 38 | } |
tests/ui/delegation/generics/impl-trait-wrong-args-count.stderr created+47| ... | ... | @@ -0,0 +1,47 @@ |
| 1 | error[E0282]: type annotations needed | |
| 2 | --> $DIR/impl-trait-wrong-args-count.rs:23:21 | |
| 3 | | | |
| 4 | LL | reuse to_reuse::bar; | |
| 5 | | ^^^ cannot infer type of the type parameter `A` declared on the function `bar` | |
| 6 | | | |
| 7 | help: consider specifying the generic arguments | |
| 8 | | | |
| 9 | LL | reuse to_reuse::bar::<A, B>; | |
| 10 | | ++++++++ | |
| 11 | ||
| 12 | error[E0284]: type annotations needed | |
| 13 | --> $DIR/impl-trait-wrong-args-count.rs:28:21 | |
| 14 | | | |
| 15 | LL | reuse to_reuse::bar2; | |
| 16 | | ^^^^ cannot infer the value of the const parameter `X` declared on the function `bar2` | |
| 17 | | | |
| 18 | note: required by a const generic parameter in `bar2` | |
| 19 | --> $DIR/impl-trait-wrong-args-count.rs:7:35 | |
| 20 | | | |
| 21 | LL | pub fn bar2<A, B, C, D, E, F, const X: usize, const Y: bool>(x: &super::XX) {} | |
| 22 | | ^^^^^^^^^^^^^^ required by this const generic parameter in `bar2` | |
| 23 | help: consider specifying the generic arguments | |
| 24 | | | |
| 25 | LL | reuse to_reuse::bar2::<A, B, C, D, E, F, X, Y>; | |
| 26 | | ++++++++++++++++++++++++++ | |
| 27 | ||
| 28 | error[E0284]: type annotations needed | |
| 29 | --> $DIR/impl-trait-wrong-args-count.rs:28:21 | |
| 30 | | | |
| 31 | LL | reuse to_reuse::bar2; | |
| 32 | | ^^^^ cannot infer the value of the const parameter `Y` declared on the function `bar2` | |
| 33 | | | |
| 34 | note: required by a const generic parameter in `bar2` | |
| 35 | --> $DIR/impl-trait-wrong-args-count.rs:7:51 | |
| 36 | | | |
| 37 | LL | pub fn bar2<A, B, C, D, E, F, const X: usize, const Y: bool>(x: &super::XX) {} | |
| 38 | | ^^^^^^^^^^^^^ required by this const generic parameter in `bar2` | |
| 39 | help: consider specifying the generic arguments | |
| 40 | | | |
| 41 | LL | reuse to_reuse::bar2::<A, B, C, D, E, F, X, Y>; | |
| 42 | | ++++++++++++++++++++++++++ | |
| 43 | ||
| 44 | error: aborting due to 3 previous errors | |
| 45 | ||
| 46 | Some errors have detailed explanations: E0282, E0284. | |
| 47 | For more information about an error, try `rustc --explain E0282`. |
tests/ui/delegation/generics/mapping/free-to-free.rs created+141| ... | ... | @@ -0,0 +1,141 @@ |
| 1 | #![feature(fn_delegation)] | |
| 2 | #![allow(incomplete_features)] | |
| 3 | #![allow(late_bound_lifetime_arguments)] | |
| 4 | ||
| 5 | //! This is one of the mapping tests, which tests mapping of delegee parent and child | |
| 6 | //! generic params, whose main goal is to create cases with | |
| 7 | //! different number of lifetimes/types/consts in delegee child and parent; and in | |
| 8 | //! delegation parent if applicable. At some tests predicates are | |
| 9 | //! added. At some tests user-specified args are specified in reuse statement. | |
| 10 | ||
| 11 | // Testing lifetimes + types + consts, reusing without | |
| 12 | // user args, checking predicates inheritance | |
| 13 | mod test_1 { | |
| 14 | fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {} | |
| 15 | ||
| 16 | pub fn check() { | |
| 17 | reuse foo as bar; | |
| 18 | //~^ ERROR: type annotations needed [E0284] | |
| 19 | bar::<i32, i32, 1>(); | |
| 20 | } | |
| 21 | } | |
| 22 | ||
| 23 | // Testing lifetimes + types + consts, reusing without user args, | |
| 24 | // providing delegation parent args in invocation | |
| 25 | mod test_2 { | |
| 26 | fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {} | |
| 27 | ||
| 28 | pub fn check<T: Clone, U: Clone>() { | |
| 29 | reuse foo as bar; | |
| 30 | //~^ ERROR: type annotations needed [E0284] | |
| 31 | bar::<T, U, 1>(); | |
| 32 | } | |
| 33 | } | |
| 34 | ||
| 35 | // Testing lifetimes + types + consts, reusing without user args, | |
| 36 | // providing random types with delegation parent generics specified | |
| 37 | mod test_3 { | |
| 38 | fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {} | |
| 39 | ||
| 40 | pub fn check<T: Clone, U: Clone>() { | |
| 41 | reuse foo as bar; | |
| 42 | //~^ ERROR: type annotations needed [E0284] | |
| 43 | bar::<u64, i32, 1>(); | |
| 44 | } | |
| 45 | } | |
| 46 | ||
| 47 | // Testing late-bound lifetimes + types + consts, reusing without user args, | |
| 48 | // providing random types with delegation parent generics specified, | |
| 49 | // checking signature inheritance | |
| 50 | mod test_4 { | |
| 51 | fn foo<'a, 'b, T: Clone, U: Clone, const N: usize>(_t: &'a T, _u: &'b U) {} | |
| 52 | ||
| 53 | pub fn check<T: Clone, U: Clone>() { | |
| 54 | reuse foo as bar; | |
| 55 | //~^ ERROR: type annotations needed [E0284] | |
| 56 | bar::<u64, i32, 1>(&1, &2); | |
| 57 | } | |
| 58 | } | |
| 59 | ||
| 60 | // Testing late-bound lifetimes + types + consts, reusing without user args, | |
| 61 | // providing random types with delegation parent generics specified, | |
| 62 | // checking signature inheritance, testing mixed order of types and consts | |
| 63 | mod test_5 { | |
| 64 | fn foo<'a, 'b, T: Clone, const N: usize, U: Clone>(_t: &'a T, _u: &'b U) {} | |
| 65 | ||
| 66 | pub fn check<T: Clone, U: Clone>() { | |
| 67 | reuse foo as bar; | |
| 68 | //~^ ERROR: type annotations needed [E0284] | |
| 69 | bar::<u64, 1, u32>(&1, &2); | |
| 70 | } | |
| 71 | } | |
| 72 | ||
| 73 | // Testing late-bound lifetimes + types + consts, reusing with user args, | |
| 74 | // checking signature inheritance, testing mixed order of types and consts | |
| 75 | mod test_6 { | |
| 76 | fn foo<'a, 'b, T: Clone, const N: usize, U: Clone>(_t: &'a T, _u: &'b U) {} | |
| 77 | ||
| 78 | pub fn check<T: Clone, U: Clone>() { | |
| 79 | reuse foo::<String, 1, String> as bar; | |
| 80 | //~^ ERROR: arguments to this function are incorrect [E0308] | |
| 81 | bar(&"".to_string(), &"".to_string()); | |
| 82 | //~^ ERROR: type annotations needed [E0284] | |
| 83 | } | |
| 84 | } | |
| 85 | ||
| 86 | // FIXME(fn_delegation): Uncomment this test when impl Traits in function params are supported | |
| 87 | ||
| 88 | // mod test_7 { | |
| 89 | // fn foo<T, U>(t: T, u: U, f: impl FnOnce(T, U) -> U) -> U { | |
| 90 | // f(t, u) | |
| 91 | // } | |
| 92 | ||
| 93 | // pub fn check() { | |
| 94 | // reuse foo as bar; | |
| 95 | // assert_eq!(bar::<i32, i32>(1, 2, |x, y| y), 2); | |
| 96 | // } | |
| 97 | // } | |
| 98 | ||
| 99 | // Testing reuse of local fn with delegation parent generic params specified, | |
| 100 | // late-bound lifetimes + types + consts, reusing with user args, | |
| 101 | // checking signature inheritance, mixed consts and types ordering | |
| 102 | mod test_8 { | |
| 103 | pub fn check<T: Clone, U: Clone>() { | |
| 104 | fn foo<'a, 'b, const N: usize, T: Clone, U: Clone>(_t: &'a T, _u: &'b U) {} | |
| 105 | ||
| 106 | reuse foo::<1, String, String> as bar; | |
| 107 | //~^ ERROR: arguments to this function are incorrect [E0308] | |
| 108 | bar(&"".to_string(), &"".to_string()); | |
| 109 | //~^ ERROR: type annotations needed [E0284] | |
| 110 | } | |
| 111 | } | |
| 112 | ||
| 113 | // Testing reuse of local fn inside closure, | |
| 114 | // late-bound lifetimes + types + consts, reusing with user args, | |
| 115 | // checking signature inheritance, mixed consts and types ordering | |
| 116 | mod test_9 { | |
| 117 | pub fn check<T: Clone, U: Clone>() { | |
| 118 | let closure = || { | |
| 119 | fn foo<'a, 'b, T: Clone, const N: usize, U: Clone>(_t: &'a T, _u: &'b U) {} | |
| 120 | ||
| 121 | reuse foo::<String, 1, String> as bar; | |
| 122 | //~^ ERROR: arguments to this function are incorrect [E0308] | |
| 123 | bar(&"".to_string(), &"".to_string()); | |
| 124 | //~^ ERROR: type annotations needed [E0284] | |
| 125 | }; | |
| 126 | ||
| 127 | closure(); | |
| 128 | } | |
| 129 | } | |
| 130 | ||
| 131 | pub fn main() { | |
| 132 | test_1::check(); | |
| 133 | test_2::check::<i32, String>(); | |
| 134 | test_3::check::<i32, String>(); | |
| 135 | test_4::check::<i32, String>(); | |
| 136 | test_5::check::<i32, String>(); | |
| 137 | test_6::check::<i32, String>(); | |
| 138 | // test_7::check(); | |
| 139 | test_8::check::<i32, String>(); | |
| 140 | test_9::check::<String, i32>(); | |
| 141 | } |
tests/ui/delegation/generics/mapping/free-to-free.stderr created+213| ... | ... | @@ -0,0 +1,213 @@ |
| 1 | error[E0284]: type annotations needed | |
| 2 | --> $DIR/free-to-free.rs:17:15 | |
| 3 | | | |
| 4 | LL | reuse foo as bar; | |
| 5 | | ^^^ cannot infer the value of the const parameter `N` declared on the function `foo` | |
| 6 | | | |
| 7 | note: required by a const generic parameter in `test_1::foo` | |
| 8 | --> $DIR/free-to-free.rs:14:48 | |
| 9 | | | |
| 10 | LL | fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {} | |
| 11 | | ^^^^^^^^^^^^^^ required by this const generic parameter in `foo` | |
| 12 | help: consider specifying the generic arguments | |
| 13 | | | |
| 14 | LL | reuse foo::<T, U, N> as bar; | |
| 15 | | +++++++++++ | |
| 16 | ||
| 17 | error[E0284]: type annotations needed | |
| 18 | --> $DIR/free-to-free.rs:29:15 | |
| 19 | | | |
| 20 | LL | reuse foo as bar; | |
| 21 | | ^^^ cannot infer the value of the const parameter `N` declared on the function `foo` | |
| 22 | | | |
| 23 | note: required by a const generic parameter in `test_2::foo` | |
| 24 | --> $DIR/free-to-free.rs:26:48 | |
| 25 | | | |
| 26 | LL | fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {} | |
| 27 | | ^^^^^^^^^^^^^^ required by this const generic parameter in `foo` | |
| 28 | help: consider specifying the generic arguments | |
| 29 | | | |
| 30 | LL | reuse foo::<T, U, N> as bar; | |
| 31 | | +++++++++++ | |
| 32 | ||
| 33 | error[E0284]: type annotations needed | |
| 34 | --> $DIR/free-to-free.rs:41:15 | |
| 35 | | | |
| 36 | LL | reuse foo as bar; | |
| 37 | | ^^^ cannot infer the value of the const parameter `N` declared on the function `foo` | |
| 38 | | | |
| 39 | note: required by a const generic parameter in `test_3::foo` | |
| 40 | --> $DIR/free-to-free.rs:38:48 | |
| 41 | | | |
| 42 | LL | fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {} | |
| 43 | | ^^^^^^^^^^^^^^ required by this const generic parameter in `foo` | |
| 44 | help: consider specifying the generic arguments | |
| 45 | | | |
| 46 | LL | reuse foo::<T, U, N> as bar; | |
| 47 | | +++++++++++ | |
| 48 | ||
| 49 | error[E0284]: type annotations needed | |
| 50 | --> $DIR/free-to-free.rs:54:15 | |
| 51 | | | |
| 52 | LL | reuse foo as bar; | |
| 53 | | ^^^ cannot infer the value of the const parameter `N` declared on the function `foo` | |
| 54 | | | |
| 55 | note: required by a const generic parameter in `test_4::foo` | |
| 56 | --> $DIR/free-to-free.rs:51:40 | |
| 57 | | | |
| 58 | LL | fn foo<'a, 'b, T: Clone, U: Clone, const N: usize>(_t: &'a T, _u: &'b U) {} | |
| 59 | | ^^^^^^^^^^^^^^ required by this const generic parameter in `foo` | |
| 60 | help: consider specifying the generic arguments | |
| 61 | | | |
| 62 | LL | reuse foo::<T, U, N> as bar; | |
| 63 | | +++++++++++ | |
| 64 | ||
| 65 | error[E0284]: type annotations needed | |
| 66 | --> $DIR/free-to-free.rs:67:15 | |
| 67 | | | |
| 68 | LL | reuse foo as bar; | |
| 69 | | ^^^ cannot infer the value of the const parameter `N` declared on the function `foo` | |
| 70 | | | |
| 71 | note: required by a const generic parameter in `test_5::foo` | |
| 72 | --> $DIR/free-to-free.rs:64:30 | |
| 73 | | | |
| 74 | LL | fn foo<'a, 'b, T: Clone, const N: usize, U: Clone>(_t: &'a T, _u: &'b U) {} | |
| 75 | | ^^^^^^^^^^^^^^ required by this const generic parameter in `foo` | |
| 76 | help: consider specifying the generic arguments | |
| 77 | | | |
| 78 | LL | reuse foo::<T, N, U> as bar; | |
| 79 | | +++++++++++ | |
| 80 | ||
| 81 | error[E0284]: type annotations needed | |
| 82 | --> $DIR/free-to-free.rs:81:9 | |
| 83 | | | |
| 84 | LL | bar(&"".to_string(), &"".to_string()); | |
| 85 | | ^^^ cannot infer the value of the const parameter `N` declared on the function `bar` | |
| 86 | | | |
| 87 | note: required by a const generic parameter in `test_6::check::bar` | |
| 88 | --> $DIR/free-to-free.rs:76:30 | |
| 89 | | | |
| 90 | LL | fn foo<'a, 'b, T: Clone, const N: usize, U: Clone>(_t: &'a T, _u: &'b U) {} | |
| 91 | | ^^^^^^^^^^^^^^ required by this const generic parameter in `bar` | |
| 92 | ... | |
| 93 | LL | reuse foo::<String, 1, String> as bar; | |
| 94 | | --- required by a bound in this function | |
| 95 | help: consider specifying the generic arguments | |
| 96 | | | |
| 97 | LL | bar::<String, N, String>(&"".to_string(), &"".to_string()); | |
| 98 | | +++++++++++++++++++++ | |
| 99 | ||
| 100 | error[E0308]: arguments to this function are incorrect | |
| 101 | --> $DIR/free-to-free.rs:79:15 | |
| 102 | | | |
| 103 | LL | fn foo<'a, 'b, T: Clone, const N: usize, U: Clone>(_t: &'a T, _u: &'b U) {} | |
| 104 | | - - found this type parameter | |
| 105 | | | | |
| 106 | | found this type parameter | |
| 107 | ... | |
| 108 | LL | reuse foo::<String, 1, String> as bar; | |
| 109 | | ^^^ | |
| 110 | | | | |
| 111 | | expected `&String`, found `&T` | |
| 112 | | expected `&String`, found `&U` | |
| 113 | | | |
| 114 | = note: expected reference `&String` | |
| 115 | found reference `&'a T` | |
| 116 | = note: expected reference `&String` | |
| 117 | found reference `&'b U` | |
| 118 | note: function defined here | |
| 119 | --> $DIR/free-to-free.rs:76:8 | |
| 120 | | | |
| 121 | LL | fn foo<'a, 'b, T: Clone, const N: usize, U: Clone>(_t: &'a T, _u: &'b U) {} | |
| 122 | | ^^^ --------- --------- | |
| 123 | ||
| 124 | error[E0284]: type annotations needed | |
| 125 | --> $DIR/free-to-free.rs:108:9 | |
| 126 | | | |
| 127 | LL | bar(&"".to_string(), &"".to_string()); | |
| 128 | | ^^^ cannot infer the value of the const parameter `N` declared on the function `bar` | |
| 129 | | | |
| 130 | note: required by a const generic parameter in `test_8::check::bar` | |
| 131 | --> $DIR/free-to-free.rs:104:24 | |
| 132 | | | |
| 133 | LL | fn foo<'a, 'b, const N: usize, T: Clone, U: Clone>(_t: &'a T, _u: &'b U) {} | |
| 134 | | ^^^^^^^^^^^^^^ required by this const generic parameter in `bar` | |
| 135 | LL | | |
| 136 | LL | reuse foo::<1, String, String> as bar; | |
| 137 | | --- required by a bound in this function | |
| 138 | help: consider specifying the generic arguments | |
| 139 | | | |
| 140 | LL | bar::<N, String, String>(&"".to_string(), &"".to_string()); | |
| 141 | | +++++++++++++++++++++ | |
| 142 | ||
| 143 | error[E0308]: arguments to this function are incorrect | |
| 144 | --> $DIR/free-to-free.rs:106:15 | |
| 145 | | | |
| 146 | LL | fn foo<'a, 'b, const N: usize, T: Clone, U: Clone>(_t: &'a T, _u: &'b U) {} | |
| 147 | | - - found this type parameter | |
| 148 | | | | |
| 149 | | found this type parameter | |
| 150 | LL | | |
| 151 | LL | reuse foo::<1, String, String> as bar; | |
| 152 | | ^^^ | |
| 153 | | | | |
| 154 | | expected `&String`, found `&T` | |
| 155 | | expected `&String`, found `&U` | |
| 156 | | | |
| 157 | = note: expected reference `&String` | |
| 158 | found reference `&'a T` | |
| 159 | = note: expected reference `&String` | |
| 160 | found reference `&'b U` | |
| 161 | note: function defined here | |
| 162 | --> $DIR/free-to-free.rs:104:12 | |
| 163 | | | |
| 164 | LL | fn foo<'a, 'b, const N: usize, T: Clone, U: Clone>(_t: &'a T, _u: &'b U) {} | |
| 165 | | ^^^ --------- --------- | |
| 166 | ||
| 167 | error[E0284]: type annotations needed | |
| 168 | --> $DIR/free-to-free.rs:123:13 | |
| 169 | | | |
| 170 | LL | bar(&"".to_string(), &"".to_string()); | |
| 171 | | ^^^ cannot infer the value of the const parameter `N` declared on the function `bar` | |
| 172 | | | |
| 173 | note: required by a const generic parameter in `test_9::check::{closure#0}::bar` | |
| 174 | --> $DIR/free-to-free.rs:119:38 | |
| 175 | | | |
| 176 | LL | fn foo<'a, 'b, T: Clone, const N: usize, U: Clone>(_t: &'a T, _u: &'b U) {} | |
| 177 | | ^^^^^^^^^^^^^^ required by this const generic parameter in `bar` | |
| 178 | LL | | |
| 179 | LL | reuse foo::<String, 1, String> as bar; | |
| 180 | | --- required by a bound in this function | |
| 181 | help: consider specifying the generic arguments | |
| 182 | | | |
| 183 | LL | bar::<String, N, String>(&"".to_string(), &"".to_string()); | |
| 184 | | +++++++++++++++++++++ | |
| 185 | ||
| 186 | error[E0308]: arguments to this function are incorrect | |
| 187 | --> $DIR/free-to-free.rs:121:19 | |
| 188 | | | |
| 189 | LL | fn foo<'a, 'b, T: Clone, const N: usize, U: Clone>(_t: &'a T, _u: &'b U) {} | |
| 190 | | - - found this type parameter | |
| 191 | | | | |
| 192 | | found this type parameter | |
| 193 | LL | | |
| 194 | LL | reuse foo::<String, 1, String> as bar; | |
| 195 | | ^^^ | |
| 196 | | | | |
| 197 | | expected `&String`, found `&T` | |
| 198 | | expected `&String`, found `&U` | |
| 199 | | | |
| 200 | = note: expected reference `&String` | |
| 201 | found reference `&'a T` | |
| 202 | = note: expected reference `&String` | |
| 203 | found reference `&'b U` | |
| 204 | note: function defined here | |
| 205 | --> $DIR/free-to-free.rs:119:16 | |
| 206 | | | |
| 207 | LL | fn foo<'a, 'b, T: Clone, const N: usize, U: Clone>(_t: &'a T, _u: &'b U) {} | |
| 208 | | ^^^ --------- --------- | |
| 209 | ||
| 210 | error: aborting due to 11 previous errors | |
| 211 | ||
| 212 | Some errors have detailed explanations: E0284, E0308. | |
| 213 | For more information about an error, try `rustc --explain E0284`. |
tests/ui/delegation/generics/mapping/free-to-trait.rs created+268| ... | ... | @@ -0,0 +1,268 @@ |
| 1 | #![feature(fn_delegation)] | |
| 2 | #![allow(incomplete_features)] | |
| 3 | #![allow(late_bound_lifetime_arguments)] | |
| 4 | ||
| 5 | //! This is one of the mapping tests, which tests mapping of delegee parent and child | |
| 6 | //! generic params, whose main goal is to create cases with | |
| 7 | //! different number of lifetimes/types/consts in delegee child and parent; and in | |
| 8 | //! delegation parent if applicable. At some tests predicates are | |
| 9 | //! added. At some tests user-specified args are specified in reuse statement. | |
| 10 | ||
| 11 | // Testing lifetimes + types + consts in both parent and child, reusing in | |
| 12 | // a function without generic params | |
| 13 | mod test_1 { | |
| 14 | trait Trait<'b, 'c, 'a, T, const N: usize>: Sized { | |
| 15 | fn foo<'d: 'd, U, const M: bool>(self) {} | |
| 16 | } | |
| 17 | ||
| 18 | impl Trait<'static, 'static, 'static, i32, 1> for u8 {} | |
| 19 | ||
| 20 | pub fn check() { | |
| 21 | fn no_ctx() { | |
| 22 | reuse Trait::foo as bar; | |
| 23 | //~^ ERROR: type annotations needed [E0284] | |
| 24 | bar::<'static, 'static, 'static, 'static, u8, i32, 1, String, true>(123); | |
| 25 | } | |
| 26 | ||
| 27 | fn with_ctx<'a, 'b, 'c, A, B, C, const N: usize, const M: bool>() { | |
| 28 | reuse Trait::foo as bar; | |
| 29 | //~^ ERROR: type annotations needed [E0284] | |
| 30 | bar::<'static, 'static, 'static, 'a, u8, i32, 1, A, M>(123); | |
| 31 | } | |
| 32 | ||
| 33 | no_ctx(); | |
| 34 | with_ctx::<i32, i32, i32, 1, true>(); | |
| 35 | } | |
| 36 | } | |
| 37 | ||
| 38 | // Testing lifetimes + types + consts in both parent and child, add user-specified args to parent | |
| 39 | mod test_2 { | |
| 40 | trait Trait<'a, T, const N: usize>: Sized { | |
| 41 | fn foo<'b: 'b, U, const M: bool>(self) {} | |
| 42 | } | |
| 43 | ||
| 44 | impl Trait<'static, i32, 1> for u8 {} | |
| 45 | ||
| 46 | pub fn check() { | |
| 47 | reuse Trait::<'static, i32, 1>::foo as bar; | |
| 48 | //~^ ERROR: the trait bound `Self: test_2::Trait<'static, i32, 1>` is not satisfied [E0277] | |
| 49 | ||
| 50 | bar::<'static, u8, String, true>(123); | |
| 51 | //~^ ERROR: function takes 5 generic arguments but 3 generic arguments were supplied [E0107] | |
| 52 | //~| ERROR: function takes 2 lifetime arguments but 1 lifetime argument was supplied [E0107] | |
| 53 | } | |
| 54 | } | |
| 55 | ||
| 56 | // Testing lifetimes + types + consts in both parent and child, | |
| 57 | // add user-specified args to child | |
| 58 | mod test_3 { | |
| 59 | trait Trait<'a, T, const N: usize>: Sized { | |
| 60 | fn foo<'b: 'b, U, const M: bool>(self) {} | |
| 61 | } | |
| 62 | ||
| 63 | impl Trait<'static, String, 1> for u8 {} | |
| 64 | ||
| 65 | pub fn check() { | |
| 66 | reuse Trait::foo::<'static, i32, true> as bar; | |
| 67 | ||
| 68 | bar::<'static, u8, String, 1>(123); | |
| 69 | //~^ ERROR: function takes 5 generic arguments but 3 generic arguments were supplied [E0107] | |
| 70 | //~| ERROR: function takes 2 lifetime arguments but 1 lifetime argument was supplied [E0107] | |
| 71 | } | |
| 72 | } | |
| 73 | ||
| 74 | // Testing types/consts in parent, lifetimes + types/consts in child, | |
| 75 | // add user-specified args to child | |
| 76 | mod test_4 { | |
| 77 | trait Trait<T, const N: usize>: Sized { | |
| 78 | fn foo<'b: 'b, U, const M: bool>(self) {} | |
| 79 | } | |
| 80 | ||
| 81 | impl Trait<String, 1> for u8 {} | |
| 82 | ||
| 83 | pub fn check() { | |
| 84 | reuse Trait::foo::<'static, i32, true> as bar; | |
| 85 | ||
| 86 | bar::<u8, String, 1>(123); | |
| 87 | //~^ ERROR: function takes 5 generic arguments but 3 generic arguments were supplied [E0107] | |
| 88 | } | |
| 89 | } | |
| 90 | ||
| 91 | // Testing consts in parent, lifetimes + types/consts in child, add user-specified args to child | |
| 92 | mod test_5 { | |
| 93 | trait Trait<const N: usize>: Sized { | |
| 94 | fn foo<'b: 'b, U, const M: bool>(self) {} | |
| 95 | } | |
| 96 | ||
| 97 | impl Trait<1> for u8 {} | |
| 98 | ||
| 99 | pub fn check() { | |
| 100 | reuse Trait::foo::<'static, i32, true> as bar; | |
| 101 | ||
| 102 | bar::<u8, 1>(123); | |
| 103 | //~^ ERROR: function takes 4 generic arguments but 2 generic arguments were supplied [E0107] | |
| 104 | } | |
| 105 | } | |
| 106 | ||
| 107 | // Testing no generics in parent, lifetimes + types/consts in child, | |
| 108 | // add user-specified args to child | |
| 109 | mod test_6 { | |
| 110 | trait Trait: Sized { | |
| 111 | fn foo<'b: 'b, U, const M: bool>(self) {} | |
| 112 | } | |
| 113 | ||
| 114 | impl Trait for u8 {} | |
| 115 | ||
| 116 | pub fn check() { | |
| 117 | reuse Trait::foo::<'static, i32, true> as bar; | |
| 118 | ||
| 119 | bar::<u8>(123); | |
| 120 | //~^ ERROR: function takes 3 generic arguments but 1 generic argument was supplied [E0107] | |
| 121 | } | |
| 122 | } | |
| 123 | ||
| 124 | // Testing lifetimes + types/consts in parent, types/consts in child, | |
| 125 | // add user-specified args to parent | |
| 126 | mod test_7 { | |
| 127 | trait Trait<'a, T, const N: usize>: Sized { | |
| 128 | fn foo<U, const M: bool>(self) {} | |
| 129 | } | |
| 130 | ||
| 131 | impl Trait<'static, i32, 1> for u8 {} | |
| 132 | ||
| 133 | pub fn check() { | |
| 134 | reuse Trait::<'static, i32, 1>::foo as bar; | |
| 135 | //~^ ERROR: the trait bound `Self: test_7::Trait<'static, i32, 1>` is not satisfied [E0277] | |
| 136 | ||
| 137 | bar::<u8, String, true>(123); | |
| 138 | //~^ ERROR: function takes 5 generic arguments but 3 generic arguments were supplied [E0107] | |
| 139 | } | |
| 140 | } | |
| 141 | ||
| 142 | // Testing lifetimes + types/consts in parent, consts in child, add user-specified args to parent | |
| 143 | mod test_8 { | |
| 144 | trait Trait<'a, T, const N: usize>: Sized { | |
| 145 | fn foo<const M: bool>(self) {} | |
| 146 | } | |
| 147 | ||
| 148 | impl Trait<'static, i32, 1> for u8 {} | |
| 149 | ||
| 150 | pub fn check() { | |
| 151 | reuse Trait::<'static, i32, 1>::foo as bar; | |
| 152 | //~^ ERROR: the trait bound `Self: test_8::Trait<'static, i32, 1>` is not satisfied [E0277] | |
| 153 | ||
| 154 | bar::<u8, true>(123); | |
| 155 | //~^ ERROR: function takes 4 generic arguments but 2 generic arguments were supplied [E0107] | |
| 156 | } | |
| 157 | } | |
| 158 | ||
| 159 | // Testing lifetimes + types/consts in parent, none in child, add user-specified args to parent | |
| 160 | mod test_9 { | |
| 161 | trait Trait<'a, T, const N: usize>: Sized { | |
| 162 | fn foo(self) {} | |
| 163 | } | |
| 164 | ||
| 165 | impl Trait<'static, i32, 1> for u8 {} | |
| 166 | ||
| 167 | pub fn check() { | |
| 168 | reuse Trait::<'static, i32, 1>::foo as bar; | |
| 169 | //~^ ERROR: the trait bound `Self: test_9::Trait<'static, i32, 1>` is not satisfied [E0277] | |
| 170 | ||
| 171 | bar::<u8>(123); | |
| 172 | //~^ ERROR: function takes 3 generic arguments but 1 generic argument was supplied [E0107] | |
| 173 | } | |
| 174 | } | |
| 175 | ||
| 176 | // Testing lifetimes + types in parent, lifetimes + types/consts in child, | |
| 177 | // adding self ty to reuse, testing using generic params from delegation parent | |
| 178 | // context, adding user-specified args to none, parent, parent and child | |
| 179 | mod test_10 { | |
| 180 | trait Trait<'b, 'c, T> { | |
| 181 | fn foo<'d: 'd, U, const M: bool>() {} | |
| 182 | } | |
| 183 | ||
| 184 | impl<'b, 'c, T> Trait<'b, 'c, T> for u8 {} | |
| 185 | ||
| 186 | pub fn check() { | |
| 187 | fn with_ctx<'a, 'b, 'c, A, B, C, const N: usize, const M: bool>() { | |
| 188 | reuse <u8 as Trait>::foo as bar; | |
| 189 | //~^ ERROR: missing generics for trait `test_10::Trait` [E0107] | |
| 190 | bar::<'a, 'b, 'c, u8, C, A, M>(); | |
| 191 | bar::<'static, 'static, 'static, u8, i32, i32, false>(); | |
| 192 | ||
| 193 | reuse <u8 as Trait::<'static, 'static, i32>>::foo as bar1; | |
| 194 | //~^ ERROR: type annotations needed [E0284] | |
| 195 | bar1::<'static, u8, i32, true>(); | |
| 196 | //~^ ERROR: function takes 4 generic arguments but 3 generic arguments were supplied [E0107] | |
| 197 | //~| ERROR: function takes 3 lifetime arguments but 1 lifetime argument was supplied [E0107] | |
| 198 | ||
| 199 | reuse <u8 as Trait::<'static, 'static, i32>>::foo::<'static, u32, true> as bar2; | |
| 200 | bar2::<u8>(); | |
| 201 | //~^ ERROR: function takes 4 generic arguments but 1 generic argument was supplied [E0107] | |
| 202 | } | |
| 203 | ||
| 204 | with_ctx::<i32, i32, i32, 1, true>(); | |
| 205 | } | |
| 206 | } | |
| 207 | ||
| 208 | // Testing lifetimes + types in parent, lifetimes + types/consts in child, | |
| 209 | // adding self ty to reuse, testing using generic params from delegation parent | |
| 210 | // context, testing predicates inheritance | |
| 211 | mod test_11 { | |
| 212 | trait Bound0 {} | |
| 213 | trait Bound1 {} | |
| 214 | trait Bound2<T, U> {} | |
| 215 | ||
| 216 | trait Trait<'a: 'static, T, P> | |
| 217 | where | |
| 218 | Self: Sized, | |
| 219 | T: Bound0, | |
| 220 | P: Bound2<P, Vec<Vec<Vec<T>>>>, | |
| 221 | { | |
| 222 | fn foo<'d: 'd, U: Bound1, const M: bool>() {} | |
| 223 | } | |
| 224 | ||
| 225 | impl Bound0 for u32 {} | |
| 226 | impl Bound1 for String {} | |
| 227 | impl<'a: 'static, T: Bound0, P: Bound2<P, Vec<Vec<Vec<T>>>>> Trait<'a, T, P> for usize {} | |
| 228 | ||
| 229 | struct Struct; | |
| 230 | impl Bound2<Struct, Vec<Vec<Vec<u32>>>> for Struct {} | |
| 231 | ||
| 232 | pub fn check<'b>() { | |
| 233 | reuse <usize as Trait>::foo; | |
| 234 | //~^ ERROR: missing generics for trait `test_11::Trait` [E0107] | |
| 235 | foo::<'static, 'b, usize, u32, Struct, String, false>(); | |
| 236 | } | |
| 237 | } | |
| 238 | ||
| 239 | // Testing lifetimes + types/consts in parent with defaults, none in child, | |
| 240 | // reuse without user-specified args | |
| 241 | mod test_12 { | |
| 242 | trait Trait<'a, T = usize, const N: usize = 123>: Sized { | |
| 243 | fn foo(self) {} | |
| 244 | } | |
| 245 | ||
| 246 | impl Trait<'static, i32, 1> for u8 {} | |
| 247 | ||
| 248 | pub fn check() { | |
| 249 | reuse Trait::foo as bar; | |
| 250 | ||
| 251 | bar::<u8, i32, 1>(123); | |
| 252 | } | |
| 253 | } | |
| 254 | ||
| 255 | pub fn main() { | |
| 256 | test_1::check(); | |
| 257 | test_2::check(); | |
| 258 | test_3::check(); | |
| 259 | test_4::check(); | |
| 260 | test_5::check(); | |
| 261 | test_6::check(); | |
| 262 | test_7::check(); | |
| 263 | test_8::check(); | |
| 264 | test_9::check(); | |
| 265 | test_10::check(); | |
| 266 | test_11::check(); | |
| 267 | test_12::check(); | |
| 268 | } |
tests/ui/delegation/generics/mapping/free-to-trait.stderr created+401| ... | ... | @@ -0,0 +1,401 @@ |
| 1 | error[E0284]: type annotations needed | |
| 2 | --> $DIR/free-to-trait.rs:22:26 | |
| 3 | | | |
| 4 | LL | reuse Trait::foo as bar; | |
| 5 | | ^^^ cannot infer the value of the const parameter `M` declared on the method `foo` | |
| 6 | | | |
| 7 | note: required by a const generic parameter in `test_1::Trait::foo` | |
| 8 | --> $DIR/free-to-trait.rs:15:27 | |
| 9 | | | |
| 10 | LL | fn foo<'d: 'd, U, const M: bool>(self) {} | |
| 11 | | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo` | |
| 12 | help: consider specifying the generic arguments | |
| 13 | | | |
| 14 | LL | reuse Trait::foo::<U, M> as bar; | |
| 15 | | ++++++++ | |
| 16 | ||
| 17 | error[E0284]: type annotations needed | |
| 18 | --> $DIR/free-to-trait.rs:28:26 | |
| 19 | | | |
| 20 | LL | reuse Trait::foo as bar; | |
| 21 | | ^^^ cannot infer the value of the const parameter `M` declared on the method `foo` | |
| 22 | | | |
| 23 | note: required by a const generic parameter in `test_1::Trait::foo` | |
| 24 | --> $DIR/free-to-trait.rs:15:27 | |
| 25 | | | |
| 26 | LL | fn foo<'d: 'd, U, const M: bool>(self) {} | |
| 27 | | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo` | |
| 28 | help: consider specifying the generic arguments | |
| 29 | | | |
| 30 | LL | reuse Trait::foo::<U, M> as bar; | |
| 31 | | ++++++++ | |
| 32 | ||
| 33 | error[E0107]: function takes 2 lifetime arguments but 1 lifetime argument was supplied | |
| 34 | --> $DIR/free-to-trait.rs:50:9 | |
| 35 | | | |
| 36 | LL | bar::<'static, u8, String, true>(123); | |
| 37 | | ^^^ ------- supplied 1 lifetime argument | |
| 38 | | | | |
| 39 | | expected 2 lifetime arguments | |
| 40 | | | |
| 41 | note: function defined here, with 2 lifetime parameters: `'a`, `'b` | |
| 42 | --> $DIR/free-to-trait.rs:47:48 | |
| 43 | | | |
| 44 | LL | trait Trait<'a, T, const N: usize>: Sized { | |
| 45 | | -- | |
| 46 | LL | fn foo<'b: 'b, U, const M: bool>(self) {} | |
| 47 | | -- | |
| 48 | ... | |
| 49 | LL | reuse Trait::<'static, i32, 1>::foo as bar; | |
| 50 | | ^^^ | |
| 51 | help: add missing lifetime argument | |
| 52 | | | |
| 53 | LL | bar::<'static, 'static, u8, String, true>(123); | |
| 54 | | +++++++++ | |
| 55 | ||
| 56 | error[E0107]: function takes 5 generic arguments but 3 generic arguments were supplied | |
| 57 | --> $DIR/free-to-trait.rs:50:9 | |
| 58 | | | |
| 59 | LL | bar::<'static, u8, String, true>(123); | |
| 60 | | ^^^ -- ------ ---- supplied 3 generic arguments | |
| 61 | | | | |
| 62 | | expected 5 generic arguments | |
| 63 | | | |
| 64 | note: function defined here, with 5 generic parameters: `Self`, `T`, `N`, `U`, `M` | |
| 65 | --> $DIR/free-to-trait.rs:47:48 | |
| 66 | | | |
| 67 | LL | trait Trait<'a, T, const N: usize>: Sized { | |
| 68 | | ----------------------------------------- | |
| 69 | LL | fn foo<'b: 'b, U, const M: bool>(self) {} | |
| 70 | | - ------------- | |
| 71 | ... | |
| 72 | LL | reuse Trait::<'static, i32, 1>::foo as bar; | |
| 73 | | ^^^ | |
| 74 | help: add missing generic arguments | |
| 75 | | | |
| 76 | LL | bar::<'static, u8, String, true, U, M>(123); | |
| 77 | | ++++++ | |
| 78 | ||
| 79 | error[E0277]: the trait bound `Self: test_2::Trait<'static, i32, 1>` is not satisfied | |
| 80 | --> $DIR/free-to-trait.rs:47:41 | |
| 81 | | | |
| 82 | LL | reuse Trait::<'static, i32, 1>::foo as bar; | |
| 83 | | ^^^ the trait `test_2::Trait<'static, i32, 1>` is not implemented for `Self` | |
| 84 | ||
| 85 | error[E0107]: function takes 2 lifetime arguments but 1 lifetime argument was supplied | |
| 86 | --> $DIR/free-to-trait.rs:68:9 | |
| 87 | | | |
| 88 | LL | bar::<'static, u8, String, 1>(123); | |
| 89 | | ^^^ ------- supplied 1 lifetime argument | |
| 90 | | | | |
| 91 | | expected 2 lifetime arguments | |
| 92 | | | |
| 93 | note: function defined here, with 2 lifetime parameters: `'a`, `'b` | |
| 94 | --> $DIR/free-to-trait.rs:66:51 | |
| 95 | | | |
| 96 | LL | trait Trait<'a, T, const N: usize>: Sized { | |
| 97 | | -- | |
| 98 | LL | fn foo<'b: 'b, U, const M: bool>(self) {} | |
| 99 | | -- | |
| 100 | ... | |
| 101 | LL | reuse Trait::foo::<'static, i32, true> as bar; | |
| 102 | | ^^^ | |
| 103 | help: add missing lifetime argument | |
| 104 | | | |
| 105 | LL | bar::<'static, 'static, u8, String, 1>(123); | |
| 106 | | +++++++++ | |
| 107 | ||
| 108 | error[E0107]: function takes 5 generic arguments but 3 generic arguments were supplied | |
| 109 | --> $DIR/free-to-trait.rs:68:9 | |
| 110 | | | |
| 111 | LL | bar::<'static, u8, String, 1>(123); | |
| 112 | | ^^^ -- ------ - supplied 3 generic arguments | |
| 113 | | | | |
| 114 | | expected 5 generic arguments | |
| 115 | | | |
| 116 | note: function defined here, with 5 generic parameters: `Self`, `T`, `N`, `U`, `M` | |
| 117 | --> $DIR/free-to-trait.rs:66:51 | |
| 118 | | | |
| 119 | LL | trait Trait<'a, T, const N: usize>: Sized { | |
| 120 | | ----------------------------------------- | |
| 121 | LL | fn foo<'b: 'b, U, const M: bool>(self) {} | |
| 122 | | - ------------- | |
| 123 | ... | |
| 124 | LL | reuse Trait::foo::<'static, i32, true> as bar; | |
| 125 | | ^^^ | |
| 126 | help: add missing generic arguments | |
| 127 | | | |
| 128 | LL | bar::<'static, u8, String, 1, U, M>(123); | |
| 129 | | ++++++ | |
| 130 | ||
| 131 | error[E0107]: function takes 5 generic arguments but 3 generic arguments were supplied | |
| 132 | --> $DIR/free-to-trait.rs:86:9 | |
| 133 | | | |
| 134 | LL | bar::<u8, String, 1>(123); | |
| 135 | | ^^^ -- ------ - supplied 3 generic arguments | |
| 136 | | | | |
| 137 | | expected 5 generic arguments | |
| 138 | | | |
| 139 | note: function defined here, with 5 generic parameters: `Self`, `T`, `N`, `U`, `M` | |
| 140 | --> $DIR/free-to-trait.rs:84:51 | |
| 141 | | | |
| 142 | LL | trait Trait<T, const N: usize>: Sized { | |
| 143 | | ------------------------------------- | |
| 144 | LL | fn foo<'b: 'b, U, const M: bool>(self) {} | |
| 145 | | - ------------- | |
| 146 | ... | |
| 147 | LL | reuse Trait::foo::<'static, i32, true> as bar; | |
| 148 | | ^^^ | |
| 149 | help: add missing generic arguments | |
| 150 | | | |
| 151 | LL | bar::<u8, String, 1, U, M>(123); | |
| 152 | | ++++++ | |
| 153 | ||
| 154 | error[E0107]: function takes 4 generic arguments but 2 generic arguments were supplied | |
| 155 | --> $DIR/free-to-trait.rs:102:9 | |
| 156 | | | |
| 157 | LL | bar::<u8, 1>(123); | |
| 158 | | ^^^ -- - supplied 2 generic arguments | |
| 159 | | | | |
| 160 | | expected 4 generic arguments | |
| 161 | | | |
| 162 | note: function defined here, with 4 generic parameters: `Self`, `N`, `U`, `M` | |
| 163 | --> $DIR/free-to-trait.rs:100:51 | |
| 164 | | | |
| 165 | LL | trait Trait<const N: usize>: Sized { | |
| 166 | | ---------------------------------- | |
| 167 | LL | fn foo<'b: 'b, U, const M: bool>(self) {} | |
| 168 | | - ------------- | |
| 169 | ... | |
| 170 | LL | reuse Trait::foo::<'static, i32, true> as bar; | |
| 171 | | ^^^ | |
| 172 | help: add missing generic arguments | |
| 173 | | | |
| 174 | LL | bar::<u8, 1, U, M>(123); | |
| 175 | | ++++++ | |
| 176 | ||
| 177 | error[E0107]: function takes 3 generic arguments but 1 generic argument was supplied | |
| 178 | --> $DIR/free-to-trait.rs:119:9 | |
| 179 | | | |
| 180 | LL | bar::<u8>(123); | |
| 181 | | ^^^ -- supplied 1 generic argument | |
| 182 | | | | |
| 183 | | expected 3 generic arguments | |
| 184 | | | |
| 185 | note: function defined here, with 3 generic parameters: `Self`, `U`, `M` | |
| 186 | --> $DIR/free-to-trait.rs:117:51 | |
| 187 | | | |
| 188 | LL | trait Trait: Sized { | |
| 189 | | ------------------ | |
| 190 | LL | fn foo<'b: 'b, U, const M: bool>(self) {} | |
| 191 | | - ------------- | |
| 192 | ... | |
| 193 | LL | reuse Trait::foo::<'static, i32, true> as bar; | |
| 194 | | ^^^ | |
| 195 | help: add missing generic arguments | |
| 196 | | | |
| 197 | LL | bar::<u8, U, M>(123); | |
| 198 | | ++++++ | |
| 199 | ||
| 200 | error[E0107]: function takes 5 generic arguments but 3 generic arguments were supplied | |
| 201 | --> $DIR/free-to-trait.rs:137:9 | |
| 202 | | | |
| 203 | LL | bar::<u8, String, true>(123); | |
| 204 | | ^^^ -- ------ ---- supplied 3 generic arguments | |
| 205 | | | | |
| 206 | | expected 5 generic arguments | |
| 207 | | | |
| 208 | note: function defined here, with 5 generic parameters: `Self`, `T`, `N`, `U`, `M` | |
| 209 | --> $DIR/free-to-trait.rs:134:48 | |
| 210 | | | |
| 211 | LL | trait Trait<'a, T, const N: usize>: Sized { | |
| 212 | | ----------------------------------------- | |
| 213 | LL | fn foo<U, const M: bool>(self) {} | |
| 214 | | - ------------- | |
| 215 | ... | |
| 216 | LL | reuse Trait::<'static, i32, 1>::foo as bar; | |
| 217 | | ^^^ | |
| 218 | help: add missing generic arguments | |
| 219 | | | |
| 220 | LL | bar::<u8, String, true, U, M>(123); | |
| 221 | | ++++++ | |
| 222 | ||
| 223 | error[E0277]: the trait bound `Self: test_7::Trait<'static, i32, 1>` is not satisfied | |
| 224 | --> $DIR/free-to-trait.rs:134:41 | |
| 225 | | | |
| 226 | LL | reuse Trait::<'static, i32, 1>::foo as bar; | |
| 227 | | ^^^ the trait `test_7::Trait<'static, i32, 1>` is not implemented for `Self` | |
| 228 | ||
| 229 | error[E0107]: function takes 4 generic arguments but 2 generic arguments were supplied | |
| 230 | --> $DIR/free-to-trait.rs:154:9 | |
| 231 | | | |
| 232 | LL | bar::<u8, true>(123); | |
| 233 | | ^^^ -- ---- supplied 2 generic arguments | |
| 234 | | | | |
| 235 | | expected 4 generic arguments | |
| 236 | | | |
| 237 | note: function defined here, with 4 generic parameters: `Self`, `T`, `N`, `M` | |
| 238 | --> $DIR/free-to-trait.rs:151:48 | |
| 239 | | | |
| 240 | LL | trait Trait<'a, T, const N: usize>: Sized { | |
| 241 | | ----------------------------------------- | |
| 242 | LL | fn foo<const M: bool>(self) {} | |
| 243 | | ------------- | |
| 244 | ... | |
| 245 | LL | reuse Trait::<'static, i32, 1>::foo as bar; | |
| 246 | | ^^^ | |
| 247 | help: add missing generic arguments | |
| 248 | | | |
| 249 | LL | bar::<u8, true, N, M>(123); | |
| 250 | | ++++++ | |
| 251 | ||
| 252 | error[E0277]: the trait bound `Self: test_8::Trait<'static, i32, 1>` is not satisfied | |
| 253 | --> $DIR/free-to-trait.rs:151:41 | |
| 254 | | | |
| 255 | LL | reuse Trait::<'static, i32, 1>::foo as bar; | |
| 256 | | ^^^ the trait `test_8::Trait<'static, i32, 1>` is not implemented for `Self` | |
| 257 | ||
| 258 | error[E0107]: function takes 3 generic arguments but 1 generic argument was supplied | |
| 259 | --> $DIR/free-to-trait.rs:171:9 | |
| 260 | | | |
| 261 | LL | bar::<u8>(123); | |
| 262 | | ^^^ -- supplied 1 generic argument | |
| 263 | | | | |
| 264 | | expected 3 generic arguments | |
| 265 | | | |
| 266 | note: function defined here, with 3 generic parameters: `Self`, `T`, `N` | |
| 267 | --> $DIR/free-to-trait.rs:168:48 | |
| 268 | | | |
| 269 | LL | trait Trait<'a, T, const N: usize>: Sized { | |
| 270 | | ----------------------------------------- | |
| 271 | ... | |
| 272 | LL | reuse Trait::<'static, i32, 1>::foo as bar; | |
| 273 | | ^^^ | |
| 274 | help: add missing generic arguments | |
| 275 | | | |
| 276 | LL | bar::<u8, T, N>(123); | |
| 277 | | ++++++ | |
| 278 | ||
| 279 | error[E0277]: the trait bound `Self: test_9::Trait<'static, i32, 1>` is not satisfied | |
| 280 | --> $DIR/free-to-trait.rs:168:41 | |
| 281 | | | |
| 282 | LL | reuse Trait::<'static, i32, 1>::foo as bar; | |
| 283 | | ^^^ the trait `test_9::Trait<'static, i32, 1>` is not implemented for `Self` | |
| 284 | ||
| 285 | error[E0107]: function takes 3 lifetime arguments but 1 lifetime argument was supplied | |
| 286 | --> $DIR/free-to-trait.rs:195:13 | |
| 287 | | | |
| 288 | LL | bar1::<'static, u8, i32, true>(); | |
| 289 | | ^^^^ ------- supplied 1 lifetime argument | |
| 290 | | | | |
| 291 | | expected 3 lifetime arguments | |
| 292 | | | |
| 293 | note: function defined here, with 3 lifetime parameters: `'b`, `'c`, `'d` | |
| 294 | --> $DIR/free-to-trait.rs:193:66 | |
| 295 | | | |
| 296 | LL | trait Trait<'b, 'c, T> { | |
| 297 | | -- -- | |
| 298 | LL | fn foo<'d: 'd, U, const M: bool>() {} | |
| 299 | | -- | |
| 300 | ... | |
| 301 | LL | reuse <u8 as Trait::<'static, 'static, i32>>::foo as bar1; | |
| 302 | | ^^^^ | |
| 303 | help: add missing lifetime arguments | |
| 304 | | | |
| 305 | LL | bar1::<'static, 'static, 'static, u8, i32, true>(); | |
| 306 | | ++++++++++++++++++ | |
| 307 | ||
| 308 | error[E0107]: function takes 4 generic arguments but 3 generic arguments were supplied | |
| 309 | --> $DIR/free-to-trait.rs:195:13 | |
| 310 | | | |
| 311 | LL | bar1::<'static, u8, i32, true>(); | |
| 312 | | ^^^^ -- --- ---- supplied 3 generic arguments | |
| 313 | | | | |
| 314 | | expected 4 generic arguments | |
| 315 | | | |
| 316 | note: function defined here, with 4 generic parameters: `Self`, `T`, `U`, `M` | |
| 317 | --> $DIR/free-to-trait.rs:193:66 | |
| 318 | | | |
| 319 | LL | trait Trait<'b, 'c, T> { | |
| 320 | | ---------------------- | |
| 321 | LL | fn foo<'d: 'd, U, const M: bool>() {} | |
| 322 | | - ------------- | |
| 323 | ... | |
| 324 | LL | reuse <u8 as Trait::<'static, 'static, i32>>::foo as bar1; | |
| 325 | | ^^^^ | |
| 326 | help: add missing generic argument | |
| 327 | | | |
| 328 | LL | bar1::<'static, u8, i32, true, M>(); | |
| 329 | | +++ | |
| 330 | ||
| 331 | error[E0107]: function takes 4 generic arguments but 1 generic argument was supplied | |
| 332 | --> $DIR/free-to-trait.rs:200:13 | |
| 333 | | | |
| 334 | LL | bar2::<u8>(); | |
| 335 | | ^^^^ -- supplied 1 generic argument | |
| 336 | | | | |
| 337 | | expected 4 generic arguments | |
| 338 | | | |
| 339 | note: function defined here, with 4 generic parameters: `Self`, `T`, `U`, `M` | |
| 340 | --> $DIR/free-to-trait.rs:199:88 | |
| 341 | | | |
| 342 | LL | trait Trait<'b, 'c, T> { | |
| 343 | | ---------------------- | |
| 344 | LL | fn foo<'d: 'd, U, const M: bool>() {} | |
| 345 | | - ------------- | |
| 346 | ... | |
| 347 | LL | reuse <u8 as Trait::<'static, 'static, i32>>::foo::<'static, u32, true> as bar2; | |
| 348 | | ^^^^ | |
| 349 | help: add missing generic arguments | |
| 350 | | | |
| 351 | LL | bar2::<u8, T, U, M>(); | |
| 352 | | +++++++++ | |
| 353 | ||
| 354 | error[E0107]: missing generics for trait `test_10::Trait` | |
| 355 | --> $DIR/free-to-trait.rs:188:26 | |
| 356 | | | |
| 357 | LL | reuse <u8 as Trait>::foo as bar; | |
| 358 | | ^^^^^ expected 1 generic argument | |
| 359 | | | |
| 360 | note: trait defined here, with 1 generic parameter: `T` | |
| 361 | --> $DIR/free-to-trait.rs:180:11 | |
| 362 | | | |
| 363 | LL | trait Trait<'b, 'c, T> { | |
| 364 | | ^^^^^ - | |
| 365 | help: add missing generic argument | |
| 366 | | | |
| 367 | LL | reuse <u8 as Trait<T>>::foo as bar; | |
| 368 | | +++ | |
| 369 | ||
| 370 | error[E0284]: type annotations needed | |
| 371 | --> $DIR/free-to-trait.rs:193:59 | |
| 372 | | | |
| 373 | LL | reuse <u8 as Trait::<'static, 'static, i32>>::foo as bar1; | |
| 374 | | ^^^ cannot infer the value of the const parameter `M` declared on the associated function `foo` | |
| 375 | | | |
| 376 | note: required by a const generic parameter in `test_10::Trait::foo` | |
| 377 | --> $DIR/free-to-trait.rs:181:27 | |
| 378 | | | |
| 379 | LL | fn foo<'d: 'd, U, const M: bool>() {} | |
| 380 | | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo` | |
| 381 | ||
| 382 | error[E0107]: missing generics for trait `test_11::Trait` | |
| 383 | --> $DIR/free-to-trait.rs:233:25 | |
| 384 | | | |
| 385 | LL | reuse <usize as Trait>::foo; | |
| 386 | | ^^^^^ expected 2 generic arguments | |
| 387 | | | |
| 388 | note: trait defined here, with 2 generic parameters: `T`, `P` | |
| 389 | --> $DIR/free-to-trait.rs:216:11 | |
| 390 | | | |
| 391 | LL | trait Trait<'a: 'static, T, P> | |
| 392 | | ^^^^^ - - | |
| 393 | help: add missing generic arguments | |
| 394 | | | |
| 395 | LL | reuse <usize as Trait<T, P>>::foo; | |
| 396 | | ++++++ | |
| 397 | ||
| 398 | error: aborting due to 22 previous errors | |
| 399 | ||
| 400 | Some errors have detailed explanations: E0107, E0277, E0284. | |
| 401 | For more information about an error, try `rustc --explain E0107`. |
tests/ui/delegation/generics/mapping/impl-trait-to-free.rs created+266| ... | ... | @@ -0,0 +1,266 @@ |
| 1 | #![feature(fn_delegation)] | |
| 2 | #![allow(incomplete_features)] | |
| 3 | #![allow(late_bound_lifetime_arguments)] | |
| 4 | ||
| 5 | //! This is one of the mapping tests, which tests mapping of delegee parent and child | |
| 6 | //! generic params, whose main goal is to create cases with | |
| 7 | //! different number of lifetimes/types/consts in delegee child and parent; and in | |
| 8 | //! delegation parent if applicable. At some tests predicates are | |
| 9 | //! added. At some tests user-specified args are specified in reuse statement. | |
| 10 | ||
| 11 | // Testing lifetimes + types/consts in child reuses, | |
| 12 | // with (un)specified user args with additional generic params in delegation parent | |
| 13 | mod test_1 { | |
| 14 | mod to_reuse { | |
| 15 | pub fn foo<'a: 'a, 'b: 'b, A, B, const N: usize>() {} | |
| 16 | pub fn bar<'a: 'a, 'b: 'b, A, B, const N: usize>(x: &super::XX) {} | |
| 17 | } | |
| 18 | ||
| 19 | trait Trait<'a, 'b, 'c, A, B, const N: usize>: Sized { | |
| 20 | fn foo<'x: 'x, 'y: 'y, AA, BB, const NN: usize>() {} | |
| 21 | fn bar<'x: 'x, 'y: 'y, AA, BB, const NN: usize>(&self) {} | |
| 22 | fn oof() {} | |
| 23 | fn rab(&self) {} | |
| 24 | } | |
| 25 | ||
| 26 | struct X<'x1, 'x2, 'x3, 'x4, X1, X2, const X3: usize>( | |
| 27 | &'x1 X1, &'x2 X2, &'x3 X1, &'x4 [usize; X3]); | |
| 28 | type XX = X::<'static, 'static, 'static, 'static, i32, i32, 3>; | |
| 29 | ||
| 30 | impl<'a, 'b, 'c, A, B, const N: usize> Trait<'a, 'b, 'c, A, B, N> for XX { | |
| 31 | reuse to_reuse::foo; | |
| 32 | //~^ ERROR: type annotations needed [E0284] | |
| 33 | reuse to_reuse::bar; | |
| 34 | //~^ ERROR: type annotations needed [E0284] | |
| 35 | ||
| 36 | reuse to_reuse::foo::<'a, 'c, A, String, 322> as oof; | |
| 37 | reuse to_reuse::bar::<'a, 'c, A, B, 223> as rab; | |
| 38 | } | |
| 39 | ||
| 40 | pub fn check() { | |
| 41 | let x = X(&1, &2, &3, &[1, 2, 3]); | |
| 42 | ||
| 43 | <XX as Trait<'static, 'static, 'static, i32, i32, 1>> | |
| 44 | ::foo::<'static, 'static, i8, i16, 123>(); | |
| 45 | <XX as Trait<'static, 'static, 'static, i32, i32, 1>> | |
| 46 | ::bar::<'static, 'static, String, i16, 123>(&x); | |
| 47 | <XX as Trait<'static, 'static, 'static, i32, i32, 1>>::oof(); | |
| 48 | <XX as Trait<'static, 'static, 'static, i32, String, 1>>::rab(&x); | |
| 49 | } | |
| 50 | } | |
| 51 | ||
| 52 | // Testing types/consts in child reuses, | |
| 53 | // with (un)specified user args, with additional generic params in delegation parent | |
| 54 | mod test_2 { | |
| 55 | mod to_reuse { | |
| 56 | pub fn foo<A, B, const N: usize>() {} | |
| 57 | pub fn bar<A, B, const N: usize>(x: &super::X) {} | |
| 58 | } | |
| 59 | ||
| 60 | trait Trait<'a, 'b, 'c, A, B, const N: usize>: Sized { | |
| 61 | fn foo<AA, BB, const NN: usize>() {} | |
| 62 | fn bar<AA, BB, const NN: usize>(&self) {} | |
| 63 | fn oof() {} | |
| 64 | fn rab(&self) {} | |
| 65 | } | |
| 66 | ||
| 67 | struct X; | |
| 68 | impl<'a, A, B, const N: usize> Trait<'a, 'static, 'static, A, B, N> for X { | |
| 69 | reuse to_reuse::foo; | |
| 70 | //~^ ERROR: type annotations needed [E0284] | |
| 71 | reuse to_reuse::bar; | |
| 72 | //~^ ERROR: type annotations needed [E0284] | |
| 73 | ||
| 74 | reuse to_reuse::foo::<A, String, 322> as oof; | |
| 75 | reuse to_reuse::bar::<i32, B, 223> as rab; | |
| 76 | } | |
| 77 | ||
| 78 | pub fn check() { | |
| 79 | <X as Trait<'static, 'static, 'static, i32, i32, 1>>::foo::<i8, i16, 123>(); | |
| 80 | <X as Trait<'static, 'static, 'static, i32, i32, 1>>::bar::<X, i16, 123>(&X); | |
| 81 | <X as Trait<'static, 'static, 'static, i32, i32, 1>>::oof(); | |
| 82 | <X as Trait<'static, 'static, 'static, i32, i32, 1>>::rab(&X); | |
| 83 | } | |
| 84 | } | |
| 85 | ||
| 86 | // Testing none in child reuses, with unspecified user args, | |
| 87 | // with additional generic params in delegation parent | |
| 88 | mod test_3 { | |
| 89 | mod to_reuse { | |
| 90 | pub fn foo() {} | |
| 91 | pub fn bar(x: &super::X) {} | |
| 92 | } | |
| 93 | ||
| 94 | trait Trait<'a, 'b, 'c, A, B, const N: usize>: Sized { | |
| 95 | fn foo() {} | |
| 96 | fn bar(&self) {} | |
| 97 | } | |
| 98 | ||
| 99 | struct X; | |
| 100 | impl<'a, A, B, const N: usize> Trait<'a, 'static, 'static, A, B, N> for X { | |
| 101 | reuse to_reuse::foo; | |
| 102 | reuse to_reuse::bar; | |
| 103 | } | |
| 104 | ||
| 105 | pub fn check() { | |
| 106 | <X as Trait<'static, 'static, 'static, i32, i32, 1>>::foo(); | |
| 107 | <X as Trait<'static, 'static, 'static, i32, i32, 1>>::bar(&X); | |
| 108 | } | |
| 109 | } | |
| 110 | ||
| 111 | // Testing lifetimes + types/consts in child reuses, | |
| 112 | // with (un)specified user args, with additional generic params in delegation parent | |
| 113 | mod test_4 { | |
| 114 | mod to_reuse { | |
| 115 | pub fn foo<'a: 'a, 'b: 'b, A, B, const N: usize>() {} | |
| 116 | pub fn bar<'a: 'a, 'b: 'b, A, B, const N: usize>(x: &super::X) {} | |
| 117 | } | |
| 118 | ||
| 119 | trait Trait<A, B, const N: usize>: Sized { | |
| 120 | fn foo<'x: 'x, 'y: 'y, AA, BB, const NN: usize>() {} | |
| 121 | fn bar<'x: 'x, 'y: 'y, AA, BB, const NN: usize>(&self) {} | |
| 122 | fn oof() {} | |
| 123 | fn rab(&self) {} | |
| 124 | } | |
| 125 | ||
| 126 | struct X; | |
| 127 | impl<'a, 'c, A, B, const N: usize> Trait<A, B, N> for X { | |
| 128 | reuse to_reuse::foo; | |
| 129 | //~^ ERROR: type annotations needed [E0284] | |
| 130 | reuse to_reuse::bar; | |
| 131 | //~^ ERROR: type annotations needed [E0284] | |
| 132 | ||
| 133 | reuse to_reuse::foo::<'a, 'c, A, String, 322> as oof; | |
| 134 | reuse to_reuse::bar::<'a, 'c, i32, B, 223> as rab; | |
| 135 | } | |
| 136 | ||
| 137 | pub fn check() { | |
| 138 | <X as Trait<i32, i32, 1>>::foo::<'static, 'static, i8, i16, 123>(); | |
| 139 | <X as Trait<i32, i32, 1>>::bar::<'static, 'static, X, i16, 123>(&X); | |
| 140 | <X as Trait<i32, i32, 1>>::oof(); | |
| 141 | <X as Trait<i32, i32, 1>>::rab(&X); | |
| 142 | } | |
| 143 | } | |
| 144 | ||
| 145 | // Testing lifetimes + types/consts in child reuses, | |
| 146 | // with (un)specified user args, with additional generic params in delegation parent | |
| 147 | mod test_5 { | |
| 148 | mod to_reuse { | |
| 149 | pub fn foo<'a: 'a, 'b: 'b, A, B, const N: usize>() {} | |
| 150 | pub fn bar<'a: 'a, 'b: 'b, A, B, const N: usize>(x: &super::X::<A, B>) {} | |
| 151 | } | |
| 152 | ||
| 153 | trait Trait: Sized { | |
| 154 | fn foo<'x: 'x, 'y: 'y, AA, BB, const NN: usize>() {} | |
| 155 | fn bar<'x: 'x, 'y: 'y, AA, BB, const NN: usize>(&self) {} | |
| 156 | fn oof() {} | |
| 157 | fn rab(&self) {} | |
| 158 | } | |
| 159 | ||
| 160 | struct X<A, B>(A, B); | |
| 161 | impl<'a, 'c, A, B> Trait for X<A, B> { | |
| 162 | reuse to_reuse::foo::<'a, 'c, A, B, 322> as oof; | |
| 163 | reuse to_reuse::bar::<'a, 'c, A, B, 223> as rab; | |
| 164 | } | |
| 165 | ||
| 166 | pub fn check() { | |
| 167 | <X::<i32, i32> as Trait>::oof(); | |
| 168 | <X::<i32, i32> as Trait>::rab(&X(1, 2)); | |
| 169 | } | |
| 170 | } | |
| 171 | ||
| 172 | // Testing types/consts in child reuses, | |
| 173 | // with (un)specified user args, with additional generic params in delegation parent | |
| 174 | mod test_6 { | |
| 175 | mod to_reuse { | |
| 176 | pub fn foo<A, B, const N: usize>() {} | |
| 177 | pub fn bar<A, B, const N: usize>(x: &super::X) {} | |
| 178 | } | |
| 179 | ||
| 180 | trait Trait<A, B, const N: usize>: Sized { | |
| 181 | fn foo<AA, BB, const NN: usize>() {} | |
| 182 | fn bar<AA, BB, const NN: usize>(&self) {} | |
| 183 | fn oof() {} | |
| 184 | fn rab(&self) {} | |
| 185 | } | |
| 186 | ||
| 187 | struct X; | |
| 188 | impl<'a, 'c, A, B, const N: usize> Trait<A, B, N> for X { | |
| 189 | reuse to_reuse::foo; | |
| 190 | //~^ ERROR: type annotations needed [E0284] | |
| 191 | reuse to_reuse::bar; | |
| 192 | //~^ ERROR: type annotations needed [E0284] | |
| 193 | ||
| 194 | reuse to_reuse::foo::<A, String, 322> as oof; | |
| 195 | reuse to_reuse::bar::<i32, B, 223> as rab; | |
| 196 | } | |
| 197 | ||
| 198 | pub fn check() { | |
| 199 | <X as Trait<i32, i32, 1>>::foo::<i8, i16, 123>(); | |
| 200 | <X as Trait<i32, i32, 1>>::bar::<X, i16, 123>(&X); | |
| 201 | <X as Trait<i32, i32, 1>>::oof(); | |
| 202 | <X as Trait<i32, i32, 1>>::rab(&X); | |
| 203 | } | |
| 204 | } | |
| 205 | ||
| 206 | // Testing none in child reuses, with unspecified user args, | |
| 207 | // with additional generic params in delegation parent | |
| 208 | mod test_7 { | |
| 209 | mod to_reuse { | |
| 210 | pub fn foo() {} | |
| 211 | pub fn bar(x: &super::X) {} | |
| 212 | } | |
| 213 | ||
| 214 | trait Trait<A, B, const N: usize>: Sized { | |
| 215 | fn foo() {} | |
| 216 | fn bar(&self) {} | |
| 217 | } | |
| 218 | ||
| 219 | struct X; | |
| 220 | impl<'a, 'c, A, B, const N: usize> Trait<A, B, N> for X { | |
| 221 | reuse to_reuse::foo; | |
| 222 | reuse to_reuse::bar; | |
| 223 | } | |
| 224 | ||
| 225 | pub fn check() { | |
| 226 | <X as Trait<i32, i32, 1>>::foo(); | |
| 227 | <X as Trait<i32, i32, 1>>::bar(&X); | |
| 228 | } | |
| 229 | } | |
| 230 | ||
| 231 | // Testing none in child reuses, with unspecified user args | |
| 232 | mod test_8 { | |
| 233 | mod to_reuse { | |
| 234 | pub fn foo() {} | |
| 235 | pub fn bar(x: &super::X) {} | |
| 236 | } | |
| 237 | ||
| 238 | trait Trait: Sized { | |
| 239 | fn foo() {} | |
| 240 | fn bar(&self) {} | |
| 241 | } | |
| 242 | ||
| 243 | struct X; | |
| 244 | impl Trait for X { | |
| 245 | reuse to_reuse::foo; | |
| 246 | reuse to_reuse::bar; | |
| 247 | } | |
| 248 | ||
| 249 | pub fn check() { | |
| 250 | <X as Trait>::foo(); | |
| 251 | <X as Trait>::bar(&X); | |
| 252 | X::foo(); | |
| 253 | X::bar(&X); | |
| 254 | } | |
| 255 | } | |
| 256 | ||
| 257 | fn main() { | |
| 258 | test_1::check(); | |
| 259 | test_2::check(); | |
| 260 | test_3::check(); | |
| 261 | test_4::check(); | |
| 262 | test_5::check(); | |
| 263 | test_6::check(); | |
| 264 | test_7::check(); | |
| 265 | test_8::check(); | |
| 266 | } |
tests/ui/delegation/generics/mapping/impl-trait-to-free.stderr created+131| ... | ... | @@ -0,0 +1,131 @@ |
| 1 | error[E0284]: type annotations needed | |
| 2 | --> $DIR/impl-trait-to-free.rs:31:25 | |
| 3 | | | |
| 4 | LL | reuse to_reuse::foo; | |
| 5 | | ^^^ cannot infer the value of the const parameter `N` declared on the function `foo` | |
| 6 | | | |
| 7 | note: required by a const generic parameter in `test_1::to_reuse::foo` | |
| 8 | --> $DIR/impl-trait-to-free.rs:15:42 | |
| 9 | | | |
| 10 | LL | pub fn foo<'a: 'a, 'b: 'b, A, B, const N: usize>() {} | |
| 11 | | ^^^^^^^^^^^^^^ required by this const generic parameter in `foo` | |
| 12 | help: consider specifying the generic arguments | |
| 13 | | | |
| 14 | LL | reuse to_reuse::foo::<A, B, N>; | |
| 15 | | +++++++++++ | |
| 16 | ||
| 17 | error[E0284]: type annotations needed | |
| 18 | --> $DIR/impl-trait-to-free.rs:33:25 | |
| 19 | | | |
| 20 | LL | reuse to_reuse::bar; | |
| 21 | | ^^^ cannot infer the value of the const parameter `N` declared on the function `bar` | |
| 22 | | | |
| 23 | note: required by a const generic parameter in `test_1::to_reuse::bar` | |
| 24 | --> $DIR/impl-trait-to-free.rs:16:42 | |
| 25 | | | |
| 26 | LL | pub fn bar<'a: 'a, 'b: 'b, A, B, const N: usize>(x: &super::XX) {} | |
| 27 | | ^^^^^^^^^^^^^^ required by this const generic parameter in `bar` | |
| 28 | help: consider specifying the generic arguments | |
| 29 | | | |
| 30 | LL | reuse to_reuse::bar::<A, B, N>; | |
| 31 | | +++++++++++ | |
| 32 | ||
| 33 | error[E0284]: type annotations needed | |
| 34 | --> $DIR/impl-trait-to-free.rs:69:25 | |
| 35 | | | |
| 36 | LL | reuse to_reuse::foo; | |
| 37 | | ^^^ cannot infer the value of the const parameter `N` declared on the function `foo` | |
| 38 | | | |
| 39 | note: required by a const generic parameter in `test_2::to_reuse::foo` | |
| 40 | --> $DIR/impl-trait-to-free.rs:56:26 | |
| 41 | | | |
| 42 | LL | pub fn foo<A, B, const N: usize>() {} | |
| 43 | | ^^^^^^^^^^^^^^ required by this const generic parameter in `foo` | |
| 44 | help: consider specifying the generic arguments | |
| 45 | | | |
| 46 | LL | reuse to_reuse::foo::<A, B, N>; | |
| 47 | | +++++++++++ | |
| 48 | ||
| 49 | error[E0284]: type annotations needed | |
| 50 | --> $DIR/impl-trait-to-free.rs:71:25 | |
| 51 | | | |
| 52 | LL | reuse to_reuse::bar; | |
| 53 | | ^^^ cannot infer the value of the const parameter `N` declared on the function `bar` | |
| 54 | | | |
| 55 | note: required by a const generic parameter in `test_2::to_reuse::bar` | |
| 56 | --> $DIR/impl-trait-to-free.rs:57:26 | |
| 57 | | | |
| 58 | LL | pub fn bar<A, B, const N: usize>(x: &super::X) {} | |
| 59 | | ^^^^^^^^^^^^^^ required by this const generic parameter in `bar` | |
| 60 | help: consider specifying the generic arguments | |
| 61 | | | |
| 62 | LL | reuse to_reuse::bar::<A, B, N>; | |
| 63 | | +++++++++++ | |
| 64 | ||
| 65 | error[E0284]: type annotations needed | |
| 66 | --> $DIR/impl-trait-to-free.rs:128:25 | |
| 67 | | | |
| 68 | LL | reuse to_reuse::foo; | |
| 69 | | ^^^ cannot infer the value of the const parameter `N` declared on the function `foo` | |
| 70 | | | |
| 71 | note: required by a const generic parameter in `test_4::to_reuse::foo` | |
| 72 | --> $DIR/impl-trait-to-free.rs:115:42 | |
| 73 | | | |
| 74 | LL | pub fn foo<'a: 'a, 'b: 'b, A, B, const N: usize>() {} | |
| 75 | | ^^^^^^^^^^^^^^ required by this const generic parameter in `foo` | |
| 76 | help: consider specifying the generic arguments | |
| 77 | | | |
| 78 | LL | reuse to_reuse::foo::<A, B, N>; | |
| 79 | | +++++++++++ | |
| 80 | ||
| 81 | error[E0284]: type annotations needed | |
| 82 | --> $DIR/impl-trait-to-free.rs:130:25 | |
| 83 | | | |
| 84 | LL | reuse to_reuse::bar; | |
| 85 | | ^^^ cannot infer the value of the const parameter `N` declared on the function `bar` | |
| 86 | | | |
| 87 | note: required by a const generic parameter in `test_4::to_reuse::bar` | |
| 88 | --> $DIR/impl-trait-to-free.rs:116:42 | |
| 89 | | | |
| 90 | LL | pub fn bar<'a: 'a, 'b: 'b, A, B, const N: usize>(x: &super::X) {} | |
| 91 | | ^^^^^^^^^^^^^^ required by this const generic parameter in `bar` | |
| 92 | help: consider specifying the generic arguments | |
| 93 | | | |
| 94 | LL | reuse to_reuse::bar::<A, B, N>; | |
| 95 | | +++++++++++ | |
| 96 | ||
| 97 | error[E0284]: type annotations needed | |
| 98 | --> $DIR/impl-trait-to-free.rs:189:25 | |
| 99 | | | |
| 100 | LL | reuse to_reuse::foo; | |
| 101 | | ^^^ cannot infer the value of the const parameter `N` declared on the function `foo` | |
| 102 | | | |
| 103 | note: required by a const generic parameter in `test_6::to_reuse::foo` | |
| 104 | --> $DIR/impl-trait-to-free.rs:176:26 | |
| 105 | | | |
| 106 | LL | pub fn foo<A, B, const N: usize>() {} | |
| 107 | | ^^^^^^^^^^^^^^ required by this const generic parameter in `foo` | |
| 108 | help: consider specifying the generic arguments | |
| 109 | | | |
| 110 | LL | reuse to_reuse::foo::<A, B, N>; | |
| 111 | | +++++++++++ | |
| 112 | ||
| 113 | error[E0284]: type annotations needed | |
| 114 | --> $DIR/impl-trait-to-free.rs:191:25 | |
| 115 | | | |
| 116 | LL | reuse to_reuse::bar; | |
| 117 | | ^^^ cannot infer the value of the const parameter `N` declared on the function `bar` | |
| 118 | | | |
| 119 | note: required by a const generic parameter in `test_6::to_reuse::bar` | |
| 120 | --> $DIR/impl-trait-to-free.rs:177:26 | |
| 121 | | | |
| 122 | LL | pub fn bar<A, B, const N: usize>(x: &super::X) {} | |
| 123 | | ^^^^^^^^^^^^^^ required by this const generic parameter in `bar` | |
| 124 | help: consider specifying the generic arguments | |
| 125 | | | |
| 126 | LL | reuse to_reuse::bar::<A, B, N>; | |
| 127 | | +++++++++++ | |
| 128 | ||
| 129 | error: aborting due to 8 previous errors | |
| 130 | ||
| 131 | For more information about this error, try `rustc --explain E0284`. |
tests/ui/delegation/generics/mapping/impl-trait-to-trait.rs created+241| ... | ... | @@ -0,0 +1,241 @@ |
| 1 | #![feature(fn_delegation)] | |
| 2 | #![allow(incomplete_features)] | |
| 3 | #![allow(late_bound_lifetime_arguments)] | |
| 4 | ||
| 5 | //! This is one of the mapping tests, which tests mapping of delegee parent and child | |
| 6 | //! generic params, whose main goal is to create cases with | |
| 7 | //! different number of lifetimes/types/consts in delegee child and parent; and in | |
| 8 | //! delegation parent if applicable. At some tests predicates are | |
| 9 | //! added. At some tests user-specified args are specified in reuse statement. | |
| 10 | ||
| 11 | // Testing types in parent, types in child reuse, | |
| 12 | // testing predicates inheritance, | |
| 13 | // with additional generic params in delegation parent | |
| 14 | mod test_1 { | |
| 15 | trait Trait0 {} | |
| 16 | ||
| 17 | trait Trait1<T> { | |
| 18 | fn foo<U>(&self) | |
| 19 | where | |
| 20 | T: Trait0, | |
| 21 | U: Trait0, | |
| 22 | { | |
| 23 | } | |
| 24 | } | |
| 25 | ||
| 26 | struct F; | |
| 27 | impl<T> Trait1<T> for F {} | |
| 28 | ||
| 29 | struct S<'a, 'b, 'c, A, B>(F, &'a A, &'b B, &'c B); | |
| 30 | ||
| 31 | impl<'a, 'b, 'c, T, A, B> Trait1<T> for S<'a, 'b, 'c, A, B> { | |
| 32 | reuse Trait1::<T>::foo { &self.0 } | |
| 33 | //~^ ERROR: type annotations needed [E0283] | |
| 34 | } | |
| 35 | ||
| 36 | impl Trait0 for u16 {} | |
| 37 | ||
| 38 | pub fn check() { | |
| 39 | let s = S(F, &123, &123, &123); | |
| 40 | <S::<'static, 'static, 'static, i32, i32> as Trait1<u16>>::foo::<u16>(&s); | |
| 41 | } | |
| 42 | } | |
| 43 | ||
| 44 | // Testing none in parent, none in child reuse, | |
| 45 | // with additional generic params in delegation parent | |
| 46 | mod test_2 { | |
| 47 | trait Trait { | |
| 48 | fn foo(&self) {} | |
| 49 | } | |
| 50 | ||
| 51 | struct F; | |
| 52 | impl Trait for F {} | |
| 53 | ||
| 54 | struct S<'a, 'b, 'c, A, B, const C: bool>(F, &'a A, &'b B, &'c B); | |
| 55 | ||
| 56 | impl<'a, 'b, 'c, A, B, const C: bool> Trait for S<'a, 'b, 'c, A, B, C> { | |
| 57 | reuse Trait::foo { &self.0 } | |
| 58 | } | |
| 59 | ||
| 60 | pub fn check() { | |
| 61 | let s = S(F, &123, &123, &123); | |
| 62 | <S::<'static, 'static, 'static, i32, i32, true> as Trait>::foo(&s); | |
| 63 | } | |
| 64 | } | |
| 65 | ||
| 66 | // Testing lifetimes + types in parent, none in child reuse, | |
| 67 | // with additional generic params in delegation parent | |
| 68 | mod test_3 { | |
| 69 | trait Trait<'a, 'b, 'c, X, Y, Z> { | |
| 70 | fn foo(&self) {} | |
| 71 | } | |
| 72 | ||
| 73 | struct F; | |
| 74 | impl<'a, 'b, 'c, X, Y, Z> Trait<'a, 'b, 'c, X, Y, Z> for F {} | |
| 75 | ||
| 76 | struct S<'a, 'b, 'c, A, B, const C: bool>(F, &'a A, &'b B, &'c B); | |
| 77 | ||
| 78 | impl<'a, 'b, 'c, A, B, const C: bool> Trait<'a, 'b, 'static, A, String, bool> | |
| 79 | for S<'a, 'b, 'c, A, B, C> { | |
| 80 | reuse Trait::<'a, 'b, 'static, A, String, bool>::foo { &self.0 } | |
| 81 | } | |
| 82 | ||
| 83 | pub fn check() { | |
| 84 | let s = S(F, &123, &123, &123); | |
| 85 | <S::<'static, 'static, 'static, i32, i32, true> | |
| 86 | as Trait<'static, 'static, 'static, i32, String, bool>>::foo(&s); | |
| 87 | } | |
| 88 | } | |
| 89 | ||
| 90 | // Testing lifetimes + types in parent, lifetimes + types/consts in child reuse, | |
| 91 | // with additional generic params in delegation parent | |
| 92 | mod test_4 { | |
| 93 | trait Trait<'a, 'b, 'c, X, Y, Z> { | |
| 94 | fn foo<'x: 'x, 'y: 'y, 'z: 'z, A, B, C, const XX: usize>(&self) {} | |
| 95 | } | |
| 96 | ||
| 97 | struct F; | |
| 98 | impl<'a, 'b, 'c, X, Y, Z> Trait<'a, 'b, 'c, X, Y, Z> for F {} | |
| 99 | ||
| 100 | struct S<'a, 'b, 'c, A, B, const C: bool>(F, &'a A, &'b B, &'c B); | |
| 101 | ||
| 102 | impl<'a, 'b, 'c, A, B, const C: bool> Trait<'a, 'b, 'static, A, String, bool> | |
| 103 | for S<'a, 'b, 'c, A, B, C> { | |
| 104 | reuse Trait::<'a, 'b, 'static, A, String, bool>::foo { &self.0 } | |
| 105 | //~^ ERROR: type annotations needed [E0284] | |
| 106 | } | |
| 107 | ||
| 108 | pub fn check() { | |
| 109 | let s = S(F, &123, &123, &123); | |
| 110 | <S::<'static, 'static, 'static, i32, i32, true> | |
| 111 | as Trait<'static, 'static, 'static, i32, String, bool>> | |
| 112 | ::foo::<'static, 'static, 'static, i32, i32, i32, 1>(&s); | |
| 113 | } | |
| 114 | } | |
| 115 | ||
| 116 | // Testing types in parent, lifetimes in child reuse | |
| 117 | // with additional generic params in delegation parent | |
| 118 | mod test_5 { | |
| 119 | trait Trait<X, Y, Z> { | |
| 120 | fn foo<'a: 'a, 'b: 'b, 'c: 'c>(&self) {} | |
| 121 | } | |
| 122 | ||
| 123 | struct F; | |
| 124 | impl<X, Y, Z> Trait<X, Y, Z> for F {} | |
| 125 | ||
| 126 | struct S<'a, 'b, 'c, A, B, const C: bool>(F, &'a A, &'b B, &'c B); | |
| 127 | ||
| 128 | impl<'a, 'b, 'c, A, B, const C: bool> Trait<A, String, bool> for S<'a, 'b, 'c, A, B, C> { | |
| 129 | reuse Trait::<A, String, bool>::foo { &self.0 } | |
| 130 | } | |
| 131 | ||
| 132 | pub fn check() { | |
| 133 | let s = S(F, &123, &123, &123); | |
| 134 | <S::<i32, i32, true> as Trait<i32, String, bool>> | |
| 135 | ::foo::<'static, 'static, 'static>(&s); | |
| 136 | <S::<i32, i32, true> as Trait<i32, String, bool>>::foo(&s); | |
| 137 | } | |
| 138 | } | |
| 139 | ||
| 140 | // Testing types in parent, types in child reuse | |
| 141 | // with additional generic params in delegation parent | |
| 142 | mod test_6 { | |
| 143 | trait Trait<X, Y, Z> { | |
| 144 | fn foo<A, B, C>(&self) {} | |
| 145 | } | |
| 146 | ||
| 147 | struct F; | |
| 148 | impl<X, Y, Z> Trait<X, Y, Z> for F {} | |
| 149 | ||
| 150 | struct S<'a, 'b, 'c, A, B, const C: bool>(F, &'a A, &'b B, &'c B); | |
| 151 | ||
| 152 | impl<'a, 'b, 'c, A, B, const C: bool> Trait<A, String, bool> for S<'a, 'b, 'c, A, B, C> { | |
| 153 | reuse Trait::<A, String, bool>::foo { &self.0 } | |
| 154 | //~^ ERROR: type annotations needed [E0282] | |
| 155 | } | |
| 156 | ||
| 157 | pub fn check() { | |
| 158 | let s = S(F, &123, &123, &123); | |
| 159 | <S::<i32, i32, true> as Trait<i32, String, bool>>::foo::<i32, i32, i32>(&s); | |
| 160 | } | |
| 161 | } | |
| 162 | ||
| 163 | // Testing types in parent, none in child reuse | |
| 164 | // with additional generic params in delegation parent | |
| 165 | mod test_7 { | |
| 166 | trait Trait<X, Y, Z> { | |
| 167 | fn foo(&self) {} | |
| 168 | } | |
| 169 | ||
| 170 | struct F; | |
| 171 | impl<X, Y, Z> Trait<X, Y, Z> for F {} | |
| 172 | ||
| 173 | struct S<'a, 'b, 'c, A, B, const C: bool>(F, &'a A, &'b B, &'c B); | |
| 174 | ||
| 175 | impl<'a, 'b, 'c, A, B, const C: bool> Trait<A, String, bool> for S<'a, 'b, 'c, A, B, C> { | |
| 176 | reuse Trait::<A, String, bool>::foo { &self.0 } | |
| 177 | } | |
| 178 | ||
| 179 | pub fn check() { | |
| 180 | let s = S(F, &123, &123, &123); | |
| 181 | <S::<i32, i32, true> as Trait<i32, String, bool>>::foo(&s); | |
| 182 | } | |
| 183 | } | |
| 184 | ||
| 185 | // Testing lifetimes in parent, none in child reuse | |
| 186 | // with additional generic params in delegation parent | |
| 187 | mod test_8 { | |
| 188 | trait Trait<'a, 'b, 'c> { | |
| 189 | fn foo(&self) {} | |
| 190 | } | |
| 191 | ||
| 192 | struct F; | |
| 193 | impl<'a, 'b, 'c> Trait<'a, 'b, 'c> for F {} | |
| 194 | ||
| 195 | struct S<'a, 'b, 'c, A, B, const C: bool>(F, &'a A, &'b B, &'c B); | |
| 196 | ||
| 197 | impl<'a, 'b, 'c, A, B, const C: bool> Trait<'a, 'b, 'c> for S<'a, 'b, 'c, A, B, C> { | |
| 198 | reuse Trait::<'a, 'static, 'b>::foo { &self.0 } | |
| 199 | } | |
| 200 | ||
| 201 | pub fn check() { | |
| 202 | let s = S(F, &123, &123, &123); | |
| 203 | <S::<i32, i32, true> as Trait<'static, 'static, 'static>>::foo(&s); | |
| 204 | } | |
| 205 | } | |
| 206 | ||
| 207 | // Testing lifetimes in parent, lifetimes in child reuse | |
| 208 | // with additional generic params in delegation parent | |
| 209 | mod test_9 { | |
| 210 | trait Trait<'a, 'b, 'c> { | |
| 211 | fn foo<'x: 'x, 'y: 'y>(&self) {} | |
| 212 | } | |
| 213 | ||
| 214 | struct F; | |
| 215 | impl<'a, 'b, 'c> Trait<'a, 'b, 'c> for F {} | |
| 216 | ||
| 217 | struct S<'a, 'b, 'c, A, B, const C: bool>(F, &'a A, &'b B, &'c B); | |
| 218 | ||
| 219 | impl<'a, 'b, 'c, A, B, const C: bool> Trait<'a, 'b, 'c> for S<'a, 'b, 'c, A, B, C> { | |
| 220 | reuse Trait::<'a, 'static, 'b>::foo { &self.0 } | |
| 221 | } | |
| 222 | ||
| 223 | pub fn check() { | |
| 224 | let s = S(F, &123, &123, &123); | |
| 225 | <S::<i32, i32, true> as Trait<'static, 'static, 'static>>::foo(&s); | |
| 226 | <S::<i32, i32, true> as Trait<'static, 'static, 'static>> | |
| 227 | ::foo::<'static, 'static>(&s); | |
| 228 | } | |
| 229 | } | |
| 230 | ||
| 231 | fn main() { | |
| 232 | test_1::check(); | |
| 233 | test_2::check(); | |
| 234 | test_3::check(); | |
| 235 | test_4::check(); | |
| 236 | test_5::check(); | |
| 237 | test_6::check(); | |
| 238 | test_7::check(); | |
| 239 | test_8::check(); | |
| 240 | test_9::check(); | |
| 241 | } |
tests/ui/delegation/generics/mapping/impl-trait-to-trait.stderr created+43| ... | ... | @@ -0,0 +1,43 @@ |
| 1 | error[E0283]: type annotations needed | |
| 2 | --> $DIR/impl-trait-to-trait.rs:32:28 | |
| 3 | | | |
| 4 | LL | reuse Trait1::<T>::foo { &self.0 } | |
| 5 | | ^^^ cannot infer type of the type parameter `U` declared on the method `foo` | |
| 6 | | | |
| 7 | = note: cannot satisfy `_: Trait0` | |
| 8 | help: the trait `Trait0` is implemented for `u16` | |
| 9 | --> $DIR/impl-trait-to-trait.rs:36:5 | |
| 10 | | | |
| 11 | LL | impl Trait0 for u16 {} | |
| 12 | | ^^^^^^^^^^^^^^^^^^^ | |
| 13 | note: required by a bound in `Trait1::foo` | |
| 14 | --> $DIR/impl-trait-to-trait.rs:21:16 | |
| 15 | | | |
| 16 | LL | fn foo<U>(&self) | |
| 17 | | --- required by a bound in this associated function | |
| 18 | ... | |
| 19 | LL | U: Trait0, | |
| 20 | | ^^^^^^ required by this bound in `Trait1::foo` | |
| 21 | ||
| 22 | error[E0284]: type annotations needed | |
| 23 | --> $DIR/impl-trait-to-trait.rs:104:58 | |
| 24 | | | |
| 25 | LL | reuse Trait::<'a, 'b, 'static, A, String, bool>::foo { &self.0 } | |
| 26 | | ^^^ cannot infer the value of the const parameter `XX` declared on the method `foo` | |
| 27 | | | |
| 28 | note: required by a const generic parameter in `test_4::Trait::foo` | |
| 29 | --> $DIR/impl-trait-to-trait.rs:94:49 | |
| 30 | | | |
| 31 | LL | fn foo<'x: 'x, 'y: 'y, 'z: 'z, A, B, C, const XX: usize>(&self) {} | |
| 32 | | ^^^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo` | |
| 33 | ||
| 34 | error[E0282]: type annotations needed | |
| 35 | --> $DIR/impl-trait-to-trait.rs:153:41 | |
| 36 | | | |
| 37 | LL | reuse Trait::<A, String, bool>::foo { &self.0 } | |
| 38 | | ^^^ cannot infer type of the type parameter `A` declared on the method `foo` | |
| 39 | ||
| 40 | error: aborting due to 3 previous errors | |
| 41 | ||
| 42 | Some errors have detailed explanations: E0282, E0283, E0284. | |
| 43 | For more information about an error, try `rustc --explain E0282`. |
tests/ui/delegation/generics/mapping/inherent-impl-to-free.rs created+130| ... | ... | @@ -0,0 +1,130 @@ |
| 1 | #![feature(fn_delegation)] | |
| 2 | #![allow(incomplete_features)] | |
| 3 | #![allow(late_bound_lifetime_arguments)] | |
| 4 | ||
| 5 | //! This is one of the mapping tests, which tests mapping of delegee parent and child | |
| 6 | //! generic params, whose main goal is to create cases with | |
| 7 | //! different number of lifetimes/types/consts in delegee child and parent; and in | |
| 8 | //! delegation parent if applicable. At some tests predicates are | |
| 9 | //! added. At some tests user-specified args are specified in reuse statement. | |
| 10 | ||
| 11 | // Testing lifetimes + types/consts OR types/consts OR none in delegation parent, | |
| 12 | // lifetimes + types/consts in child reuse, | |
| 13 | // with(out) user-specified args | |
| 14 | mod test_1 { | |
| 15 | mod to_reuse { | |
| 16 | pub fn foo<'a: 'a, 'b: 'b, A, B, const N: usize>() {} | |
| 17 | } | |
| 18 | ||
| 19 | struct X1<'a, 'b, T, X, const N: usize>(&'a T, &'b X, &'a [i32; N]); | |
| 20 | impl<'a, 'b, T, E, const N: usize> X1<'a, 'b, T, E, N> { | |
| 21 | reuse to_reuse::foo; | |
| 22 | //~^ ERROR: type annotations needed [E0284] | |
| 23 | reuse to_reuse::foo::<'static, 'static, i32, String, 1> as bar; | |
| 24 | } | |
| 25 | ||
| 26 | struct X2<T, X, const N: usize>(T, X, &'static [i32; N]); | |
| 27 | impl<T, E, const N: usize> X2<T, E, N> { | |
| 28 | reuse to_reuse::foo; | |
| 29 | //~^ ERROR: type annotations needed [E0284] | |
| 30 | reuse to_reuse::foo::<'static, 'static, i32, String, 1> as bar; | |
| 31 | } | |
| 32 | ||
| 33 | struct X3; | |
| 34 | impl X3 { | |
| 35 | reuse to_reuse::foo; | |
| 36 | //~^ ERROR: type annotations needed [E0284] | |
| 37 | reuse to_reuse::foo::<'static, 'static, i32, String, 1> as bar; | |
| 38 | } | |
| 39 | ||
| 40 | pub fn check() { | |
| 41 | X1::<'static, 'static, i32, i32, 1> | |
| 42 | ::foo::<'static, 'static, String, String, 123>(); | |
| 43 | X1::<'static, 'static, i32, i32, 1>::bar(); | |
| 44 | //~^ ERROR: type annotations needed [E0284] | |
| 45 | ||
| 46 | X2::<i32, i32, 1>::foo::<'static, 'static, String, String, 123>(); | |
| 47 | X2::<i32, i32, 1>::bar(); | |
| 48 | //~^ ERROR: type annotations needed [E0284] | |
| 49 | ||
| 50 | X3::foo::<'static, 'static, String, String, 123>(); | |
| 51 | X3::bar(); | |
| 52 | //~^ ERROR: type annotations needed [E0284] | |
| 53 | } | |
| 54 | } | |
| 55 | ||
| 56 | // Testing lifetimes + types/consts OR types/consts OR none in parent, | |
| 57 | // types/consts in child reuse, with(out) user-specified args | |
| 58 | mod test_2 { | |
| 59 | fn foo<A, B, const N: usize>() {} | |
| 60 | ||
| 61 | struct X1<'a, 'b, T, X, const N: usize>(&'a T, &'b X, &'a [i32; N]); | |
| 62 | impl<'a, 'b, T, E, const N: usize> X1<'a, 'b, T, E, N> { | |
| 63 | reuse foo; | |
| 64 | //~^ ERROR: type annotations needed [E0284] | |
| 65 | reuse foo::<i32, String, 1> as bar; | |
| 66 | } | |
| 67 | ||
| 68 | struct X2<T, X, const N: usize>(T, X, &'static [i32; N]); | |
| 69 | impl<T, E, const N: usize> X2<T, E, N> { | |
| 70 | reuse foo; | |
| 71 | //~^ ERROR: type annotations needed [E0284] | |
| 72 | reuse foo::<i32, String, 1> as bar; | |
| 73 | } | |
| 74 | ||
| 75 | struct X3; | |
| 76 | impl X3 { | |
| 77 | reuse foo; | |
| 78 | //~^ ERROR: type annotations needed [E0284] | |
| 79 | reuse foo::<i32, String, 1> as bar; | |
| 80 | } | |
| 81 | ||
| 82 | pub fn check() { | |
| 83 | X1::<'static, 'static, i32, i32, 1>::foo::<String, String, 123>(); | |
| 84 | X1::<'static, 'static, i32, i32, 1>::bar(); | |
| 85 | //~^ ERROR: type annotations needed [E0284] | |
| 86 | ||
| 87 | X2::<i32, i32, 1>::foo::<String, String, 123>(); | |
| 88 | X2::<i32, i32, 1>::bar(); | |
| 89 | //~^ ERROR: type annotations needed [E0284] | |
| 90 | ||
| 91 | X3::foo::<String, String, 123>(); | |
| 92 | X3::bar(); | |
| 93 | //~^ ERROR: type annotations needed [E0284] | |
| 94 | } | |
| 95 | } | |
| 96 | ||
| 97 | // Testing lifetimes + types/consts OR types/consts OR none in parent, | |
| 98 | // none in child reuse | |
| 99 | mod test_3 { | |
| 100 | fn foo() {} | |
| 101 | ||
| 102 | struct X1<'a, 'b, T, X, const N: usize>(&'a T, &'b X, &'a [i32; N]); | |
| 103 | impl<'a, 'b, T, E, const N: usize> X1<'a, 'b, T, E, N> { | |
| 104 | reuse foo; | |
| 105 | } | |
| 106 | ||
| 107 | struct X2<T, X, const N: usize>(T, X, &'static [i32; N]); | |
| 108 | impl<T, E, const N: usize> X2<T, E, N> { | |
| 109 | reuse foo; | |
| 110 | } | |
| 111 | ||
| 112 | struct X3; | |
| 113 | impl X3 { | |
| 114 | reuse foo; | |
| 115 | } | |
| 116 | ||
| 117 | pub fn check() { | |
| 118 | X1::<'static, 'static, i32, i32, 1>::foo(); | |
| 119 | ||
| 120 | X2::<i32, i32, 1>::foo(); | |
| 121 | ||
| 122 | X3::foo(); | |
| 123 | } | |
| 124 | } | |
| 125 | ||
| 126 | fn main() { | |
| 127 | test_1::check(); | |
| 128 | test_2::check(); | |
| 129 | test_3::check(); | |
| 130 | } |
tests/ui/delegation/generics/mapping/inherent-impl-to-free.stderr created+213| ... | ... | @@ -0,0 +1,213 @@ |
| 1 | error[E0284]: type annotations needed | |
| 2 | --> $DIR/inherent-impl-to-free.rs:21:25 | |
| 3 | | | |
| 4 | LL | reuse to_reuse::foo; | |
| 5 | | ^^^ cannot infer the value of the const parameter `N` declared on the function `foo` | |
| 6 | | | |
| 7 | note: required by a const generic parameter in `to_reuse::foo` | |
| 8 | --> $DIR/inherent-impl-to-free.rs:16:42 | |
| 9 | | | |
| 10 | LL | pub fn foo<'a: 'a, 'b: 'b, A, B, const N: usize>() {} | |
| 11 | | ^^^^^^^^^^^^^^ required by this const generic parameter in `foo` | |
| 12 | help: consider specifying the generic arguments | |
| 13 | | | |
| 14 | LL | reuse to_reuse::foo::<A, B, N>; | |
| 15 | | +++++++++++ | |
| 16 | ||
| 17 | error[E0284]: type annotations needed | |
| 18 | --> $DIR/inherent-impl-to-free.rs:28:25 | |
| 19 | | | |
| 20 | LL | reuse to_reuse::foo; | |
| 21 | | ^^^ cannot infer the value of the const parameter `N` declared on the function `foo` | |
| 22 | | | |
| 23 | note: required by a const generic parameter in `to_reuse::foo` | |
| 24 | --> $DIR/inherent-impl-to-free.rs:16:42 | |
| 25 | | | |
| 26 | LL | pub fn foo<'a: 'a, 'b: 'b, A, B, const N: usize>() {} | |
| 27 | | ^^^^^^^^^^^^^^ required by this const generic parameter in `foo` | |
| 28 | help: consider specifying the generic arguments | |
| 29 | | | |
| 30 | LL | reuse to_reuse::foo::<A, B, N>; | |
| 31 | | +++++++++++ | |
| 32 | ||
| 33 | error[E0284]: type annotations needed | |
| 34 | --> $DIR/inherent-impl-to-free.rs:35:25 | |
| 35 | | | |
| 36 | LL | reuse to_reuse::foo; | |
| 37 | | ^^^ cannot infer the value of the const parameter `N` declared on the function `foo` | |
| 38 | | | |
| 39 | note: required by a const generic parameter in `to_reuse::foo` | |
| 40 | --> $DIR/inherent-impl-to-free.rs:16:42 | |
| 41 | | | |
| 42 | LL | pub fn foo<'a: 'a, 'b: 'b, A, B, const N: usize>() {} | |
| 43 | | ^^^^^^^^^^^^^^ required by this const generic parameter in `foo` | |
| 44 | help: consider specifying the generic arguments | |
| 45 | | | |
| 46 | LL | reuse to_reuse::foo::<A, B, N>; | |
| 47 | | +++++++++++ | |
| 48 | ||
| 49 | error[E0284]: type annotations needed | |
| 50 | --> $DIR/inherent-impl-to-free.rs:43:9 | |
| 51 | | | |
| 52 | LL | X1::<'static, 'static, i32, i32, 1>::bar(); | |
| 53 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `N` declared on the associated function `bar` | |
| 54 | | | |
| 55 | note: required by a const generic parameter in `test_1::X1::<'a, 'b, T, E, N>::bar` | |
| 56 | --> $DIR/inherent-impl-to-free.rs:16:42 | |
| 57 | | | |
| 58 | LL | pub fn foo<'a: 'a, 'b: 'b, A, B, const N: usize>() {} | |
| 59 | | ^^^^^^^^^^^^^^ required by this const generic parameter in `X1::<'a, 'b, T, E, N>::bar` | |
| 60 | ... | |
| 61 | LL | reuse to_reuse::foo::<'static, 'static, i32, String, 1> as bar; | |
| 62 | | --- required by a bound in this associated function | |
| 63 | help: consider specifying the generic arguments | |
| 64 | | | |
| 65 | LL | X1::<'static, 'static, i32, i32, 1>::bar::<A, B, N>(); | |
| 66 | | +++++++++++ | |
| 67 | ||
| 68 | error[E0284]: type annotations needed | |
| 69 | --> $DIR/inherent-impl-to-free.rs:47:9 | |
| 70 | | | |
| 71 | LL | X2::<i32, i32, 1>::bar(); | |
| 72 | | ^^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `N` declared on the associated function `bar` | |
| 73 | | | |
| 74 | note: required by a const generic parameter in `test_1::X2::<T, E, N>::bar` | |
| 75 | --> $DIR/inherent-impl-to-free.rs:16:42 | |
| 76 | | | |
| 77 | LL | pub fn foo<'a: 'a, 'b: 'b, A, B, const N: usize>() {} | |
| 78 | | ^^^^^^^^^^^^^^ required by this const generic parameter in `X2::<T, E, N>::bar` | |
| 79 | ... | |
| 80 | LL | reuse to_reuse::foo::<'static, 'static, i32, String, 1> as bar; | |
| 81 | | --- required by a bound in this associated function | |
| 82 | help: consider specifying the generic arguments | |
| 83 | | | |
| 84 | LL | X2::<i32, i32, 1>::bar::<A, B, N>(); | |
| 85 | | +++++++++++ | |
| 86 | ||
| 87 | error[E0284]: type annotations needed | |
| 88 | --> $DIR/inherent-impl-to-free.rs:51:9 | |
| 89 | | | |
| 90 | LL | X3::bar(); | |
| 91 | | ^^^^^^^ cannot infer the value of the const parameter `N` declared on the associated function `bar` | |
| 92 | | | |
| 93 | note: required by a const generic parameter in `test_1::X3::bar` | |
| 94 | --> $DIR/inherent-impl-to-free.rs:16:42 | |
| 95 | | | |
| 96 | LL | pub fn foo<'a: 'a, 'b: 'b, A, B, const N: usize>() {} | |
| 97 | | ^^^^^^^^^^^^^^ required by this const generic parameter in `X3::bar` | |
| 98 | ... | |
| 99 | LL | reuse to_reuse::foo::<'static, 'static, i32, String, 1> as bar; | |
| 100 | | --- required by a bound in this associated function | |
| 101 | help: consider specifying the generic arguments | |
| 102 | | | |
| 103 | LL | X3::bar::<A, B, N>(); | |
| 104 | | +++++++++++ | |
| 105 | ||
| 106 | error[E0284]: type annotations needed | |
| 107 | --> $DIR/inherent-impl-to-free.rs:63:15 | |
| 108 | | | |
| 109 | LL | reuse foo; | |
| 110 | | ^^^ cannot infer the value of the const parameter `N` declared on the function `foo` | |
| 111 | | | |
| 112 | note: required by a const generic parameter in `test_2::foo` | |
| 113 | --> $DIR/inherent-impl-to-free.rs:59:18 | |
| 114 | | | |
| 115 | LL | fn foo<A, B, const N: usize>() {} | |
| 116 | | ^^^^^^^^^^^^^^ required by this const generic parameter in `foo` | |
| 117 | help: consider specifying the generic arguments | |
| 118 | | | |
| 119 | LL | reuse foo::<A, B, N>; | |
| 120 | | +++++++++++ | |
| 121 | ||
| 122 | error[E0284]: type annotations needed | |
| 123 | --> $DIR/inherent-impl-to-free.rs:70:15 | |
| 124 | | | |
| 125 | LL | reuse foo; | |
| 126 | | ^^^ cannot infer the value of the const parameter `N` declared on the function `foo` | |
| 127 | | | |
| 128 | note: required by a const generic parameter in `test_2::foo` | |
| 129 | --> $DIR/inherent-impl-to-free.rs:59:18 | |
| 130 | | | |
| 131 | LL | fn foo<A, B, const N: usize>() {} | |
| 132 | | ^^^^^^^^^^^^^^ required by this const generic parameter in `foo` | |
| 133 | help: consider specifying the generic arguments | |
| 134 | | | |
| 135 | LL | reuse foo::<A, B, N>; | |
| 136 | | +++++++++++ | |
| 137 | ||
| 138 | error[E0284]: type annotations needed | |
| 139 | --> $DIR/inherent-impl-to-free.rs:77:15 | |
| 140 | | | |
| 141 | LL | reuse foo; | |
| 142 | | ^^^ cannot infer the value of the const parameter `N` declared on the function `foo` | |
| 143 | | | |
| 144 | note: required by a const generic parameter in `test_2::foo` | |
| 145 | --> $DIR/inherent-impl-to-free.rs:59:18 | |
| 146 | | | |
| 147 | LL | fn foo<A, B, const N: usize>() {} | |
| 148 | | ^^^^^^^^^^^^^^ required by this const generic parameter in `foo` | |
| 149 | help: consider specifying the generic arguments | |
| 150 | | | |
| 151 | LL | reuse foo::<A, B, N>; | |
| 152 | | +++++++++++ | |
| 153 | ||
| 154 | error[E0284]: type annotations needed | |
| 155 | --> $DIR/inherent-impl-to-free.rs:84:9 | |
| 156 | | | |
| 157 | LL | X1::<'static, 'static, i32, i32, 1>::bar(); | |
| 158 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `N` declared on the associated function `bar` | |
| 159 | | | |
| 160 | note: required by a const generic parameter in `test_2::X1::<'a, 'b, T, E, N>::bar` | |
| 161 | --> $DIR/inherent-impl-to-free.rs:59:18 | |
| 162 | | | |
| 163 | LL | fn foo<A, B, const N: usize>() {} | |
| 164 | | ^^^^^^^^^^^^^^ required by this const generic parameter in `X1::<'a, 'b, T, E, N>::bar` | |
| 165 | ... | |
| 166 | LL | reuse foo::<i32, String, 1> as bar; | |
| 167 | | --- required by a bound in this associated function | |
| 168 | help: consider specifying the generic arguments | |
| 169 | | | |
| 170 | LL | X1::<'static, 'static, i32, i32, 1>::bar::<A, B, N>(); | |
| 171 | | +++++++++++ | |
| 172 | ||
| 173 | error[E0284]: type annotations needed | |
| 174 | --> $DIR/inherent-impl-to-free.rs:88:9 | |
| 175 | | | |
| 176 | LL | X2::<i32, i32, 1>::bar(); | |
| 177 | | ^^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `N` declared on the associated function `bar` | |
| 178 | | | |
| 179 | note: required by a const generic parameter in `test_2::X2::<T, E, N>::bar` | |
| 180 | --> $DIR/inherent-impl-to-free.rs:59:18 | |
| 181 | | | |
| 182 | LL | fn foo<A, B, const N: usize>() {} | |
| 183 | | ^^^^^^^^^^^^^^ required by this const generic parameter in `X2::<T, E, N>::bar` | |
| 184 | ... | |
| 185 | LL | reuse foo::<i32, String, 1> as bar; | |
| 186 | | --- required by a bound in this associated function | |
| 187 | help: consider specifying the generic arguments | |
| 188 | | | |
| 189 | LL | X2::<i32, i32, 1>::bar::<A, B, N>(); | |
| 190 | | +++++++++++ | |
| 191 | ||
| 192 | error[E0284]: type annotations needed | |
| 193 | --> $DIR/inherent-impl-to-free.rs:92:9 | |
| 194 | | | |
| 195 | LL | X3::bar(); | |
| 196 | | ^^^^^^^ cannot infer the value of the const parameter `N` declared on the associated function `bar` | |
| 197 | | | |
| 198 | note: required by a const generic parameter in `test_2::X3::bar` | |
| 199 | --> $DIR/inherent-impl-to-free.rs:59:18 | |
| 200 | | | |
| 201 | LL | fn foo<A, B, const N: usize>() {} | |
| 202 | | ^^^^^^^^^^^^^^ required by this const generic parameter in `X3::bar` | |
| 203 | ... | |
| 204 | LL | reuse foo::<i32, String, 1> as bar; | |
| 205 | | --- required by a bound in this associated function | |
| 206 | help: consider specifying the generic arguments | |
| 207 | | | |
| 208 | LL | X3::bar::<A, B, N>(); | |
| 209 | | +++++++++++ | |
| 210 | ||
| 211 | error: aborting due to 12 previous errors | |
| 212 | ||
| 213 | For more information about this error, try `rustc --explain E0284`. |
tests/ui/delegation/generics/mapping/inherent-impl-to-trait.rs created+228| ... | ... | @@ -0,0 +1,228 @@ |
| 1 | #![feature(fn_delegation)] | |
| 2 | #![allow(incomplete_features)] | |
| 3 | #![allow(late_bound_lifetime_arguments)] | |
| 4 | ||
| 5 | //! This is one of the mapping tests, which tests mapping of delegee parent and child | |
| 6 | //! generic params, whose main goal is to create cases with | |
| 7 | //! different number of lifetimes/types/consts in delegee child and parent; and in | |
| 8 | //! delegation parent if applicable. At some tests predicates are | |
| 9 | //! added. At some tests user-specified args are specified in reuse statement. | |
| 10 | ||
| 11 | // Testing types in parent, none in child, | |
| 12 | // user-specified args in parent, checking predicates inheritance, | |
| 13 | // with additional generic params in delegation parent | |
| 14 | mod test_1 { | |
| 15 | trait Trait<T: ToString> { | |
| 16 | fn foo(&self) {} | |
| 17 | } | |
| 18 | ||
| 19 | struct F; | |
| 20 | impl<T: ToString> Trait<T> for F {} | |
| 21 | ||
| 22 | struct S<'a, 'b, 'c, A, B>(F, &'a A, &'b B, &'c B); | |
| 23 | impl<'a, 'b, 'c, A, B> S<'a, 'b, 'c, A, B> { | |
| 24 | reuse Trait::<String>::foo { &self.0 } | |
| 25 | } | |
| 26 | ||
| 27 | pub fn check() { | |
| 28 | let s = S(F, &123, &123, &123); | |
| 29 | S::<'static, 'static, 'static, i32, i32>::foo(&s); | |
| 30 | //~^ ERROR: type annotations needed [E0283] | |
| 31 | s.foo(); | |
| 32 | } | |
| 33 | } | |
| 34 | ||
| 35 | // Testing lifetimes + types/consts in parent, none in child, | |
| 36 | // with additional generic params in delegation parent | |
| 37 | mod test_2 { | |
| 38 | trait Trait<'x, 'y, T, const B: bool> { | |
| 39 | fn foo(&self) {} | |
| 40 | } | |
| 41 | ||
| 42 | struct F; | |
| 43 | impl<'x, 'y, T, const B: bool> Trait<'x, 'y, T, B> for F {} | |
| 44 | ||
| 45 | struct S<'a, 'b, 'c, A, B>(F, &'a A, &'b B, &'c B); | |
| 46 | impl<'a, 'b, 'c, A, B> S<'a, 'b, 'c, A, B> { | |
| 47 | reuse Trait::<'a, 'b, String, true>::foo { &self.0 } | |
| 48 | } | |
| 49 | ||
| 50 | pub fn check() { | |
| 51 | let s = S(F, &123, &123, &123); | |
| 52 | S::<'static, 'static, 'static, i32, i32>::foo(&s); | |
| 53 | //~^ ERROR: type annotations needed [E0284] | |
| 54 | s.foo(); | |
| 55 | //~^ ERROR: type annotations needed [E0284] | |
| 56 | } | |
| 57 | } | |
| 58 | ||
| 59 | // Testing lifetimes in parent, none in child, | |
| 60 | // with additional generic params in delegation parent | |
| 61 | mod test_3 { | |
| 62 | trait Trait<'x, 'y> { | |
| 63 | fn foo(&self) {} | |
| 64 | } | |
| 65 | ||
| 66 | struct F; | |
| 67 | impl<'x, 'y> Trait<'x, 'y> for F {} | |
| 68 | ||
| 69 | struct S<'a, 'b, 'c, A, B>(F, &'a A, &'b B, &'c B); | |
| 70 | impl<'a, 'b, 'c, A, B> S<'a, 'b, 'c, A, B> { | |
| 71 | reuse Trait::<'a, 'b>::foo { &self.0 } | |
| 72 | } | |
| 73 | ||
| 74 | pub fn check() { | |
| 75 | let s = S(F, &123, &123, &123); | |
| 76 | S::<'static, 'static, 'static, i32, i32>::foo(&s); | |
| 77 | s.foo(); | |
| 78 | } | |
| 79 | } | |
| 80 | ||
| 81 | // Testing none in parent, none in child, | |
| 82 | // with additional generic params in delegation parent | |
| 83 | mod test_4 { | |
| 84 | trait Trait { | |
| 85 | fn foo(&self) {} | |
| 86 | } | |
| 87 | ||
| 88 | struct F; | |
| 89 | impl Trait for F {} | |
| 90 | ||
| 91 | struct S<'a, 'b, 'c, A, B>(F, &'a A, &'b B, &'c B); | |
| 92 | impl<'a, 'b, 'c, A, B> S<'a, 'b, 'c, A, B> { | |
| 93 | reuse Trait::foo { &self.0 } | |
| 94 | } | |
| 95 | ||
| 96 | pub fn check() { | |
| 97 | let s = S(F, &123, &123, &123); | |
| 98 | S::<'static, 'static, 'static, i32, i32>::foo(&s); | |
| 99 | s.foo(); | |
| 100 | } | |
| 101 | } | |
| 102 | ||
| 103 | // Testing none in parent, lifetimes in child, | |
| 104 | // with additional generic params in delegation parent | |
| 105 | mod test_5 { | |
| 106 | trait Trait { | |
| 107 | fn foo<'a: 'a, 'b: 'b>(&self) {} | |
| 108 | } | |
| 109 | ||
| 110 | struct F; | |
| 111 | impl Trait for F {} | |
| 112 | ||
| 113 | struct S<'a, 'b, 'c, A, B>(F, &'a A, &'b B, &'c B); | |
| 114 | impl<'a, 'b, 'c, A, B> S<'a, 'b, 'c, A, B> { | |
| 115 | reuse Trait::foo::<'a, 'b> { &self.0 } | |
| 116 | } | |
| 117 | ||
| 118 | pub fn check() { | |
| 119 | let s = S(F, &123, &123, &123); | |
| 120 | S::<'static, 'static, 'static, i32, i32>::foo(&s); | |
| 121 | s.foo(); | |
| 122 | } | |
| 123 | } | |
| 124 | ||
| 125 | // Testing none in parent, lifetimes + types in child, | |
| 126 | // with additional generic params in delegation parent | |
| 127 | mod test_6 { | |
| 128 | trait Trait { | |
| 129 | fn foo<'a: 'a, 'b: 'b, A, B, C>(&self) {} | |
| 130 | } | |
| 131 | ||
| 132 | struct F; | |
| 133 | impl Trait for F {} | |
| 134 | ||
| 135 | struct S<'a, 'b, 'c, A, B>(F, &'a A, &'b B, &'c B); | |
| 136 | impl<'a, 'b, 'c, A, B> S<'a, 'b, 'c, A, B> { | |
| 137 | reuse Trait::foo::<'a, 'b, A, B, String> { &self.0 } | |
| 138 | } | |
| 139 | ||
| 140 | pub fn check() { | |
| 141 | let s = S(F, &123, &123, &123); | |
| 142 | S::<'static, 'static, 'static, i32, i32>::foo(&s); | |
| 143 | //~^ ERROR: type annotations needed [E0282] | |
| 144 | s.foo(); | |
| 145 | } | |
| 146 | } | |
| 147 | ||
| 148 | // Testing lifetimes in parent, lifetimes + types in child, | |
| 149 | // with additional generic params in delegation parent | |
| 150 | mod test_7 { | |
| 151 | trait Trait<'x, 'y, 'z> { | |
| 152 | fn foo<'a: 'a, 'b: 'b, A, B, C>(&self) {} | |
| 153 | } | |
| 154 | ||
| 155 | struct F; | |
| 156 | impl<'a, 'b, 'c> Trait<'a, 'b, 'c> for F {} | |
| 157 | ||
| 158 | struct S<'a, 'b, 'c, A, B>(F, &'a A, &'b B, &'c B); | |
| 159 | impl<'a, 'b, 'c, A, B> S<'a, 'b, 'c, A, B> { | |
| 160 | reuse Trait::<'a, 'b, 'c>::foo::<'a, 'b, A, B, String> { &self.0 } | |
| 161 | } | |
| 162 | ||
| 163 | pub fn check() { | |
| 164 | let s = S(F, &123, &123, &123); | |
| 165 | S::<'static, 'static, 'static, i32, i32>::foo(&s); | |
| 166 | //~^ ERROR: type annotations needed [E0282] | |
| 167 | s.foo(); | |
| 168 | } | |
| 169 | } | |
| 170 | ||
| 171 | // Testing lifetimes + types in parent, lifetimes + types in child, | |
| 172 | // with additional generic params in delegation parent | |
| 173 | mod test_8 { | |
| 174 | trait Trait<'x, 'y, 'z, X, Y, Z> { | |
| 175 | fn foo<'a: 'a, 'b: 'b, A, B, C>(&self) {} | |
| 176 | } | |
| 177 | ||
| 178 | struct F; | |
| 179 | impl<'a, 'b, 'c, X, Y, Z> Trait<'a, 'b, 'c, X, Y, Z> for F {} | |
| 180 | ||
| 181 | struct S<'a, 'b, 'c, A, B>(F, &'a A, &'b B, &'c B); | |
| 182 | impl<'a, 'b, 'c, A, B> S<'a, 'b, 'c, A, B> { | |
| 183 | reuse Trait::<'a, 'b, 'c, B, A, i32>::foo::<'a, 'b, A, B, String> { &self.0 } | |
| 184 | } | |
| 185 | ||
| 186 | pub fn check() { | |
| 187 | let s = S(F, &123, &123, &123); | |
| 188 | S::<'static, 'static, 'static, i32, i32>::foo(&s); | |
| 189 | //~^ ERROR: type annotations needed [E0282] | |
| 190 | s.foo(); | |
| 191 | } | |
| 192 | } | |
| 193 | ||
| 194 | // Testing lifetimes + types in parent, lifetimes + types in child, | |
| 195 | // with additional generic params in delegation parent, | |
| 196 | // inside a function with generic params | |
| 197 | mod test_9 { | |
| 198 | trait Trait<'x, 'y, 'z, X, Y, Z> { | |
| 199 | fn foo<'a: 'a, 'b: 'b, A, B, C>(&self) {} | |
| 200 | } | |
| 201 | ||
| 202 | struct F; | |
| 203 | impl<'a, 'b, 'c, X, Y, Z> Trait<'a, 'b, 'c, X, Y, Z> for F {} | |
| 204 | ||
| 205 | pub fn check<T, U>() { | |
| 206 | struct S<'a, 'b, 'c, A, B>(F, &'a A, &'b B, &'c B); | |
| 207 | impl<'a, 'b, 'c, A, B> S<'a, 'b, 'c, A, B> { | |
| 208 | reuse Trait::<'a, 'b, 'c, B, A, i32>::foo::<'a, 'b, A, B, String> { &self.0 } | |
| 209 | } | |
| 210 | ||
| 211 | let s = S(F, &123, &123, &123); | |
| 212 | S::<'static, 'static, 'static, i32, i32>::foo(&s); | |
| 213 | //~^ ERROR: type annotations needed [E0282] | |
| 214 | s.foo(); | |
| 215 | } | |
| 216 | } | |
| 217 | ||
| 218 | pub fn main() { | |
| 219 | test_1::check(); | |
| 220 | test_2::check(); | |
| 221 | test_3::check(); | |
| 222 | test_4::check(); | |
| 223 | test_5::check(); | |
| 224 | test_6::check(); | |
| 225 | test_7::check(); | |
| 226 | test_8::check(); | |
| 227 | test_9::check::<u32, String>(); | |
| 228 | } |
tests/ui/delegation/generics/mapping/inherent-impl-to-trait.stderr created+106| ... | ... | @@ -0,0 +1,106 @@ |
| 1 | error[E0283]: type annotations needed | |
| 2 | --> $DIR/inherent-impl-to-trait.rs:29:9 | |
| 3 | | | |
| 4 | LL | S::<'static, 'static, 'static, i32, i32>::foo(&s); | |
| 5 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the method `foo` | |
| 6 | | | |
| 7 | = note: cannot satisfy `_: ToString` | |
| 8 | note: required by a bound in `test_1::S::<'a, 'b, 'c, A, B>::foo` | |
| 9 | --> $DIR/inherent-impl-to-trait.rs:15:20 | |
| 10 | | | |
| 11 | LL | trait Trait<T: ToString> { | |
| 12 | | ^^^^^^^^ required by this bound in `S::<'a, 'b, 'c, A, B>::foo` | |
| 13 | ... | |
| 14 | LL | reuse Trait::<String>::foo { &self.0 } | |
| 15 | | --- required by a bound in this associated function | |
| 16 | help: consider specifying the generic argument | |
| 17 | | | |
| 18 | LL | S::<'static, 'static, 'static, i32, i32>::foo::<T>(&s); | |
| 19 | | +++++ | |
| 20 | ||
| 21 | error[E0284]: type annotations needed | |
| 22 | --> $DIR/inherent-impl-to-trait.rs:52:9 | |
| 23 | | | |
| 24 | LL | S::<'static, 'static, 'static, i32, i32>::foo(&s); | |
| 25 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `B` declared on the method `foo` | |
| 26 | | | |
| 27 | note: required by a const generic parameter in `test_2::S::<'a, 'b, 'c, A, B>::foo` | |
| 28 | --> $DIR/inherent-impl-to-trait.rs:38:28 | |
| 29 | | | |
| 30 | LL | trait Trait<'x, 'y, T, const B: bool> { | |
| 31 | | ^^^^^^^^^^^^^ required by this const generic parameter in `S::<'a, 'b, 'c, A, B>::foo` | |
| 32 | ... | |
| 33 | LL | reuse Trait::<'a, 'b, String, true>::foo { &self.0 } | |
| 34 | | --- required by a bound in this associated function | |
| 35 | help: consider specifying the generic arguments | |
| 36 | | | |
| 37 | LL | S::<'static, 'static, 'static, i32, i32>::foo::<T, B>(&s); | |
| 38 | | ++++++++ | |
| 39 | ||
| 40 | error[E0284]: type annotations needed | |
| 41 | --> $DIR/inherent-impl-to-trait.rs:54:11 | |
| 42 | | | |
| 43 | LL | s.foo(); | |
| 44 | | ^^^ cannot infer the value of the const parameter `B` declared on the method `foo` | |
| 45 | | | |
| 46 | note: required by a const generic parameter in `test_2::S::<'a, 'b, 'c, A, B>::foo` | |
| 47 | --> $DIR/inherent-impl-to-trait.rs:38:28 | |
| 48 | | | |
| 49 | LL | trait Trait<'x, 'y, T, const B: bool> { | |
| 50 | | ^^^^^^^^^^^^^ required by this const generic parameter in `S::<'a, 'b, 'c, A, B>::foo` | |
| 51 | ... | |
| 52 | LL | reuse Trait::<'a, 'b, String, true>::foo { &self.0 } | |
| 53 | | --- required by a bound in this associated function | |
| 54 | help: consider specifying the generic arguments | |
| 55 | | | |
| 56 | LL | s.foo::<T, B>(); | |
| 57 | | ++++++++ | |
| 58 | ||
| 59 | error[E0282]: type annotations needed | |
| 60 | --> $DIR/inherent-impl-to-trait.rs:142:9 | |
| 61 | | | |
| 62 | LL | S::<'static, 'static, 'static, i32, i32>::foo(&s); | |
| 63 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `A` declared on the method `foo` | |
| 64 | | | |
| 65 | help: consider specifying the generic arguments | |
| 66 | | | |
| 67 | LL | S::<'static, 'static, 'static, i32, i32>::foo::<A, B, C>(&s); | |
| 68 | | +++++++++++ | |
| 69 | ||
| 70 | error[E0282]: type annotations needed | |
| 71 | --> $DIR/inherent-impl-to-trait.rs:165:9 | |
| 72 | | | |
| 73 | LL | S::<'static, 'static, 'static, i32, i32>::foo(&s); | |
| 74 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `A` declared on the method `foo` | |
| 75 | | | |
| 76 | help: consider specifying the generic arguments | |
| 77 | | | |
| 78 | LL | S::<'static, 'static, 'static, i32, i32>::foo::<A, B, C>(&s); | |
| 79 | | +++++++++++ | |
| 80 | ||
| 81 | error[E0282]: type annotations needed | |
| 82 | --> $DIR/inherent-impl-to-trait.rs:188:9 | |
| 83 | | | |
| 84 | LL | S::<'static, 'static, 'static, i32, i32>::foo(&s); | |
| 85 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `X` declared on the method `foo` | |
| 86 | | | |
| 87 | help: consider specifying the generic arguments | |
| 88 | | | |
| 89 | LL | S::<'static, 'static, 'static, i32, i32>::foo::<X, Y, Z, A, B, C>(&s); | |
| 90 | | ++++++++++++++++++++ | |
| 91 | ||
| 92 | error[E0282]: type annotations needed | |
| 93 | --> $DIR/inherent-impl-to-trait.rs:212:9 | |
| 94 | | | |
| 95 | LL | S::<'static, 'static, 'static, i32, i32>::foo(&s); | |
| 96 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `X` declared on the method `foo` | |
| 97 | | | |
| 98 | help: consider specifying the generic arguments | |
| 99 | | | |
| 100 | LL | S::<'static, 'static, 'static, i32, i32>::foo::<X, Y, Z, A, B, C>(&s); | |
| 101 | | ++++++++++++++++++++ | |
| 102 | ||
| 103 | error: aborting due to 7 previous errors | |
| 104 | ||
| 105 | Some errors have detailed explanations: E0282, E0283, E0284. | |
| 106 | For more information about an error, try `rustc --explain E0282`. |
tests/ui/delegation/generics/mapping/trait-to-free.rs created+142| ... | ... | @@ -0,0 +1,142 @@ |
| 1 | #![feature(fn_delegation)] | |
| 2 | #![allow(incomplete_features)] | |
| 3 | #![allow(late_bound_lifetime_arguments)] | |
| 4 | ||
| 5 | //! This is one of the mapping tests, which tests mapping of delegee parent and child | |
| 6 | //! generic params, whose main goal is to create cases with | |
| 7 | //! different number of lifetimes/types/consts in delegee child and parent; and in | |
| 8 | //! delegation parent if applicable. At some tests predicates are | |
| 9 | //! added. At some tests user-specified args are specified in reuse statement. | |
| 10 | ||
| 11 | // Testing lifetimes + types/consts in child, lifetimes + types/consts in delegation parent, | |
| 12 | // with(out) user-specified args | |
| 13 | mod test_1 { | |
| 14 | fn foo<'a: 'a, 'b: 'b, T: Clone + ToString, U: Clone, const N: usize>() {} | |
| 15 | ||
| 16 | trait Trait<'a, A, B, C, const N: usize> { | |
| 17 | reuse foo; | |
| 18 | //~^ ERROR: type annotations needed [E0284] | |
| 19 | reuse foo::<'static, 'static, i32, String, 1> as bar; | |
| 20 | } | |
| 21 | ||
| 22 | impl Trait<'static, i32, i32, i32, 1> for u32 {} | |
| 23 | pub fn check() { | |
| 24 | <u32 as Trait<'static, i32, i32, i32, 1>>::foo::<'static, 'static, i32, String, 1>(); | |
| 25 | <u32 as Trait<'static, i32, i32, i32, 1>>::bar(); | |
| 26 | //~^ ERROR: type annotations needed [E0284] | |
| 27 | } | |
| 28 | } | |
| 29 | ||
| 30 | // Testing types/consts in child, lifetimes + types/consts in delegation parent, | |
| 31 | // with(out) user-specified args | |
| 32 | mod test_2 { | |
| 33 | fn foo<T: Clone, U: Clone, const N: usize>() {} | |
| 34 | ||
| 35 | trait Trait<'a, A, B, C, const N: usize> { | |
| 36 | reuse foo; | |
| 37 | //~^ ERROR: type annotations needed [E0284] | |
| 38 | reuse foo::<i32, String, 1> as bar; | |
| 39 | } | |
| 40 | ||
| 41 | impl Trait<'static, i32, i32, i32, 1> for u32 {} | |
| 42 | pub fn check() { | |
| 43 | <u32 as Trait<'static, i32, i32, i32, 1>>::foo::<i32, String, 1>(); | |
| 44 | <u32 as Trait<'static, i32, i32, i32, 1>>::bar(); | |
| 45 | //~^ ERROR: type annotations needed [E0284] | |
| 46 | } | |
| 47 | } | |
| 48 | ||
| 49 | // Testing none in child, lifetimes + types/consts in delegation parent, | |
| 50 | // with(out) user-specified args | |
| 51 | mod test_3 { | |
| 52 | fn foo() {} | |
| 53 | ||
| 54 | trait Trait<'a, A, B, C, const N: usize> { | |
| 55 | reuse foo; | |
| 56 | } | |
| 57 | ||
| 58 | impl Trait<'static, i32, i32, i32, 1> for u32 {} | |
| 59 | pub fn check() { | |
| 60 | <u32 as Trait<'static, i32, i32, i32, 1>>::foo(); | |
| 61 | } | |
| 62 | } | |
| 63 | ||
| 64 | // Testing lifetimes + types/consts in child, types/consts in delegation parent, | |
| 65 | // with(out) user-specified args | |
| 66 | mod test_4 { | |
| 67 | fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {} | |
| 68 | ||
| 69 | trait Trait<A, B, C, const N: usize> { | |
| 70 | reuse foo; | |
| 71 | //~^ ERROR: type annotations needed [E0284] | |
| 72 | reuse foo::<'static, 'static, i32, String, 1> as bar; | |
| 73 | } | |
| 74 | ||
| 75 | impl Trait<i32, i32, i32, 1> for u32 {} | |
| 76 | pub fn check() { | |
| 77 | <u32 as Trait<i32, i32, i32, 1>>::foo::<'static, 'static, i32, String, 1>(); | |
| 78 | <u32 as Trait<i32, i32, i32, 1>>::bar(); | |
| 79 | //~^ ERROR: type annotations needed [E0284] | |
| 80 | } | |
| 81 | } | |
| 82 | ||
| 83 | // Testing lifetimes + types/consts in child, none in delegation parent, | |
| 84 | // with(out) user-specified args | |
| 85 | mod test_5 { | |
| 86 | fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {} | |
| 87 | ||
| 88 | trait Trait { | |
| 89 | reuse foo; | |
| 90 | //~^ ERROR: type annotations needed [E0284] | |
| 91 | reuse foo::<'static, 'static, i32, String, 1> as bar; | |
| 92 | } | |
| 93 | ||
| 94 | impl Trait for u32 {} | |
| 95 | pub fn check() { | |
| 96 | <u32 as Trait>::foo::<'static, 'static, i32, String, 1>(); | |
| 97 | <u32 as Trait>::bar(); | |
| 98 | //~^ ERROR: type annotations needed [E0284] | |
| 99 | } | |
| 100 | } | |
| 101 | ||
| 102 | // Testing types/consts in child, none in delegation parent, with(out) user-specified args | |
| 103 | mod test_6 { | |
| 104 | fn foo<T: Clone, U: Clone, const N: usize>() {} | |
| 105 | ||
| 106 | trait Trait { | |
| 107 | reuse foo; | |
| 108 | //~^ ERROR: type annotations needed [E0284] | |
| 109 | reuse foo::<i32, String, 1> as bar; | |
| 110 | } | |
| 111 | ||
| 112 | impl Trait for u32 {} | |
| 113 | pub fn check() { | |
| 114 | <u32 as Trait>::foo::<i32, String, 1>(); | |
| 115 | <u32 as Trait>::bar(); | |
| 116 | //~^ ERROR: type annotations needed [E0284] | |
| 117 | } | |
| 118 | } | |
| 119 | ||
| 120 | // Testing none in child, none in delegation parent, with(out) user-specified args | |
| 121 | mod test_7 { | |
| 122 | fn foo() {} | |
| 123 | ||
| 124 | trait Trait { | |
| 125 | reuse foo; | |
| 126 | } | |
| 127 | ||
| 128 | impl Trait for u32 {} | |
| 129 | pub fn check() { | |
| 130 | <u32 as Trait>::foo(); | |
| 131 | } | |
| 132 | } | |
| 133 | ||
| 134 | pub fn main() { | |
| 135 | test_1::check(); | |
| 136 | test_2::check(); | |
| 137 | test_3::check(); | |
| 138 | test_4::check(); | |
| 139 | test_5::check(); | |
| 140 | test_6::check(); | |
| 141 | test_7::check(); | |
| 142 | } |
tests/ui/delegation/generics/mapping/trait-to-free.stderr created+166| ... | ... | @@ -0,0 +1,166 @@ |
| 1 | error[E0284]: type annotations needed | |
| 2 | --> $DIR/trait-to-free.rs:17:15 | |
| 3 | | | |
| 4 | LL | reuse foo; | |
| 5 | | ^^^ cannot infer the value of the const parameter `N` declared on the function `foo` | |
| 6 | | | |
| 7 | note: required by a const generic parameter in `test_1::foo` | |
| 8 | --> $DIR/trait-to-free.rs:14:59 | |
| 9 | | | |
| 10 | LL | fn foo<'a: 'a, 'b: 'b, T: Clone + ToString, U: Clone, const N: usize>() {} | |
| 11 | | ^^^^^^^^^^^^^^ required by this const generic parameter in `foo` | |
| 12 | help: consider specifying the generic arguments | |
| 13 | | | |
| 14 | LL | reuse foo::<T, U, N>; | |
| 15 | | +++++++++++ | |
| 16 | ||
| 17 | error[E0284]: type annotations needed | |
| 18 | --> $DIR/trait-to-free.rs:25:9 | |
| 19 | | | |
| 20 | LL | <u32 as Trait<'static, i32, i32, i32, 1>>::bar(); | |
| 21 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `N` declared on the associated function `bar` | |
| 22 | | | |
| 23 | note: required by a const generic parameter in `test_1::Trait::bar` | |
| 24 | --> $DIR/trait-to-free.rs:14:59 | |
| 25 | | | |
| 26 | LL | fn foo<'a: 'a, 'b: 'b, T: Clone + ToString, U: Clone, const N: usize>() {} | |
| 27 | | ^^^^^^^^^^^^^^ required by this const generic parameter in `Trait::bar` | |
| 28 | ... | |
| 29 | LL | reuse foo::<'static, 'static, i32, String, 1> as bar; | |
| 30 | | --- required by a bound in this associated function | |
| 31 | ||
| 32 | error[E0284]: type annotations needed | |
| 33 | --> $DIR/trait-to-free.rs:36:15 | |
| 34 | | | |
| 35 | LL | reuse foo; | |
| 36 | | ^^^ cannot infer the value of the const parameter `N` declared on the function `foo` | |
| 37 | | | |
| 38 | note: required by a const generic parameter in `test_2::foo` | |
| 39 | --> $DIR/trait-to-free.rs:33:32 | |
| 40 | | | |
| 41 | LL | fn foo<T: Clone, U: Clone, const N: usize>() {} | |
| 42 | | ^^^^^^^^^^^^^^ required by this const generic parameter in `foo` | |
| 43 | help: consider specifying the generic arguments | |
| 44 | | | |
| 45 | LL | reuse foo::<T, U, N>; | |
| 46 | | +++++++++++ | |
| 47 | ||
| 48 | error[E0284]: type annotations needed | |
| 49 | --> $DIR/trait-to-free.rs:44:9 | |
| 50 | | | |
| 51 | LL | <u32 as Trait<'static, i32, i32, i32, 1>>::bar(); | |
| 52 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `N` declared on the associated function `bar` | |
| 53 | | | |
| 54 | note: required by a const generic parameter in `test_2::Trait::bar` | |
| 55 | --> $DIR/trait-to-free.rs:33:32 | |
| 56 | | | |
| 57 | LL | fn foo<T: Clone, U: Clone, const N: usize>() {} | |
| 58 | | ^^^^^^^^^^^^^^ required by this const generic parameter in `Trait::bar` | |
| 59 | ... | |
| 60 | LL | reuse foo::<i32, String, 1> as bar; | |
| 61 | | --- required by a bound in this associated function | |
| 62 | ||
| 63 | error[E0284]: type annotations needed | |
| 64 | --> $DIR/trait-to-free.rs:70:15 | |
| 65 | | | |
| 66 | LL | reuse foo; | |
| 67 | | ^^^ cannot infer the value of the const parameter `N` declared on the function `foo` | |
| 68 | | | |
| 69 | note: required by a const generic parameter in `test_4::foo` | |
| 70 | --> $DIR/trait-to-free.rs:67:48 | |
| 71 | | | |
| 72 | LL | fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {} | |
| 73 | | ^^^^^^^^^^^^^^ required by this const generic parameter in `foo` | |
| 74 | help: consider specifying the generic arguments | |
| 75 | | | |
| 76 | LL | reuse foo::<T, U, N>; | |
| 77 | | +++++++++++ | |
| 78 | ||
| 79 | error[E0284]: type annotations needed | |
| 80 | --> $DIR/trait-to-free.rs:78:9 | |
| 81 | | | |
| 82 | LL | <u32 as Trait<i32, i32, i32, 1>>::bar(); | |
| 83 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `N` declared on the associated function `bar` | |
| 84 | | | |
| 85 | note: required by a const generic parameter in `test_4::Trait::bar` | |
| 86 | --> $DIR/trait-to-free.rs:67:48 | |
| 87 | | | |
| 88 | LL | fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {} | |
| 89 | | ^^^^^^^^^^^^^^ required by this const generic parameter in `Trait::bar` | |
| 90 | ... | |
| 91 | LL | reuse foo::<'static, 'static, i32, String, 1> as bar; | |
| 92 | | --- required by a bound in this associated function | |
| 93 | ||
| 94 | error[E0284]: type annotations needed | |
| 95 | --> $DIR/trait-to-free.rs:89:15 | |
| 96 | | | |
| 97 | LL | reuse foo; | |
| 98 | | ^^^ cannot infer the value of the const parameter `N` declared on the function `foo` | |
| 99 | | | |
| 100 | note: required by a const generic parameter in `test_5::foo` | |
| 101 | --> $DIR/trait-to-free.rs:86:48 | |
| 102 | | | |
| 103 | LL | fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {} | |
| 104 | | ^^^^^^^^^^^^^^ required by this const generic parameter in `foo` | |
| 105 | help: consider specifying the generic arguments | |
| 106 | | | |
| 107 | LL | reuse foo::<T, U, N>; | |
| 108 | | +++++++++++ | |
| 109 | ||
| 110 | error[E0284]: type annotations needed | |
| 111 | --> $DIR/trait-to-free.rs:97:9 | |
| 112 | | | |
| 113 | LL | <u32 as Trait>::bar(); | |
| 114 | | ^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `N` declared on the associated function `bar` | |
| 115 | | | |
| 116 | note: required by a const generic parameter in `test_5::Trait::bar` | |
| 117 | --> $DIR/trait-to-free.rs:86:48 | |
| 118 | | | |
| 119 | LL | fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {} | |
| 120 | | ^^^^^^^^^^^^^^ required by this const generic parameter in `Trait::bar` | |
| 121 | ... | |
| 122 | LL | reuse foo::<'static, 'static, i32, String, 1> as bar; | |
| 123 | | --- required by a bound in this associated function | |
| 124 | help: consider specifying the generic arguments | |
| 125 | | | |
| 126 | LL | <u32 as Trait>::bar::<T, U, N>(); | |
| 127 | | +++++++++++ | |
| 128 | ||
| 129 | error[E0284]: type annotations needed | |
| 130 | --> $DIR/trait-to-free.rs:107:15 | |
| 131 | | | |
| 132 | LL | reuse foo; | |
| 133 | | ^^^ cannot infer the value of the const parameter `N` declared on the function `foo` | |
| 134 | | | |
| 135 | note: required by a const generic parameter in `test_6::foo` | |
| 136 | --> $DIR/trait-to-free.rs:104:32 | |
| 137 | | | |
| 138 | LL | fn foo<T: Clone, U: Clone, const N: usize>() {} | |
| 139 | | ^^^^^^^^^^^^^^ required by this const generic parameter in `foo` | |
| 140 | help: consider specifying the generic arguments | |
| 141 | | | |
| 142 | LL | reuse foo::<T, U, N>; | |
| 143 | | +++++++++++ | |
| 144 | ||
| 145 | error[E0284]: type annotations needed | |
| 146 | --> $DIR/trait-to-free.rs:115:9 | |
| 147 | | | |
| 148 | LL | <u32 as Trait>::bar(); | |
| 149 | | ^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `N` declared on the associated function `bar` | |
| 150 | | | |
| 151 | note: required by a const generic parameter in `test_6::Trait::bar` | |
| 152 | --> $DIR/trait-to-free.rs:104:32 | |
| 153 | | | |
| 154 | LL | fn foo<T: Clone, U: Clone, const N: usize>() {} | |
| 155 | | ^^^^^^^^^^^^^^ required by this const generic parameter in `Trait::bar` | |
| 156 | ... | |
| 157 | LL | reuse foo::<i32, String, 1> as bar; | |
| 158 | | --- required by a bound in this associated function | |
| 159 | help: consider specifying the generic arguments | |
| 160 | | | |
| 161 | LL | <u32 as Trait>::bar::<T, U, N>(); | |
| 162 | | +++++++++++ | |
| 163 | ||
| 164 | error: aborting due to 10 previous errors | |
| 165 | ||
| 166 | For more information about this error, try `rustc --explain E0284`. |
tests/ui/delegation/generics/mapping/trait-to-trait.rs created+895| ... | ... | @@ -0,0 +1,895 @@ |
| 1 | #![feature(fn_delegation)] | |
| 2 | #![allow(incomplete_features)] | |
| 3 | #![allow(late_bound_lifetime_arguments)] | |
| 4 | ||
| 5 | //! This is one of the mapping tests, which tests mapping of delegee parent and child | |
| 6 | //! generic params, whose main goal is to create cases with | |
| 7 | //! different number of lifetimes/types/consts in delegee child and parent; and in | |
| 8 | //! delegation parent if applicable. At some tests predicates are | |
| 9 | //! added. At some tests user-specified args are specified in reuse statement. | |
| 10 | ||
| 11 | // Testing lifetimes + types in parent, | |
| 12 | // lifetimes + types/consts in child, | |
| 13 | // in delegation parent with: | |
| 14 | // lifetimes + types OR none OR lifetimes OR types, | |
| 15 | // with(out) user-specified args, with different target expr | |
| 16 | mod test_1 { | |
| 17 | trait Trait<'b, 'c, 'a, T>: Sized { | |
| 18 | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 19 | } | |
| 20 | ||
| 21 | impl<'b, 'c, 'a, T> Trait<'b, 'c, 'a, T> for u8 {} | |
| 22 | ||
| 23 | trait Trait2<'a, 'b, 'c, X, Y, Z> { | |
| 24 | fn get() -> &'static u8 { &0 } | |
| 25 | fn get_self(&self) -> &'static u8 { &0 } | |
| 26 | reuse Trait::<'static, 'static, 'static, i32>::foo as bar1 { Self::get() } | |
| 27 | //~^ ERROR: type annotations needed [E0284] | |
| 28 | reuse Trait::<'static, 'static, 'static, i32>::foo::<'static, String, false> as bar2 { | |
| 29 | Self::get() | |
| 30 | } | |
| 31 | ||
| 32 | reuse Trait::<'static, 'static, 'static, i32>::foo as bar3 { self.get_self() } | |
| 33 | //~^ ERROR: type annotations needed [E0284] | |
| 34 | reuse Trait::<'static, 'static, 'static, i32>::foo::<'static, String, false> | |
| 35 | as bar4 { self.get_self() } | |
| 36 | ||
| 37 | // FIXME(fn_delegation): Uncomment those tests when proper support for | |
| 38 | // generics when method call is generated is added | |
| 39 | ||
| 40 | // reuse Trait::foo::<'static, String, false> as bar5 { Self::get() } | |
| 41 | // reuse Trait::foo as bar6 { Self::get() } | |
| 42 | // reuse Trait::foo::<'static, String, false> as bar7 { self.get_self() } | |
| 43 | // reuse Trait::foo as bar8 { self.get_self() } | |
| 44 | } | |
| 45 | ||
| 46 | trait Trait3 { | |
| 47 | fn get() -> &'static u8 { &0 } | |
| 48 | fn get_self(&self) -> &'static u8 { &0 } | |
| 49 | reuse Trait::<'static, 'static, 'static, i32>::foo as bar1 { Self::get() } | |
| 50 | //~^ ERROR: type annotations needed [E0284] | |
| 51 | reuse Trait::<'static, 'static, 'static, i32>::foo::<'static, String, false> | |
| 52 | as bar2 { Self::get() } | |
| 53 | reuse Trait::<'static, 'static, 'static, i32>::foo as bar3 { self.get_self() } | |
| 54 | //~^ ERROR: type annotations needed [E0284] | |
| 55 | reuse Trait::<'static, 'static, 'static, i32>::foo::<'static, String, false> | |
| 56 | as bar4 { self.get_self() } | |
| 57 | } | |
| 58 | ||
| 59 | trait Trait4<'a, 'b, 'c> { | |
| 60 | fn get() -> &'static u8 { &0 } | |
| 61 | fn get_self(&self) -> &'static u8 { &0 } | |
| 62 | reuse Trait::<'static, 'static, 'static, i32>::foo as bar1 { Self::get() } | |
| 63 | //~^ ERROR: type annotations needed [E0284] | |
| 64 | reuse Trait::<'static, 'static, 'static, i32>::foo::<'static, String, false> | |
| 65 | as bar2 { Self::get() } | |
| 66 | reuse Trait::<'static, 'static, 'static, i32>::foo as bar3 { self.get_self() } | |
| 67 | //~^ ERROR: type annotations needed [E0284] | |
| 68 | reuse Trait::<'static, 'static, 'static, i32>::foo::<'static, String, false> | |
| 69 | as bar4 { self.get_self() } | |
| 70 | } | |
| 71 | ||
| 72 | trait Trait5<X, Y, Z> { | |
| 73 | fn get() -> &'static u8 { &0 } | |
| 74 | fn get_self(&self) -> &'static u8 { &0 } | |
| 75 | reuse Trait::<'static, 'static, 'static, i32>::foo as bar1 { Self::get() } | |
| 76 | //~^ ERROR: type annotations needed [E0284] | |
| 77 | reuse Trait::<'static, 'static, 'static, i32>::foo::<'static, String, false> | |
| 78 | as bar2 { Self::get() } | |
| 79 | reuse Trait::<'static, 'static, 'static, i32>::foo as bar3 { self.get_self() } | |
| 80 | //~^ ERROR: type annotations needed [E0284] | |
| 81 | reuse Trait::<'static, 'static, 'static, i32>::foo::<'static, String, false> | |
| 82 | as bar4 { self.get_self() } | |
| 83 | } | |
| 84 | ||
| 85 | impl<'a, 'b, 'c, X, Y, Z> Trait2<'a, 'b, 'c, X, Y, Z> for u32 {} | |
| 86 | impl Trait3 for u32 {} | |
| 87 | impl<'a, 'b, 'c> Trait4<'a, 'b, 'c> for u32 {} | |
| 88 | impl<X, Y, Z> Trait5<X, Y, Z> for u32 {} | |
| 89 | ||
| 90 | pub fn check<'a: 'a>() { | |
| 91 | <u32 as Trait2<'static, 'static, 'static, i32, i32, i32>> | |
| 92 | ::bar1::<'static, String, true>(&123); | |
| 93 | //~^ ERROR: method takes 3 generic arguments but 2 generic arguments were supplied [E0107] | |
| 94 | //~| ERROR: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present [E0794] | |
| 95 | <u32 as Trait3>::bar1::<'static, String, true>(&123); | |
| 96 | //~^ ERROR: method takes 3 generic arguments but 2 generic arguments were supplied [E0107] | |
| 97 | //~| ERROR: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present [E0794] | |
| 98 | <u32 as Trait4<'a, 'a, 'static>>::bar1::<'static, String, true>(&123); | |
| 99 | //~^ ERROR: method takes 3 generic arguments but 2 generic arguments were supplied [E0107] | |
| 100 | //~| ERROR: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present [E0794] | |
| 101 | <u32 as Trait5<i32, u64, String>>::bar1::<'static, String, true>(&123); | |
| 102 | //~^ ERROR: method takes 3 generic arguments but 2 generic arguments were supplied [E0107] | |
| 103 | //~| ERROR: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present [E0794] | |
| 104 | ||
| 105 | <u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>::bar2(&123); | |
| 106 | <u32 as Trait3>::bar2(&123); | |
| 107 | <u32 as Trait4<'a, 'a, 'static>>::bar2(&123); | |
| 108 | <u32 as Trait5<i32, u64, String>>::bar2(&123); | |
| 109 | ||
| 110 | <u32 as Trait2<'static, 'static, 'static, i32, i32, i32>> | |
| 111 | ::bar3::<'static, String, true>(&123); | |
| 112 | //~^ ERROR: method takes 3 generic arguments but 2 generic arguments were supplied [E0107] | |
| 113 | //~| ERROR: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present [E0794] | |
| 114 | <u32 as Trait3>::bar3::<'static, String, true>(&123); | |
| 115 | //~^ ERROR: method takes 3 generic arguments but 2 generic arguments were supplied [E0107] | |
| 116 | //~| ERROR: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present [E0794] | |
| 117 | <u32 as Trait4<'a, 'a, 'static>>::bar3::<'static, String, true>(&123); | |
| 118 | //~^ ERROR: method takes 3 generic arguments but 2 generic arguments were supplied [E0107] | |
| 119 | //~| ERROR: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present [E0794] | |
| 120 | <u32 as Trait5<i32, u64, String>>::bar3::<'static, String, true>(&123); | |
| 121 | //~^ ERROR: method takes 3 generic arguments but 2 generic arguments were supplied [E0107] | |
| 122 | //~| ERROR: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present [E0794] | |
| 123 | ||
| 124 | <u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>::bar4(&123); | |
| 125 | <u32 as Trait3>::bar4(&123); | |
| 126 | <u32 as Trait4<'a, 'a, 'static>>::bar4(&123); | |
| 127 | <u32 as Trait5<i32, u64, String>>::bar4(&123); | |
| 128 | } | |
| 129 | } | |
| 130 | ||
| 131 | // Testing types in parent, | |
| 132 | // lifetimes + types/consts in child, | |
| 133 | // in delegation parent with: | |
| 134 | // lifetimes + types OR none OR lifetimes OR types, | |
| 135 | // with(out) user-specified args, with different target expr | |
| 136 | mod test_2 { | |
| 137 | trait Trait<T>: Sized { | |
| 138 | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 139 | } | |
| 140 | ||
| 141 | impl<T> Trait<T> for u8 {} | |
| 142 | ||
| 143 | trait Trait2<'a, 'b, 'c, X, Y, Z> { | |
| 144 | fn get() -> &'static u8 { &0 } | |
| 145 | fn get_self(&self) -> &'static u8 { &0 } | |
| 146 | reuse Trait::<i32>::foo as bar1 { Self::get() } | |
| 147 | //~^ ERROR: type annotations needed [E0284] | |
| 148 | reuse Trait::<i32>::foo::<'static, String, false> as bar2 { Self::get() } | |
| 149 | reuse Trait::<i32>::foo as bar3 { self.get_self() } | |
| 150 | //~^ ERROR: type annotations needed [E0284] | |
| 151 | reuse Trait::<i32>::foo::<'static, String, false> as bar4 { self.get_self() } | |
| 152 | } | |
| 153 | ||
| 154 | trait Trait3 { | |
| 155 | fn get() -> &'static u8 { &0 } | |
| 156 | fn get_self(&self) -> &'static u8 { &0 } | |
| 157 | reuse Trait::<i32>::foo as bar1 { Self::get() } | |
| 158 | //~^ ERROR: type annotations needed [E0284] | |
| 159 | reuse Trait::<i32>::foo::<'static, String, false> as bar2 { Self::get() } | |
| 160 | reuse Trait::<i32>::foo as bar3 { self.get_self() } | |
| 161 | //~^ ERROR: type annotations needed [E0284] | |
| 162 | reuse Trait::<i32>::foo::<'static, String, false> as bar4 { self.get_self() } | |
| 163 | } | |
| 164 | ||
| 165 | trait Trait4<'a, 'b, 'c> { | |
| 166 | fn get() -> &'static u8 { &0 } | |
| 167 | fn get_self(&self) -> &'static u8 { &0 } | |
| 168 | reuse Trait::<i32>::foo as bar1 { Self::get() } | |
| 169 | //~^ ERROR: type annotations needed [E0284] | |
| 170 | reuse Trait::<i32>::foo::<'static, String, false> as bar2 { Self::get() } | |
| 171 | reuse Trait::<i32>::foo as bar3 { self.get_self() } | |
| 172 | //~^ ERROR: type annotations needed [E0284] | |
| 173 | reuse Trait::<i32>::foo::<'static, String, false> as bar4 { self.get_self() } | |
| 174 | } | |
| 175 | ||
| 176 | trait Trait5<X, Y, Z> { | |
| 177 | fn get() -> &'static u8 { &0 } | |
| 178 | fn get_self(&self) -> &'static u8 { &0 } | |
| 179 | reuse Trait::<i32>::foo as bar1 { Self::get() } | |
| 180 | //~^ ERROR: type annotations needed [E0284] | |
| 181 | reuse Trait::<i32>::foo::<'static, String, false> as bar2 { Self::get() } | |
| 182 | reuse Trait::<i32>::foo as bar3 { self.get_self() } | |
| 183 | //~^ ERROR: type annotations needed [E0284] | |
| 184 | reuse Trait::<i32>::foo::<'static, String, false> as bar4 { self.get_self() } | |
| 185 | } | |
| 186 | ||
| 187 | impl<'a, 'b, 'c, X, Y, Z> Trait2<'a, 'b, 'c, X, Y, Z> for u32 {} | |
| 188 | impl Trait3 for u32 {} | |
| 189 | impl<'a, 'b, 'c> Trait4<'a, 'b, 'c> for u32 {} | |
| 190 | impl<X, Y, Z> Trait5<X, Y, Z> for u32 {} | |
| 191 | ||
| 192 | pub fn check<'a: 'a>() { | |
| 193 | <u32 as Trait2<'static, 'static, 'static, i32, i32, i32>> | |
| 194 | ::bar1::<'static, String, true>(&123); | |
| 195 | //~^ ERROR: method takes 3 generic arguments but 2 generic arguments were supplied [E0107] | |
| 196 | <u32 as Trait3>::bar1::<'static, String, true>(&123); | |
| 197 | //~^ ERROR: method takes 3 generic arguments but 2 generic arguments were supplied [E0107] | |
| 198 | <u32 as Trait4<'a, 'a, 'static>>::bar1::<'static, String, true>(&123); | |
| 199 | //~^ ERROR: method takes 3 generic arguments but 2 generic arguments were supplied [E0107] | |
| 200 | <u32 as Trait5<i32, u64, String>>::bar1::<'static, String, true>(&123); | |
| 201 | //~^ ERROR: method takes 3 generic arguments but 2 generic arguments were supplied [E0107] | |
| 202 | ||
| 203 | <u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>::bar2(&123); | |
| 204 | <u32 as Trait3>::bar2(&123); | |
| 205 | <u32 as Trait4<'a, 'a, 'static>>::bar2(&123); | |
| 206 | <u32 as Trait5<i32, u64, String>>::bar2(&123); | |
| 207 | ||
| 208 | <u32 as Trait2<'static, 'static, 'static, i32, i32, i32>> | |
| 209 | ::bar3::<'static, String, true>(&123); | |
| 210 | //~^ ERROR: method takes 3 generic arguments but 2 generic arguments were supplied [E0107] | |
| 211 | <u32 as Trait3>::bar3::<'static, String, true>(&123); | |
| 212 | //~^ ERROR: method takes 3 generic arguments but 2 generic arguments were supplied [E0107] | |
| 213 | <u32 as Trait4<'a, 'a, 'static>>::bar3::<'static, String, true>(&123); | |
| 214 | //~^ ERROR: method takes 3 generic arguments but 2 generic arguments were supplied [E0107] | |
| 215 | <u32 as Trait5<i32, u64, String>>::bar3::<'static, String, true>(&123); | |
| 216 | //~^ ERROR: method takes 3 generic arguments but 2 generic arguments were supplied [E0107] | |
| 217 | ||
| 218 | <u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>::bar4(&123); | |
| 219 | <u32 as Trait3>::bar4(&123); | |
| 220 | <u32 as Trait4<'a, 'a, 'static>>::bar4(&123); | |
| 221 | <u32 as Trait5<i32, u64, String>>::bar4(&123); | |
| 222 | } | |
| 223 | } | |
| 224 | ||
| 225 | // Testing lifetimes in parent, | |
| 226 | // lifetimes + types/consts in child, | |
| 227 | // in delegation parent with: | |
| 228 | // lifetimes + types OR none OR lifetimes OR types, | |
| 229 | // with(out) user-specified args, with different target expr | |
| 230 | mod test_3 { | |
| 231 | trait Trait<'b, 'c, 'a>: Sized { | |
| 232 | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 233 | } | |
| 234 | ||
| 235 | impl<'b, 'c, 'a> Trait<'b, 'c, 'a> for u8 {} | |
| 236 | ||
| 237 | trait Trait2<'a, 'b, 'c, X, Y, Z> { | |
| 238 | fn get() -> &'static u8 { &0 } | |
| 239 | fn get_self(&self) -> &'static u8 { &0 } | |
| 240 | reuse Trait::<'static, 'static, 'static>::foo as bar1 { Self::get() } | |
| 241 | //~^ ERROR: type annotations needed [E0284] | |
| 242 | reuse Trait::<'static, 'static, 'static>::foo::<'static, String, false> as bar2 { | |
| 243 | Self::get() | |
| 244 | } | |
| 245 | reuse Trait::<'static, 'static, 'static>::foo as bar3 { self.get_self() } | |
| 246 | //~^ ERROR: type annotations needed [E0284] | |
| 247 | reuse Trait::<'static, 'static, 'static>::foo::<'static, String, false> as bar4 { | |
| 248 | self.get_self() | |
| 249 | } | |
| 250 | } | |
| 251 | ||
| 252 | trait Trait3 { | |
| 253 | fn get() -> &'static u8 { &0 } | |
| 254 | fn get_self(&self) -> &'static u8 { &0 } | |
| 255 | reuse Trait::<'static, 'static, 'static>::foo as bar1 { Self::get() } | |
| 256 | //~^ ERROR: type annotations needed [E0284] | |
| 257 | reuse Trait::<'static, 'static, 'static>::foo::<'static, String, false> as bar2 { | |
| 258 | Self::get() | |
| 259 | } | |
| 260 | reuse Trait::<'static, 'static, 'static>::foo as bar3 { self.get_self() } | |
| 261 | //~^ ERROR: type annotations needed [E0284] | |
| 262 | reuse Trait::<'static, 'static, 'static>::foo::<'static, String, false> as bar4 { | |
| 263 | self.get_self() | |
| 264 | } | |
| 265 | } | |
| 266 | ||
| 267 | trait Trait4<'a, 'b, 'c> { | |
| 268 | fn get() -> &'static u8 { &0 } | |
| 269 | fn get_self(&self) -> &'static u8 { &0 } | |
| 270 | reuse Trait::<'static, 'static, 'static>::foo as bar1 { Self::get() } | |
| 271 | //~^ ERROR: type annotations needed [E0284] | |
| 272 | reuse Trait::<'static, 'static, 'static>::foo::<'static, String, false> as bar2 { | |
| 273 | Self::get() | |
| 274 | } | |
| 275 | reuse Trait::<'static, 'static, 'static>::foo as bar3 { self.get_self() } | |
| 276 | //~^ ERROR: type annotations needed [E0284] | |
| 277 | reuse Trait::<'static, 'static, 'static>::foo::<'static, String, false> as bar4 { | |
| 278 | self.get_self() | |
| 279 | } | |
| 280 | } | |
| 281 | ||
| 282 | trait Trait5<X, Y, Z> { | |
| 283 | fn get() -> &'static u8 { &0 } | |
| 284 | fn get_self(&self) -> &'static u8 { &0 } | |
| 285 | reuse Trait::<'static, 'static, 'static>::foo as bar1 { Self::get() } | |
| 286 | //~^ ERROR: type annotations needed [E0284] | |
| 287 | reuse Trait::<'static, 'static, 'static>::foo::<'static, String, false> | |
| 288 | as bar2 { Self::get() } | |
| 289 | reuse Trait::<'static, 'static, 'static>::foo as bar3 { self.get_self() } | |
| 290 | //~^ ERROR: type annotations needed [E0284] | |
| 291 | reuse Trait::<'static, 'static, 'static>::foo::<'static, String, false> | |
| 292 | as bar4 { self.get_self() } | |
| 293 | } | |
| 294 | ||
| 295 | impl<'a, 'b, 'c, X, Y, Z> Trait2<'a, 'b, 'c, X, Y, Z> for u32 {} | |
| 296 | impl Trait3 for u32 {} | |
| 297 | impl<'a, 'b, 'c> Trait4<'a, 'b, 'c> for u32 {} | |
| 298 | impl<X, Y, Z> Trait5<X, Y, Z> for u32 {} | |
| 299 | ||
| 300 | pub fn check<'a: 'a>() { | |
| 301 | <u32 as Trait2<'static, 'static, 'static, i32, i32, i32>> | |
| 302 | ::bar1::<'static, String, true>(&123); | |
| 303 | //~^ ERROR: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present [E0794] | |
| 304 | <u32 as Trait3>::bar1::<'static, String, true>(&123); | |
| 305 | //~^ ERROR: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present [E0794] | |
| 306 | <u32 as Trait4<'a, 'a, 'static>>::bar1::<'static, String, true>(&123); | |
| 307 | //~^ ERROR: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present [E0794] | |
| 308 | <u32 as Trait5<i32, u64, String>>::bar1::<'static, String, true>(&123); | |
| 309 | //~^ ERROR: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present [E0794] | |
| 310 | ||
| 311 | <u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>::bar2(&123); | |
| 312 | <u32 as Trait3>::bar2(&123); | |
| 313 | <u32 as Trait4<'a, 'a, 'static>>::bar2(&123); | |
| 314 | <u32 as Trait5<i32, u64, String>>::bar2(&123); | |
| 315 | ||
| 316 | <u32 as Trait2<'static, 'static, 'static, i32, i32, i32>> | |
| 317 | ::bar3::<'static, String, true>(&123); | |
| 318 | //~^ ERROR: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present [E0794] | |
| 319 | <u32 as Trait3>::bar3::<'static, String, true>(&123); | |
| 320 | //~^ ERROR: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present [E0794] | |
| 321 | <u32 as Trait4<'a, 'a, 'static>>::bar3::<'static, String, true>(&123); | |
| 322 | //~^ ERROR: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present [E0794] | |
| 323 | <u32 as Trait5<i32, u64, String>>::bar3::<'static, String, true>(&123); | |
| 324 | //~^ ERROR: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present [E0794] | |
| 325 | ||
| 326 | <u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>::bar4(&123); | |
| 327 | <u32 as Trait3>::bar4(&123); | |
| 328 | <u32 as Trait4<'a, 'a, 'static>>::bar4(&123); | |
| 329 | <u32 as Trait5<i32, u64, String>>::bar4(&123); | |
| 330 | } | |
| 331 | } | |
| 332 | ||
| 333 | // Testing none in parent, | |
| 334 | // lifetimes + types/consts in child, | |
| 335 | // in delegation parent with: | |
| 336 | // lifetimes + types OR none OR lifetimes OR types, | |
| 337 | // with(out) user-specified args, with different target expr | |
| 338 | mod test_4 { | |
| 339 | trait Trait: Sized { | |
| 340 | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 341 | } | |
| 342 | ||
| 343 | impl Trait for u8 {} | |
| 344 | ||
| 345 | trait Trait2<'a, 'b, 'c, X, Y, Z> { | |
| 346 | fn get() -> &'static u8 { &0 } | |
| 347 | fn get_self(&self) -> &'static u8 { &0 } | |
| 348 | reuse Trait::foo as bar1 { Self::get() } | |
| 349 | //~^ ERROR: type annotations needed [E0284] | |
| 350 | reuse Trait::foo::<'static, String, false> as bar2 { Self::get() } | |
| 351 | reuse Trait::foo as bar3 { self.get_self() } | |
| 352 | //~^ ERROR: type annotations needed [E0284] | |
| 353 | reuse Trait::foo::<'static, String, false> as bar4 { self.get_self() } | |
| 354 | } | |
| 355 | ||
| 356 | trait Trait3 { | |
| 357 | fn get() -> &'static u8 { &0 } | |
| 358 | fn get_self(&self) -> &'static u8 { &0 } | |
| 359 | reuse Trait::foo as bar1 { Self::get() } | |
| 360 | //~^ ERROR: type annotations needed [E0284] | |
| 361 | reuse Trait::foo::<'static, String, false> as bar2 { Self::get() } | |
| 362 | reuse Trait::foo as bar3 { self.get_self() } | |
| 363 | //~^ ERROR: type annotations needed [E0284] | |
| 364 | reuse Trait::foo::<'static, String, false> as bar4 { self.get_self() } | |
| 365 | } | |
| 366 | ||
| 367 | trait Trait4<'a, 'b, 'c> { | |
| 368 | fn get() -> &'static u8 { &0 } | |
| 369 | fn get_self(&self) -> &'static u8 { &0 } | |
| 370 | reuse Trait::foo as bar1 { Self::get() } | |
| 371 | //~^ ERROR: type annotations needed [E0284] | |
| 372 | reuse Trait::foo::<'static, String, false> as bar2 { Self::get() } | |
| 373 | reuse Trait::foo as bar3 { self.get_self() } | |
| 374 | //~^ ERROR: type annotations needed [E0284] | |
| 375 | reuse Trait::foo::<'static, String, false> as bar4 { self.get_self() } | |
| 376 | } | |
| 377 | ||
| 378 | trait Trait5<X, Y, Z> { | |
| 379 | fn get() -> &'static u8 { &0 } | |
| 380 | fn get_self(&self) -> &'static u8 { &0 } | |
| 381 | reuse Trait::foo as bar1 { Self::get() } | |
| 382 | //~^ ERROR: type annotations needed [E0284] | |
| 383 | reuse Trait::foo::<'static, String, false> as bar2 { Self::get() } | |
| 384 | reuse Trait::foo as bar3 { self.get_self() } | |
| 385 | //~^ ERROR: type annotations needed [E0284] | |
| 386 | reuse Trait::foo::<'static, String, false> as bar4 { self.get_self() } | |
| 387 | } | |
| 388 | ||
| 389 | impl<'a, 'b, 'c, X, Y, Z> Trait2<'a, 'b, 'c, X, Y, Z> for u32 {} | |
| 390 | impl Trait3 for u32 {} | |
| 391 | impl<'a, 'b, 'c> Trait4<'a, 'b, 'c> for u32 {} | |
| 392 | impl<X, Y, Z> Trait5<X, Y, Z> for u32 {} | |
| 393 | ||
| 394 | pub fn check<'a: 'a>() { | |
| 395 | <u32 as Trait2<'static, 'static, 'static, i32, i32, i32>> | |
| 396 | ::bar1::<'static, String, true>(&123); | |
| 397 | <u32 as Trait3>::bar1::<'static, String, true>(&123); | |
| 398 | <u32 as Trait4<'a, 'a, 'static>>::bar1::<'static, String, true>(&123); | |
| 399 | <u32 as Trait5<i32, u64, String>>::bar1::<'static, String, true>(&123); | |
| 400 | ||
| 401 | <u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>::bar2(&123); | |
| 402 | //~^ ERROR: type annotations needed [E0284] | |
| 403 | <u32 as Trait3>::bar2(&123); | |
| 404 | //~^ ERROR: type annotations needed [E0284] | |
| 405 | <u32 as Trait4<'a, 'a, 'static>>::bar2(&123); | |
| 406 | //~^ ERROR: type annotations needed [E0284] | |
| 407 | <u32 as Trait5<i32, u64, String>>::bar2(&123); | |
| 408 | //~^ ERROR: type annotations needed [E0284] | |
| 409 | ||
| 410 | <u32 as Trait2<'static, 'static, 'static, i32, i32, i32>> | |
| 411 | ::bar3::<'static, String, true>(&123); | |
| 412 | <u32 as Trait3>::bar3::<'static, String, true>(&123); | |
| 413 | <u32 as Trait4<'a, 'a, 'static>>::bar3::<'static, String, true>(&123); | |
| 414 | <u32 as Trait5<i32, u64, String>>::bar3::<'static, String, true>(&123); | |
| 415 | ||
| 416 | <u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>::bar4(&123); | |
| 417 | //~^ ERROR: type annotations needed [E0284] | |
| 418 | <u32 as Trait3>::bar4(&123); | |
| 419 | //~^ ERROR: type annotations needed [E0284] | |
| 420 | <u32 as Trait4<'a, 'a, 'static>>::bar4(&123); | |
| 421 | //~^ ERROR: type annotations needed [E0284] | |
| 422 | <u32 as Trait5<i32, u64, String>>::bar4(&123); | |
| 423 | //~^ ERROR: type annotations needed [E0284] | |
| 424 | } | |
| 425 | } | |
| 426 | ||
| 427 | // Testing lifetimes + types in parent, | |
| 428 | // types/consts in child, | |
| 429 | // in delegation parent with: | |
| 430 | // lifetimes + types OR none OR lifetimes OR types, | |
| 431 | // with(out) user-specified args, with different target expr | |
| 432 | mod test_5 { | |
| 433 | trait Trait<'b, 'c, 'a, T>: Sized { | |
| 434 | fn foo<U, const M: bool>(&self) {} | |
| 435 | } | |
| 436 | ||
| 437 | impl<'b, 'c, 'a, T> Trait<'b, 'c, 'a, T> for u8 {} | |
| 438 | ||
| 439 | trait Trait2<'a, 'b, 'c, X, Y, Z> { | |
| 440 | fn get() -> &'static u8 { &0 } | |
| 441 | fn get_self(&self) -> &'static u8 { &0 } | |
| 442 | reuse Trait::<'static, 'static, 'static, i32>::foo as bar1 { Self::get() } | |
| 443 | //~^ ERROR: type annotations needed [E0284] | |
| 444 | reuse Trait::<'static, 'static, 'static, i32>::foo::<String, false> as bar2 { | |
| 445 | Self::get() | |
| 446 | } | |
| 447 | reuse Trait::<'static, 'static, 'static, i32>::foo as bar3 { self.get_self() } | |
| 448 | //~^ ERROR: type annotations needed [E0284] | |
| 449 | reuse Trait::<'static, 'static, 'static, i32>::foo::<String, false> as bar4 { | |
| 450 | self.get_self() | |
| 451 | } | |
| 452 | } | |
| 453 | ||
| 454 | trait Trait3 { | |
| 455 | fn get() -> &'static u8 { &0 } | |
| 456 | fn get_self(&self) -> &'static u8 { &0 } | |
| 457 | reuse Trait::<'static, 'static, 'static, i32>::foo as bar1 { Self::get() } | |
| 458 | //~^ ERROR: type annotations needed [E0284] | |
| 459 | reuse Trait::<'static, 'static, 'static, i32>::foo::<String, false> as bar2 { | |
| 460 | Self::get() | |
| 461 | } | |
| 462 | reuse Trait::<'static, 'static, 'static, i32>::foo as bar3 { self.get_self() } | |
| 463 | //~^ ERROR: type annotations needed [E0284] | |
| 464 | reuse Trait::<'static, 'static, 'static, i32>::foo::<String, false> as bar4 { | |
| 465 | self.get_self() | |
| 466 | } | |
| 467 | } | |
| 468 | ||
| 469 | trait Trait4<'a, 'b, 'c> { | |
| 470 | fn get() -> &'static u8 { &0 } | |
| 471 | fn get_self(&self) -> &'static u8 { &0 } | |
| 472 | reuse Trait::<'static, 'static, 'static, i32>::foo as bar1 { Self::get() } | |
| 473 | //~^ ERROR: type annotations needed [E0284] | |
| 474 | reuse Trait::<'static, 'static, 'static, i32>::foo::<String, false> as bar2 { | |
| 475 | Self::get() | |
| 476 | } | |
| 477 | reuse Trait::<'static, 'static, 'static, i32>::foo as bar3 { self.get_self() } | |
| 478 | //~^ ERROR: type annotations needed [E0284] | |
| 479 | reuse Trait::<'static, 'static, 'static, i32>::foo::<String, false> as bar4 { | |
| 480 | self.get_self() | |
| 481 | } | |
| 482 | } | |
| 483 | ||
| 484 | trait Trait5<X, Y, Z> { | |
| 485 | fn get() -> &'static u8 { &0 } | |
| 486 | fn get_self(&self) -> &'static u8 { &0 } | |
| 487 | reuse Trait::<'static, 'static, 'static, i32>::foo as bar1 { Self::get() } | |
| 488 | //~^ ERROR: type annotations needed [E0284] | |
| 489 | reuse Trait::<'static, 'static, 'static, i32>::foo::<String, false> as bar2 { | |
| 490 | Self::get() | |
| 491 | } | |
| 492 | reuse Trait::<'static, 'static, 'static, i32>::foo as bar3 { self.get_self() } | |
| 493 | //~^ ERROR: type annotations needed [E0284] | |
| 494 | reuse Trait::<'static, 'static, 'static, i32>::foo::<String, false> as bar4 { | |
| 495 | self.get_self() | |
| 496 | } | |
| 497 | } | |
| 498 | ||
| 499 | impl<'a, 'b, 'c, X, Y, Z> Trait2<'a, 'b, 'c, X, Y, Z> for u32 {} | |
| 500 | impl Trait3 for u32 {} | |
| 501 | impl<'a, 'b, 'c> Trait4<'a, 'b, 'c> for u32 {} | |
| 502 | impl<X, Y, Z> Trait5<X, Y, Z> for u32 {} | |
| 503 | ||
| 504 | pub fn check<'a: 'a>() { | |
| 505 | <u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>::bar1::<String, true>(&123); | |
| 506 | //~^ ERROR: method takes 3 generic arguments but 2 generic arguments were supplied [E0107] | |
| 507 | <u32 as Trait3>::bar1::<String, true>(&123); | |
| 508 | //~^ ERROR: method takes 3 generic arguments but 2 generic arguments were supplied [E0107] | |
| 509 | <u32 as Trait4<'a, 'a, 'static>>::bar1::<String, true>(&123); | |
| 510 | //~^ ERROR: method takes 3 generic arguments but 2 generic arguments were supplied [E0107] | |
| 511 | <u32 as Trait5<i32, u64, String>>::bar1::<String, true>(&123); | |
| 512 | //~^ ERROR: method takes 3 generic arguments but 2 generic arguments were supplied [E0107] | |
| 513 | ||
| 514 | <u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>::bar2(&123); | |
| 515 | <u32 as Trait3>::bar2(&123); | |
| 516 | <u32 as Trait4<'a, 'a, 'static>>::bar2(&123); | |
| 517 | <u32 as Trait5<i32, u64, String>>::bar2(&123); | |
| 518 | ||
| 519 | <u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>::bar3::<String, true>(&123); | |
| 520 | //~^ ERROR: method takes 3 generic arguments but 2 generic arguments were supplied [E0107] | |
| 521 | <u32 as Trait3>::bar3::<String, true>(&123); | |
| 522 | //~^ ERROR: method takes 3 generic arguments but 2 generic arguments were supplied [E0107] | |
| 523 | <u32 as Trait4<'a, 'a, 'static>>::bar3::<String, true>(&123); | |
| 524 | //~^ ERROR: method takes 3 generic arguments but 2 generic arguments were supplied [E0107] | |
| 525 | <u32 as Trait5<i32, u64, String>>::bar3::<String, true>(&123); | |
| 526 | //~^ ERROR: method takes 3 generic arguments but 2 generic arguments were supplied [E0107] | |
| 527 | ||
| 528 | <u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>::bar4(&123); | |
| 529 | <u32 as Trait3>::bar4(&123); | |
| 530 | <u32 as Trait4<'a, 'a, 'static>>::bar4(&123); | |
| 531 | <u32 as Trait5<i32, u64, String>>::bar4(&123); | |
| 532 | } | |
| 533 | } | |
| 534 | ||
| 535 | // Testing lifetimes + types in parent, | |
| 536 | // none in child, | |
| 537 | // in delegation parent with: | |
| 538 | // lifetimes + types OR none OR lifetimes OR types, | |
| 539 | // with(out) user-specified args, with different target expr | |
| 540 | mod test_6 { | |
| 541 | trait Trait<'b, 'c, 'a, T>: Sized { | |
| 542 | fn foo(&self) {} | |
| 543 | } | |
| 544 | ||
| 545 | impl<'b, 'c, 'a, T> Trait<'b, 'c, 'a, T> for u8 {} | |
| 546 | ||
| 547 | trait Trait2<'a, 'b, 'c, X, Y, Z> { | |
| 548 | fn get() -> &'static u8 { &0 } | |
| 549 | fn get_self(&self) -> &'static u8 { &0 } | |
| 550 | reuse Trait::<'static, 'static, 'static, i32>::foo as bar1 { Self::get() } | |
| 551 | reuse Trait::<'static, 'static, 'static, i32>::foo as bar3 { self.get_self() } | |
| 552 | } | |
| 553 | ||
| 554 | trait Trait3 { | |
| 555 | fn get() -> &'static u8 { &0 } | |
| 556 | fn get_self(&self) -> &'static u8 { &0 } | |
| 557 | reuse Trait::<'static, 'static, 'static, i32>::foo as bar1 { Self::get() } | |
| 558 | reuse Trait::<'static, 'static, 'static, i32>::foo as bar3 { self.get_self() } | |
| 559 | } | |
| 560 | ||
| 561 | trait Trait4<'a, 'b, 'c> { | |
| 562 | fn get() -> &'static u8 { &0 } | |
| 563 | fn get_self(&self) -> &'static u8 { &0 } | |
| 564 | reuse Trait::<'static, 'static, 'static, i32>::foo as bar1 { Self::get() } | |
| 565 | reuse Trait::<'static, 'static, 'static, i32>::foo as bar3 { self.get_self() } | |
| 566 | } | |
| 567 | ||
| 568 | trait Trait5<X, Y, Z> { | |
| 569 | fn get() -> &'static u8 { &0 } | |
| 570 | fn get_self(&self) -> &'static u8 { &0 } | |
| 571 | reuse Trait::<'static, 'static, 'static, i32>::foo as bar1 { Self::get() } | |
| 572 | reuse Trait::<'static, 'static, 'static, i32>::foo as bar3 { self.get_self() } | |
| 573 | } | |
| 574 | ||
| 575 | impl<'a, 'b, 'c, X, Y, Z> Trait2<'a, 'b, 'c, X, Y, Z> for u32 {} | |
| 576 | impl Trait3 for u32 {} | |
| 577 | impl<'a, 'b, 'c> Trait4<'a, 'b, 'c> for u32 {} | |
| 578 | impl<X, Y, Z> Trait5<X, Y, Z> for u32 {} | |
| 579 | ||
| 580 | pub fn check<'a: 'a>() { | |
| 581 | <u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>::bar1(&123); | |
| 582 | //~^ ERROR: type annotations needed [E0282] | |
| 583 | <u32 as Trait3>::bar1(&123); | |
| 584 | <u32 as Trait4<'a, 'a, 'static>>::bar1(&123); | |
| 585 | <u32 as Trait5<i32, u64, String>>::bar1(&123); | |
| 586 | ||
| 587 | <u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>::bar3(&123); | |
| 588 | <u32 as Trait3>::bar3(&123); | |
| 589 | <u32 as Trait4<'a, 'a, 'static>>::bar3(&123); | |
| 590 | <u32 as Trait5<i32, u64, String>>::bar3(&123); | |
| 591 | } | |
| 592 | } | |
| 593 | ||
| 594 | // Testing types in parent, | |
| 595 | // none in child, | |
| 596 | // in delegation parent with: | |
| 597 | // lifetimes + types OR none OR lifetimes OR types, | |
| 598 | // with user-specified args, with different target expr | |
| 599 | mod test_7 { | |
| 600 | trait Trait<T>: Sized { | |
| 601 | fn foo(&self) {} | |
| 602 | } | |
| 603 | ||
| 604 | impl<T> Trait<T> for u8 {} | |
| 605 | ||
| 606 | trait Trait2<'a, 'b, 'c, X, Y, Z> { | |
| 607 | fn get() -> &'static u8 { &0 } | |
| 608 | fn get_self(&self) -> &'static u8 { &0 } | |
| 609 | reuse Trait::<i32>::foo as bar1 { Self::get() } | |
| 610 | reuse Trait::<i32>::foo as bar3 { self.get_self() } | |
| 611 | } | |
| 612 | ||
| 613 | trait Trait3 { | |
| 614 | fn get() -> &'static u8 { &0 } | |
| 615 | fn get_self(&self) -> &'static u8 { &0 } | |
| 616 | reuse Trait::<i32>::foo as bar1 { Self::get() } | |
| 617 | reuse Trait::<i32>::foo as bar3 { self.get_self() } | |
| 618 | } | |
| 619 | ||
| 620 | trait Trait4<'a, 'b, 'c> { | |
| 621 | fn get() -> &'static u8 { &0 } | |
| 622 | fn get_self(&self) -> &'static u8 { &0 } | |
| 623 | reuse Trait::<i32>::foo as bar1 { Self::get() } | |
| 624 | reuse Trait::<i32>::foo as bar3 { self.get_self() } | |
| 625 | } | |
| 626 | ||
| 627 | trait Trait5<X, Y, Z> { | |
| 628 | fn get() -> &'static u8 { &0 } | |
| 629 | fn get_self(&self) -> &'static u8 { &0 } | |
| 630 | reuse Trait::<i32>::foo as bar1 { Self::get() } | |
| 631 | reuse Trait::<i32>::foo as bar3 { self.get_self() } | |
| 632 | } | |
| 633 | ||
| 634 | impl<'a, 'b, 'c, X, Y, Z> Trait2<'a, 'b, 'c, X, Y, Z> for u32 {} | |
| 635 | impl Trait3 for u32 {} | |
| 636 | impl<'a, 'b, 'c> Trait4<'a, 'b, 'c> for u32 {} | |
| 637 | impl<X, Y, Z> Trait5<X, Y, Z> for u32 {} | |
| 638 | ||
| 639 | pub fn check<'a: 'a>() { | |
| 640 | <u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>::bar1(&123); | |
| 641 | //~^ ERROR: type annotations needed [E0282] | |
| 642 | <u32 as Trait3>::bar1(&123); | |
| 643 | <u32 as Trait4<'a, 'a, 'static>>::bar1(&123); | |
| 644 | <u32 as Trait5<i32, u64, String>>::bar1(&123); | |
| 645 | ||
| 646 | <u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>::bar3(&123); | |
| 647 | <u32 as Trait3>::bar3(&123); | |
| 648 | <u32 as Trait4<'a, 'a, 'static>>::bar3(&123); | |
| 649 | <u32 as Trait5<i32, u64, String>>::bar3(&123); | |
| 650 | } | |
| 651 | } | |
| 652 | ||
| 653 | // Testing none in parent, | |
| 654 | // none in child, | |
| 655 | // in delegation parent with: | |
| 656 | // lifetimes + types OR none OR lifetimes OR types, | |
| 657 | // without user-specified args, with different target expr | |
| 658 | mod test_8 { | |
| 659 | trait Trait: Sized { | |
| 660 | fn foo(&self) {} | |
| 661 | } | |
| 662 | ||
| 663 | impl Trait for u8 {} | |
| 664 | ||
| 665 | trait Trait2<'a, 'b, 'c, X, Y, Z> { | |
| 666 | fn get() -> &'static u8 { &0 } | |
| 667 | fn get_self(&self) -> &'static u8 { &0 } | |
| 668 | reuse Trait::foo as bar1 { Self::get() } | |
| 669 | reuse Trait::foo as bar3 { self.get_self() } | |
| 670 | } | |
| 671 | ||
| 672 | trait Trait3 { | |
| 673 | fn get() -> &'static u8 { &0 } | |
| 674 | fn get_self(&self) -> &'static u8 { &0 } | |
| 675 | reuse Trait::foo as bar1 { Self::get() } | |
| 676 | reuse Trait::foo as bar3 { self.get_self() } | |
| 677 | } | |
| 678 | ||
| 679 | trait Trait4<'a, 'b, 'c> { | |
| 680 | fn get() -> &'static u8 { &0 } | |
| 681 | fn get_self(&self) -> &'static u8 { &0 } | |
| 682 | reuse Trait::foo as bar1 { Self::get() } | |
| 683 | reuse Trait::foo as bar3 { self.get_self() } | |
| 684 | } | |
| 685 | ||
| 686 | trait Trait5<X, Y, Z> { | |
| 687 | fn get() -> &'static u8 { &0 } | |
| 688 | fn get_self(&self) -> &'static u8 { &0 } | |
| 689 | reuse Trait::foo as bar1 { Self::get() } | |
| 690 | reuse Trait::foo as bar3 { self.get_self() } | |
| 691 | } | |
| 692 | ||
| 693 | impl<'a, 'b, 'c, X, Y, Z> Trait2<'a, 'b, 'c, X, Y, Z> for u32 {} | |
| 694 | impl Trait3 for u32 {} | |
| 695 | impl<'a, 'b, 'c> Trait4<'a, 'b, 'c> for u32 {} | |
| 696 | impl<X, Y, Z> Trait5<X, Y, Z> for u32 {} | |
| 697 | ||
| 698 | pub fn check<'a: 'a>() { | |
| 699 | <u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>::bar1(&123); | |
| 700 | <u32 as Trait3>::bar1(&123); | |
| 701 | <u32 as Trait4<'a, 'a, 'static>>::bar1(&123); | |
| 702 | <u32 as Trait5<i32, u64, String>>::bar1(&123); | |
| 703 | ||
| 704 | <u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>::bar3(&123); | |
| 705 | <u32 as Trait3>::bar3(&123); | |
| 706 | <u32 as Trait4<'a, 'a, 'static>>::bar3(&123); | |
| 707 | <u32 as Trait5<i32, u64, String>>::bar3(&123); | |
| 708 | } | |
| 709 | } | |
| 710 | ||
| 711 | // Testing types in parent, | |
| 712 | // lifetimes in child, | |
| 713 | // in delegation parent with: | |
| 714 | // lifetimes + types OR none OR lifetimes OR types, | |
| 715 | // with(out) user-specified args, with different target expr | |
| 716 | mod test_9 { | |
| 717 | trait Trait<T>: Sized { | |
| 718 | fn foo<'a: 'a, 'b: 'b>(&self) {} | |
| 719 | } | |
| 720 | ||
| 721 | impl<T> Trait<T> for u8 {} | |
| 722 | ||
| 723 | trait Trait2<'a, 'b, 'c, X, Y, Z> { | |
| 724 | fn get() -> &'static u8 { &0 } | |
| 725 | fn get_self(&self) -> &'static u8 { &0 } | |
| 726 | reuse Trait::<i32>::foo as bar1 { Self::get() } | |
| 727 | reuse Trait::<i32>::foo::<'static, 'static> as bar2 { Self::get() } | |
| 728 | reuse Trait::<i32>::foo as bar3 { self.get_self() } | |
| 729 | reuse Trait::<i32>::foo::<'static, 'static> as bar4 { self.get_self() } | |
| 730 | } | |
| 731 | ||
| 732 | trait Trait3 { | |
| 733 | fn get() -> &'static u8 { &0 } | |
| 734 | fn get_self(&self) -> &'static u8 { &0 } | |
| 735 | reuse Trait::<i32>::foo as bar1 { Self::get() } | |
| 736 | reuse Trait::<i32>::foo::<'static, 'static> as bar2 { Self::get() } | |
| 737 | reuse Trait::<i32>::foo as bar3 { self.get_self() } | |
| 738 | reuse Trait::<i32>::foo::<'static, 'static> as bar4 { self.get_self() } | |
| 739 | } | |
| 740 | ||
| 741 | trait Trait4<'a, 'b, 'c> { | |
| 742 | fn get() -> &'static u8 { &0 } | |
| 743 | fn get_self(&self) -> &'static u8 { &0 } | |
| 744 | reuse Trait::<i32>::foo as bar1 { Self::get() } | |
| 745 | reuse Trait::<i32>::foo::<'static, 'static> as bar2 { Self::get() } | |
| 746 | reuse Trait::<i32>::foo as bar3 { self.get_self() } | |
| 747 | reuse Trait::<i32>::foo::<'static, 'static> as bar4 { self.get_self() } | |
| 748 | } | |
| 749 | ||
| 750 | trait Trait5<X, Y, Z> { | |
| 751 | fn get() -> &'static u8 { &0 } | |
| 752 | fn get_self(&self) -> &'static u8 { &0 } | |
| 753 | reuse Trait::<i32>::foo as bar1 { Self::get() } | |
| 754 | reuse Trait::<i32>::foo::<'static, 'static> as bar2 { Self::get() } | |
| 755 | reuse Trait::<i32>::foo as bar3 { self.get_self() } | |
| 756 | reuse Trait::<i32>::foo::<'static, 'static> as bar4 { self.get_self() } | |
| 757 | } | |
| 758 | ||
| 759 | impl<'a, 'b, 'c, X, Y, Z> Trait2<'a, 'b, 'c, X, Y, Z> for u32 {} | |
| 760 | impl Trait3 for u32 {} | |
| 761 | impl<'a, 'b, 'c> Trait4<'a, 'b, 'c> for u32 {} | |
| 762 | impl<X, Y, Z> Trait5<X, Y, Z> for u32 {} | |
| 763 | ||
| 764 | pub fn check<'a: 'a>() { | |
| 765 | <u32 as Trait2<'static, 'static, 'static, i32, i32, i32>> | |
| 766 | //~^ ERROR: type annotations needed [E0282] | |
| 767 | ::bar1::<'static, 'static>(&123); | |
| 768 | <u32 as Trait3>::bar1::<'static, 'static>(&123); | |
| 769 | <u32 as Trait4<'a, 'a, 'static>>::bar1::<'a, 'a>(&123); | |
| 770 | <u32 as Trait5<i32, u64, String>>::bar1::<'a, 'a>(&123); | |
| 771 | ||
| 772 | <u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>::bar2(&123); | |
| 773 | <u32 as Trait3>::bar2(&123); | |
| 774 | <u32 as Trait4<'a, 'a, 'static>>::bar2(&123); | |
| 775 | <u32 as Trait5<i32, u64, String>>::bar2(&123); | |
| 776 | ||
| 777 | <u32 as Trait2<'static, 'static, 'static, i32, i32, i32>> | |
| 778 | ::bar3::<'static, 'static>(&123); | |
| 779 | <u32 as Trait3>::bar3::<'static, 'static>(&123); | |
| 780 | <u32 as Trait4<'a, 'a, 'static>>::bar3::<'static, 'static>(&123); | |
| 781 | <u32 as Trait5<i32, u64, String>>::bar3::<'static, 'static>(&123); | |
| 782 | ||
| 783 | <u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>::bar4(&123); | |
| 784 | <u32 as Trait3>::bar4(&123); | |
| 785 | <u32 as Trait4<'a, 'a, 'static>>::bar4(&123); | |
| 786 | <u32 as Trait5<i32, u64, String>>::bar4(&123); | |
| 787 | } | |
| 788 | } | |
| 789 | ||
| 790 | // Testing lifetimes in parent, | |
| 791 | // lifetimes in child, | |
| 792 | // in delegation parent with: | |
| 793 | // lifetimes + types OR none OR lifetimes OR types, | |
| 794 | // with(out) user-specified args, with different target expr | |
| 795 | mod test_10 { | |
| 796 | trait Trait<'x, 'y, 'z>: Sized { | |
| 797 | fn foo<'a: 'a, 'b: 'b>(&self) {} | |
| 798 | } | |
| 799 | ||
| 800 | impl<'x, 'y, 'z> Trait<'x, 'y, 'z> for u8 {} | |
| 801 | ||
| 802 | trait Trait2<'a, 'b, 'c, X, Y, Z> { | |
| 803 | fn get() -> &'static u8 { &0 } | |
| 804 | fn get_self(&self) -> &'static u8 { &0 } | |
| 805 | reuse Trait::<'a, 'b, 'static>::foo as bar1 { Self::get() } | |
| 806 | reuse Trait::<'a, 'b, 'static>::foo::<'static, 'static> as bar2 { Self::get() } | |
| 807 | reuse Trait::<'a, 'b, 'static>::foo as bar3 { self.get_self() } | |
| 808 | reuse Trait::<'a, 'b, 'static>::foo::<'static, 'static> as bar4 { self.get_self() } | |
| 809 | } | |
| 810 | ||
| 811 | trait Trait3 { | |
| 812 | fn get() -> &'static u8 { &0 } | |
| 813 | fn get_self(&self) -> &'static u8 { &0 } | |
| 814 | reuse Trait::<'static, 'static, 'static>::foo as bar1 { Self::get() } | |
| 815 | reuse Trait::<'static, 'static, 'static>::foo::<'static, 'static> as bar2 { | |
| 816 | Self::get() | |
| 817 | } | |
| 818 | reuse Trait::<'static, 'static, 'static>::foo as bar3 { self.get_self() } | |
| 819 | reuse Trait::<'static, 'static, 'static>::foo::<'static, 'static> as bar4 { | |
| 820 | self.get_self() | |
| 821 | } | |
| 822 | } | |
| 823 | ||
| 824 | trait Trait4<'a, 'b, 'c> { | |
| 825 | fn get() -> &'static u8 { &0 } | |
| 826 | fn get_self(&self) -> &'static u8 { &0 } | |
| 827 | reuse Trait::<'a, 'b, 'static>::foo as bar1 { Self::get() } | |
| 828 | reuse Trait::<'a, 'b, 'static>::foo::<'static, 'static> as bar2 { Self::get() } | |
| 829 | reuse Trait::<'a, 'b, 'static>::foo as bar3 { self.get_self() } | |
| 830 | reuse Trait::<'a, 'b, 'static>::foo::<'static, 'static> as bar4 { self.get_self() } | |
| 831 | } | |
| 832 | ||
| 833 | trait Trait5<X, Y, Z> { | |
| 834 | fn get() -> &'static u8 { &0 } | |
| 835 | fn get_self(&self) -> &'static u8 { &0 } | |
| 836 | reuse Trait::<'static, 'static, 'static>::foo as bar1 { Self::get() } | |
| 837 | reuse Trait::<'static, 'static, 'static>::foo::<'static, 'static> as bar2 { | |
| 838 | Self::get() | |
| 839 | } | |
| 840 | reuse Trait::<'static, 'static, 'static>::foo as bar3 { self.get_self() } | |
| 841 | reuse Trait::<'static, 'static, 'static>::foo::<'static, 'static> as bar4 { | |
| 842 | self.get_self() | |
| 843 | } | |
| 844 | } | |
| 845 | ||
| 846 | impl<'a, 'b, 'c, X, Y, Z> Trait2<'a, 'b, 'c, X, Y, Z> for u32 {} | |
| 847 | impl Trait3 for u32 {} | |
| 848 | impl<'a, 'b, 'c> Trait4<'a, 'b, 'c> for u32 {} | |
| 849 | impl<X, Y, Z> Trait5<X, Y, Z> for u32 {} | |
| 850 | ||
| 851 | pub fn check<'a: 'a>() { | |
| 852 | <u32 as Trait2<'static, 'static, 'static, i32, i32, i32>> | |
| 853 | ::bar1::<'static, 'static>(&123); | |
| 854 | //~^ ERROR: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present [E0794] | |
| 855 | <u32 as Trait3>::bar1::<'static, 'static>(&123); | |
| 856 | //~^ ERROR: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present [E0794] | |
| 857 | <u32 as Trait4<'a, 'a, 'static>>::bar1::<'a, 'a>(&123); | |
| 858 | //~^ ERROR: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present [E0794] | |
| 859 | <u32 as Trait5<i32, u64, String>>::bar1::<'a, 'a>(&123); | |
| 860 | //~^ ERROR: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present [E0794] | |
| 861 | ||
| 862 | <u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>::bar2(&123); | |
| 863 | <u32 as Trait3>::bar2(&123); | |
| 864 | <u32 as Trait4<'a, 'a, 'static>>::bar2(&123); | |
| 865 | <u32 as Trait5<i32, u64, String>>::bar2(&123); | |
| 866 | ||
| 867 | <u32 as Trait2<'static, 'static, 'static, i32, i32, i32>> | |
| 868 | ::bar3::<'static, 'static>(&123); | |
| 869 | //~^ ERROR: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present [E0794] | |
| 870 | <u32 as Trait3>::bar3::<'static, 'static>(&123); | |
| 871 | //~^ ERROR: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present [E0794] | |
| 872 | <u32 as Trait4<'a, 'a, 'static>>::bar3::<'static, 'static>(&123); | |
| 873 | //~^ ERROR: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present [E0794] | |
| 874 | <u32 as Trait5<i32, u64, String>>::bar3::<'static, 'static>(&123); | |
| 875 | //~^ ERROR: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present [E0794] | |
| 876 | ||
| 877 | <u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>::bar4(&123); | |
| 878 | <u32 as Trait3>::bar4(&123); | |
| 879 | <u32 as Trait4<'a, 'a, 'static>>::bar4(&123); | |
| 880 | <u32 as Trait5<i32, u64, String>>::bar4(&123); | |
| 881 | } | |
| 882 | } | |
| 883 | ||
| 884 | pub fn main() { | |
| 885 | test_1::check(); | |
| 886 | test_2::check(); | |
| 887 | test_3::check(); | |
| 888 | test_4::check(); | |
| 889 | test_5::check(); | |
| 890 | test_6::check(); | |
| 891 | test_7::check(); | |
| 892 | test_8::check(); | |
| 893 | test_9::check(); | |
| 894 | test_10::check(); | |
| 895 | } |
tests/ui/delegation/generics/mapping/trait-to-trait.stderr created+1544| ... | ... | @@ -0,0 +1,1544 @@ |
| 1 | error[E0284]: type annotations needed | |
| 2 | --> $DIR/trait-to-trait.rs:26:56 | |
| 3 | | | |
| 4 | LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar1 { Self::get() } | |
| 5 | | ^^^ cannot infer the value of the const parameter `M` declared on the method `foo` | |
| 6 | | | |
| 7 | note: required by a const generic parameter in `test_1::Trait::foo` | |
| 8 | --> $DIR/trait-to-trait.rs:18:27 | |
| 9 | | | |
| 10 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 11 | | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo` | |
| 12 | ||
| 13 | error[E0284]: type annotations needed | |
| 14 | --> $DIR/trait-to-trait.rs:32:56 | |
| 15 | | | |
| 16 | LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar3 { self.get_self() } | |
| 17 | | ^^^ cannot infer the value of the const parameter `M` declared on the method `foo` | |
| 18 | | | |
| 19 | note: required by a const generic parameter in `test_1::Trait::foo` | |
| 20 | --> $DIR/trait-to-trait.rs:18:27 | |
| 21 | | | |
| 22 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 23 | | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo` | |
| 24 | ||
| 25 | error[E0284]: type annotations needed | |
| 26 | --> $DIR/trait-to-trait.rs:49:56 | |
| 27 | | | |
| 28 | LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar1 { Self::get() } | |
| 29 | | ^^^ cannot infer the value of the const parameter `M` declared on the method `foo` | |
| 30 | | | |
| 31 | note: required by a const generic parameter in `test_1::Trait::foo` | |
| 32 | --> $DIR/trait-to-trait.rs:18:27 | |
| 33 | | | |
| 34 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 35 | | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo` | |
| 36 | ||
| 37 | error[E0284]: type annotations needed | |
| 38 | --> $DIR/trait-to-trait.rs:53:56 | |
| 39 | | | |
| 40 | LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar3 { self.get_self() } | |
| 41 | | ^^^ cannot infer the value of the const parameter `M` declared on the method `foo` | |
| 42 | | | |
| 43 | note: required by a const generic parameter in `test_1::Trait::foo` | |
| 44 | --> $DIR/trait-to-trait.rs:18:27 | |
| 45 | | | |
| 46 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 47 | | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo` | |
| 48 | ||
| 49 | error[E0284]: type annotations needed | |
| 50 | --> $DIR/trait-to-trait.rs:62:56 | |
| 51 | | | |
| 52 | LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar1 { Self::get() } | |
| 53 | | ^^^ cannot infer the value of the const parameter `M` declared on the method `foo` | |
| 54 | | | |
| 55 | note: required by a const generic parameter in `test_1::Trait::foo` | |
| 56 | --> $DIR/trait-to-trait.rs:18:27 | |
| 57 | | | |
| 58 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 59 | | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo` | |
| 60 | ||
| 61 | error[E0284]: type annotations needed | |
| 62 | --> $DIR/trait-to-trait.rs:66:56 | |
| 63 | | | |
| 64 | LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar3 { self.get_self() } | |
| 65 | | ^^^ cannot infer the value of the const parameter `M` declared on the method `foo` | |
| 66 | | | |
| 67 | note: required by a const generic parameter in `test_1::Trait::foo` | |
| 68 | --> $DIR/trait-to-trait.rs:18:27 | |
| 69 | | | |
| 70 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 71 | | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo` | |
| 72 | ||
| 73 | error[E0284]: type annotations needed | |
| 74 | --> $DIR/trait-to-trait.rs:75:56 | |
| 75 | | | |
| 76 | LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar1 { Self::get() } | |
| 77 | | ^^^ cannot infer the value of the const parameter `M` declared on the method `foo` | |
| 78 | | | |
| 79 | note: required by a const generic parameter in `test_1::Trait::foo` | |
| 80 | --> $DIR/trait-to-trait.rs:18:27 | |
| 81 | | | |
| 82 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 83 | | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo` | |
| 84 | ||
| 85 | error[E0284]: type annotations needed | |
| 86 | --> $DIR/trait-to-trait.rs:79:56 | |
| 87 | | | |
| 88 | LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar3 { self.get_self() } | |
| 89 | | ^^^ cannot infer the value of the const parameter `M` declared on the method `foo` | |
| 90 | | | |
| 91 | note: required by a const generic parameter in `test_1::Trait::foo` | |
| 92 | --> $DIR/trait-to-trait.rs:18:27 | |
| 93 | | | |
| 94 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 95 | | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo` | |
| 96 | ||
| 97 | error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present | |
| 98 | --> $DIR/trait-to-trait.rs:92:22 | |
| 99 | | | |
| 100 | LL | ::bar1::<'static, String, true>(&123); | |
| 101 | | ^^^^^^^ | |
| 102 | | | |
| 103 | note: the late bound lifetime parameter is introduced here | |
| 104 | --> $DIR/trait-to-trait.rs:18:42 | |
| 105 | | | |
| 106 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 107 | | ^ | |
| 108 | ||
| 109 | error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied | |
| 110 | --> $DIR/trait-to-trait.rs:92:15 | |
| 111 | | | |
| 112 | LL | ::bar1::<'static, String, true>(&123); | |
| 113 | | ^^^^ ------ ---- supplied 2 generic arguments | |
| 114 | | | | |
| 115 | | expected 3 generic arguments | |
| 116 | | | |
| 117 | note: method defined here, with 3 generic parameters: `T`, `U`, `M` | |
| 118 | --> $DIR/trait-to-trait.rs:26:63 | |
| 119 | | | |
| 120 | LL | trait Trait<'b, 'c, 'a, T>: Sized { | |
| 121 | | - | |
| 122 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 123 | | - ------------- | |
| 124 | ... | |
| 125 | LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar1 { Self::get() } | |
| 126 | | ^^^^ | |
| 127 | help: add missing generic argument | |
| 128 | | | |
| 129 | LL | ::bar1::<'static, String, true, M>(&123); | |
| 130 | | +++ | |
| 131 | ||
| 132 | error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present | |
| 133 | --> $DIR/trait-to-trait.rs:95:33 | |
| 134 | | | |
| 135 | LL | <u32 as Trait3>::bar1::<'static, String, true>(&123); | |
| 136 | | ^^^^^^^ | |
| 137 | | | |
| 138 | note: the late bound lifetime parameter is introduced here | |
| 139 | --> $DIR/trait-to-trait.rs:18:42 | |
| 140 | | | |
| 141 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 142 | | ^ | |
| 143 | ||
| 144 | error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied | |
| 145 | --> $DIR/trait-to-trait.rs:95:26 | |
| 146 | | | |
| 147 | LL | <u32 as Trait3>::bar1::<'static, String, true>(&123); | |
| 148 | | ^^^^ ------ ---- supplied 2 generic arguments | |
| 149 | | | | |
| 150 | | expected 3 generic arguments | |
| 151 | | | |
| 152 | note: method defined here, with 3 generic parameters: `T`, `U`, `M` | |
| 153 | --> $DIR/trait-to-trait.rs:49:63 | |
| 154 | | | |
| 155 | LL | trait Trait<'b, 'c, 'a, T>: Sized { | |
| 156 | | - | |
| 157 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 158 | | - ------------- | |
| 159 | ... | |
| 160 | LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar1 { Self::get() } | |
| 161 | | ^^^^ | |
| 162 | help: add missing generic argument | |
| 163 | | | |
| 164 | LL | <u32 as Trait3>::bar1::<'static, String, true, M>(&123); | |
| 165 | | +++ | |
| 166 | ||
| 167 | error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present | |
| 168 | --> $DIR/trait-to-trait.rs:98:50 | |
| 169 | | | |
| 170 | LL | <u32 as Trait4<'a, 'a, 'static>>::bar1::<'static, String, true>(&123); | |
| 171 | | ^^^^^^^ | |
| 172 | | | |
| 173 | note: the late bound lifetime parameter is introduced here | |
| 174 | --> $DIR/trait-to-trait.rs:18:42 | |
| 175 | | | |
| 176 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 177 | | ^ | |
| 178 | ||
| 179 | error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied | |
| 180 | --> $DIR/trait-to-trait.rs:98:43 | |
| 181 | | | |
| 182 | LL | <u32 as Trait4<'a, 'a, 'static>>::bar1::<'static, String, true>(&123); | |
| 183 | | ^^^^ ------ ---- supplied 2 generic arguments | |
| 184 | | | | |
| 185 | | expected 3 generic arguments | |
| 186 | | | |
| 187 | note: method defined here, with 3 generic parameters: `T`, `U`, `M` | |
| 188 | --> $DIR/trait-to-trait.rs:62:63 | |
| 189 | | | |
| 190 | LL | trait Trait<'b, 'c, 'a, T>: Sized { | |
| 191 | | - | |
| 192 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 193 | | - ------------- | |
| 194 | ... | |
| 195 | LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar1 { Self::get() } | |
| 196 | | ^^^^ | |
| 197 | help: add missing generic argument | |
| 198 | | | |
| 199 | LL | <u32 as Trait4<'a, 'a, 'static>>::bar1::<'static, String, true, M>(&123); | |
| 200 | | +++ | |
| 201 | ||
| 202 | error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present | |
| 203 | --> $DIR/trait-to-trait.rs:101:51 | |
| 204 | | | |
| 205 | LL | <u32 as Trait5<i32, u64, String>>::bar1::<'static, String, true>(&123); | |
| 206 | | ^^^^^^^ | |
| 207 | | | |
| 208 | note: the late bound lifetime parameter is introduced here | |
| 209 | --> $DIR/trait-to-trait.rs:18:42 | |
| 210 | | | |
| 211 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 212 | | ^ | |
| 213 | ||
| 214 | error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied | |
| 215 | --> $DIR/trait-to-trait.rs:101:44 | |
| 216 | | | |
| 217 | LL | <u32 as Trait5<i32, u64, String>>::bar1::<'static, String, true>(&123); | |
| 218 | | ^^^^ ------ ---- supplied 2 generic arguments | |
| 219 | | | | |
| 220 | | expected 3 generic arguments | |
| 221 | | | |
| 222 | note: method defined here, with 3 generic parameters: `T`, `U`, `M` | |
| 223 | --> $DIR/trait-to-trait.rs:75:63 | |
| 224 | | | |
| 225 | LL | trait Trait<'b, 'c, 'a, T>: Sized { | |
| 226 | | - | |
| 227 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 228 | | - ------------- | |
| 229 | ... | |
| 230 | LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar1 { Self::get() } | |
| 231 | | ^^^^ | |
| 232 | help: add missing generic argument | |
| 233 | | | |
| 234 | LL | <u32 as Trait5<i32, u64, String>>::bar1::<'static, String, true, M>(&123); | |
| 235 | | +++ | |
| 236 | ||
| 237 | error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present | |
| 238 | --> $DIR/trait-to-trait.rs:111:22 | |
| 239 | | | |
| 240 | LL | ::bar3::<'static, String, true>(&123); | |
| 241 | | ^^^^^^^ | |
| 242 | | | |
| 243 | note: the late bound lifetime parameter is introduced here | |
| 244 | --> $DIR/trait-to-trait.rs:18:42 | |
| 245 | | | |
| 246 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 247 | | ^ | |
| 248 | ||
| 249 | error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied | |
| 250 | --> $DIR/trait-to-trait.rs:111:15 | |
| 251 | | | |
| 252 | LL | ::bar3::<'static, String, true>(&123); | |
| 253 | | ^^^^ ------ ---- supplied 2 generic arguments | |
| 254 | | | | |
| 255 | | expected 3 generic arguments | |
| 256 | | | |
| 257 | note: method defined here, with 3 generic parameters: `T`, `U`, `M` | |
| 258 | --> $DIR/trait-to-trait.rs:32:63 | |
| 259 | | | |
| 260 | LL | trait Trait<'b, 'c, 'a, T>: Sized { | |
| 261 | | - | |
| 262 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 263 | | - ------------- | |
| 264 | ... | |
| 265 | LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar3 { self.get_self() } | |
| 266 | | ^^^^ | |
| 267 | help: add missing generic argument | |
| 268 | | | |
| 269 | LL | ::bar3::<'static, String, true, M>(&123); | |
| 270 | | +++ | |
| 271 | ||
| 272 | error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present | |
| 273 | --> $DIR/trait-to-trait.rs:114:33 | |
| 274 | | | |
| 275 | LL | <u32 as Trait3>::bar3::<'static, String, true>(&123); | |
| 276 | | ^^^^^^^ | |
| 277 | | | |
| 278 | note: the late bound lifetime parameter is introduced here | |
| 279 | --> $DIR/trait-to-trait.rs:18:42 | |
| 280 | | | |
| 281 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 282 | | ^ | |
| 283 | ||
| 284 | error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied | |
| 285 | --> $DIR/trait-to-trait.rs:114:26 | |
| 286 | | | |
| 287 | LL | <u32 as Trait3>::bar3::<'static, String, true>(&123); | |
| 288 | | ^^^^ ------ ---- supplied 2 generic arguments | |
| 289 | | | | |
| 290 | | expected 3 generic arguments | |
| 291 | | | |
| 292 | note: method defined here, with 3 generic parameters: `T`, `U`, `M` | |
| 293 | --> $DIR/trait-to-trait.rs:53:63 | |
| 294 | | | |
| 295 | LL | trait Trait<'b, 'c, 'a, T>: Sized { | |
| 296 | | - | |
| 297 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 298 | | - ------------- | |
| 299 | ... | |
| 300 | LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar3 { self.get_self() } | |
| 301 | | ^^^^ | |
| 302 | help: add missing generic argument | |
| 303 | | | |
| 304 | LL | <u32 as Trait3>::bar3::<'static, String, true, M>(&123); | |
| 305 | | +++ | |
| 306 | ||
| 307 | error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present | |
| 308 | --> $DIR/trait-to-trait.rs:117:50 | |
| 309 | | | |
| 310 | LL | <u32 as Trait4<'a, 'a, 'static>>::bar3::<'static, String, true>(&123); | |
| 311 | | ^^^^^^^ | |
| 312 | | | |
| 313 | note: the late bound lifetime parameter is introduced here | |
| 314 | --> $DIR/trait-to-trait.rs:18:42 | |
| 315 | | | |
| 316 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 317 | | ^ | |
| 318 | ||
| 319 | error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied | |
| 320 | --> $DIR/trait-to-trait.rs:117:43 | |
| 321 | | | |
| 322 | LL | <u32 as Trait4<'a, 'a, 'static>>::bar3::<'static, String, true>(&123); | |
| 323 | | ^^^^ ------ ---- supplied 2 generic arguments | |
| 324 | | | | |
| 325 | | expected 3 generic arguments | |
| 326 | | | |
| 327 | note: method defined here, with 3 generic parameters: `T`, `U`, `M` | |
| 328 | --> $DIR/trait-to-trait.rs:66:63 | |
| 329 | | | |
| 330 | LL | trait Trait<'b, 'c, 'a, T>: Sized { | |
| 331 | | - | |
| 332 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 333 | | - ------------- | |
| 334 | ... | |
| 335 | LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar3 { self.get_self() } | |
| 336 | | ^^^^ | |
| 337 | help: add missing generic argument | |
| 338 | | | |
| 339 | LL | <u32 as Trait4<'a, 'a, 'static>>::bar3::<'static, String, true, M>(&123); | |
| 340 | | +++ | |
| 341 | ||
| 342 | error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present | |
| 343 | --> $DIR/trait-to-trait.rs:120:51 | |
| 344 | | | |
| 345 | LL | <u32 as Trait5<i32, u64, String>>::bar3::<'static, String, true>(&123); | |
| 346 | | ^^^^^^^ | |
| 347 | | | |
| 348 | note: the late bound lifetime parameter is introduced here | |
| 349 | --> $DIR/trait-to-trait.rs:18:42 | |
| 350 | | | |
| 351 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 352 | | ^ | |
| 353 | ||
| 354 | error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied | |
| 355 | --> $DIR/trait-to-trait.rs:120:44 | |
| 356 | | | |
| 357 | LL | <u32 as Trait5<i32, u64, String>>::bar3::<'static, String, true>(&123); | |
| 358 | | ^^^^ ------ ---- supplied 2 generic arguments | |
| 359 | | | | |
| 360 | | expected 3 generic arguments | |
| 361 | | | |
| 362 | note: method defined here, with 3 generic parameters: `T`, `U`, `M` | |
| 363 | --> $DIR/trait-to-trait.rs:79:63 | |
| 364 | | | |
| 365 | LL | trait Trait<'b, 'c, 'a, T>: Sized { | |
| 366 | | - | |
| 367 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 368 | | - ------------- | |
| 369 | ... | |
| 370 | LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar3 { self.get_self() } | |
| 371 | | ^^^^ | |
| 372 | help: add missing generic argument | |
| 373 | | | |
| 374 | LL | <u32 as Trait5<i32, u64, String>>::bar3::<'static, String, true, M>(&123); | |
| 375 | | +++ | |
| 376 | ||
| 377 | error[E0284]: type annotations needed | |
| 378 | --> $DIR/trait-to-trait.rs:146:29 | |
| 379 | | | |
| 380 | LL | reuse Trait::<i32>::foo as bar1 { Self::get() } | |
| 381 | | ^^^ cannot infer the value of the const parameter `M` declared on the method `foo` | |
| 382 | | | |
| 383 | note: required by a const generic parameter in `test_2::Trait::foo` | |
| 384 | --> $DIR/trait-to-trait.rs:138:27 | |
| 385 | | | |
| 386 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 387 | | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo` | |
| 388 | ||
| 389 | error[E0284]: type annotations needed | |
| 390 | --> $DIR/trait-to-trait.rs:149:29 | |
| 391 | | | |
| 392 | LL | reuse Trait::<i32>::foo as bar3 { self.get_self() } | |
| 393 | | ^^^ cannot infer the value of the const parameter `M` declared on the method `foo` | |
| 394 | | | |
| 395 | note: required by a const generic parameter in `test_2::Trait::foo` | |
| 396 | --> $DIR/trait-to-trait.rs:138:27 | |
| 397 | | | |
| 398 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 399 | | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo` | |
| 400 | ||
| 401 | error[E0284]: type annotations needed | |
| 402 | --> $DIR/trait-to-trait.rs:157:29 | |
| 403 | | | |
| 404 | LL | reuse Trait::<i32>::foo as bar1 { Self::get() } | |
| 405 | | ^^^ cannot infer the value of the const parameter `M` declared on the method `foo` | |
| 406 | | | |
| 407 | note: required by a const generic parameter in `test_2::Trait::foo` | |
| 408 | --> $DIR/trait-to-trait.rs:138:27 | |
| 409 | | | |
| 410 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 411 | | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo` | |
| 412 | ||
| 413 | error[E0284]: type annotations needed | |
| 414 | --> $DIR/trait-to-trait.rs:160:29 | |
| 415 | | | |
| 416 | LL | reuse Trait::<i32>::foo as bar3 { self.get_self() } | |
| 417 | | ^^^ cannot infer the value of the const parameter `M` declared on the method `foo` | |
| 418 | | | |
| 419 | note: required by a const generic parameter in `test_2::Trait::foo` | |
| 420 | --> $DIR/trait-to-trait.rs:138:27 | |
| 421 | | | |
| 422 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 423 | | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo` | |
| 424 | ||
| 425 | error[E0284]: type annotations needed | |
| 426 | --> $DIR/trait-to-trait.rs:168:29 | |
| 427 | | | |
| 428 | LL | reuse Trait::<i32>::foo as bar1 { Self::get() } | |
| 429 | | ^^^ cannot infer the value of the const parameter `M` declared on the method `foo` | |
| 430 | | | |
| 431 | note: required by a const generic parameter in `test_2::Trait::foo` | |
| 432 | --> $DIR/trait-to-trait.rs:138:27 | |
| 433 | | | |
| 434 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 435 | | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo` | |
| 436 | ||
| 437 | error[E0284]: type annotations needed | |
| 438 | --> $DIR/trait-to-trait.rs:171:29 | |
| 439 | | | |
| 440 | LL | reuse Trait::<i32>::foo as bar3 { self.get_self() } | |
| 441 | | ^^^ cannot infer the value of the const parameter `M` declared on the method `foo` | |
| 442 | | | |
| 443 | note: required by a const generic parameter in `test_2::Trait::foo` | |
| 444 | --> $DIR/trait-to-trait.rs:138:27 | |
| 445 | | | |
| 446 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 447 | | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo` | |
| 448 | ||
| 449 | error[E0284]: type annotations needed | |
| 450 | --> $DIR/trait-to-trait.rs:179:29 | |
| 451 | | | |
| 452 | LL | reuse Trait::<i32>::foo as bar1 { Self::get() } | |
| 453 | | ^^^ cannot infer the value of the const parameter `M` declared on the method `foo` | |
| 454 | | | |
| 455 | note: required by a const generic parameter in `test_2::Trait::foo` | |
| 456 | --> $DIR/trait-to-trait.rs:138:27 | |
| 457 | | | |
| 458 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 459 | | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo` | |
| 460 | ||
| 461 | error[E0284]: type annotations needed | |
| 462 | --> $DIR/trait-to-trait.rs:182:29 | |
| 463 | | | |
| 464 | LL | reuse Trait::<i32>::foo as bar3 { self.get_self() } | |
| 465 | | ^^^ cannot infer the value of the const parameter `M` declared on the method `foo` | |
| 466 | | | |
| 467 | note: required by a const generic parameter in `test_2::Trait::foo` | |
| 468 | --> $DIR/trait-to-trait.rs:138:27 | |
| 469 | | | |
| 470 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 471 | | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo` | |
| 472 | ||
| 473 | error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied | |
| 474 | --> $DIR/trait-to-trait.rs:194:15 | |
| 475 | | | |
| 476 | LL | ::bar1::<'static, String, true>(&123); | |
| 477 | | ^^^^ ------ ---- supplied 2 generic arguments | |
| 478 | | | | |
| 479 | | expected 3 generic arguments | |
| 480 | | | |
| 481 | note: method defined here, with 3 generic parameters: `T`, `U`, `M` | |
| 482 | --> $DIR/trait-to-trait.rs:146:36 | |
| 483 | | | |
| 484 | LL | trait Trait<T>: Sized { | |
| 485 | | - | |
| 486 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 487 | | - ------------- | |
| 488 | ... | |
| 489 | LL | reuse Trait::<i32>::foo as bar1 { Self::get() } | |
| 490 | | ^^^^ | |
| 491 | help: add missing generic argument | |
| 492 | | | |
| 493 | LL | ::bar1::<'static, String, true, M>(&123); | |
| 494 | | +++ | |
| 495 | ||
| 496 | error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied | |
| 497 | --> $DIR/trait-to-trait.rs:196:26 | |
| 498 | | | |
| 499 | LL | <u32 as Trait3>::bar1::<'static, String, true>(&123); | |
| 500 | | ^^^^ ------ ---- supplied 2 generic arguments | |
| 501 | | | | |
| 502 | | expected 3 generic arguments | |
| 503 | | | |
| 504 | note: method defined here, with 3 generic parameters: `T`, `U`, `M` | |
| 505 | --> $DIR/trait-to-trait.rs:157:36 | |
| 506 | | | |
| 507 | LL | trait Trait<T>: Sized { | |
| 508 | | - | |
| 509 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 510 | | - ------------- | |
| 511 | ... | |
| 512 | LL | reuse Trait::<i32>::foo as bar1 { Self::get() } | |
| 513 | | ^^^^ | |
| 514 | help: add missing generic argument | |
| 515 | | | |
| 516 | LL | <u32 as Trait3>::bar1::<'static, String, true, M>(&123); | |
| 517 | | +++ | |
| 518 | ||
| 519 | error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied | |
| 520 | --> $DIR/trait-to-trait.rs:198:43 | |
| 521 | | | |
| 522 | LL | <u32 as Trait4<'a, 'a, 'static>>::bar1::<'static, String, true>(&123); | |
| 523 | | ^^^^ ------ ---- supplied 2 generic arguments | |
| 524 | | | | |
| 525 | | expected 3 generic arguments | |
| 526 | | | |
| 527 | note: method defined here, with 3 generic parameters: `T`, `U`, `M` | |
| 528 | --> $DIR/trait-to-trait.rs:168:36 | |
| 529 | | | |
| 530 | LL | trait Trait<T>: Sized { | |
| 531 | | - | |
| 532 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 533 | | - ------------- | |
| 534 | ... | |
| 535 | LL | reuse Trait::<i32>::foo as bar1 { Self::get() } | |
| 536 | | ^^^^ | |
| 537 | help: add missing generic argument | |
| 538 | | | |
| 539 | LL | <u32 as Trait4<'a, 'a, 'static>>::bar1::<'static, String, true, M>(&123); | |
| 540 | | +++ | |
| 541 | ||
| 542 | error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied | |
| 543 | --> $DIR/trait-to-trait.rs:200:44 | |
| 544 | | | |
| 545 | LL | <u32 as Trait5<i32, u64, String>>::bar1::<'static, String, true>(&123); | |
| 546 | | ^^^^ ------ ---- supplied 2 generic arguments | |
| 547 | | | | |
| 548 | | expected 3 generic arguments | |
| 549 | | | |
| 550 | note: method defined here, with 3 generic parameters: `T`, `U`, `M` | |
| 551 | --> $DIR/trait-to-trait.rs:179:36 | |
| 552 | | | |
| 553 | LL | trait Trait<T>: Sized { | |
| 554 | | - | |
| 555 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 556 | | - ------------- | |
| 557 | ... | |
| 558 | LL | reuse Trait::<i32>::foo as bar1 { Self::get() } | |
| 559 | | ^^^^ | |
| 560 | help: add missing generic argument | |
| 561 | | | |
| 562 | LL | <u32 as Trait5<i32, u64, String>>::bar1::<'static, String, true, M>(&123); | |
| 563 | | +++ | |
| 564 | ||
| 565 | error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied | |
| 566 | --> $DIR/trait-to-trait.rs:209:15 | |
| 567 | | | |
| 568 | LL | ::bar3::<'static, String, true>(&123); | |
| 569 | | ^^^^ ------ ---- supplied 2 generic arguments | |
| 570 | | | | |
| 571 | | expected 3 generic arguments | |
| 572 | | | |
| 573 | note: method defined here, with 3 generic parameters: `T`, `U`, `M` | |
| 574 | --> $DIR/trait-to-trait.rs:149:36 | |
| 575 | | | |
| 576 | LL | trait Trait<T>: Sized { | |
| 577 | | - | |
| 578 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 579 | | - ------------- | |
| 580 | ... | |
| 581 | LL | reuse Trait::<i32>::foo as bar3 { self.get_self() } | |
| 582 | | ^^^^ | |
| 583 | help: add missing generic argument | |
| 584 | | | |
| 585 | LL | ::bar3::<'static, String, true, M>(&123); | |
| 586 | | +++ | |
| 587 | ||
| 588 | error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied | |
| 589 | --> $DIR/trait-to-trait.rs:211:26 | |
| 590 | | | |
| 591 | LL | <u32 as Trait3>::bar3::<'static, String, true>(&123); | |
| 592 | | ^^^^ ------ ---- supplied 2 generic arguments | |
| 593 | | | | |
| 594 | | expected 3 generic arguments | |
| 595 | | | |
| 596 | note: method defined here, with 3 generic parameters: `T`, `U`, `M` | |
| 597 | --> $DIR/trait-to-trait.rs:160:36 | |
| 598 | | | |
| 599 | LL | trait Trait<T>: Sized { | |
| 600 | | - | |
| 601 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 602 | | - ------------- | |
| 603 | ... | |
| 604 | LL | reuse Trait::<i32>::foo as bar3 { self.get_self() } | |
| 605 | | ^^^^ | |
| 606 | help: add missing generic argument | |
| 607 | | | |
| 608 | LL | <u32 as Trait3>::bar3::<'static, String, true, M>(&123); | |
| 609 | | +++ | |
| 610 | ||
| 611 | error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied | |
| 612 | --> $DIR/trait-to-trait.rs:213:43 | |
| 613 | | | |
| 614 | LL | <u32 as Trait4<'a, 'a, 'static>>::bar3::<'static, String, true>(&123); | |
| 615 | | ^^^^ ------ ---- supplied 2 generic arguments | |
| 616 | | | | |
| 617 | | expected 3 generic arguments | |
| 618 | | | |
| 619 | note: method defined here, with 3 generic parameters: `T`, `U`, `M` | |
| 620 | --> $DIR/trait-to-trait.rs:171:36 | |
| 621 | | | |
| 622 | LL | trait Trait<T>: Sized { | |
| 623 | | - | |
| 624 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 625 | | - ------------- | |
| 626 | ... | |
| 627 | LL | reuse Trait::<i32>::foo as bar3 { self.get_self() } | |
| 628 | | ^^^^ | |
| 629 | help: add missing generic argument | |
| 630 | | | |
| 631 | LL | <u32 as Trait4<'a, 'a, 'static>>::bar3::<'static, String, true, M>(&123); | |
| 632 | | +++ | |
| 633 | ||
| 634 | error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied | |
| 635 | --> $DIR/trait-to-trait.rs:215:44 | |
| 636 | | | |
| 637 | LL | <u32 as Trait5<i32, u64, String>>::bar3::<'static, String, true>(&123); | |
| 638 | | ^^^^ ------ ---- supplied 2 generic arguments | |
| 639 | | | | |
| 640 | | expected 3 generic arguments | |
| 641 | | | |
| 642 | note: method defined here, with 3 generic parameters: `T`, `U`, `M` | |
| 643 | --> $DIR/trait-to-trait.rs:182:36 | |
| 644 | | | |
| 645 | LL | trait Trait<T>: Sized { | |
| 646 | | - | |
| 647 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 648 | | - ------------- | |
| 649 | ... | |
| 650 | LL | reuse Trait::<i32>::foo as bar3 { self.get_self() } | |
| 651 | | ^^^^ | |
| 652 | help: add missing generic argument | |
| 653 | | | |
| 654 | LL | <u32 as Trait5<i32, u64, String>>::bar3::<'static, String, true, M>(&123); | |
| 655 | | +++ | |
| 656 | ||
| 657 | error[E0284]: type annotations needed | |
| 658 | --> $DIR/trait-to-trait.rs:240:51 | |
| 659 | | | |
| 660 | LL | reuse Trait::<'static, 'static, 'static>::foo as bar1 { Self::get() } | |
| 661 | | ^^^ cannot infer the value of the const parameter `M` declared on the method `foo` | |
| 662 | | | |
| 663 | note: required by a const generic parameter in `test_3::Trait::foo` | |
| 664 | --> $DIR/trait-to-trait.rs:232:27 | |
| 665 | | | |
| 666 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 667 | | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo` | |
| 668 | help: consider specifying the generic arguments | |
| 669 | | | |
| 670 | LL | reuse Trait::<'static, 'static, 'static>::foo::<U, M> as bar1 { Self::get() } | |
| 671 | | ++++++++ | |
| 672 | ||
| 673 | error[E0284]: type annotations needed | |
| 674 | --> $DIR/trait-to-trait.rs:245:51 | |
| 675 | | | |
| 676 | LL | reuse Trait::<'static, 'static, 'static>::foo as bar3 { self.get_self() } | |
| 677 | | ^^^ cannot infer the value of the const parameter `M` declared on the method `foo` | |
| 678 | | | |
| 679 | note: required by a const generic parameter in `test_3::Trait::foo` | |
| 680 | --> $DIR/trait-to-trait.rs:232:27 | |
| 681 | | | |
| 682 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 683 | | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo` | |
| 684 | help: consider specifying the generic arguments | |
| 685 | | | |
| 686 | LL | reuse Trait::<'static, 'static, 'static>::foo::<U, M> as bar3 { self.get_self() } | |
| 687 | | ++++++++ | |
| 688 | ||
| 689 | error[E0284]: type annotations needed | |
| 690 | --> $DIR/trait-to-trait.rs:255:51 | |
| 691 | | | |
| 692 | LL | reuse Trait::<'static, 'static, 'static>::foo as bar1 { Self::get() } | |
| 693 | | ^^^ cannot infer the value of the const parameter `M` declared on the method `foo` | |
| 694 | | | |
| 695 | note: required by a const generic parameter in `test_3::Trait::foo` | |
| 696 | --> $DIR/trait-to-trait.rs:232:27 | |
| 697 | | | |
| 698 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 699 | | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo` | |
| 700 | help: consider specifying the generic arguments | |
| 701 | | | |
| 702 | LL | reuse Trait::<'static, 'static, 'static>::foo::<U, M> as bar1 { Self::get() } | |
| 703 | | ++++++++ | |
| 704 | ||
| 705 | error[E0284]: type annotations needed | |
| 706 | --> $DIR/trait-to-trait.rs:260:51 | |
| 707 | | | |
| 708 | LL | reuse Trait::<'static, 'static, 'static>::foo as bar3 { self.get_self() } | |
| 709 | | ^^^ cannot infer the value of the const parameter `M` declared on the method `foo` | |
| 710 | | | |
| 711 | note: required by a const generic parameter in `test_3::Trait::foo` | |
| 712 | --> $DIR/trait-to-trait.rs:232:27 | |
| 713 | | | |
| 714 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 715 | | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo` | |
| 716 | help: consider specifying the generic arguments | |
| 717 | | | |
| 718 | LL | reuse Trait::<'static, 'static, 'static>::foo::<U, M> as bar3 { self.get_self() } | |
| 719 | | ++++++++ | |
| 720 | ||
| 721 | error[E0284]: type annotations needed | |
| 722 | --> $DIR/trait-to-trait.rs:270:51 | |
| 723 | | | |
| 724 | LL | reuse Trait::<'static, 'static, 'static>::foo as bar1 { Self::get() } | |
| 725 | | ^^^ cannot infer the value of the const parameter `M` declared on the method `foo` | |
| 726 | | | |
| 727 | note: required by a const generic parameter in `test_3::Trait::foo` | |
| 728 | --> $DIR/trait-to-trait.rs:232:27 | |
| 729 | | | |
| 730 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 731 | | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo` | |
| 732 | help: consider specifying the generic arguments | |
| 733 | | | |
| 734 | LL | reuse Trait::<'static, 'static, 'static>::foo::<U, M> as bar1 { Self::get() } | |
| 735 | | ++++++++ | |
| 736 | ||
| 737 | error[E0284]: type annotations needed | |
| 738 | --> $DIR/trait-to-trait.rs:275:51 | |
| 739 | | | |
| 740 | LL | reuse Trait::<'static, 'static, 'static>::foo as bar3 { self.get_self() } | |
| 741 | | ^^^ cannot infer the value of the const parameter `M` declared on the method `foo` | |
| 742 | | | |
| 743 | note: required by a const generic parameter in `test_3::Trait::foo` | |
| 744 | --> $DIR/trait-to-trait.rs:232:27 | |
| 745 | | | |
| 746 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 747 | | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo` | |
| 748 | help: consider specifying the generic arguments | |
| 749 | | | |
| 750 | LL | reuse Trait::<'static, 'static, 'static>::foo::<U, M> as bar3 { self.get_self() } | |
| 751 | | ++++++++ | |
| 752 | ||
| 753 | error[E0284]: type annotations needed | |
| 754 | --> $DIR/trait-to-trait.rs:285:51 | |
| 755 | | | |
| 756 | LL | reuse Trait::<'static, 'static, 'static>::foo as bar1 { Self::get() } | |
| 757 | | ^^^ cannot infer the value of the const parameter `M` declared on the method `foo` | |
| 758 | | | |
| 759 | note: required by a const generic parameter in `test_3::Trait::foo` | |
| 760 | --> $DIR/trait-to-trait.rs:232:27 | |
| 761 | | | |
| 762 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 763 | | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo` | |
| 764 | help: consider specifying the generic arguments | |
| 765 | | | |
| 766 | LL | reuse Trait::<'static, 'static, 'static>::foo::<U, M> as bar1 { Self::get() } | |
| 767 | | ++++++++ | |
| 768 | ||
| 769 | error[E0284]: type annotations needed | |
| 770 | --> $DIR/trait-to-trait.rs:289:51 | |
| 771 | | | |
| 772 | LL | reuse Trait::<'static, 'static, 'static>::foo as bar3 { self.get_self() } | |
| 773 | | ^^^ cannot infer the value of the const parameter `M` declared on the method `foo` | |
| 774 | | | |
| 775 | note: required by a const generic parameter in `test_3::Trait::foo` | |
| 776 | --> $DIR/trait-to-trait.rs:232:27 | |
| 777 | | | |
| 778 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 779 | | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo` | |
| 780 | help: consider specifying the generic arguments | |
| 781 | | | |
| 782 | LL | reuse Trait::<'static, 'static, 'static>::foo::<U, M> as bar3 { self.get_self() } | |
| 783 | | ++++++++ | |
| 784 | ||
| 785 | error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present | |
| 786 | --> $DIR/trait-to-trait.rs:302:22 | |
| 787 | | | |
| 788 | LL | ::bar1::<'static, String, true>(&123); | |
| 789 | | ^^^^^^^ | |
| 790 | | | |
| 791 | note: the late bound lifetime parameter is introduced here | |
| 792 | --> $DIR/trait-to-trait.rs:232:42 | |
| 793 | | | |
| 794 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 795 | | ^ | |
| 796 | ||
| 797 | error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present | |
| 798 | --> $DIR/trait-to-trait.rs:304:33 | |
| 799 | | | |
| 800 | LL | <u32 as Trait3>::bar1::<'static, String, true>(&123); | |
| 801 | | ^^^^^^^ | |
| 802 | | | |
| 803 | note: the late bound lifetime parameter is introduced here | |
| 804 | --> $DIR/trait-to-trait.rs:232:42 | |
| 805 | | | |
| 806 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 807 | | ^ | |
| 808 | ||
| 809 | error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present | |
| 810 | --> $DIR/trait-to-trait.rs:306:50 | |
| 811 | | | |
| 812 | LL | <u32 as Trait4<'a, 'a, 'static>>::bar1::<'static, String, true>(&123); | |
| 813 | | ^^^^^^^ | |
| 814 | | | |
| 815 | note: the late bound lifetime parameter is introduced here | |
| 816 | --> $DIR/trait-to-trait.rs:232:42 | |
| 817 | | | |
| 818 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 819 | | ^ | |
| 820 | ||
| 821 | error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present | |
| 822 | --> $DIR/trait-to-trait.rs:308:51 | |
| 823 | | | |
| 824 | LL | <u32 as Trait5<i32, u64, String>>::bar1::<'static, String, true>(&123); | |
| 825 | | ^^^^^^^ | |
| 826 | | | |
| 827 | note: the late bound lifetime parameter is introduced here | |
| 828 | --> $DIR/trait-to-trait.rs:232:42 | |
| 829 | | | |
| 830 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 831 | | ^ | |
| 832 | ||
| 833 | error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present | |
| 834 | --> $DIR/trait-to-trait.rs:317:22 | |
| 835 | | | |
| 836 | LL | ::bar3::<'static, String, true>(&123); | |
| 837 | | ^^^^^^^ | |
| 838 | | | |
| 839 | note: the late bound lifetime parameter is introduced here | |
| 840 | --> $DIR/trait-to-trait.rs:232:42 | |
| 841 | | | |
| 842 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 843 | | ^ | |
| 844 | ||
| 845 | error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present | |
| 846 | --> $DIR/trait-to-trait.rs:319:33 | |
| 847 | | | |
| 848 | LL | <u32 as Trait3>::bar3::<'static, String, true>(&123); | |
| 849 | | ^^^^^^^ | |
| 850 | | | |
| 851 | note: the late bound lifetime parameter is introduced here | |
| 852 | --> $DIR/trait-to-trait.rs:232:42 | |
| 853 | | | |
| 854 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 855 | | ^ | |
| 856 | ||
| 857 | error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present | |
| 858 | --> $DIR/trait-to-trait.rs:321:50 | |
| 859 | | | |
| 860 | LL | <u32 as Trait4<'a, 'a, 'static>>::bar3::<'static, String, true>(&123); | |
| 861 | | ^^^^^^^ | |
| 862 | | | |
| 863 | note: the late bound lifetime parameter is introduced here | |
| 864 | --> $DIR/trait-to-trait.rs:232:42 | |
| 865 | | | |
| 866 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 867 | | ^ | |
| 868 | ||
| 869 | error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present | |
| 870 | --> $DIR/trait-to-trait.rs:323:51 | |
| 871 | | | |
| 872 | LL | <u32 as Trait5<i32, u64, String>>::bar3::<'static, String, true>(&123); | |
| 873 | | ^^^^^^^ | |
| 874 | | | |
| 875 | note: the late bound lifetime parameter is introduced here | |
| 876 | --> $DIR/trait-to-trait.rs:232:42 | |
| 877 | | | |
| 878 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 879 | | ^ | |
| 880 | ||
| 881 | error[E0284]: type annotations needed | |
| 882 | --> $DIR/trait-to-trait.rs:348:22 | |
| 883 | | | |
| 884 | LL | reuse Trait::foo as bar1 { Self::get() } | |
| 885 | | ^^^ cannot infer the value of the const parameter `M` declared on the method `foo` | |
| 886 | | | |
| 887 | note: required by a const generic parameter in `test_4::Trait::foo` | |
| 888 | --> $DIR/trait-to-trait.rs:340:27 | |
| 889 | | | |
| 890 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 891 | | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo` | |
| 892 | help: consider specifying the generic arguments | |
| 893 | | | |
| 894 | LL | reuse Trait::foo::<U, M> as bar1 { Self::get() } | |
| 895 | | ++++++++ | |
| 896 | ||
| 897 | error[E0284]: type annotations needed | |
| 898 | --> $DIR/trait-to-trait.rs:351:22 | |
| 899 | | | |
| 900 | LL | reuse Trait::foo as bar3 { self.get_self() } | |
| 901 | | ^^^ cannot infer the value of the const parameter `M` declared on the method `foo` | |
| 902 | | | |
| 903 | note: required by a const generic parameter in `test_4::Trait::foo` | |
| 904 | --> $DIR/trait-to-trait.rs:340:27 | |
| 905 | | | |
| 906 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 907 | | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo` | |
| 908 | help: consider specifying the generic arguments | |
| 909 | | | |
| 910 | LL | reuse Trait::foo::<U, M> as bar3 { self.get_self() } | |
| 911 | | ++++++++ | |
| 912 | ||
| 913 | error[E0284]: type annotations needed | |
| 914 | --> $DIR/trait-to-trait.rs:359:22 | |
| 915 | | | |
| 916 | LL | reuse Trait::foo as bar1 { Self::get() } | |
| 917 | | ^^^ cannot infer the value of the const parameter `M` declared on the method `foo` | |
| 918 | | | |
| 919 | note: required by a const generic parameter in `test_4::Trait::foo` | |
| 920 | --> $DIR/trait-to-trait.rs:340:27 | |
| 921 | | | |
| 922 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 923 | | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo` | |
| 924 | help: consider specifying the generic arguments | |
| 925 | | | |
| 926 | LL | reuse Trait::foo::<U, M> as bar1 { Self::get() } | |
| 927 | | ++++++++ | |
| 928 | ||
| 929 | error[E0284]: type annotations needed | |
| 930 | --> $DIR/trait-to-trait.rs:362:22 | |
| 931 | | | |
| 932 | LL | reuse Trait::foo as bar3 { self.get_self() } | |
| 933 | | ^^^ cannot infer the value of the const parameter `M` declared on the method `foo` | |
| 934 | | | |
| 935 | note: required by a const generic parameter in `test_4::Trait::foo` | |
| 936 | --> $DIR/trait-to-trait.rs:340:27 | |
| 937 | | | |
| 938 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 939 | | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo` | |
| 940 | help: consider specifying the generic arguments | |
| 941 | | | |
| 942 | LL | reuse Trait::foo::<U, M> as bar3 { self.get_self() } | |
| 943 | | ++++++++ | |
| 944 | ||
| 945 | error[E0284]: type annotations needed | |
| 946 | --> $DIR/trait-to-trait.rs:370:22 | |
| 947 | | | |
| 948 | LL | reuse Trait::foo as bar1 { Self::get() } | |
| 949 | | ^^^ cannot infer the value of the const parameter `M` declared on the method `foo` | |
| 950 | | | |
| 951 | note: required by a const generic parameter in `test_4::Trait::foo` | |
| 952 | --> $DIR/trait-to-trait.rs:340:27 | |
| 953 | | | |
| 954 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 955 | | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo` | |
| 956 | help: consider specifying the generic arguments | |
| 957 | | | |
| 958 | LL | reuse Trait::foo::<U, M> as bar1 { Self::get() } | |
| 959 | | ++++++++ | |
| 960 | ||
| 961 | error[E0284]: type annotations needed | |
| 962 | --> $DIR/trait-to-trait.rs:373:22 | |
| 963 | | | |
| 964 | LL | reuse Trait::foo as bar3 { self.get_self() } | |
| 965 | | ^^^ cannot infer the value of the const parameter `M` declared on the method `foo` | |
| 966 | | | |
| 967 | note: required by a const generic parameter in `test_4::Trait::foo` | |
| 968 | --> $DIR/trait-to-trait.rs:340:27 | |
| 969 | | | |
| 970 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 971 | | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo` | |
| 972 | help: consider specifying the generic arguments | |
| 973 | | | |
| 974 | LL | reuse Trait::foo::<U, M> as bar3 { self.get_self() } | |
| 975 | | ++++++++ | |
| 976 | ||
| 977 | error[E0284]: type annotations needed | |
| 978 | --> $DIR/trait-to-trait.rs:381:22 | |
| 979 | | | |
| 980 | LL | reuse Trait::foo as bar1 { Self::get() } | |
| 981 | | ^^^ cannot infer the value of the const parameter `M` declared on the method `foo` | |
| 982 | | | |
| 983 | note: required by a const generic parameter in `test_4::Trait::foo` | |
| 984 | --> $DIR/trait-to-trait.rs:340:27 | |
| 985 | | | |
| 986 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 987 | | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo` | |
| 988 | help: consider specifying the generic arguments | |
| 989 | | | |
| 990 | LL | reuse Trait::foo::<U, M> as bar1 { Self::get() } | |
| 991 | | ++++++++ | |
| 992 | ||
| 993 | error[E0284]: type annotations needed | |
| 994 | --> $DIR/trait-to-trait.rs:384:22 | |
| 995 | | | |
| 996 | LL | reuse Trait::foo as bar3 { self.get_self() } | |
| 997 | | ^^^ cannot infer the value of the const parameter `M` declared on the method `foo` | |
| 998 | | | |
| 999 | note: required by a const generic parameter in `test_4::Trait::foo` | |
| 1000 | --> $DIR/trait-to-trait.rs:340:27 | |
| 1001 | | | |
| 1002 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 1003 | | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo` | |
| 1004 | help: consider specifying the generic arguments | |
| 1005 | | | |
| 1006 | LL | reuse Trait::foo::<U, M> as bar3 { self.get_self() } | |
| 1007 | | ++++++++ | |
| 1008 | ||
| 1009 | error[E0284]: type annotations needed | |
| 1010 | --> $DIR/trait-to-trait.rs:401:9 | |
| 1011 | | | |
| 1012 | LL | <u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>::bar2(&123); | |
| 1013 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `M` declared on the method `bar2` | |
| 1014 | | | |
| 1015 | note: required by a const generic parameter in `test_4::Trait2::bar2` | |
| 1016 | --> $DIR/trait-to-trait.rs:340:27 | |
| 1017 | | | |
| 1018 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 1019 | | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait2::bar2` | |
| 1020 | ... | |
| 1021 | LL | reuse Trait::foo::<'static, String, false> as bar2 { Self::get() } | |
| 1022 | | ---- required by a bound in this associated function | |
| 1023 | ||
| 1024 | error[E0284]: type annotations needed | |
| 1025 | --> $DIR/trait-to-trait.rs:403:9 | |
| 1026 | | | |
| 1027 | LL | <u32 as Trait3>::bar2(&123); | |
| 1028 | | ^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `M` declared on the method `bar2` | |
| 1029 | | | |
| 1030 | note: required by a const generic parameter in `test_4::Trait3::bar2` | |
| 1031 | --> $DIR/trait-to-trait.rs:340:27 | |
| 1032 | | | |
| 1033 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 1034 | | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait3::bar2` | |
| 1035 | ... | |
| 1036 | LL | reuse Trait::foo::<'static, String, false> as bar2 { Self::get() } | |
| 1037 | | ---- required by a bound in this associated function | |
| 1038 | help: consider specifying the generic arguments | |
| 1039 | | | |
| 1040 | LL | <u32 as Trait3>::bar2::<U, M>(&123); | |
| 1041 | | ++++++++ | |
| 1042 | ||
| 1043 | error[E0284]: type annotations needed | |
| 1044 | --> $DIR/trait-to-trait.rs:405:9 | |
| 1045 | | | |
| 1046 | LL | <u32 as Trait4<'a, 'a, 'static>>::bar2(&123); | |
| 1047 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `M` declared on the method `bar2` | |
| 1048 | | | |
| 1049 | note: required by a const generic parameter in `test_4::Trait4::bar2` | |
| 1050 | --> $DIR/trait-to-trait.rs:340:27 | |
| 1051 | | | |
| 1052 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 1053 | | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait4::bar2` | |
| 1054 | ... | |
| 1055 | LL | reuse Trait::foo::<'static, String, false> as bar2 { Self::get() } | |
| 1056 | | ---- required by a bound in this associated function | |
| 1057 | help: consider specifying the generic arguments | |
| 1058 | | | |
| 1059 | LL | <u32 as Trait4<'a, 'a, 'static>>::bar2::<U, M>(&123); | |
| 1060 | | ++++++++ | |
| 1061 | ||
| 1062 | error[E0284]: type annotations needed | |
| 1063 | --> $DIR/trait-to-trait.rs:407:9 | |
| 1064 | | | |
| 1065 | LL | <u32 as Trait5<i32, u64, String>>::bar2(&123); | |
| 1066 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `M` declared on the method `bar2` | |
| 1067 | | | |
| 1068 | note: required by a const generic parameter in `test_4::Trait5::bar2` | |
| 1069 | --> $DIR/trait-to-trait.rs:340:27 | |
| 1070 | | | |
| 1071 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 1072 | | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait5::bar2` | |
| 1073 | ... | |
| 1074 | LL | reuse Trait::foo::<'static, String, false> as bar2 { Self::get() } | |
| 1075 | | ---- required by a bound in this associated function | |
| 1076 | ||
| 1077 | error[E0284]: type annotations needed | |
| 1078 | --> $DIR/trait-to-trait.rs:416:9 | |
| 1079 | | | |
| 1080 | LL | <u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>::bar4(&123); | |
| 1081 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `M` declared on the method `bar4` | |
| 1082 | | | |
| 1083 | note: required by a const generic parameter in `test_4::Trait2::bar4` | |
| 1084 | --> $DIR/trait-to-trait.rs:340:27 | |
| 1085 | | | |
| 1086 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 1087 | | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait2::bar4` | |
| 1088 | ... | |
| 1089 | LL | reuse Trait::foo::<'static, String, false> as bar4 { self.get_self() } | |
| 1090 | | ---- required by a bound in this associated function | |
| 1091 | ||
| 1092 | error[E0284]: type annotations needed | |
| 1093 | --> $DIR/trait-to-trait.rs:418:9 | |
| 1094 | | | |
| 1095 | LL | <u32 as Trait3>::bar4(&123); | |
| 1096 | | ^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `M` declared on the method `bar4` | |
| 1097 | | | |
| 1098 | note: required by a const generic parameter in `test_4::Trait3::bar4` | |
| 1099 | --> $DIR/trait-to-trait.rs:340:27 | |
| 1100 | | | |
| 1101 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 1102 | | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait3::bar4` | |
| 1103 | ... | |
| 1104 | LL | reuse Trait::foo::<'static, String, false> as bar4 { self.get_self() } | |
| 1105 | | ---- required by a bound in this associated function | |
| 1106 | help: consider specifying the generic arguments | |
| 1107 | | | |
| 1108 | LL | <u32 as Trait3>::bar4::<U, M>(&123); | |
| 1109 | | ++++++++ | |
| 1110 | ||
| 1111 | error[E0284]: type annotations needed | |
| 1112 | --> $DIR/trait-to-trait.rs:420:9 | |
| 1113 | | | |
| 1114 | LL | <u32 as Trait4<'a, 'a, 'static>>::bar4(&123); | |
| 1115 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `M` declared on the method `bar4` | |
| 1116 | | | |
| 1117 | note: required by a const generic parameter in `test_4::Trait4::bar4` | |
| 1118 | --> $DIR/trait-to-trait.rs:340:27 | |
| 1119 | | | |
| 1120 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 1121 | | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait4::bar4` | |
| 1122 | ... | |
| 1123 | LL | reuse Trait::foo::<'static, String, false> as bar4 { self.get_self() } | |
| 1124 | | ---- required by a bound in this associated function | |
| 1125 | help: consider specifying the generic arguments | |
| 1126 | | | |
| 1127 | LL | <u32 as Trait4<'a, 'a, 'static>>::bar4::<U, M>(&123); | |
| 1128 | | ++++++++ | |
| 1129 | ||
| 1130 | error[E0284]: type annotations needed | |
| 1131 | --> $DIR/trait-to-trait.rs:422:9 | |
| 1132 | | | |
| 1133 | LL | <u32 as Trait5<i32, u64, String>>::bar4(&123); | |
| 1134 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `M` declared on the method `bar4` | |
| 1135 | | | |
| 1136 | note: required by a const generic parameter in `test_4::Trait5::bar4` | |
| 1137 | --> $DIR/trait-to-trait.rs:340:27 | |
| 1138 | | | |
| 1139 | LL | fn foo<'d: 'd, U, const M: bool>(&self) {} | |
| 1140 | | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait5::bar4` | |
| 1141 | ... | |
| 1142 | LL | reuse Trait::foo::<'static, String, false> as bar4 { self.get_self() } | |
| 1143 | | ---- required by a bound in this associated function | |
| 1144 | ||
| 1145 | error[E0284]: type annotations needed | |
| 1146 | --> $DIR/trait-to-trait.rs:442:56 | |
| 1147 | | | |
| 1148 | LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar1 { Self::get() } | |
| 1149 | | ^^^ cannot infer the value of the const parameter `M` declared on the method `foo` | |
| 1150 | | | |
| 1151 | note: required by a const generic parameter in `test_5::Trait::foo` | |
| 1152 | --> $DIR/trait-to-trait.rs:434:19 | |
| 1153 | | | |
| 1154 | LL | fn foo<U, const M: bool>(&self) {} | |
| 1155 | | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo` | |
| 1156 | ||
| 1157 | error[E0284]: type annotations needed | |
| 1158 | --> $DIR/trait-to-trait.rs:447:56 | |
| 1159 | | | |
| 1160 | LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar3 { self.get_self() } | |
| 1161 | | ^^^ cannot infer the value of the const parameter `M` declared on the method `foo` | |
| 1162 | | | |
| 1163 | note: required by a const generic parameter in `test_5::Trait::foo` | |
| 1164 | --> $DIR/trait-to-trait.rs:434:19 | |
| 1165 | | | |
| 1166 | LL | fn foo<U, const M: bool>(&self) {} | |
| 1167 | | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo` | |
| 1168 | ||
| 1169 | error[E0284]: type annotations needed | |
| 1170 | --> $DIR/trait-to-trait.rs:457:56 | |
| 1171 | | | |
| 1172 | LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar1 { Self::get() } | |
| 1173 | | ^^^ cannot infer the value of the const parameter `M` declared on the method `foo` | |
| 1174 | | | |
| 1175 | note: required by a const generic parameter in `test_5::Trait::foo` | |
| 1176 | --> $DIR/trait-to-trait.rs:434:19 | |
| 1177 | | | |
| 1178 | LL | fn foo<U, const M: bool>(&self) {} | |
| 1179 | | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo` | |
| 1180 | ||
| 1181 | error[E0284]: type annotations needed | |
| 1182 | --> $DIR/trait-to-trait.rs:462:56 | |
| 1183 | | | |
| 1184 | LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar3 { self.get_self() } | |
| 1185 | | ^^^ cannot infer the value of the const parameter `M` declared on the method `foo` | |
| 1186 | | | |
| 1187 | note: required by a const generic parameter in `test_5::Trait::foo` | |
| 1188 | --> $DIR/trait-to-trait.rs:434:19 | |
| 1189 | | | |
| 1190 | LL | fn foo<U, const M: bool>(&self) {} | |
| 1191 | | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo` | |
| 1192 | ||
| 1193 | error[E0284]: type annotations needed | |
| 1194 | --> $DIR/trait-to-trait.rs:472:56 | |
| 1195 | | | |
| 1196 | LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar1 { Self::get() } | |
| 1197 | | ^^^ cannot infer the value of the const parameter `M` declared on the method `foo` | |
| 1198 | | | |
| 1199 | note: required by a const generic parameter in `test_5::Trait::foo` | |
| 1200 | --> $DIR/trait-to-trait.rs:434:19 | |
| 1201 | | | |
| 1202 | LL | fn foo<U, const M: bool>(&self) {} | |
| 1203 | | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo` | |
| 1204 | ||
| 1205 | error[E0284]: type annotations needed | |
| 1206 | --> $DIR/trait-to-trait.rs:477:56 | |
| 1207 | | | |
| 1208 | LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar3 { self.get_self() } | |
| 1209 | | ^^^ cannot infer the value of the const parameter `M` declared on the method `foo` | |
| 1210 | | | |
| 1211 | note: required by a const generic parameter in `test_5::Trait::foo` | |
| 1212 | --> $DIR/trait-to-trait.rs:434:19 | |
| 1213 | | | |
| 1214 | LL | fn foo<U, const M: bool>(&self) {} | |
| 1215 | | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo` | |
| 1216 | ||
| 1217 | error[E0284]: type annotations needed | |
| 1218 | --> $DIR/trait-to-trait.rs:487:56 | |
| 1219 | | | |
| 1220 | LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar1 { Self::get() } | |
| 1221 | | ^^^ cannot infer the value of the const parameter `M` declared on the method `foo` | |
| 1222 | | | |
| 1223 | note: required by a const generic parameter in `test_5::Trait::foo` | |
| 1224 | --> $DIR/trait-to-trait.rs:434:19 | |
| 1225 | | | |
| 1226 | LL | fn foo<U, const M: bool>(&self) {} | |
| 1227 | | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo` | |
| 1228 | ||
| 1229 | error[E0284]: type annotations needed | |
| 1230 | --> $DIR/trait-to-trait.rs:492:56 | |
| 1231 | | | |
| 1232 | LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar3 { self.get_self() } | |
| 1233 | | ^^^ cannot infer the value of the const parameter `M` declared on the method `foo` | |
| 1234 | | | |
| 1235 | note: required by a const generic parameter in `test_5::Trait::foo` | |
| 1236 | --> $DIR/trait-to-trait.rs:434:19 | |
| 1237 | | | |
| 1238 | LL | fn foo<U, const M: bool>(&self) {} | |
| 1239 | | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo` | |
| 1240 | ||
| 1241 | error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied | |
| 1242 | --> $DIR/trait-to-trait.rs:505:68 | |
| 1243 | | | |
| 1244 | LL | <u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>::bar1::<String, true>(&123); | |
| 1245 | | ^^^^ ------ ---- supplied 2 generic arguments | |
| 1246 | | | | |
| 1247 | | expected 3 generic arguments | |
| 1248 | | | |
| 1249 | note: method defined here, with 3 generic parameters: `T`, `U`, `M` | |
| 1250 | --> $DIR/trait-to-trait.rs:442:63 | |
| 1251 | | | |
| 1252 | LL | trait Trait<'b, 'c, 'a, T>: Sized { | |
| 1253 | | - | |
| 1254 | LL | fn foo<U, const M: bool>(&self) {} | |
| 1255 | | - ------------- | |
| 1256 | ... | |
| 1257 | LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar1 { Self::get() } | |
| 1258 | | ^^^^ | |
| 1259 | help: add missing generic argument | |
| 1260 | | | |
| 1261 | LL | <u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>::bar1::<String, true, M>(&123); | |
| 1262 | | +++ | |
| 1263 | ||
| 1264 | error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied | |
| 1265 | --> $DIR/trait-to-trait.rs:507:26 | |
| 1266 | | | |
| 1267 | LL | <u32 as Trait3>::bar1::<String, true>(&123); | |
| 1268 | | ^^^^ ------ ---- supplied 2 generic arguments | |
| 1269 | | | | |
| 1270 | | expected 3 generic arguments | |
| 1271 | | | |
| 1272 | note: method defined here, with 3 generic parameters: `T`, `U`, `M` | |
| 1273 | --> $DIR/trait-to-trait.rs:457:63 | |
| 1274 | | | |
| 1275 | LL | trait Trait<'b, 'c, 'a, T>: Sized { | |
| 1276 | | - | |
| 1277 | LL | fn foo<U, const M: bool>(&self) {} | |
| 1278 | | - ------------- | |
| 1279 | ... | |
| 1280 | LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar1 { Self::get() } | |
| 1281 | | ^^^^ | |
| 1282 | help: add missing generic argument | |
| 1283 | | | |
| 1284 | LL | <u32 as Trait3>::bar1::<String, true, M>(&123); | |
| 1285 | | +++ | |
| 1286 | ||
| 1287 | error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied | |
| 1288 | --> $DIR/trait-to-trait.rs:509:43 | |
| 1289 | | | |
| 1290 | LL | <u32 as Trait4<'a, 'a, 'static>>::bar1::<String, true>(&123); | |
| 1291 | | ^^^^ ------ ---- supplied 2 generic arguments | |
| 1292 | | | | |
| 1293 | | expected 3 generic arguments | |
| 1294 | | | |
| 1295 | note: method defined here, with 3 generic parameters: `T`, `U`, `M` | |
| 1296 | --> $DIR/trait-to-trait.rs:472:63 | |
| 1297 | | | |
| 1298 | LL | trait Trait<'b, 'c, 'a, T>: Sized { | |
| 1299 | | - | |
| 1300 | LL | fn foo<U, const M: bool>(&self) {} | |
| 1301 | | - ------------- | |
| 1302 | ... | |
| 1303 | LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar1 { Self::get() } | |
| 1304 | | ^^^^ | |
| 1305 | help: add missing generic argument | |
| 1306 | | | |
| 1307 | LL | <u32 as Trait4<'a, 'a, 'static>>::bar1::<String, true, M>(&123); | |
| 1308 | | +++ | |
| 1309 | ||
| 1310 | error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied | |
| 1311 | --> $DIR/trait-to-trait.rs:511:44 | |
| 1312 | | | |
| 1313 | LL | <u32 as Trait5<i32, u64, String>>::bar1::<String, true>(&123); | |
| 1314 | | ^^^^ ------ ---- supplied 2 generic arguments | |
| 1315 | | | | |
| 1316 | | expected 3 generic arguments | |
| 1317 | | | |
| 1318 | note: method defined here, with 3 generic parameters: `T`, `U`, `M` | |
| 1319 | --> $DIR/trait-to-trait.rs:487:63 | |
| 1320 | | | |
| 1321 | LL | trait Trait<'b, 'c, 'a, T>: Sized { | |
| 1322 | | - | |
| 1323 | LL | fn foo<U, const M: bool>(&self) {} | |
| 1324 | | - ------------- | |
| 1325 | ... | |
| 1326 | LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar1 { Self::get() } | |
| 1327 | | ^^^^ | |
| 1328 | help: add missing generic argument | |
| 1329 | | | |
| 1330 | LL | <u32 as Trait5<i32, u64, String>>::bar1::<String, true, M>(&123); | |
| 1331 | | +++ | |
| 1332 | ||
| 1333 | error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied | |
| 1334 | --> $DIR/trait-to-trait.rs:519:68 | |
| 1335 | | | |
| 1336 | LL | <u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>::bar3::<String, true>(&123); | |
| 1337 | | ^^^^ ------ ---- supplied 2 generic arguments | |
| 1338 | | | | |
| 1339 | | expected 3 generic arguments | |
| 1340 | | | |
| 1341 | note: method defined here, with 3 generic parameters: `T`, `U`, `M` | |
| 1342 | --> $DIR/trait-to-trait.rs:447:63 | |
| 1343 | | | |
| 1344 | LL | trait Trait<'b, 'c, 'a, T>: Sized { | |
| 1345 | | - | |
| 1346 | LL | fn foo<U, const M: bool>(&self) {} | |
| 1347 | | - ------------- | |
| 1348 | ... | |
| 1349 | LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar3 { self.get_self() } | |
| 1350 | | ^^^^ | |
| 1351 | help: add missing generic argument | |
| 1352 | | | |
| 1353 | LL | <u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>::bar3::<String, true, M>(&123); | |
| 1354 | | +++ | |
| 1355 | ||
| 1356 | error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied | |
| 1357 | --> $DIR/trait-to-trait.rs:521:26 | |
| 1358 | | | |
| 1359 | LL | <u32 as Trait3>::bar3::<String, true>(&123); | |
| 1360 | | ^^^^ ------ ---- supplied 2 generic arguments | |
| 1361 | | | | |
| 1362 | | expected 3 generic arguments | |
| 1363 | | | |
| 1364 | note: method defined here, with 3 generic parameters: `T`, `U`, `M` | |
| 1365 | --> $DIR/trait-to-trait.rs:462:63 | |
| 1366 | | | |
| 1367 | LL | trait Trait<'b, 'c, 'a, T>: Sized { | |
| 1368 | | - | |
| 1369 | LL | fn foo<U, const M: bool>(&self) {} | |
| 1370 | | - ------------- | |
| 1371 | ... | |
| 1372 | LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar3 { self.get_self() } | |
| 1373 | | ^^^^ | |
| 1374 | help: add missing generic argument | |
| 1375 | | | |
| 1376 | LL | <u32 as Trait3>::bar3::<String, true, M>(&123); | |
| 1377 | | +++ | |
| 1378 | ||
| 1379 | error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied | |
| 1380 | --> $DIR/trait-to-trait.rs:523:43 | |
| 1381 | | | |
| 1382 | LL | <u32 as Trait4<'a, 'a, 'static>>::bar3::<String, true>(&123); | |
| 1383 | | ^^^^ ------ ---- supplied 2 generic arguments | |
| 1384 | | | | |
| 1385 | | expected 3 generic arguments | |
| 1386 | | | |
| 1387 | note: method defined here, with 3 generic parameters: `T`, `U`, `M` | |
| 1388 | --> $DIR/trait-to-trait.rs:477:63 | |
| 1389 | | | |
| 1390 | LL | trait Trait<'b, 'c, 'a, T>: Sized { | |
| 1391 | | - | |
| 1392 | LL | fn foo<U, const M: bool>(&self) {} | |
| 1393 | | - ------------- | |
| 1394 | ... | |
| 1395 | LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar3 { self.get_self() } | |
| 1396 | | ^^^^ | |
| 1397 | help: add missing generic argument | |
| 1398 | | | |
| 1399 | LL | <u32 as Trait4<'a, 'a, 'static>>::bar3::<String, true, M>(&123); | |
| 1400 | | +++ | |
| 1401 | ||
| 1402 | error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied | |
| 1403 | --> $DIR/trait-to-trait.rs:525:44 | |
| 1404 | | | |
| 1405 | LL | <u32 as Trait5<i32, u64, String>>::bar3::<String, true>(&123); | |
| 1406 | | ^^^^ ------ ---- supplied 2 generic arguments | |
| 1407 | | | | |
| 1408 | | expected 3 generic arguments | |
| 1409 | | | |
| 1410 | note: method defined here, with 3 generic parameters: `T`, `U`, `M` | |
| 1411 | --> $DIR/trait-to-trait.rs:492:63 | |
| 1412 | | | |
| 1413 | LL | trait Trait<'b, 'c, 'a, T>: Sized { | |
| 1414 | | - | |
| 1415 | LL | fn foo<U, const M: bool>(&self) {} | |
| 1416 | | - ------------- | |
| 1417 | ... | |
| 1418 | LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar3 { self.get_self() } | |
| 1419 | | ^^^^ | |
| 1420 | help: add missing generic argument | |
| 1421 | | | |
| 1422 | LL | <u32 as Trait5<i32, u64, String>>::bar3::<String, true, M>(&123); | |
| 1423 | | +++ | |
| 1424 | ||
| 1425 | error[E0282]: type annotations needed | |
| 1426 | --> $DIR/trait-to-trait.rs:581:9 | |
| 1427 | | | |
| 1428 | LL | <u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>::bar1(&123); | |
| 1429 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the method `bar1` | |
| 1430 | ||
| 1431 | error[E0282]: type annotations needed | |
| 1432 | --> $DIR/trait-to-trait.rs:640:9 | |
| 1433 | | | |
| 1434 | LL | <u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>::bar1(&123); | |
| 1435 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the method `bar1` | |
| 1436 | ||
| 1437 | error[E0282]: type annotations needed | |
| 1438 | --> $DIR/trait-to-trait.rs:765:9 | |
| 1439 | | | |
| 1440 | LL | / <u32 as Trait2<'static, 'static, 'static, i32, i32, i32>> | |
| 1441 | LL | | | |
| 1442 | LL | | ::bar1::<'static, 'static>(&123); | |
| 1443 | | |______________________________________^ cannot infer type of the type parameter `T` declared on the method `bar1` | |
| 1444 | ||
| 1445 | error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present | |
| 1446 | --> $DIR/trait-to-trait.rs:853:22 | |
| 1447 | | | |
| 1448 | LL | ::bar1::<'static, 'static>(&123); | |
| 1449 | | ^^^^^^^ | |
| 1450 | | | |
| 1451 | note: the late bound lifetime parameter is introduced here | |
| 1452 | --> $DIR/trait-to-trait.rs:797:32 | |
| 1453 | | | |
| 1454 | LL | fn foo<'a: 'a, 'b: 'b>(&self) {} | |
| 1455 | | ^ | |
| 1456 | ||
| 1457 | error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present | |
| 1458 | --> $DIR/trait-to-trait.rs:855:33 | |
| 1459 | | | |
| 1460 | LL | <u32 as Trait3>::bar1::<'static, 'static>(&123); | |
| 1461 | | ^^^^^^^ | |
| 1462 | | | |
| 1463 | note: the late bound lifetime parameter is introduced here | |
| 1464 | --> $DIR/trait-to-trait.rs:797:32 | |
| 1465 | | | |
| 1466 | LL | fn foo<'a: 'a, 'b: 'b>(&self) {} | |
| 1467 | | ^ | |
| 1468 | ||
| 1469 | error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present | |
| 1470 | --> $DIR/trait-to-trait.rs:857:50 | |
| 1471 | | | |
| 1472 | LL | <u32 as Trait4<'a, 'a, 'static>>::bar1::<'a, 'a>(&123); | |
| 1473 | | ^^ | |
| 1474 | | | |
| 1475 | note: the late bound lifetime parameter is introduced here | |
| 1476 | --> $DIR/trait-to-trait.rs:797:32 | |
| 1477 | | | |
| 1478 | LL | fn foo<'a: 'a, 'b: 'b>(&self) {} | |
| 1479 | | ^ | |
| 1480 | ||
| 1481 | error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present | |
| 1482 | --> $DIR/trait-to-trait.rs:859:51 | |
| 1483 | | | |
| 1484 | LL | <u32 as Trait5<i32, u64, String>>::bar1::<'a, 'a>(&123); | |
| 1485 | | ^^ | |
| 1486 | | | |
| 1487 | note: the late bound lifetime parameter is introduced here | |
| 1488 | --> $DIR/trait-to-trait.rs:797:32 | |
| 1489 | | | |
| 1490 | LL | fn foo<'a: 'a, 'b: 'b>(&self) {} | |
| 1491 | | ^ | |
| 1492 | ||
| 1493 | error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present | |
| 1494 | --> $DIR/trait-to-trait.rs:868:22 | |
| 1495 | | | |
| 1496 | LL | ::bar3::<'static, 'static>(&123); | |
| 1497 | | ^^^^^^^ | |
| 1498 | | | |
| 1499 | note: the late bound lifetime parameter is introduced here | |
| 1500 | --> $DIR/trait-to-trait.rs:797:32 | |
| 1501 | | | |
| 1502 | LL | fn foo<'a: 'a, 'b: 'b>(&self) {} | |
| 1503 | | ^ | |
| 1504 | ||
| 1505 | error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present | |
| 1506 | --> $DIR/trait-to-trait.rs:870:33 | |
| 1507 | | | |
| 1508 | LL | <u32 as Trait3>::bar3::<'static, 'static>(&123); | |
| 1509 | | ^^^^^^^ | |
| 1510 | | | |
| 1511 | note: the late bound lifetime parameter is introduced here | |
| 1512 | --> $DIR/trait-to-trait.rs:797:32 | |
| 1513 | | | |
| 1514 | LL | fn foo<'a: 'a, 'b: 'b>(&self) {} | |
| 1515 | | ^ | |
| 1516 | ||
| 1517 | error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present | |
| 1518 | --> $DIR/trait-to-trait.rs:872:50 | |
| 1519 | | | |
| 1520 | LL | <u32 as Trait4<'a, 'a, 'static>>::bar3::<'static, 'static>(&123); | |
| 1521 | | ^^^^^^^ | |
| 1522 | | | |
| 1523 | note: the late bound lifetime parameter is introduced here | |
| 1524 | --> $DIR/trait-to-trait.rs:797:32 | |
| 1525 | | | |
| 1526 | LL | fn foo<'a: 'a, 'b: 'b>(&self) {} | |
| 1527 | | ^ | |
| 1528 | ||
| 1529 | error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present | |
| 1530 | --> $DIR/trait-to-trait.rs:874:51 | |
| 1531 | | | |
| 1532 | LL | <u32 as Trait5<i32, u64, String>>::bar3::<'static, 'static>(&123); | |
| 1533 | | ^^^^^^^ | |
| 1534 | | | |
| 1535 | note: the late bound lifetime parameter is introduced here | |
| 1536 | --> $DIR/trait-to-trait.rs:797:32 | |
| 1537 | | | |
| 1538 | LL | fn foo<'a: 'a, 'b: 'b>(&self) {} | |
| 1539 | | ^ | |
| 1540 | ||
| 1541 | error: aborting due to 99 previous errors | |
| 1542 | ||
| 1543 | Some errors have detailed explanations: E0107, E0282, E0284, E0794. | |
| 1544 | For more information about an error, try `rustc --explain E0107`. |
tests/ui/delegation/target-expr-pass.rs+1-1| ... | ... | @@ -25,7 +25,7 @@ struct S(F); //~ WARN struct `S` is never constructed |
| 25 | 25 | impl Trait for S { |
| 26 | 26 | reuse <F as Trait>::bar { |
| 27 | 27 | #[allow(unused_imports)] |
| 28 | use self::to_reuse::{foo, inner::self}; | |
| 28 | use self::to_reuse::{foo, inner::{self}}; | |
| 29 | 29 | let x = foo(12); |
| 30 | 30 | assert_eq!(x, 12); |
| 31 | 31 | &self.0 |
tests/ui/diagnostics-infra/primary-fluent-bundle-missing.rs deleted-24| ... | ... | @@ -1,24 +0,0 @@ |
| 1 | //! Regression test for https://github.com/rust-lang/rust/issues/106755 | |
| 2 | ||
| 3 | //@ compile-flags:-Ztranslate-lang=en_US | |
| 4 | ||
| 5 | #![feature(negative_impls)] | |
| 6 | #![feature(marker_trait_attr)] | |
| 7 | ||
| 8 | #[marker] | |
| 9 | trait MyTrait {} | |
| 10 | ||
| 11 | struct TestType<T>(::std::marker::PhantomData<T>); | |
| 12 | ||
| 13 | unsafe impl<T: MyTrait + 'static> Send for TestType<T> {} | |
| 14 | ||
| 15 | impl<T: MyTrait> !Send for TestType<T> {} | |
| 16 | //~^ ERROR found both positive and negative implementation | |
| 17 | //~| ERROR `!Send` impl requires `T: MyTrait` but the struct it is implemented for does not | |
| 18 | ||
| 19 | unsafe impl<T: 'static> Send for TestType<T> {} //~ ERROR conflicting implementations | |
| 20 | ||
| 21 | impl !Send for TestType<i32> {} | |
| 22 | //~^ ERROR `!Send` impls cannot be specialized | |
| 23 | ||
| 24 | fn main() {} |
tests/ui/diagnostics-infra/primary-fluent-bundle-missing.stderr deleted-47| ... | ... | @@ -1,47 +0,0 @@ |
| 1 | error[E0751]: found both positive and negative implementation of trait `Send` for type `TestType<_>`: | |
| 2 | --> $DIR/primary-fluent-bundle-missing.rs:15:1 | |
| 3 | | | |
| 4 | LL | unsafe impl<T: MyTrait + 'static> Send for TestType<T> {} | |
| 5 | | ------------------------------------------------------ positive implementation here | |
| 6 | LL | | |
| 7 | LL | impl<T: MyTrait> !Send for TestType<T> {} | |
| 8 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ negative implementation here | |
| 9 | ||
| 10 | error[E0119]: conflicting implementations of trait `Send` for type `TestType<_>` | |
| 11 | --> $DIR/primary-fluent-bundle-missing.rs:19:1 | |
| 12 | | | |
| 13 | LL | unsafe impl<T: MyTrait + 'static> Send for TestType<T> {} | |
| 14 | | ------------------------------------------------------ first implementation here | |
| 15 | ... | |
| 16 | LL | unsafe impl<T: 'static> Send for TestType<T> {} | |
| 17 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `TestType<_>` | |
| 18 | ||
| 19 | error[E0367]: `!Send` impl requires `T: MyTrait` but the struct it is implemented for does not | |
| 20 | --> $DIR/primary-fluent-bundle-missing.rs:15:9 | |
| 21 | | | |
| 22 | LL | impl<T: MyTrait> !Send for TestType<T> {} | |
| 23 | | ^^^^^^^ | |
| 24 | | | |
| 25 | note: the implementor must specify the same requirement | |
| 26 | --> $DIR/primary-fluent-bundle-missing.rs:11:1 | |
| 27 | | | |
| 28 | LL | struct TestType<T>(::std::marker::PhantomData<T>); | |
| 29 | | ^^^^^^^^^^^^^^^^^^ | |
| 30 | ||
| 31 | error[E0366]: `!Send` impls cannot be specialized | |
| 32 | --> $DIR/primary-fluent-bundle-missing.rs:21:1 | |
| 33 | | | |
| 34 | LL | impl !Send for TestType<i32> {} | |
| 35 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 36 | | | |
| 37 | = note: `i32` is not a generic parameter | |
| 38 | note: use the same sequence of generic lifetime, type and const parameters as the struct definition | |
| 39 | --> $DIR/primary-fluent-bundle-missing.rs:11:1 | |
| 40 | | | |
| 41 | LL | struct TestType<T>(::std::marker::PhantomData<T>); | |
| 42 | | ^^^^^^^^^^^^^^^^^^ | |
| 43 | ||
| 44 | error: aborting due to 4 previous errors | |
| 45 | ||
| 46 | Some errors have detailed explanations: E0119, E0366, E0367, E0751. | |
| 47 | For more information about an error, try `rustc --explain E0119`. |
tests/ui/dollar-crate/dollar-crate-is-keyword-2.rs+1-2| ... | ... | @@ -2,8 +2,7 @@ mod a {} |
| 2 | 2 | |
| 3 | 3 | macro_rules! m { |
| 4 | 4 | () => { |
| 5 | use a::$crate; //~ ERROR: unresolved import `a::$crate` | |
| 6 | //~^ NOTE: no `$crate` in `a` | |
| 5 | use a::$crate; //~ ERROR: `$crate` in paths can only be used in start position | |
| 7 | 6 | use a::$crate::b; //~ ERROR: `$crate` in paths can only be used in start position |
| 8 | 7 | //~^ NOTE: can only be used in path start position |
| 9 | 8 | type A = a::$crate; //~ ERROR: `$crate` in paths can only be used in start position |
tests/ui/dollar-crate/dollar-crate-is-keyword-2.stderr+10-11| ... | ... | @@ -1,19 +1,19 @@ |
| 1 | error[E0433]: `$crate` in paths can only be used in start position | |
| 2 | --> $DIR/dollar-crate-is-keyword-2.rs:7:16 | |
| 1 | error: `$crate` in paths can only be used in start position | |
| 2 | --> $DIR/dollar-crate-is-keyword-2.rs:5:16 | |
| 3 | 3 | | |
| 4 | LL | use a::$crate::b; | |
| 5 | | ^^^^^^ can only be used in path start position | |
| 4 | LL | use a::$crate; | |
| 5 | | ^^^^^^ | |
| 6 | 6 | ... |
| 7 | 7 | LL | m!(); |
| 8 | 8 | | ---- in this macro invocation |
| 9 | 9 | | |
| 10 | 10 | = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) |
| 11 | 11 | |
| 12 | error[E0432]: unresolved import `a::$crate` | |
| 13 | --> $DIR/dollar-crate-is-keyword-2.rs:5:13 | |
| 12 | error[E0433]: `$crate` in paths can only be used in start position | |
| 13 | --> $DIR/dollar-crate-is-keyword-2.rs:6:16 | |
| 14 | 14 | | |
| 15 | LL | use a::$crate; | |
| 16 | | ^^^^^^^^^ no `$crate` in `a` | |
| 15 | LL | use a::$crate::b; | |
| 16 | | ^^^^^^ can only be used in path start position | |
| 17 | 17 | ... |
| 18 | 18 | LL | m!(); |
| 19 | 19 | | ---- in this macro invocation |
| ... | ... | @@ -21,7 +21,7 @@ LL | m!(); |
| 21 | 21 | = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) |
| 22 | 22 | |
| 23 | 23 | error[E0433]: `$crate` in paths can only be used in start position |
| 24 | --> $DIR/dollar-crate-is-keyword-2.rs:9:21 | |
| 24 | --> $DIR/dollar-crate-is-keyword-2.rs:8:21 | |
| 25 | 25 | | |
| 26 | 26 | LL | type A = a::$crate; |
| 27 | 27 | | ^^^^^^ can only be used in path start position |
| ... | ... | @@ -33,5 +33,4 @@ LL | m!(); |
| 33 | 33 | |
| 34 | 34 | error: aborting due to 3 previous errors |
| 35 | 35 | |
| 36 | Some errors have detailed explanations: E0432, E0433. | |
| 37 | For more information about an error, try `rustc --explain E0432`. | |
| 36 | For more information about this error, try `rustc --explain E0433`. |
tests/ui/dollar-crate/dollar-crate-is-keyword.rs+1-2| ... | ... | @@ -6,9 +6,8 @@ macro_rules! m { |
| 6 | 6 | struct $crate {} //~ ERROR expected identifier, found reserved identifier `$crate` |
| 7 | 7 | } |
| 8 | 8 | |
| 9 | use $crate; //~ ERROR `$crate` may not be imported | |
| 9 | use $crate; //~ ERROR imports need to be explicitly named | |
| 10 | 10 | use $crate as $crate; //~ ERROR expected identifier, found reserved identifier `$crate` |
| 11 | //~^ ERROR `$crate` may not be imported | |
| 12 | 11 | } |
| 13 | 12 | } |
| 14 | 13 |
tests/ui/dollar-crate/dollar-crate-is-keyword.stderr+7-14| ... | ... | @@ -20,27 +20,20 @@ LL | m!(); |
| 20 | 20 | | |
| 21 | 21 | = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) |
| 22 | 22 | |
| 23 | error: `$crate` may not be imported | |
| 24 | --> $DIR/dollar-crate-is-keyword.rs:9:9 | |
| 23 | error: imports need to be explicitly named | |
| 24 | --> $DIR/dollar-crate-is-keyword.rs:9:13 | |
| 25 | 25 | | |
| 26 | 26 | LL | use $crate; |
| 27 | | ^^^^^^^^^^^ | |
| 27 | | ^^^^^^ | |
| 28 | 28 | ... |
| 29 | 29 | LL | m!(); |
| 30 | 30 | | ---- in this macro invocation |
| 31 | 31 | | |
| 32 | 32 | = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) |
| 33 | ||
| 34 | error: `$crate` may not be imported | |
| 35 | --> $DIR/dollar-crate-is-keyword.rs:10:9 | |
| 33 | help: try renaming it with a name | |
| 36 | 34 | | |
| 37 | LL | use $crate as $crate; | |
| 38 | | ^^^^^^^^^^^^^^^^^^^^^ | |
| 39 | ... | |
| 40 | LL | m!(); | |
| 41 | | ---- in this macro invocation | |
| 42 | | | |
| 43 | = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 35 | LL | use $crate as name; | |
| 36 | | +++++++ | |
| 44 | 37 | |
| 45 | error: aborting due to 4 previous errors | |
| 38 | error: aborting due to 3 previous errors | |
| 46 | 39 |
tests/ui/error-codes/E0430.rs+1-2| ... | ... | @@ -1,5 +1,4 @@ |
| 1 | use std::fmt::{self, self}; //~ ERROR E0430 | |
| 2 | //~^ ERROR E0252 | |
| 1 | use std::fmt::{self, self}; //~ ERROR the name `fmt` is defined multiple times | |
| 3 | 2 | |
| 4 | 3 | fn main () { |
| 5 | 4 | } |
tests/ui/error-codes/E0430.stderr+2-11| ... | ... | @@ -1,11 +1,3 @@ |
| 1 | error[E0430]: `self` import can only appear once in an import list | |
| 2 | --> $DIR/E0430.rs:1:16 | |
| 3 | | | |
| 4 | LL | use std::fmt::{self, self}; | |
| 5 | | ^^^^ ---- another `self` import appears here | |
| 6 | | | | |
| 7 | | can only appear once in an import list | |
| 8 | ||
| 9 | 1 | error[E0252]: the name `fmt` is defined multiple times |
| 10 | 2 | --> $DIR/E0430.rs:1:22 |
| 11 | 3 | | |
| ... | ... | @@ -16,7 +8,6 @@ LL | use std::fmt::{self, self}; |
| 16 | 8 | | |
| 17 | 9 | = note: `fmt` must be defined only once in the type namespace of this module |
| 18 | 10 | |
| 19 | error: aborting due to 2 previous errors | |
| 11 | error: aborting due to 1 previous error | |
| 20 | 12 | |
| 21 | Some errors have detailed explanations: E0252, E0430. | |
| 22 | For more information about an error, try `rustc --explain E0252`. | |
| 13 | For more information about this error, try `rustc --explain E0252`. |
tests/ui/error-codes/E0431.rs+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | use {self}; //~ ERROR E0431 | |
| 1 | use {self}; //~ ERROR imports need to be explicitly named | |
| 2 | 2 | |
| 3 | 3 | fn main () { |
| 4 | 4 | } |
tests/ui/error-codes/E0431.stderr+7-3| ... | ... | @@ -1,9 +1,13 @@ |
| 1 | error[E0431]: `self` import can only appear in an import list with a non-empty prefix | |
| 1 | error: imports need to be explicitly named | |
| 2 | 2 | --> $DIR/E0431.rs:1:6 |
| 3 | 3 | | |
| 4 | 4 | LL | use {self}; |
| 5 | | ^^^^ can only appear in an import list with a non-empty prefix | |
| 5 | | ^^^^ | |
| 6 | | | |
| 7 | help: try renaming it with a name | |
| 8 | | | |
| 9 | LL | use {self as name}; | |
| 10 | | +++++++ | |
| 6 | 11 | |
| 7 | 12 | error: aborting due to 1 previous error |
| 8 | 13 | |
| 9 | For more information about this error, try `rustc --explain E0431`. |
tests/ui/imports/import-crate-var.rs+1-1| ... | ... | @@ -4,5 +4,5 @@ |
| 4 | 4 | |
| 5 | 5 | fn main() { |
| 6 | 6 | m!(); |
| 7 | //~^ ERROR `$crate` may not be imported | |
| 7 | //~^ ERROR imports need to be explicitly named | |
| 8 | 8 | } |
tests/ui/imports/import-crate-var.stderr+6-1| ... | ... | @@ -1,10 +1,15 @@ |
| 1 | error: `$crate` may not be imported | |
| 1 | error: imports need to be explicitly named | |
| 2 | 2 | --> $DIR/import-crate-var.rs:6:5 |
| 3 | 3 | | |
| 4 | 4 | LL | m!(); |
| 5 | 5 | | ^^^^ |
| 6 | 6 | | |
| 7 | 7 | = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) |
| 8 | help: try renaming it with a name | |
| 9 | --> $DIR/auxiliary/import_crate_var.rs:5:15 | |
| 10 | | | |
| 11 | LL | use $crate as name; | |
| 12 | | +++++++ | |
| 8 | 13 | |
| 9 | 14 | error: aborting due to 1 previous error |
| 10 | 15 |
tests/ui/imports/issue-47623.rs+1-1| ... | ... | @@ -1,3 +1,3 @@ |
| 1 | use self; //~ERROR `self` imports are only allowed within a { } list | |
| 1 | use self; //~ERROR imports need to be explicitly named | |
| 2 | 2 | |
| 3 | 3 | fn main() {} |
tests/ui/imports/issue-47623.stderr+1-2| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | error[E0429]: `self` imports are only allowed within a { } list | |
| 1 | error: imports need to be explicitly named | |
| 2 | 2 | --> $DIR/issue-47623.rs:1:5 |
| 3 | 3 | | |
| 4 | 4 | LL | use self; |
| ... | ... | @@ -6,4 +6,3 @@ LL | use self; |
| 6 | 6 | |
| 7 | 7 | error: aborting due to 1 previous error |
| 8 | 8 | |
| 9 | For more information about this error, try `rustc --explain E0429`. |
tests/ui/marker_trait_attr/conflicting-send-impls-for-marker-trait-106755.rs-2| ... | ... | @@ -1,5 +1,3 @@ |
| 1 | //@ compile-flags:-Ztranslate-lang=en_US | |
| 2 | ||
| 3 | 1 | #![feature(negative_impls)] |
| 4 | 2 | #![feature(marker_trait_attr)] |
| 5 | 3 |
tests/ui/marker_trait_attr/conflicting-send-impls-for-marker-trait-106755.stderr+6-6| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | error[E0751]: found both positive and negative implementation of trait `Send` for type `TestType<_>`: |
| 2 | --> $DIR/conflicting-send-impls-for-marker-trait-106755.rs:13:1 | |
| 2 | --> $DIR/conflicting-send-impls-for-marker-trait-106755.rs:11:1 | |
| 3 | 3 | | |
| 4 | 4 | LL | unsafe impl<T: MyTrait + 'static> Send for TestType<T> {} |
| 5 | 5 | | ------------------------------------------------------ positive implementation here |
| ... | ... | @@ -8,7 +8,7 @@ LL | impl<T: MyTrait> !Send for TestType<T> {} |
| 8 | 8 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ negative implementation here |
| 9 | 9 | |
| 10 | 10 | error[E0119]: conflicting implementations of trait `Send` for type `TestType<_>` |
| 11 | --> $DIR/conflicting-send-impls-for-marker-trait-106755.rs:17:1 | |
| 11 | --> $DIR/conflicting-send-impls-for-marker-trait-106755.rs:15:1 | |
| 12 | 12 | | |
| 13 | 13 | LL | unsafe impl<T: MyTrait + 'static> Send for TestType<T> {} |
| 14 | 14 | | ------------------------------------------------------ first implementation here |
| ... | ... | @@ -17,26 +17,26 @@ LL | unsafe impl<T: 'static> Send for TestType<T> {} |
| 17 | 17 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `TestType<_>` |
| 18 | 18 | |
| 19 | 19 | error[E0367]: `!Send` impl requires `T: MyTrait` but the struct it is implemented for does not |
| 20 | --> $DIR/conflicting-send-impls-for-marker-trait-106755.rs:13:9 | |
| 20 | --> $DIR/conflicting-send-impls-for-marker-trait-106755.rs:11:9 | |
| 21 | 21 | | |
| 22 | 22 | LL | impl<T: MyTrait> !Send for TestType<T> {} |
| 23 | 23 | | ^^^^^^^ |
| 24 | 24 | | |
| 25 | 25 | note: the implementor must specify the same requirement |
| 26 | --> $DIR/conflicting-send-impls-for-marker-trait-106755.rs:9:1 | |
| 26 | --> $DIR/conflicting-send-impls-for-marker-trait-106755.rs:7:1 | |
| 27 | 27 | | |
| 28 | 28 | LL | struct TestType<T>(::std::marker::PhantomData<T>); |
| 29 | 29 | | ^^^^^^^^^^^^^^^^^^ |
| 30 | 30 | |
| 31 | 31 | error[E0366]: `!Send` impls cannot be specialized |
| 32 | --> $DIR/conflicting-send-impls-for-marker-trait-106755.rs:19:1 | |
| 32 | --> $DIR/conflicting-send-impls-for-marker-trait-106755.rs:17:1 | |
| 33 | 33 | | |
| 34 | 34 | LL | impl !Send for TestType<i32> {} |
| 35 | 35 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 36 | 36 | | |
| 37 | 37 | = note: `i32` is not a generic parameter |
| 38 | 38 | note: use the same sequence of generic lifetime, type and const parameters as the struct definition |
| 39 | --> $DIR/conflicting-send-impls-for-marker-trait-106755.rs:9:1 | |
| 39 | --> $DIR/conflicting-send-impls-for-marker-trait-106755.rs:7:1 | |
| 40 | 40 | | |
| 41 | 41 | LL | struct TestType<T>(::std::marker::PhantomData<T>); |
| 42 | 42 | | ^^^^^^^^^^^^^^^^^^ |
tests/ui/rfcs/rfc-2126-extern-absolute-paths/single-segment.rs+1-1| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | //@ compile-flags:--extern xcrate |
| 3 | 3 | //@ edition:2018 |
| 4 | 4 | |
| 5 | use crate; //~ ERROR crate root imports need to be explicitly named: `use crate as name;` | |
| 5 | use crate; //~ ERROR imports need to be explicitly named | |
| 6 | 6 | use *; //~ ERROR cannot glob-import all possible crates |
| 7 | 7 | |
| 8 | 8 | fn main() { |
tests/ui/rfcs/rfc-2126-extern-absolute-paths/single-segment.stderr+6-1| ... | ... | @@ -1,8 +1,13 @@ |
| 1 | error: crate root imports need to be explicitly named: `use crate as name;` | |
| 1 | error: imports need to be explicitly named | |
| 2 | 2 | --> $DIR/single-segment.rs:5:5 |
| 3 | 3 | | |
| 4 | 4 | LL | use crate; |
| 5 | 5 | | ^^^^^ |
| 6 | | | |
| 7 | help: try renaming it with a name | |
| 8 | | | |
| 9 | LL | use crate as name; | |
| 10 | | +++++++ | |
| 6 | 11 | |
| 7 | 12 | error: cannot glob-import all possible crates |
| 8 | 13 | --> $DIR/single-segment.rs:6:5 |
tests/ui/rfcs/rfc-2294-if-let-guard/warns.rs-2| ... | ... | @@ -1,5 +1,4 @@ |
| 1 | 1 | #[deny(irrefutable_let_patterns)] |
| 2 | ||
| 3 | 2 | fn irrefutable_let_guard() { |
| 4 | 3 | match Some(()) { |
| 5 | 4 | Some(x) if let () = x => {} |
| ... | ... | @@ -21,7 +20,6 @@ fn trailing_irrefutable_pattern_binding() { |
| 21 | 20 | fn trailing_irrefutable_in_let_chain() { |
| 22 | 21 | match Some(5) { |
| 23 | 22 | Some(x) if let Some(y) = Some(x) && let z = 0 => {} |
| 24 | //~^ ERROR trailing irrefutable pattern in let chain | |
| 25 | 23 | _ => {} |
| 26 | 24 | } |
| 27 | 25 | } |
tests/ui/rfcs/rfc-2294-if-let-guard/warns.stderr+6-20| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | error: irrefutable `if let` guard pattern |
| 2 | --> $DIR/warns.rs:5:20 | |
| 2 | --> $DIR/warns.rs:4:20 | |
| 3 | 3 | | |
| 4 | 4 | LL | Some(x) if let () = x => {} |
| 5 | 5 | | ^^^^^^^^^^ |
| ... | ... | @@ -13,7 +13,7 @@ LL | #[deny(irrefutable_let_patterns)] |
| 13 | 13 | | ^^^^^^^^^^^^^^^^^^^^^^^^ |
| 14 | 14 | |
| 15 | 15 | error: irrefutable `if let` guard pattern |
| 16 | --> $DIR/warns.rs:14:14 | |
| 16 | --> $DIR/warns.rs:13:14 | |
| 17 | 17 | | |
| 18 | 18 | LL | o if let x = 0 => {} |
| 19 | 19 | | ^^^^^^^^^ |
| ... | ... | @@ -21,27 +21,13 @@ LL | o if let x = 0 => {} |
| 21 | 21 | = note: this pattern will always match, so the guard is useless |
| 22 | 22 | = help: consider removing the guard and adding a `let` inside the match arm |
| 23 | 23 | note: the lint level is defined here |
| 24 | --> $DIR/warns.rs:11:8 | |
| 25 | | | |
| 26 | LL | #[deny(irrefutable_let_patterns)] | |
| 27 | | ^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 28 | ||
| 29 | error: trailing irrefutable pattern in let chain | |
| 30 | --> $DIR/warns.rs:23:45 | |
| 31 | | | |
| 32 | LL | Some(x) if let Some(y) = Some(x) && let z = 0 => {} | |
| 33 | | ^^^^^^^^^ | |
| 34 | | | |
| 35 | = note: this pattern will always match | |
| 36 | = help: consider moving it into the body | |
| 37 | note: the lint level is defined here | |
| 38 | --> $DIR/warns.rs:20:8 | |
| 24 | --> $DIR/warns.rs:10:8 | |
| 39 | 25 | | |
| 40 | 26 | LL | #[deny(irrefutable_let_patterns)] |
| 41 | 27 | | ^^^^^^^^^^^^^^^^^^^^^^^^ |
| 42 | 28 | |
| 43 | 29 | error: unreachable pattern |
| 44 | --> $DIR/warns.rs:32:25 | |
| 30 | --> $DIR/warns.rs:30:25 | |
| 45 | 31 | | |
| 46 | 32 | LL | x if let None | None = x => {} |
| 47 | 33 | | ---- ^^^^ no value can reach this |
| ... | ... | @@ -49,10 +35,10 @@ LL | x if let None | None = x => {} |
| 49 | 35 | | matches all the relevant values |
| 50 | 36 | | |
| 51 | 37 | note: the lint level is defined here |
| 52 | --> $DIR/warns.rs:29:8 | |
| 38 | --> $DIR/warns.rs:27:8 | |
| 53 | 39 | | |
| 54 | 40 | LL | #[deny(unreachable_patterns)] |
| 55 | 41 | | ^^^^^^^^^^^^^^^^^^^^ |
| 56 | 42 | |
| 57 | error: aborting due to 4 previous errors | |
| 43 | error: aborting due to 3 previous errors | |
| 58 | 44 |
tests/ui/rfcs/rfc-2497-if-let-chains/irrefutable-lets.disallowed.stderr deleted-133| ... | ... | @@ -1,133 +0,0 @@ |
| 1 | error: leading irrefutable pattern in let chain | |
| 2 | --> $DIR/irrefutable-lets.rs:13:8 | |
| 3 | | | |
| 4 | LL | if let first = &opt && let Some(second) = first && let None = second.start {} | |
| 5 | | ^^^^^^^^^^^^^^^^ | |
| 6 | | | |
| 7 | = note: this pattern will always match | |
| 8 | = help: consider moving it outside of the construct | |
| 9 | note: the lint level is defined here | |
| 10 | --> $DIR/irrefutable-lets.rs:6:30 | |
| 11 | | | |
| 12 | LL | #![cfg_attr(disallowed, deny(irrefutable_let_patterns))] | |
| 13 | | ^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 14 | ||
| 15 | error: irrefutable `if let` patterns | |
| 16 | --> $DIR/irrefutable-lets.rs:19:8 | |
| 17 | | | |
| 18 | LL | if let first = &opt && let (a, b) = (1, 2) {} | |
| 19 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 20 | | | |
| 21 | = note: these patterns will always match, so the `if let` is useless | |
| 22 | = help: consider replacing the `if let` with a `let` | |
| 23 | ||
| 24 | error: leading irrefutable pattern in let chain | |
| 25 | --> $DIR/irrefutable-lets.rs:22:8 | |
| 26 | | | |
| 27 | LL | if let first = &opt && let Some(second) = first && let None = second.start && let v = 0 {} | |
| 28 | | ^^^^^^^^^^^^^^^^ | |
| 29 | | | |
| 30 | = note: this pattern will always match | |
| 31 | = help: consider moving it outside of the construct | |
| 32 | ||
| 33 | error: trailing irrefutable pattern in let chain | |
| 34 | --> $DIR/irrefutable-lets.rs:22:83 | |
| 35 | | | |
| 36 | LL | if let first = &opt && let Some(second) = first && let None = second.start && let v = 0 {} | |
| 37 | | ^^^^^^^^^ | |
| 38 | | | |
| 39 | = note: this pattern will always match | |
| 40 | = help: consider moving it into the body | |
| 41 | ||
| 42 | error: trailing irrefutable patterns in let chain | |
| 43 | --> $DIR/irrefutable-lets.rs:26:37 | |
| 44 | | | |
| 45 | LL | if let Some(ref first) = opt && let second = first && let _third = second {} | |
| 46 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 47 | | | |
| 48 | = note: these patterns will always match | |
| 49 | = help: consider moving them into the body | |
| 50 | ||
| 51 | error: leading irrefutable pattern in let chain | |
| 52 | --> $DIR/irrefutable-lets.rs:29:8 | |
| 53 | | | |
| 54 | LL | if let Range { start: local_start, end: _ } = (None..Some(1)) && let None = local_start {} | |
| 55 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 56 | | | |
| 57 | = note: this pattern will always match | |
| 58 | = help: consider moving it outside of the construct | |
| 59 | ||
| 60 | error: leading irrefutable pattern in let chain | |
| 61 | --> $DIR/irrefutable-lets.rs:32:8 | |
| 62 | | | |
| 63 | LL | if let (a, b, c) = (Some(1), Some(1), Some(1)) && let None = Some(1) {} | |
| 64 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 65 | | | |
| 66 | = note: this pattern will always match | |
| 67 | = help: consider moving it outside of the construct | |
| 68 | ||
| 69 | error: leading irrefutable pattern in let chain | |
| 70 | --> $DIR/irrefutable-lets.rs:35:8 | |
| 71 | | | |
| 72 | LL | if let first = &opt && let None = Some(1) {} | |
| 73 | | ^^^^^^^^^^^^^^^^ | |
| 74 | | | |
| 75 | = note: this pattern will always match | |
| 76 | = help: consider moving it outside of the construct | |
| 77 | ||
| 78 | error: irrefutable `if let` guard patterns | |
| 79 | --> $DIR/irrefutable-lets.rs:44:28 | |
| 80 | | | |
| 81 | LL | Some(ref first) if let second = first && let _third = second && let v = 4 + 4 => {}, | |
| 82 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 83 | | | |
| 84 | = note: these patterns will always match, so the guard is useless | |
| 85 | = help: consider removing the guard and adding a `let` inside the match arm | |
| 86 | ||
| 87 | error: trailing irrefutable patterns in let chain | |
| 88 | --> $DIR/irrefutable-lets.rs:59:16 | |
| 89 | | | |
| 90 | LL | && let v = local_end && let w = v => {}, | |
| 91 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 92 | | | |
| 93 | = note: these patterns will always match | |
| 94 | = help: consider moving them into the body | |
| 95 | ||
| 96 | error: irrefutable `while let` patterns | |
| 97 | --> $DIR/irrefutable-lets.rs:68:11 | |
| 98 | | | |
| 99 | LL | while let first = &opt && let (a, b) = (1, 2) {} | |
| 100 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 101 | | | |
| 102 | = note: these patterns will always match, so the loop will never exit | |
| 103 | = help: consider instead using a `loop { ... }` with a `let` inside it | |
| 104 | ||
| 105 | error: trailing irrefutable patterns in let chain | |
| 106 | --> $DIR/irrefutable-lets.rs:71:40 | |
| 107 | | | |
| 108 | LL | while let Some(ref first) = opt && let second = first && let _third = second {} | |
| 109 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 110 | | | |
| 111 | = note: these patterns will always match | |
| 112 | = help: consider moving them into the body | |
| 113 | ||
| 114 | error: trailing irrefutable pattern in let chain | |
| 115 | --> $DIR/irrefutable-lets.rs:87:12 | |
| 116 | | | |
| 117 | LL | && let x = &opt | |
| 118 | | ^^^^^^^^^^^^ | |
| 119 | | | |
| 120 | = note: this pattern will always match | |
| 121 | = help: consider moving it into the body | |
| 122 | ||
| 123 | error: leading irrefutable pattern in let chain | |
| 124 | --> $DIR/irrefutable-lets.rs:93:12 | |
| 125 | | | |
| 126 | LL | if let x = opt.clone().map(|_| 1) | |
| 127 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 128 | | | |
| 129 | = note: this pattern will always match | |
| 130 | = help: consider moving it outside of the construct | |
| 131 | ||
| 132 | error: aborting due to 14 previous errors | |
| 133 |
tests/ui/rfcs/rfc-2497-if-let-chains/irrefutable-lets.rs+3-21| ... | ... | @@ -1,39 +1,27 @@ |
| 1 | //@ revisions: allowed disallowed | |
| 2 | //@[allowed] check-pass | |
| 1 | //@ check-pass | |
| 3 | 2 | //@ edition: 2024 |
| 4 | 3 | |
| 5 | #![cfg_attr(allowed, allow(irrefutable_let_patterns))] | |
| 6 | #![cfg_attr(disallowed, deny(irrefutable_let_patterns))] | |
| 7 | ||
| 8 | 4 | use std::ops::Range; |
| 9 | 5 | |
| 10 | 6 | fn main() { |
| 11 | 7 | let opt = Some(None..Some(1)); |
| 12 | 8 | |
| 13 | 9 | if let first = &opt && let Some(second) = first && let None = second.start {} |
| 14 | //[disallowed]~^ ERROR leading irrefutable pattern in let chain | |
| 15 | 10 | |
| 16 | 11 | // No lint as the irrefutable pattern is surrounded by other stuff |
| 17 | 12 | if 4 * 2 == 0 && let first = &opt && let Some(second) = first && let None = second.start {} |
| 18 | 13 | |
| 19 | 14 | if let first = &opt && let (a, b) = (1, 2) {} |
| 20 | //[disallowed]~^ ERROR irrefutable `if let` patterns | |
| 21 | 15 | |
| 22 | 16 | if let first = &opt && let Some(second) = first && let None = second.start && let v = 0 {} |
| 23 | //[disallowed]~^ ERROR leading irrefutable pattern in let chain | |
| 24 | //[disallowed]~^^ ERROR trailing irrefutable pattern in let chain | |
| 25 | 17 | |
| 26 | 18 | if let Some(ref first) = opt && let second = first && let _third = second {} |
| 27 | //[disallowed]~^ ERROR trailing irrefutable patterns in let chain | |
| 28 | 19 | |
| 29 | 20 | if let Range { start: local_start, end: _ } = (None..Some(1)) && let None = local_start {} |
| 30 | //[disallowed]~^ ERROR leading irrefutable pattern in let chain | |
| 31 | 21 | |
| 32 | 22 | if let (a, b, c) = (Some(1), Some(1), Some(1)) && let None = Some(1) {} |
| 33 | //[disallowed]~^ ERROR leading irrefutable pattern in let chain | |
| 34 | 23 | |
| 35 | 24 | if let first = &opt && let None = Some(1) {} |
| 36 | //[disallowed]~^ ERROR leading irrefutable pattern in let chain | |
| 37 | 25 | |
| 38 | 26 | if let Some(ref first) = opt |
| 39 | 27 | && let Range { start: local_start, end: _ } = first |
| ... | ... | @@ -42,7 +30,6 @@ fn main() { |
| 42 | 30 | |
| 43 | 31 | match opt { |
| 44 | 32 | Some(ref first) if let second = first && let _third = second && let v = 4 + 4 => {}, |
| 45 | //[disallowed]~^ ERROR irrefutable `if let` guard patterns | |
| 46 | 33 | _ => {} |
| 47 | 34 | } |
| 48 | 35 | |
| ... | ... | @@ -57,7 +44,6 @@ fn main() { |
| 57 | 44 | match opt { |
| 58 | 45 | Some(ref first) if let Range { start: Some(_), end: local_end } = first |
| 59 | 46 | && let v = local_end && let w = v => {}, |
| 60 | //[disallowed]~^ ERROR trailing irrefutable patterns in let chain | |
| 61 | 47 | _ => {} |
| 62 | 48 | } |
| 63 | 49 | |
| ... | ... | @@ -66,15 +52,13 @@ fn main() { |
| 66 | 52 | while let first = &opt && let Some(second) = first && let None = second.start {} |
| 67 | 53 | |
| 68 | 54 | while let first = &opt && let (a, b) = (1, 2) {} |
| 69 | //[disallowed]~^ ERROR irrefutable `while let` patterns | |
| 70 | 55 | |
| 71 | 56 | while let Some(ref first) = opt && let second = first && let _third = second {} |
| 72 | //[disallowed]~^ ERROR trailing irrefutable patterns in let chain | |
| 73 | 57 | |
| 74 | 58 | while let Some(ref first) = opt |
| 75 | 59 | && let Range { start: local_start, end: _ } = first |
| 76 | && let None = local_start { | |
| 77 | } | |
| 60 | && let None = local_start | |
| 61 | {} | |
| 78 | 62 | |
| 79 | 63 | // No error. An extra nesting level would be required for the `else if`. |
| 80 | 64 | if opt == Some(None..None) { |
| ... | ... | @@ -85,13 +69,11 @@ fn main() { |
| 85 | 69 | if opt == Some(None..None) { |
| 86 | 70 | } else if opt.is_some() |
| 87 | 71 | && let x = &opt |
| 88 | //[disallowed]~^ ERROR trailing irrefutable pattern in let chain | |
| 89 | 72 | {} |
| 90 | 73 | |
| 91 | 74 | if opt == Some(None..None) { |
| 92 | 75 | } else { |
| 93 | 76 | if let x = opt.clone().map(|_| 1) |
| 94 | //[disallowed]~^ ERROR leading irrefutable pattern in let chain | |
| 95 | 77 | && x == Some(1) |
| 96 | 78 | {} |
| 97 | 79 | } |
tests/ui/use/use-crate-self.rs+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | 1 | use crate::{self}; |
| 2 | //~^ ERROR crate root imports need to be explicitly named: `use crate as name;` | |
| 2 | //~^ ERROR imports need to be explicitly named | |
| 3 | 3 | |
| 4 | 4 | fn main() {} |
tests/ui/use/use-crate-self.stderr+6-1| ... | ... | @@ -1,8 +1,13 @@ |
| 1 | error: crate root imports need to be explicitly named: `use crate as name;` | |
| 1 | error: imports need to be explicitly named | |
| 2 | 2 | --> $DIR/use-crate-self.rs:1:13 |
| 3 | 3 | | |
| 4 | 4 | LL | use crate::{self}; |
| 5 | 5 | | ^^^^ |
| 6 | | | |
| 7 | help: try renaming it with a name | |
| 8 | | | |
| 9 | LL | use crate::{self as name}; | |
| 10 | | +++++++ | |
| 6 | 11 | |
| 7 | 12 | error: aborting due to 1 previous error |
| 8 | 13 |
tests/ui/use/use-keyword.rs+1-7| ... | ... | @@ -1,16 +1,10 @@ |
| 1 | // Check that imports with naked super and self don't fail during parsing | |
| 2 | // FIXME: this shouldn't fail during name resolution either | |
| 1 | //@ check-pass | |
| 3 | 2 | |
| 4 | 3 | mod a { |
| 5 | 4 | mod b { |
| 6 | 5 | use self as A; |
| 7 | //~^ ERROR `self` imports are only allowed within a { } list | |
| 8 | 6 | use super as B; |
| 9 | //~^ ERROR unresolved import `super` [E0432] | |
| 10 | //~| NOTE no `super` in the root | |
| 11 | 7 | use super::{self as C}; |
| 12 | //~^ ERROR unresolved import `super` [E0432] | |
| 13 | //~| NOTE no `super` in the root | |
| 14 | 8 | } |
| 15 | 9 | } |
| 16 | 10 |
tests/ui/use/use-keyword.stderr deleted-22| ... | ... | @@ -1,22 +0,0 @@ |
| 1 | error[E0429]: `self` imports are only allowed within a { } list | |
| 2 | --> $DIR/use-keyword.rs:6:13 | |
| 3 | | | |
| 4 | LL | use self as A; | |
| 5 | | ^^^^ | |
| 6 | ||
| 7 | error[E0432]: unresolved import `super` | |
| 8 | --> $DIR/use-keyword.rs:8:13 | |
| 9 | | | |
| 10 | LL | use super as B; | |
| 11 | | ^^^^^^^^^^ no `super` in the root | |
| 12 | ||
| 13 | error[E0432]: unresolved import `super` | |
| 14 | --> $DIR/use-keyword.rs:11:21 | |
| 15 | | | |
| 16 | LL | use super::{self as C}; | |
| 17 | | ^^^^^^^^^ no `super` in the root | |
| 18 | ||
| 19 | error: aborting due to 3 previous errors | |
| 20 | ||
| 21 | Some errors have detailed explanations: E0429, E0432. | |
| 22 | For more information about an error, try `rustc --explain E0429`. |
tests/ui/use/use-mod/use-mod-2.rs+2-4| ... | ... | @@ -1,11 +1,9 @@ |
| 1 | 1 | mod foo { |
| 2 | 2 | use self::{self}; |
| 3 | //~^ ERROR unresolved import `self` [E0432] | |
| 4 | //~| NOTE no `self` in the root | |
| 3 | //~^ ERROR imports need to be explicitly named | |
| 5 | 4 | |
| 6 | 5 | use super::{self}; |
| 7 | //~^ ERROR unresolved import `super` [E0432] | |
| 8 | //~| NOTE no `super` in the root | |
| 6 | //~^ ERROR imports need to be explicitly named | |
| 9 | 7 | } |
| 10 | 8 | |
| 11 | 9 | fn main() {} |
tests/ui/use/use-mod/use-mod-2.stderr+15-6| ... | ... | @@ -1,15 +1,24 @@ |
| 1 | error[E0432]: unresolved import `self` | |
| 1 | error: imports need to be explicitly named | |
| 2 | 2 | --> $DIR/use-mod-2.rs:2:16 |
| 3 | 3 | | |
| 4 | 4 | LL | use self::{self}; |
| 5 | | ^^^^ no `self` in the root | |
| 5 | | ^^^^ | |
| 6 | | | |
| 7 | help: try renaming it with a name | |
| 8 | | | |
| 9 | LL | use self::{self as name}; | |
| 10 | | +++++++ | |
| 6 | 11 | |
| 7 | error[E0432]: unresolved import `super` | |
| 8 | --> $DIR/use-mod-2.rs:6:17 | |
| 12 | error: imports need to be explicitly named | |
| 13 | --> $DIR/use-mod-2.rs:5:17 | |
| 9 | 14 | | |
| 10 | 15 | LL | use super::{self}; |
| 11 | | ^^^^ no `super` in the root | |
| 16 | | ^^^^ | |
| 17 | | | |
| 18 | help: try renaming it with a name | |
| 19 | | | |
| 20 | LL | use super::{self as name}; | |
| 21 | | +++++++ | |
| 12 | 22 | |
| 13 | 23 | error: aborting due to 2 previous errors |
| 14 | 24 | |
| 15 | For more information about this error, try `rustc --explain E0432`. |
tests/ui/use/use-mod/use-mod.rs+1-2| ... | ... | @@ -1,13 +1,12 @@ |
| 1 | 1 | use foo::bar::{ |
| 2 | 2 | self, |
| 3 | //~^ ERROR `self` import can only appear once in an import list | |
| 4 | 3 | Bar, |
| 5 | 4 | self |
| 6 | 5 | //~^ ERROR the name `bar` is defined multiple times |
| 7 | 6 | }; |
| 8 | 7 | |
| 9 | 8 | use {self}; |
| 10 | //~^ ERROR `self` import can only appear in an import list with a non-empty prefix | |
| 9 | //~^ ERROR imports need to be explicitly named | |
| 11 | 10 | |
| 12 | 11 | mod foo { |
| 13 | 12 | pub mod bar { |
tests/ui/use/use-mod/use-mod.stderr+12-17| ... | ... | @@ -1,24 +1,20 @@ |
| 1 | error[E0430]: `self` import can only appear once in an import list | |
| 2 | --> $DIR/use-mod.rs:2:5 | |
| 3 | | | |
| 4 | LL | self, | |
| 5 | | ^^^^ can only appear once in an import list | |
| 6 | ... | |
| 7 | LL | self | |
| 8 | | ---- another `self` import appears here | |
| 9 | ||
| 10 | error[E0431]: `self` import can only appear in an import list with a non-empty prefix | |
| 11 | --> $DIR/use-mod.rs:9:6 | |
| 1 | error: imports need to be explicitly named | |
| 2 | --> $DIR/use-mod.rs:8:6 | |
| 12 | 3 | | |
| 13 | 4 | LL | use {self}; |
| 14 | | ^^^^ can only appear in an import list with a non-empty prefix | |
| 5 | | ^^^^ | |
| 6 | | | |
| 7 | help: try renaming it with a name | |
| 8 | | | |
| 9 | LL | use {self as name}; | |
| 10 | | +++++++ | |
| 15 | 11 | |
| 16 | 12 | error[E0252]: the name `bar` is defined multiple times |
| 17 | --> $DIR/use-mod.rs:5:5 | |
| 13 | --> $DIR/use-mod.rs:4:5 | |
| 18 | 14 | | |
| 19 | 15 | LL | self, |
| 20 | 16 | | ---- previous import of the module `bar` here |
| 21 | ... | |
| 17 | LL | Bar, | |
| 22 | 18 | LL | self |
| 23 | 19 | | ^^^^ |
| 24 | 20 | | | |
| ... | ... | @@ -27,7 +23,6 @@ LL | self |
| 27 | 23 | | |
| 28 | 24 | = note: `bar` must be defined only once in the type namespace of this module |
| 29 | 25 | |
| 30 | error: aborting due to 3 previous errors | |
| 26 | error: aborting due to 2 previous errors | |
| 31 | 27 | |
| 32 | Some errors have detailed explanations: E0252, E0430, E0431. | |
| 33 | For more information about an error, try `rustc --explain E0252`. | |
| 28 | For more information about this error, try `rustc --explain E0252`. |
tests/ui/use/use-path-segment-kw.e2015.stderr created+1199| ... | ... | @@ -0,0 +1,1199 @@ |
| 1 | error: imports need to be explicitly named | |
| 2 | --> $DIR/use-path-segment-kw.rs:97:13 | |
| 3 | | | |
| 4 | LL | use crate; | |
| 5 | | ^^^^^ | |
| 6 | | | |
| 7 | help: try renaming it with a name | |
| 8 | | | |
| 9 | LL | use crate as name; | |
| 10 | | +++++++ | |
| 11 | ||
| 12 | error: `crate` in paths can only be used in start position | |
| 13 | --> $DIR/use-path-segment-kw.rs:101:15 | |
| 14 | | | |
| 15 | LL | use ::crate; | |
| 16 | | ^^^^^ | |
| 17 | ||
| 18 | error: `crate` in paths can only be used in start position | |
| 19 | --> $DIR/use-path-segment-kw.rs:102:15 | |
| 20 | | | |
| 21 | LL | use ::crate as _crate2; | |
| 22 | | ^^^^^ | |
| 23 | ||
| 24 | error: `crate` in paths can only be used in start position | |
| 25 | --> $DIR/use-path-segment-kw.rs:103:16 | |
| 26 | | | |
| 27 | LL | use ::{crate}; | |
| 28 | | ^^^^^ | |
| 29 | ||
| 30 | error: `crate` in paths can only be used in start position | |
| 31 | --> $DIR/use-path-segment-kw.rs:104:16 | |
| 32 | | | |
| 33 | LL | use ::{crate as _nested_crate2}; | |
| 34 | | ^^^^^ | |
| 35 | ||
| 36 | error: `crate` in paths can only be used in start position | |
| 37 | --> $DIR/use-path-segment-kw.rs:107:21 | |
| 38 | | | |
| 39 | LL | use foobar::crate; | |
| 40 | | ^^^^^ | |
| 41 | ||
| 42 | error: `crate` in paths can only be used in start position | |
| 43 | --> $DIR/use-path-segment-kw.rs:108:21 | |
| 44 | | | |
| 45 | LL | use foobar::crate as _crate3; | |
| 46 | | ^^^^^ | |
| 47 | ||
| 48 | error: `crate` in paths can only be used in start position | |
| 49 | --> $DIR/use-path-segment-kw.rs:109:22 | |
| 50 | | | |
| 51 | LL | use foobar::{crate}; | |
| 52 | | ^^^^^ | |
| 53 | ||
| 54 | error: `crate` in paths can only be used in start position | |
| 55 | --> $DIR/use-path-segment-kw.rs:110:22 | |
| 56 | | | |
| 57 | LL | use foobar::{crate as _nested_crate3}; | |
| 58 | | ^^^^^ | |
| 59 | ||
| 60 | error: `crate` in paths can only be used in start position | |
| 61 | --> $DIR/use-path-segment-kw.rs:113:20 | |
| 62 | | | |
| 63 | LL | use crate::crate; | |
| 64 | | ^^^^^ | |
| 65 | ||
| 66 | error: `crate` in paths can only be used in start position | |
| 67 | --> $DIR/use-path-segment-kw.rs:114:20 | |
| 68 | | | |
| 69 | LL | use crate::crate as _crate4; | |
| 70 | | ^^^^^ | |
| 71 | ||
| 72 | error: `crate` in paths can only be used in start position | |
| 73 | --> $DIR/use-path-segment-kw.rs:115:21 | |
| 74 | | | |
| 75 | LL | use crate::{crate}; | |
| 76 | | ^^^^^ | |
| 77 | ||
| 78 | error: `crate` in paths can only be used in start position | |
| 79 | --> $DIR/use-path-segment-kw.rs:116:21 | |
| 80 | | | |
| 81 | LL | use crate::{crate as _nested_crate4}; | |
| 82 | | ^^^^^ | |
| 83 | ||
| 84 | error: `crate` in paths can only be used in start position | |
| 85 | --> $DIR/use-path-segment-kw.rs:119:20 | |
| 86 | | | |
| 87 | LL | use super::crate; | |
| 88 | | ^^^^^ | |
| 89 | ||
| 90 | error: `crate` in paths can only be used in start position | |
| 91 | --> $DIR/use-path-segment-kw.rs:120:20 | |
| 92 | | | |
| 93 | LL | use super::crate as _crate5; | |
| 94 | | ^^^^^ | |
| 95 | ||
| 96 | error: `crate` in paths can only be used in start position | |
| 97 | --> $DIR/use-path-segment-kw.rs:121:21 | |
| 98 | | | |
| 99 | LL | use super::{crate}; | |
| 100 | | ^^^^^ | |
| 101 | ||
| 102 | error: `crate` in paths can only be used in start position | |
| 103 | --> $DIR/use-path-segment-kw.rs:122:21 | |
| 104 | | | |
| 105 | LL | use super::{crate as _nested_crate5}; | |
| 106 | | ^^^^^ | |
| 107 | ||
| 108 | error: `crate` in paths can only be used in start position | |
| 109 | --> $DIR/use-path-segment-kw.rs:125:19 | |
| 110 | | | |
| 111 | LL | use self::crate; | |
| 112 | | ^^^^^ | |
| 113 | ||
| 114 | error: `crate` in paths can only be used in start position | |
| 115 | --> $DIR/use-path-segment-kw.rs:126:19 | |
| 116 | | | |
| 117 | LL | use self::crate as _crate6; | |
| 118 | | ^^^^^ | |
| 119 | ||
| 120 | error: `crate` in paths can only be used in start position | |
| 121 | --> $DIR/use-path-segment-kw.rs:127:20 | |
| 122 | | | |
| 123 | LL | use self::{crate}; | |
| 124 | | ^^^^^ | |
| 125 | ||
| 126 | error: `crate` in paths can only be used in start position | |
| 127 | --> $DIR/use-path-segment-kw.rs:128:20 | |
| 128 | | | |
| 129 | LL | use self::{crate as _nested_crate6}; | |
| 130 | | ^^^^^ | |
| 131 | ||
| 132 | error: imports need to be explicitly named | |
| 133 | --> $DIR/use-path-segment-kw.rs:135:13 | |
| 134 | | | |
| 135 | LL | use super; | |
| 136 | | ^^^^^ | |
| 137 | | | |
| 138 | help: try renaming it with a name | |
| 139 | | | |
| 140 | LL | use super as name; | |
| 141 | | +++++++ | |
| 142 | ||
| 143 | error: `super` in paths can only be used in start position, after `self`, or after another `super` | |
| 144 | --> $DIR/use-path-segment-kw.rs:139:15 | |
| 145 | | | |
| 146 | LL | use ::super; | |
| 147 | | ^^^^^ | |
| 148 | ||
| 149 | error: `super` in paths can only be used in start position, after `self`, or after another `super` | |
| 150 | --> $DIR/use-path-segment-kw.rs:140:15 | |
| 151 | | | |
| 152 | LL | use ::super as _super2; | |
| 153 | | ^^^^^ | |
| 154 | ||
| 155 | error: `super` in paths can only be used in start position, after `self`, or after another `super` | |
| 156 | --> $DIR/use-path-segment-kw.rs:141:16 | |
| 157 | | | |
| 158 | LL | use ::{super}; | |
| 159 | | ^^^^^ | |
| 160 | ||
| 161 | error: `super` in paths can only be used in start position, after `self`, or after another `super` | |
| 162 | --> $DIR/use-path-segment-kw.rs:142:16 | |
| 163 | | | |
| 164 | LL | ... use ::{super as _nested_super2}; | |
| 165 | | ^^^^^ | |
| 166 | ||
| 167 | error: `super` in paths can only be used in start position, after `self`, or after another `super` | |
| 168 | --> $DIR/use-path-segment-kw.rs:145:21 | |
| 169 | | | |
| 170 | LL | use foobar::super; | |
| 171 | | ^^^^^ | |
| 172 | ||
| 173 | error: `super` in paths can only be used in start position, after `self`, or after another `super` | |
| 174 | --> $DIR/use-path-segment-kw.rs:146:21 | |
| 175 | | | |
| 176 | LL | ... use foobar::super as _super3; | |
| 177 | | ^^^^^ | |
| 178 | ||
| 179 | error: `super` in paths can only be used in start position, after `self`, or after another `super` | |
| 180 | --> $DIR/use-path-segment-kw.rs:147:22 | |
| 181 | | | |
| 182 | LL | use foobar::{super}; | |
| 183 | | ^^^^^ | |
| 184 | ||
| 185 | error: `super` in paths can only be used in start position, after `self`, or after another `super` | |
| 186 | --> $DIR/use-path-segment-kw.rs:148:22 | |
| 187 | | | |
| 188 | LL | ... use foobar::{super as _nested_super3}; | |
| 189 | | ^^^^^ | |
| 190 | ||
| 191 | error: `super` in paths can only be used in start position, after `self`, or after another `super` | |
| 192 | --> $DIR/use-path-segment-kw.rs:151:20 | |
| 193 | | | |
| 194 | LL | use crate::super; | |
| 195 | | ^^^^^ | |
| 196 | ||
| 197 | error: `super` in paths can only be used in start position, after `self`, or after another `super` | |
| 198 | --> $DIR/use-path-segment-kw.rs:152:20 | |
| 199 | | | |
| 200 | LL | ... use crate::super as _super4; | |
| 201 | | ^^^^^ | |
| 202 | ||
| 203 | error: `super` in paths can only be used in start position, after `self`, or after another `super` | |
| 204 | --> $DIR/use-path-segment-kw.rs:153:21 | |
| 205 | | | |
| 206 | LL | use crate::{super}; | |
| 207 | | ^^^^^ | |
| 208 | ||
| 209 | error: `super` in paths can only be used in start position, after `self`, or after another `super` | |
| 210 | --> $DIR/use-path-segment-kw.rs:154:21 | |
| 211 | | | |
| 212 | LL | ... use crate::{super as _nested_super4}; | |
| 213 | | ^^^^^ | |
| 214 | ||
| 215 | error: imports need to be explicitly named | |
| 216 | --> $DIR/use-path-segment-kw.rs:157:20 | |
| 217 | | | |
| 218 | LL | use super::super; | |
| 219 | | ^^^^^ | |
| 220 | | | |
| 221 | help: try renaming it with a name | |
| 222 | | | |
| 223 | LL | use super::super as name; | |
| 224 | | +++++++ | |
| 225 | ||
| 226 | error: imports need to be explicitly named | |
| 227 | --> $DIR/use-path-segment-kw.rs:159:21 | |
| 228 | | | |
| 229 | LL | use super::{super}; | |
| 230 | | ^^^^^ | |
| 231 | | | |
| 232 | help: try renaming it with a name | |
| 233 | | | |
| 234 | LL | use super::{super as name}; | |
| 235 | | +++++++ | |
| 236 | ||
| 237 | error: imports need to be explicitly named | |
| 238 | --> $DIR/use-path-segment-kw.rs:163:19 | |
| 239 | | | |
| 240 | LL | use self::super; | |
| 241 | | ^^^^^ | |
| 242 | | | |
| 243 | help: try renaming it with a name | |
| 244 | | | |
| 245 | LL | use self::super as name; | |
| 246 | | +++++++ | |
| 247 | ||
| 248 | error: imports need to be explicitly named | |
| 249 | --> $DIR/use-path-segment-kw.rs:165:20 | |
| 250 | | | |
| 251 | LL | use self::{super}; | |
| 252 | | ^^^^^ | |
| 253 | | | |
| 254 | help: try renaming it with a name | |
| 255 | | | |
| 256 | LL | use self::{super as name}; | |
| 257 | | +++++++ | |
| 258 | ||
| 259 | error: imports need to be explicitly named | |
| 260 | --> $DIR/use-path-segment-kw.rs:173:13 | |
| 261 | | | |
| 262 | LL | use self; | |
| 263 | | ^^^^ | |
| 264 | ||
| 265 | error[E0429]: `self` imports are only allowed within a { } list | |
| 266 | --> $DIR/use-path-segment-kw.rs:177:13 | |
| 267 | | | |
| 268 | LL | use ::self; | |
| 269 | | ^^^^^^ | |
| 270 | ||
| 271 | error: imports need to be explicitly named | |
| 272 | --> $DIR/use-path-segment-kw.rs:177:15 | |
| 273 | | | |
| 274 | LL | use ::self; | |
| 275 | | ^^^^ | |
| 276 | ||
| 277 | error[E0429]: `self` imports are only allowed within a { } list | |
| 278 | --> $DIR/use-path-segment-kw.rs:180:13 | |
| 279 | | | |
| 280 | LL | use ::self as _self2; | |
| 281 | | ^^^^^^ | |
| 282 | ||
| 283 | error: imports need to be explicitly named | |
| 284 | --> $DIR/use-path-segment-kw.rs:182:16 | |
| 285 | | | |
| 286 | LL | use ::{self}; | |
| 287 | | ^^^^ | |
| 288 | | | |
| 289 | help: try renaming it with a name | |
| 290 | | | |
| 291 | LL | use ::{self as name}; | |
| 292 | | +++++++ | |
| 293 | ||
| 294 | error[E0429]: `self` imports are only allowed within a { } list | |
| 295 | --> $DIR/use-path-segment-kw.rs:187:28 | |
| 296 | | | |
| 297 | LL | pub use foobar::qux::self; | |
| 298 | | ^^^^^^ | |
| 299 | | | |
| 300 | help: consider importing the module directly | |
| 301 | | | |
| 302 | LL - pub use foobar::qux::self; | |
| 303 | LL + pub use foobar::qux; | |
| 304 | | | |
| 305 | help: alternatively, use the multi-path `use` syntax to import `self` | |
| 306 | | | |
| 307 | LL | pub use foobar::qux::{self}; | |
| 308 | | + + | |
| 309 | ||
| 310 | error[E0429]: `self` imports are only allowed within a { } list | |
| 311 | --> $DIR/use-path-segment-kw.rs:189:23 | |
| 312 | | | |
| 313 | LL | pub use foobar::self as _self3; | |
| 314 | | ^^^^^^ | |
| 315 | | | |
| 316 | help: consider importing the module directly | |
| 317 | | | |
| 318 | LL - pub use foobar::self as _self3; | |
| 319 | LL + pub use foobar as _self3; | |
| 320 | | | |
| 321 | help: alternatively, use the multi-path `use` syntax to import `self` | |
| 322 | | | |
| 323 | LL | pub use foobar::{self as _self3}; | |
| 324 | | + + | |
| 325 | ||
| 326 | error[E0429]: `self` imports are only allowed within a { } list | |
| 327 | --> $DIR/use-path-segment-kw.rs:195:18 | |
| 328 | | | |
| 329 | LL | use crate::self; | |
| 330 | | ^^^^^^ | |
| 331 | | | |
| 332 | help: consider importing the module directly | |
| 333 | | | |
| 334 | LL - use crate::self; | |
| 335 | LL + use crate; | |
| 336 | | | |
| 337 | help: alternatively, use the multi-path `use` syntax to import `self` | |
| 338 | | | |
| 339 | LL | use crate::{self}; | |
| 340 | | + + | |
| 341 | ||
| 342 | error: imports need to be explicitly named | |
| 343 | --> $DIR/use-path-segment-kw.rs:195:20 | |
| 344 | | | |
| 345 | LL | use crate::self; | |
| 346 | | ^^^^ | |
| 347 | ||
| 348 | error[E0429]: `self` imports are only allowed within a { } list | |
| 349 | --> $DIR/use-path-segment-kw.rs:197:22 | |
| 350 | | | |
| 351 | LL | pub use crate::self as _self4; | |
| 352 | | ^^^^^^ | |
| 353 | | | |
| 354 | help: consider importing the module directly | |
| 355 | | | |
| 356 | LL - pub use crate::self as _self4; | |
| 357 | LL + pub use crate as _self4; | |
| 358 | | | |
| 359 | help: alternatively, use the multi-path `use` syntax to import `self` | |
| 360 | | | |
| 361 | LL | pub use crate::{self as _self4}; | |
| 362 | | + + | |
| 363 | ||
| 364 | error: imports need to be explicitly named | |
| 365 | --> $DIR/use-path-segment-kw.rs:198:21 | |
| 366 | | | |
| 367 | LL | use crate::{self}; | |
| 368 | | ^^^^ | |
| 369 | | | |
| 370 | help: try renaming it with a name | |
| 371 | | | |
| 372 | LL | use crate::{self as name}; | |
| 373 | | +++++++ | |
| 374 | ||
| 375 | error[E0429]: `self` imports are only allowed within a { } list | |
| 376 | --> $DIR/use-path-segment-kw.rs:202:18 | |
| 377 | | | |
| 378 | LL | use super::self; | |
| 379 | | ^^^^^^ | |
| 380 | | | |
| 381 | help: consider importing the module directly | |
| 382 | | | |
| 383 | LL - use super::self; | |
| 384 | LL + use super; | |
| 385 | | | |
| 386 | help: alternatively, use the multi-path `use` syntax to import `self` | |
| 387 | | | |
| 388 | LL | use super::{self}; | |
| 389 | | + + | |
| 390 | ||
| 391 | error: imports need to be explicitly named | |
| 392 | --> $DIR/use-path-segment-kw.rs:202:20 | |
| 393 | | | |
| 394 | LL | use super::self; | |
| 395 | | ^^^^ | |
| 396 | ||
| 397 | error[E0429]: `self` imports are only allowed within a { } list | |
| 398 | --> $DIR/use-path-segment-kw.rs:204:22 | |
| 399 | | | |
| 400 | LL | pub use super::self as _self5; | |
| 401 | | ^^^^^^ | |
| 402 | | | |
| 403 | help: consider importing the module directly | |
| 404 | | | |
| 405 | LL - pub use super::self as _self5; | |
| 406 | LL + pub use super as _self5; | |
| 407 | | | |
| 408 | help: alternatively, use the multi-path `use` syntax to import `self` | |
| 409 | | | |
| 410 | LL | pub use super::{self as _self5}; | |
| 411 | | + + | |
| 412 | ||
| 413 | error: imports need to be explicitly named | |
| 414 | --> $DIR/use-path-segment-kw.rs:205:21 | |
| 415 | | | |
| 416 | LL | use super::{self}; | |
| 417 | | ^^^^ | |
| 418 | | | |
| 419 | help: try renaming it with a name | |
| 420 | | | |
| 421 | LL | use super::{self as name}; | |
| 422 | | +++++++ | |
| 423 | ||
| 424 | error[E0429]: `self` imports are only allowed within a { } list | |
| 425 | --> $DIR/use-path-segment-kw.rs:209:17 | |
| 426 | | | |
| 427 | LL | use self::self; | |
| 428 | | ^^^^^^ | |
| 429 | | | |
| 430 | help: consider importing the module directly | |
| 431 | | | |
| 432 | LL - use self::self; | |
| 433 | LL + use self; | |
| 434 | | | |
| 435 | help: alternatively, use the multi-path `use` syntax to import `self` | |
| 436 | | | |
| 437 | LL | use self::{self}; | |
| 438 | | + + | |
| 439 | ||
| 440 | error: imports need to be explicitly named | |
| 441 | --> $DIR/use-path-segment-kw.rs:209:19 | |
| 442 | | | |
| 443 | LL | use self::self; | |
| 444 | | ^^^^ | |
| 445 | ||
| 446 | error[E0429]: `self` imports are only allowed within a { } list | |
| 447 | --> $DIR/use-path-segment-kw.rs:211:21 | |
| 448 | | | |
| 449 | LL | pub use self::self as _self6; | |
| 450 | | ^^^^^^ | |
| 451 | | | |
| 452 | help: consider importing the module directly | |
| 453 | | | |
| 454 | LL - pub use self::self as _self6; | |
| 455 | LL + pub use self as _self6; | |
| 456 | | | |
| 457 | help: alternatively, use the multi-path `use` syntax to import `self` | |
| 458 | | | |
| 459 | LL | pub use self::{self as _self6}; | |
| 460 | | + + | |
| 461 | ||
| 462 | error: imports need to be explicitly named | |
| 463 | --> $DIR/use-path-segment-kw.rs:212:20 | |
| 464 | | | |
| 465 | LL | use self::{self}; | |
| 466 | | ^^^^ | |
| 467 | | | |
| 468 | help: try renaming it with a name | |
| 469 | | | |
| 470 | LL | use self::{self as name}; | |
| 471 | | +++++++ | |
| 472 | ||
| 473 | error[E0429]: `self` imports are only allowed within a { } list | |
| 474 | --> $DIR/use-path-segment-kw.rs:216:28 | |
| 475 | | | |
| 476 | LL | use crate::foo::bar::self; | |
| 477 | | ^^^^^^ | |
| 478 | | | |
| 479 | help: consider importing the module directly | |
| 480 | | | |
| 481 | LL - use crate::foo::bar::self; | |
| 482 | LL + use crate::foo::bar; | |
| 483 | | | |
| 484 | help: alternatively, use the multi-path `use` syntax to import `self` | |
| 485 | | | |
| 486 | LL | use crate::foo::bar::{self}; | |
| 487 | | + + | |
| 488 | ||
| 489 | error[E0429]: `self` imports are only allowed within a { } list | |
| 490 | --> $DIR/use-path-segment-kw.rs:217:28 | |
| 491 | | | |
| 492 | LL | use crate::foo::bar::self as _self7; | |
| 493 | | ^^^^^^ | |
| 494 | | | |
| 495 | help: consider importing the module directly | |
| 496 | | | |
| 497 | LL - use crate::foo::bar::self as _self7; | |
| 498 | LL + use crate::foo::bar as _self7; | |
| 499 | | | |
| 500 | help: alternatively, use the multi-path `use` syntax to import `self` | |
| 501 | | | |
| 502 | LL | use crate::foo::bar::{self as _self7}; | |
| 503 | | + + | |
| 504 | ||
| 505 | error: imports need to be explicitly named | |
| 506 | --> $DIR/use-path-segment-kw.rs:11:13 | |
| 507 | | | |
| 508 | LL | use $crate; | |
| 509 | | ^^^^^^ | |
| 510 | ... | |
| 511 | LL | macro_dollar_crate!(); | |
| 512 | | --------------------- in this macro invocation | |
| 513 | | | |
| 514 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 515 | help: try renaming it with a name | |
| 516 | | | |
| 517 | LL | use $crate as name; | |
| 518 | | +++++++ | |
| 519 | ||
| 520 | error: `$crate` in paths can only be used in start position | |
| 521 | --> $DIR/use-path-segment-kw.rs:15:15 | |
| 522 | | | |
| 523 | LL | use ::$crate; | |
| 524 | | ^^^^^^ | |
| 525 | ... | |
| 526 | LL | macro_dollar_crate!(); | |
| 527 | | --------------------- in this macro invocation | |
| 528 | | | |
| 529 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 530 | ||
| 531 | error: `$crate` in paths can only be used in start position | |
| 532 | --> $DIR/use-path-segment-kw.rs:16:15 | |
| 533 | | | |
| 534 | LL | use ::$crate as _dollar_crate2; | |
| 535 | | ^^^^^^ | |
| 536 | ... | |
| 537 | LL | macro_dollar_crate!(); | |
| 538 | | --------------------- in this macro invocation | |
| 539 | | | |
| 540 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 541 | ||
| 542 | error: `$crate` in paths can only be used in start position | |
| 543 | --> $DIR/use-path-segment-kw.rs:17:16 | |
| 544 | | | |
| 545 | LL | use ::{$crate}; | |
| 546 | | ^^^^^^ | |
| 547 | ... | |
| 548 | LL | macro_dollar_crate!(); | |
| 549 | | --------------------- in this macro invocation | |
| 550 | | | |
| 551 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 552 | ||
| 553 | error: `$crate` in paths can only be used in start position | |
| 554 | --> $DIR/use-path-segment-kw.rs:18:16 | |
| 555 | | | |
| 556 | LL | use ::{$crate as _nested_dollar_crate2}; | |
| 557 | | ^^^^^^ | |
| 558 | ... | |
| 559 | LL | macro_dollar_crate!(); | |
| 560 | | --------------------- in this macro invocation | |
| 561 | | | |
| 562 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 563 | ||
| 564 | error: `$crate` in paths can only be used in start position | |
| 565 | --> $DIR/use-path-segment-kw.rs:21:21 | |
| 566 | | | |
| 567 | LL | use foobar::$crate; | |
| 568 | | ^^^^^^ | |
| 569 | ... | |
| 570 | LL | macro_dollar_crate!(); | |
| 571 | | --------------------- in this macro invocation | |
| 572 | | | |
| 573 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 574 | ||
| 575 | error: `$crate` in paths can only be used in start position | |
| 576 | --> $DIR/use-path-segment-kw.rs:22:21 | |
| 577 | | | |
| 578 | LL | use foobar::$crate as _dollar_crate3; | |
| 579 | | ^^^^^^ | |
| 580 | ... | |
| 581 | LL | macro_dollar_crate!(); | |
| 582 | | --------------------- in this macro invocation | |
| 583 | | | |
| 584 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 585 | ||
| 586 | error: `$crate` in paths can only be used in start position | |
| 587 | --> $DIR/use-path-segment-kw.rs:23:22 | |
| 588 | | | |
| 589 | LL | use foobar::{$crate}; | |
| 590 | | ^^^^^^ | |
| 591 | ... | |
| 592 | LL | macro_dollar_crate!(); | |
| 593 | | --------------------- in this macro invocation | |
| 594 | | | |
| 595 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 596 | ||
| 597 | error: `$crate` in paths can only be used in start position | |
| 598 | --> $DIR/use-path-segment-kw.rs:24:22 | |
| 599 | | | |
| 600 | LL | use foobar::{$crate as _nested_dollar_crate3}; | |
| 601 | | ^^^^^^ | |
| 602 | ... | |
| 603 | LL | macro_dollar_crate!(); | |
| 604 | | --------------------- in this macro invocation | |
| 605 | | | |
| 606 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 607 | ||
| 608 | error: `$crate` in paths can only be used in start position | |
| 609 | --> $DIR/use-path-segment-kw.rs:27:20 | |
| 610 | | | |
| 611 | LL | use crate::$crate; | |
| 612 | | ^^^^^^ | |
| 613 | ... | |
| 614 | LL | macro_dollar_crate!(); | |
| 615 | | --------------------- in this macro invocation | |
| 616 | | | |
| 617 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 618 | ||
| 619 | error: `$crate` in paths can only be used in start position | |
| 620 | --> $DIR/use-path-segment-kw.rs:28:20 | |
| 621 | | | |
| 622 | LL | use crate::$crate as _dollar_crate4; | |
| 623 | | ^^^^^^ | |
| 624 | ... | |
| 625 | LL | macro_dollar_crate!(); | |
| 626 | | --------------------- in this macro invocation | |
| 627 | | | |
| 628 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 629 | ||
| 630 | error: `$crate` in paths can only be used in start position | |
| 631 | --> $DIR/use-path-segment-kw.rs:29:21 | |
| 632 | | | |
| 633 | LL | use crate::{$crate}; | |
| 634 | | ^^^^^^ | |
| 635 | ... | |
| 636 | LL | macro_dollar_crate!(); | |
| 637 | | --------------------- in this macro invocation | |
| 638 | | | |
| 639 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 640 | ||
| 641 | error: `$crate` in paths can only be used in start position | |
| 642 | --> $DIR/use-path-segment-kw.rs:30:21 | |
| 643 | | | |
| 644 | LL | use crate::{$crate as _nested_dollar_crate4}; | |
| 645 | | ^^^^^^ | |
| 646 | ... | |
| 647 | LL | macro_dollar_crate!(); | |
| 648 | | --------------------- in this macro invocation | |
| 649 | | | |
| 650 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 651 | ||
| 652 | error: `$crate` in paths can only be used in start position | |
| 653 | --> $DIR/use-path-segment-kw.rs:33:20 | |
| 654 | | | |
| 655 | LL | use super::$crate; | |
| 656 | | ^^^^^^ | |
| 657 | ... | |
| 658 | LL | macro_dollar_crate!(); | |
| 659 | | --------------------- in this macro invocation | |
| 660 | | | |
| 661 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 662 | ||
| 663 | error: `$crate` in paths can only be used in start position | |
| 664 | --> $DIR/use-path-segment-kw.rs:34:20 | |
| 665 | | | |
| 666 | LL | use super::$crate as _dollar_crate5; | |
| 667 | | ^^^^^^ | |
| 668 | ... | |
| 669 | LL | macro_dollar_crate!(); | |
| 670 | | --------------------- in this macro invocation | |
| 671 | | | |
| 672 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 673 | ||
| 674 | error: `$crate` in paths can only be used in start position | |
| 675 | --> $DIR/use-path-segment-kw.rs:35:21 | |
| 676 | | | |
| 677 | LL | use super::{$crate}; | |
| 678 | | ^^^^^^ | |
| 679 | ... | |
| 680 | LL | macro_dollar_crate!(); | |
| 681 | | --------------------- in this macro invocation | |
| 682 | | | |
| 683 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 684 | ||
| 685 | error: `$crate` in paths can only be used in start position | |
| 686 | --> $DIR/use-path-segment-kw.rs:36:21 | |
| 687 | | | |
| 688 | LL | use super::{$crate as _nested_dollar_crate5}; | |
| 689 | | ^^^^^^ | |
| 690 | ... | |
| 691 | LL | macro_dollar_crate!(); | |
| 692 | | --------------------- in this macro invocation | |
| 693 | | | |
| 694 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 695 | ||
| 696 | error: `$crate` in paths can only be used in start position | |
| 697 | --> $DIR/use-path-segment-kw.rs:39:19 | |
| 698 | | | |
| 699 | LL | use self::$crate; | |
| 700 | | ^^^^^^ | |
| 701 | ... | |
| 702 | LL | macro_dollar_crate!(); | |
| 703 | | --------------------- in this macro invocation | |
| 704 | | | |
| 705 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 706 | ||
| 707 | error: `$crate` in paths can only be used in start position | |
| 708 | --> $DIR/use-path-segment-kw.rs:40:19 | |
| 709 | | | |
| 710 | LL | use self::$crate as _dollar_crate6; | |
| 711 | | ^^^^^^ | |
| 712 | ... | |
| 713 | LL | macro_dollar_crate!(); | |
| 714 | | --------------------- in this macro invocation | |
| 715 | | | |
| 716 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 717 | ||
| 718 | error: `$crate` in paths can only be used in start position | |
| 719 | --> $DIR/use-path-segment-kw.rs:41:20 | |
| 720 | | | |
| 721 | LL | use self::{$crate}; | |
| 722 | | ^^^^^^ | |
| 723 | ... | |
| 724 | LL | macro_dollar_crate!(); | |
| 725 | | --------------------- in this macro invocation | |
| 726 | | | |
| 727 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 728 | ||
| 729 | error: `$crate` in paths can only be used in start position | |
| 730 | --> $DIR/use-path-segment-kw.rs:42:20 | |
| 731 | | | |
| 732 | LL | use self::{$crate as _nested_dollar_crate6}; | |
| 733 | | ^^^^^^ | |
| 734 | ... | |
| 735 | LL | macro_dollar_crate!(); | |
| 736 | | --------------------- in this macro invocation | |
| 737 | | | |
| 738 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 739 | ||
| 740 | error: `$crate` in paths can only be used in start position | |
| 741 | --> $DIR/use-path-segment-kw.rs:45:21 | |
| 742 | | | |
| 743 | LL | use $crate::$crate; | |
| 744 | | ^^^^^^ | |
| 745 | ... | |
| 746 | LL | macro_dollar_crate!(); | |
| 747 | | --------------------- in this macro invocation | |
| 748 | | | |
| 749 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 750 | ||
| 751 | error: `$crate` in paths can only be used in start position | |
| 752 | --> $DIR/use-path-segment-kw.rs:46:21 | |
| 753 | | | |
| 754 | LL | use $crate::$crate as _dollar_crate7; | |
| 755 | | ^^^^^^ | |
| 756 | ... | |
| 757 | LL | macro_dollar_crate!(); | |
| 758 | | --------------------- in this macro invocation | |
| 759 | | | |
| 760 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 761 | ||
| 762 | error: `$crate` in paths can only be used in start position | |
| 763 | --> $DIR/use-path-segment-kw.rs:47:22 | |
| 764 | | | |
| 765 | LL | use $crate::{$crate}; | |
| 766 | | ^^^^^^ | |
| 767 | ... | |
| 768 | LL | macro_dollar_crate!(); | |
| 769 | | --------------------- in this macro invocation | |
| 770 | | | |
| 771 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 772 | ||
| 773 | error: `$crate` in paths can only be used in start position | |
| 774 | --> $DIR/use-path-segment-kw.rs:48:22 | |
| 775 | | | |
| 776 | LL | use $crate::{$crate as _nested_dollar_crate7}; | |
| 777 | | ^^^^^^ | |
| 778 | ... | |
| 779 | LL | macro_dollar_crate!(); | |
| 780 | | --------------------- in this macro invocation | |
| 781 | | | |
| 782 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 783 | ||
| 784 | error: `crate` in paths can only be used in start position | |
| 785 | --> $DIR/use-path-segment-kw.rs:51:21 | |
| 786 | | | |
| 787 | LL | use $crate::crate; | |
| 788 | | ^^^^^ | |
| 789 | ... | |
| 790 | LL | macro_dollar_crate!(); | |
| 791 | | --------------------- in this macro invocation | |
| 792 | | | |
| 793 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 794 | ||
| 795 | error: `crate` in paths can only be used in start position | |
| 796 | --> $DIR/use-path-segment-kw.rs:52:21 | |
| 797 | | | |
| 798 | LL | use $crate::crate as _m_crate8; | |
| 799 | | ^^^^^ | |
| 800 | ... | |
| 801 | LL | macro_dollar_crate!(); | |
| 802 | | --------------------- in this macro invocation | |
| 803 | | | |
| 804 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 805 | ||
| 806 | error: `crate` in paths can only be used in start position | |
| 807 | --> $DIR/use-path-segment-kw.rs:53:22 | |
| 808 | | | |
| 809 | LL | use $crate::{crate}; | |
| 810 | | ^^^^^ | |
| 811 | ... | |
| 812 | LL | macro_dollar_crate!(); | |
| 813 | | --------------------- in this macro invocation | |
| 814 | | | |
| 815 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 816 | ||
| 817 | error: `crate` in paths can only be used in start position | |
| 818 | --> $DIR/use-path-segment-kw.rs:54:22 | |
| 819 | | | |
| 820 | LL | use $crate::{crate as _m_nested_crate8}; | |
| 821 | | ^^^^^ | |
| 822 | ... | |
| 823 | LL | macro_dollar_crate!(); | |
| 824 | | --------------------- in this macro invocation | |
| 825 | | | |
| 826 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 827 | ||
| 828 | error: `super` in paths can only be used in start position, after `self`, or after another `super` | |
| 829 | --> $DIR/use-path-segment-kw.rs:57:21 | |
| 830 | | | |
| 831 | LL | use $crate::super; | |
| 832 | | ^^^^^ | |
| 833 | ... | |
| 834 | LL | macro_dollar_crate!(); | |
| 835 | | --------------------- in this macro invocation | |
| 836 | | | |
| 837 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 838 | ||
| 839 | error: `super` in paths can only be used in start position, after `self`, or after another `super` | |
| 840 | --> $DIR/use-path-segment-kw.rs:58:21 | |
| 841 | | | |
| 842 | LL | ... use $crate::super as _m_super8; | |
| 843 | | ^^^^^ | |
| 844 | ... | |
| 845 | LL | ... macro_dollar_crate!(); | |
| 846 | | --------------------- in this macro invocation | |
| 847 | | | |
| 848 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 849 | ||
| 850 | error: `super` in paths can only be used in start position, after `self`, or after another `super` | |
| 851 | --> $DIR/use-path-segment-kw.rs:59:22 | |
| 852 | | | |
| 853 | LL | use $crate::{super}; | |
| 854 | | ^^^^^ | |
| 855 | ... | |
| 856 | LL | macro_dollar_crate!(); | |
| 857 | | --------------------- in this macro invocation | |
| 858 | | | |
| 859 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 860 | ||
| 861 | error: `super` in paths can only be used in start position, after `self`, or after another `super` | |
| 862 | --> $DIR/use-path-segment-kw.rs:60:22 | |
| 863 | | | |
| 864 | LL | ... use $crate::{super as _m_nested_super8}; | |
| 865 | | ^^^^^ | |
| 866 | ... | |
| 867 | LL | ... macro_dollar_crate!(); | |
| 868 | | --------------------- in this macro invocation | |
| 869 | | | |
| 870 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 871 | ||
| 872 | error[E0429]: `self` imports are only allowed within a { } list | |
| 873 | --> $DIR/use-path-segment-kw.rs:63:19 | |
| 874 | | | |
| 875 | LL | use $crate::self; | |
| 876 | | ^^^^^^ | |
| 877 | ... | |
| 878 | LL | macro_dollar_crate!(); | |
| 879 | | --------------------- in this macro invocation | |
| 880 | | | |
| 881 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 882 | help: consider importing the module directly | |
| 883 | | | |
| 884 | LL - use $crate::self; | |
| 885 | LL + use $crate; | |
| 886 | | | |
| 887 | help: alternatively, use the multi-path `use` syntax to import `self` | |
| 888 | | | |
| 889 | LL | use $crate::{self}; | |
| 890 | | + + | |
| 891 | ||
| 892 | error: imports need to be explicitly named | |
| 893 | --> $DIR/use-path-segment-kw.rs:63:21 | |
| 894 | | | |
| 895 | LL | use $crate::self; | |
| 896 | | ^^^^ | |
| 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[E0429]: `self` imports are only allowed within a { } list | |
| 904 | --> $DIR/use-path-segment-kw.rs:65:23 | |
| 905 | | | |
| 906 | LL | pub use $crate::self as _m_self8; | |
| 907 | | ^^^^^^ | |
| 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 | help: consider importing the module directly | |
| 914 | | | |
| 915 | LL - pub use $crate::self as _m_self8; | |
| 916 | LL + pub use $crate as _m_self8; | |
| 917 | | | |
| 918 | help: alternatively, use the multi-path `use` syntax to import `self` | |
| 919 | | | |
| 920 | LL | pub use $crate::{self as _m_self8}; | |
| 921 | | + + | |
| 922 | ||
| 923 | error: imports need to be explicitly named | |
| 924 | --> $DIR/use-path-segment-kw.rs:66:22 | |
| 925 | | | |
| 926 | LL | use $crate::{self}; | |
| 927 | | ^^^^ | |
| 928 | ... | |
| 929 | LL | macro_dollar_crate!(); | |
| 930 | | --------------------- in this macro invocation | |
| 931 | | | |
| 932 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 933 | help: try renaming it with a name | |
| 934 | | | |
| 935 | LL | use $crate::{self as name}; | |
| 936 | | +++++++ | |
| 937 | ||
| 938 | error[E0432]: unresolved import `foobar` | |
| 939 | --> $DIR/use-path-segment-kw.rs:187:17 | |
| 940 | | | |
| 941 | LL | pub use foobar::qux::self; | |
| 942 | | ^^^^^^ | |
| 943 | | | |
| 944 | help: a similar path exists | |
| 945 | | | |
| 946 | LL | pub use self::foobar::qux::self; | |
| 947 | | ++++++ | |
| 948 | ||
| 949 | error[E0432]: unresolved import `foobar` | |
| 950 | --> $DIR/use-path-segment-kw.rs:189:17 | |
| 951 | | | |
| 952 | LL | pub use foobar::self as _self3; | |
| 953 | | ^^^^^^^^^^^^^^^^^^^^^^ no `foobar` in the root | |
| 954 | ||
| 955 | error[E0432]: unresolved import `foobar` | |
| 956 | --> $DIR/use-path-segment-kw.rs:191:17 | |
| 957 | | | |
| 958 | LL | pub use foobar::baz::{self}; | |
| 959 | | ^^^^^^ | |
| 960 | | | |
| 961 | help: a similar path exists | |
| 962 | | | |
| 963 | LL | pub use self::foobar::baz::{self}; | |
| 964 | | ++++++ | |
| 965 | ||
| 966 | error[E0432]: unresolved import `foobar` | |
| 967 | --> $DIR/use-path-segment-kw.rs:192:26 | |
| 968 | | | |
| 969 | LL | pub use foobar::{self as _nested_self3}; | |
| 970 | | ^^^^^^^^^^^^^^^^^^^^^ no `foobar` in the root | |
| 971 | ||
| 972 | error[E0433]: `self` in paths can only be used in start position | |
| 973 | --> $DIR/use-path-segment-kw.rs:215:36 | |
| 974 | | | |
| 975 | LL | type D7 = crate::foo::bar::self; | |
| 976 | | ^^^^ can only be used in path start position | |
| 977 | ||
| 978 | error[E0573]: expected type, found module `$crate` | |
| 979 | --> $DIR/use-path-segment-kw.rs:10:19 | |
| 980 | | | |
| 981 | LL | type A1 = $crate; | |
| 982 | | ^^^^^^ not a type | |
| 983 | ... | |
| 984 | LL | macro_dollar_crate!(); | |
| 985 | | --------------------- in this macro invocation | |
| 986 | | | |
| 987 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 988 | ||
| 989 | error[E0573]: expected type, found module `crate` | |
| 990 | --> $DIR/use-path-segment-kw.rs:96:19 | |
| 991 | | | |
| 992 | LL | type B1 = crate; | |
| 993 | | ^^^^^ not a type | |
| 994 | ||
| 995 | error[E0573]: expected type, found module `super` | |
| 996 | --> $DIR/use-path-segment-kw.rs:134:19 | |
| 997 | | | |
| 998 | LL | type C1 = super; | |
| 999 | | ^^^^^ not a type | |
| 1000 | ||
| 1001 | error[E0573]: expected type, found module `super::super` | |
| 1002 | --> $DIR/use-path-segment-kw.rs:156:19 | |
| 1003 | | | |
| 1004 | LL | type C5 = super::super; | |
| 1005 | | ^^^^^^^^^^^^ not a type | |
| 1006 | ||
| 1007 | error[E0573]: expected type, found module `self::super` | |
| 1008 | --> $DIR/use-path-segment-kw.rs:162:19 | |
| 1009 | | | |
| 1010 | LL | type C6 = self::super; | |
| 1011 | | ^^^^^^^^^^^ not a type | |
| 1012 | ||
| 1013 | error[E0573]: expected type, found module `self` | |
| 1014 | --> $DIR/use-path-segment-kw.rs:172:19 | |
| 1015 | | | |
| 1016 | LL | type D1 = self; | |
| 1017 | | ^^^^ not a type | |
| 1018 | ||
| 1019 | error[E0433]: global paths cannot start with `$crate` | |
| 1020 | --> $DIR/use-path-segment-kw.rs:14:21 | |
| 1021 | | | |
| 1022 | LL | type A2 = ::$crate; | |
| 1023 | | ^^^^^^ cannot start with this | |
| 1024 | ... | |
| 1025 | LL | macro_dollar_crate!(); | |
| 1026 | | --------------------- in this macro invocation | |
| 1027 | | | |
| 1028 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 1029 | ||
| 1030 | error[E0433]: `$crate` in paths can only be used in start position | |
| 1031 | --> $DIR/use-path-segment-kw.rs:20:27 | |
| 1032 | | | |
| 1033 | LL | type A3 = foobar::$crate; | |
| 1034 | | ^^^^^^ can only be used in path start position | |
| 1035 | ... | |
| 1036 | LL | macro_dollar_crate!(); | |
| 1037 | | --------------------- in this macro invocation | |
| 1038 | | | |
| 1039 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 1040 | ||
| 1041 | error[E0433]: `$crate` in paths can only be used in start position | |
| 1042 | --> $DIR/use-path-segment-kw.rs:26:26 | |
| 1043 | | | |
| 1044 | LL | type A4 = crate::$crate; | |
| 1045 | | ^^^^^^ can only be used in path start position | |
| 1046 | ... | |
| 1047 | LL | macro_dollar_crate!(); | |
| 1048 | | --------------------- in this macro invocation | |
| 1049 | | | |
| 1050 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 1051 | ||
| 1052 | error[E0433]: `$crate` in paths can only be used in start position | |
| 1053 | --> $DIR/use-path-segment-kw.rs:32:26 | |
| 1054 | | | |
| 1055 | LL | type A5 = super::$crate; | |
| 1056 | | ^^^^^^ can only be used in path start position | |
| 1057 | ... | |
| 1058 | LL | macro_dollar_crate!(); | |
| 1059 | | --------------------- in this macro invocation | |
| 1060 | | | |
| 1061 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 1062 | ||
| 1063 | error[E0433]: `$crate` in paths can only be used in start position | |
| 1064 | --> $DIR/use-path-segment-kw.rs:38:25 | |
| 1065 | | | |
| 1066 | LL | type A6 = self::$crate; | |
| 1067 | | ^^^^^^ can only be used in path start position | |
| 1068 | ... | |
| 1069 | LL | macro_dollar_crate!(); | |
| 1070 | | --------------------- in this macro invocation | |
| 1071 | | | |
| 1072 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 1073 | ||
| 1074 | error[E0433]: `$crate` in paths can only be used in start position | |
| 1075 | --> $DIR/use-path-segment-kw.rs:44:27 | |
| 1076 | | | |
| 1077 | LL | type A7 = $crate::$crate; | |
| 1078 | | ^^^^^^ can only be used in path start position | |
| 1079 | ... | |
| 1080 | LL | macro_dollar_crate!(); | |
| 1081 | | --------------------- in this macro invocation | |
| 1082 | | | |
| 1083 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 1084 | ||
| 1085 | error[E0433]: `crate` in paths can only be used in start position | |
| 1086 | --> $DIR/use-path-segment-kw.rs:50:27 | |
| 1087 | | | |
| 1088 | LL | type A8 = $crate::crate; | |
| 1089 | | ^^^^^ can only be used in path start position | |
| 1090 | ... | |
| 1091 | LL | macro_dollar_crate!(); | |
| 1092 | | --------------------- in this macro invocation | |
| 1093 | | | |
| 1094 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 1095 | ||
| 1096 | error[E0433]: `super` in paths can only be used in start position | |
| 1097 | --> $DIR/use-path-segment-kw.rs:56:27 | |
| 1098 | | | |
| 1099 | LL | type A9 = $crate::super; | |
| 1100 | | ^^^^^ can only be used in path start position | |
| 1101 | ... | |
| 1102 | LL | macro_dollar_crate!(); | |
| 1103 | | --------------------- in this macro invocation | |
| 1104 | | | |
| 1105 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 1106 | ||
| 1107 | error[E0433]: `self` in paths can only be used in start position | |
| 1108 | --> $DIR/use-path-segment-kw.rs:62:28 | |
| 1109 | | | |
| 1110 | LL | type A10 = $crate::self; | |
| 1111 | | ^^^^ can only be used in path start position | |
| 1112 | ... | |
| 1113 | LL | macro_dollar_crate!(); | |
| 1114 | | --------------------- in this macro invocation | |
| 1115 | | | |
| 1116 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 1117 | ||
| 1118 | error[E0433]: global paths cannot start with `crate` | |
| 1119 | --> $DIR/use-path-segment-kw.rs:100:21 | |
| 1120 | | | |
| 1121 | LL | type B2 = ::crate; | |
| 1122 | | ^^^^^ cannot start with this | |
| 1123 | ||
| 1124 | error[E0433]: `crate` in paths can only be used in start position | |
| 1125 | --> $DIR/use-path-segment-kw.rs:106:27 | |
| 1126 | | | |
| 1127 | LL | type B3 = foobar::crate; | |
| 1128 | | ^^^^^ can only be used in path start position | |
| 1129 | ||
| 1130 | error[E0433]: `crate` in paths can only be used in start position | |
| 1131 | --> $DIR/use-path-segment-kw.rs:112:26 | |
| 1132 | | | |
| 1133 | LL | type B4 = crate::crate; | |
| 1134 | | ^^^^^ can only be used in path start position | |
| 1135 | ||
| 1136 | error[E0433]: `crate` in paths can only be used in start position | |
| 1137 | --> $DIR/use-path-segment-kw.rs:118:26 | |
| 1138 | | | |
| 1139 | LL | type B5 = super::crate; | |
| 1140 | | ^^^^^ can only be used in path start position | |
| 1141 | ||
| 1142 | error[E0433]: `crate` in paths can only be used in start position | |
| 1143 | --> $DIR/use-path-segment-kw.rs:124:25 | |
| 1144 | | | |
| 1145 | LL | type B6 = self::crate; | |
| 1146 | | ^^^^^ can only be used in path start position | |
| 1147 | ||
| 1148 | error[E0433]: global paths cannot start with `super` | |
| 1149 | --> $DIR/use-path-segment-kw.rs:138:21 | |
| 1150 | | | |
| 1151 | LL | type C2 = ::super; | |
| 1152 | | ^^^^^ cannot start with this | |
| 1153 | ||
| 1154 | error[E0433]: `super` in paths can only be used in start position | |
| 1155 | --> $DIR/use-path-segment-kw.rs:144:27 | |
| 1156 | | | |
| 1157 | LL | type C3 = foobar::super; | |
| 1158 | | ^^^^^ can only be used in path start position | |
| 1159 | ||
| 1160 | error[E0433]: `super` in paths can only be used in start position | |
| 1161 | --> $DIR/use-path-segment-kw.rs:150:26 | |
| 1162 | | | |
| 1163 | LL | type C4 = crate::super; | |
| 1164 | | ^^^^^ can only be used in path start position | |
| 1165 | ||
| 1166 | error[E0433]: global paths cannot start with `self` | |
| 1167 | --> $DIR/use-path-segment-kw.rs:176:21 | |
| 1168 | | | |
| 1169 | LL | type D2 = ::self; | |
| 1170 | | ^^^^ cannot start with this | |
| 1171 | ||
| 1172 | error[E0433]: `self` in paths can only be used in start position | |
| 1173 | --> $DIR/use-path-segment-kw.rs:186:27 | |
| 1174 | | | |
| 1175 | LL | type D3 = foobar::self; | |
| 1176 | | ^^^^ can only be used in path start position | |
| 1177 | ||
| 1178 | error[E0433]: `self` in paths can only be used in start position | |
| 1179 | --> $DIR/use-path-segment-kw.rs:194:26 | |
| 1180 | | | |
| 1181 | LL | type D4 = crate::self; | |
| 1182 | | ^^^^ can only be used in path start position | |
| 1183 | ||
| 1184 | error[E0433]: `self` in paths can only be used in start position | |
| 1185 | --> $DIR/use-path-segment-kw.rs:201:26 | |
| 1186 | | | |
| 1187 | LL | type D5 = super::self; | |
| 1188 | | ^^^^ can only be used in path start position | |
| 1189 | ||
| 1190 | error[E0433]: `self` in paths can only be used in start position | |
| 1191 | --> $DIR/use-path-segment-kw.rs:208:25 | |
| 1192 | | | |
| 1193 | LL | type D6 = self::self; | |
| 1194 | | ^^^^ can only be used in path start position | |
| 1195 | ||
| 1196 | error: aborting due to 129 previous errors | |
| 1197 | ||
| 1198 | Some errors have detailed explanations: E0429, E0432, E0433, E0573. | |
| 1199 | For more information about an error, try `rustc --explain E0429`. |
tests/ui/use/use-path-segment-kw.e2018.stderr created+1166| ... | ... | @@ -0,0 +1,1166 @@ |
| 1 | error: imports need to be explicitly named | |
| 2 | --> $DIR/use-path-segment-kw.rs:97:13 | |
| 3 | | | |
| 4 | LL | use crate; | |
| 5 | | ^^^^^ | |
| 6 | | | |
| 7 | help: try renaming it with a name | |
| 8 | | | |
| 9 | LL | use crate as name; | |
| 10 | | +++++++ | |
| 11 | ||
| 12 | error: `crate` in paths can only be used in start position | |
| 13 | --> $DIR/use-path-segment-kw.rs:101:15 | |
| 14 | | | |
| 15 | LL | use ::crate; | |
| 16 | | ^^^^^ | |
| 17 | ||
| 18 | error: `crate` in paths can only be used in start position | |
| 19 | --> $DIR/use-path-segment-kw.rs:102:15 | |
| 20 | | | |
| 21 | LL | use ::crate as _crate2; | |
| 22 | | ^^^^^ | |
| 23 | ||
| 24 | error: `crate` in paths can only be used in start position | |
| 25 | --> $DIR/use-path-segment-kw.rs:103:16 | |
| 26 | | | |
| 27 | LL | use ::{crate}; | |
| 28 | | ^^^^^ | |
| 29 | ||
| 30 | error: `crate` in paths can only be used in start position | |
| 31 | --> $DIR/use-path-segment-kw.rs:104:16 | |
| 32 | | | |
| 33 | LL | use ::{crate as _nested_crate2}; | |
| 34 | | ^^^^^ | |
| 35 | ||
| 36 | error: `crate` in paths can only be used in start position | |
| 37 | --> $DIR/use-path-segment-kw.rs:107:21 | |
| 38 | | | |
| 39 | LL | use foobar::crate; | |
| 40 | | ^^^^^ | |
| 41 | ||
| 42 | error: `crate` in paths can only be used in start position | |
| 43 | --> $DIR/use-path-segment-kw.rs:108:21 | |
| 44 | | | |
| 45 | LL | use foobar::crate as _crate3; | |
| 46 | | ^^^^^ | |
| 47 | ||
| 48 | error: `crate` in paths can only be used in start position | |
| 49 | --> $DIR/use-path-segment-kw.rs:109:22 | |
| 50 | | | |
| 51 | LL | use foobar::{crate}; | |
| 52 | | ^^^^^ | |
| 53 | ||
| 54 | error: `crate` in paths can only be used in start position | |
| 55 | --> $DIR/use-path-segment-kw.rs:110:22 | |
| 56 | | | |
| 57 | LL | use foobar::{crate as _nested_crate3}; | |
| 58 | | ^^^^^ | |
| 59 | ||
| 60 | error: `crate` in paths can only be used in start position | |
| 61 | --> $DIR/use-path-segment-kw.rs:113:20 | |
| 62 | | | |
| 63 | LL | use crate::crate; | |
| 64 | | ^^^^^ | |
| 65 | ||
| 66 | error: `crate` in paths can only be used in start position | |
| 67 | --> $DIR/use-path-segment-kw.rs:114:20 | |
| 68 | | | |
| 69 | LL | use crate::crate as _crate4; | |
| 70 | | ^^^^^ | |
| 71 | ||
| 72 | error: `crate` in paths can only be used in start position | |
| 73 | --> $DIR/use-path-segment-kw.rs:115:21 | |
| 74 | | | |
| 75 | LL | use crate::{crate}; | |
| 76 | | ^^^^^ | |
| 77 | ||
| 78 | error: `crate` in paths can only be used in start position | |
| 79 | --> $DIR/use-path-segment-kw.rs:116:21 | |
| 80 | | | |
| 81 | LL | use crate::{crate as _nested_crate4}; | |
| 82 | | ^^^^^ | |
| 83 | ||
| 84 | error: `crate` in paths can only be used in start position | |
| 85 | --> $DIR/use-path-segment-kw.rs:119:20 | |
| 86 | | | |
| 87 | LL | use super::crate; | |
| 88 | | ^^^^^ | |
| 89 | ||
| 90 | error: `crate` in paths can only be used in start position | |
| 91 | --> $DIR/use-path-segment-kw.rs:120:20 | |
| 92 | | | |
| 93 | LL | use super::crate as _crate5; | |
| 94 | | ^^^^^ | |
| 95 | ||
| 96 | error: `crate` in paths can only be used in start position | |
| 97 | --> $DIR/use-path-segment-kw.rs:121:21 | |
| 98 | | | |
| 99 | LL | use super::{crate}; | |
| 100 | | ^^^^^ | |
| 101 | ||
| 102 | error: `crate` in paths can only be used in start position | |
| 103 | --> $DIR/use-path-segment-kw.rs:122:21 | |
| 104 | | | |
| 105 | LL | use super::{crate as _nested_crate5}; | |
| 106 | | ^^^^^ | |
| 107 | ||
| 108 | error: `crate` in paths can only be used in start position | |
| 109 | --> $DIR/use-path-segment-kw.rs:125:19 | |
| 110 | | | |
| 111 | LL | use self::crate; | |
| 112 | | ^^^^^ | |
| 113 | ||
| 114 | error: `crate` in paths can only be used in start position | |
| 115 | --> $DIR/use-path-segment-kw.rs:126:19 | |
| 116 | | | |
| 117 | LL | use self::crate as _crate6; | |
| 118 | | ^^^^^ | |
| 119 | ||
| 120 | error: `crate` in paths can only be used in start position | |
| 121 | --> $DIR/use-path-segment-kw.rs:127:20 | |
| 122 | | | |
| 123 | LL | use self::{crate}; | |
| 124 | | ^^^^^ | |
| 125 | ||
| 126 | error: `crate` in paths can only be used in start position | |
| 127 | --> $DIR/use-path-segment-kw.rs:128:20 | |
| 128 | | | |
| 129 | LL | use self::{crate as _nested_crate6}; | |
| 130 | | ^^^^^ | |
| 131 | ||
| 132 | error: imports need to be explicitly named | |
| 133 | --> $DIR/use-path-segment-kw.rs:135:13 | |
| 134 | | | |
| 135 | LL | use super; | |
| 136 | | ^^^^^ | |
| 137 | | | |
| 138 | help: try renaming it with a name | |
| 139 | | | |
| 140 | LL | use super as name; | |
| 141 | | +++++++ | |
| 142 | ||
| 143 | error: `super` in paths can only be used in start position, after `self`, or after another `super` | |
| 144 | --> $DIR/use-path-segment-kw.rs:139:15 | |
| 145 | | | |
| 146 | LL | use ::super; | |
| 147 | | ^^^^^ | |
| 148 | ||
| 149 | error: `super` in paths can only be used in start position, after `self`, or after another `super` | |
| 150 | --> $DIR/use-path-segment-kw.rs:140:15 | |
| 151 | | | |
| 152 | LL | use ::super as _super2; | |
| 153 | | ^^^^^ | |
| 154 | ||
| 155 | error: `super` in paths can only be used in start position, after `self`, or after another `super` | |
| 156 | --> $DIR/use-path-segment-kw.rs:141:16 | |
| 157 | | | |
| 158 | LL | use ::{super}; | |
| 159 | | ^^^^^ | |
| 160 | ||
| 161 | error: `super` in paths can only be used in start position, after `self`, or after another `super` | |
| 162 | --> $DIR/use-path-segment-kw.rs:142:16 | |
| 163 | | | |
| 164 | LL | ... use ::{super as _nested_super2}; | |
| 165 | | ^^^^^ | |
| 166 | ||
| 167 | error: `super` in paths can only be used in start position, after `self`, or after another `super` | |
| 168 | --> $DIR/use-path-segment-kw.rs:145:21 | |
| 169 | | | |
| 170 | LL | use foobar::super; | |
| 171 | | ^^^^^ | |
| 172 | ||
| 173 | error: `super` in paths can only be used in start position, after `self`, or after another `super` | |
| 174 | --> $DIR/use-path-segment-kw.rs:146:21 | |
| 175 | | | |
| 176 | LL | ... use foobar::super as _super3; | |
| 177 | | ^^^^^ | |
| 178 | ||
| 179 | error: `super` in paths can only be used in start position, after `self`, or after another `super` | |
| 180 | --> $DIR/use-path-segment-kw.rs:147:22 | |
| 181 | | | |
| 182 | LL | use foobar::{super}; | |
| 183 | | ^^^^^ | |
| 184 | ||
| 185 | error: `super` in paths can only be used in start position, after `self`, or after another `super` | |
| 186 | --> $DIR/use-path-segment-kw.rs:148:22 | |
| 187 | | | |
| 188 | LL | ... use foobar::{super as _nested_super3}; | |
| 189 | | ^^^^^ | |
| 190 | ||
| 191 | error: `super` in paths can only be used in start position, after `self`, or after another `super` | |
| 192 | --> $DIR/use-path-segment-kw.rs:151:20 | |
| 193 | | | |
| 194 | LL | use crate::super; | |
| 195 | | ^^^^^ | |
| 196 | ||
| 197 | error: `super` in paths can only be used in start position, after `self`, or after another `super` | |
| 198 | --> $DIR/use-path-segment-kw.rs:152:20 | |
| 199 | | | |
| 200 | LL | ... use crate::super as _super4; | |
| 201 | | ^^^^^ | |
| 202 | ||
| 203 | error: `super` in paths can only be used in start position, after `self`, or after another `super` | |
| 204 | --> $DIR/use-path-segment-kw.rs:153:21 | |
| 205 | | | |
| 206 | LL | use crate::{super}; | |
| 207 | | ^^^^^ | |
| 208 | ||
| 209 | error: `super` in paths can only be used in start position, after `self`, or after another `super` | |
| 210 | --> $DIR/use-path-segment-kw.rs:154:21 | |
| 211 | | | |
| 212 | LL | ... use crate::{super as _nested_super4}; | |
| 213 | | ^^^^^ | |
| 214 | ||
| 215 | error: imports need to be explicitly named | |
| 216 | --> $DIR/use-path-segment-kw.rs:157:20 | |
| 217 | | | |
| 218 | LL | use super::super; | |
| 219 | | ^^^^^ | |
| 220 | | | |
| 221 | help: try renaming it with a name | |
| 222 | | | |
| 223 | LL | use super::super as name; | |
| 224 | | +++++++ | |
| 225 | ||
| 226 | error: imports need to be explicitly named | |
| 227 | --> $DIR/use-path-segment-kw.rs:159:21 | |
| 228 | | | |
| 229 | LL | use super::{super}; | |
| 230 | | ^^^^^ | |
| 231 | | | |
| 232 | help: try renaming it with a name | |
| 233 | | | |
| 234 | LL | use super::{super as name}; | |
| 235 | | +++++++ | |
| 236 | ||
| 237 | error: imports need to be explicitly named | |
| 238 | --> $DIR/use-path-segment-kw.rs:163:19 | |
| 239 | | | |
| 240 | LL | use self::super; | |
| 241 | | ^^^^^ | |
| 242 | | | |
| 243 | help: try renaming it with a name | |
| 244 | | | |
| 245 | LL | use self::super as name; | |
| 246 | | +++++++ | |
| 247 | ||
| 248 | error: imports need to be explicitly named | |
| 249 | --> $DIR/use-path-segment-kw.rs:165:20 | |
| 250 | | | |
| 251 | LL | use self::{super}; | |
| 252 | | ^^^^^ | |
| 253 | | | |
| 254 | help: try renaming it with a name | |
| 255 | | | |
| 256 | LL | use self::{super as name}; | |
| 257 | | +++++++ | |
| 258 | ||
| 259 | error: imports need to be explicitly named | |
| 260 | --> $DIR/use-path-segment-kw.rs:173:13 | |
| 261 | | | |
| 262 | LL | use self; | |
| 263 | | ^^^^ | |
| 264 | ||
| 265 | error: extern prelude cannot be imported | |
| 266 | --> $DIR/use-path-segment-kw.rs:177:13 | |
| 267 | | | |
| 268 | LL | use ::self; | |
| 269 | | ^^^^^^ | |
| 270 | ||
| 271 | error: extern prelude cannot be imported | |
| 272 | --> $DIR/use-path-segment-kw.rs:180:13 | |
| 273 | | | |
| 274 | LL | use ::self as _self2; | |
| 275 | | ^^^^^^^^^^^^^^^^ | |
| 276 | ||
| 277 | error: extern prelude cannot be imported | |
| 278 | --> $DIR/use-path-segment-kw.rs:182:16 | |
| 279 | | | |
| 280 | LL | use ::{self}; | |
| 281 | | ^^^^ | |
| 282 | ||
| 283 | error: extern prelude cannot be imported | |
| 284 | --> $DIR/use-path-segment-kw.rs:184:20 | |
| 285 | | | |
| 286 | LL | pub use ::{self as _nested_self2}; | |
| 287 | | ^^^^^^^^^^^^^^^^^^^^^ | |
| 288 | ||
| 289 | error[E0429]: `self` imports are only allowed within a { } list | |
| 290 | --> $DIR/use-path-segment-kw.rs:187:28 | |
| 291 | | | |
| 292 | LL | pub use foobar::qux::self; | |
| 293 | | ^^^^^^ | |
| 294 | | | |
| 295 | help: consider importing the module directly | |
| 296 | | | |
| 297 | LL - pub use foobar::qux::self; | |
| 298 | LL + pub use foobar::qux; | |
| 299 | | | |
| 300 | help: alternatively, use the multi-path `use` syntax to import `self` | |
| 301 | | | |
| 302 | LL | pub use foobar::qux::{self}; | |
| 303 | | + + | |
| 304 | ||
| 305 | error[E0429]: `self` imports are only allowed within a { } list | |
| 306 | --> $DIR/use-path-segment-kw.rs:189:23 | |
| 307 | | | |
| 308 | LL | pub use foobar::self as _self3; | |
| 309 | | ^^^^^^ | |
| 310 | | | |
| 311 | help: consider importing the module directly | |
| 312 | | | |
| 313 | LL - pub use foobar::self as _self3; | |
| 314 | LL + pub use foobar as _self3; | |
| 315 | | | |
| 316 | help: alternatively, use the multi-path `use` syntax to import `self` | |
| 317 | | | |
| 318 | LL | pub use foobar::{self as _self3}; | |
| 319 | | + + | |
| 320 | ||
| 321 | error[E0429]: `self` imports are only allowed within a { } list | |
| 322 | --> $DIR/use-path-segment-kw.rs:195:18 | |
| 323 | | | |
| 324 | LL | use crate::self; | |
| 325 | | ^^^^^^ | |
| 326 | | | |
| 327 | help: consider importing the module directly | |
| 328 | | | |
| 329 | LL - use crate::self; | |
| 330 | LL + use crate; | |
| 331 | | | |
| 332 | help: alternatively, use the multi-path `use` syntax to import `self` | |
| 333 | | | |
| 334 | LL | use crate::{self}; | |
| 335 | | + + | |
| 336 | ||
| 337 | error: imports need to be explicitly named | |
| 338 | --> $DIR/use-path-segment-kw.rs:195:20 | |
| 339 | | | |
| 340 | LL | use crate::self; | |
| 341 | | ^^^^ | |
| 342 | ||
| 343 | error[E0429]: `self` imports are only allowed within a { } list | |
| 344 | --> $DIR/use-path-segment-kw.rs:197:22 | |
| 345 | | | |
| 346 | LL | pub use crate::self as _self4; | |
| 347 | | ^^^^^^ | |
| 348 | | | |
| 349 | help: consider importing the module directly | |
| 350 | | | |
| 351 | LL - pub use crate::self as _self4; | |
| 352 | LL + pub use crate as _self4; | |
| 353 | | | |
| 354 | help: alternatively, use the multi-path `use` syntax to import `self` | |
| 355 | | | |
| 356 | LL | pub use crate::{self as _self4}; | |
| 357 | | + + | |
| 358 | ||
| 359 | error: imports need to be explicitly named | |
| 360 | --> $DIR/use-path-segment-kw.rs:198:21 | |
| 361 | | | |
| 362 | LL | use crate::{self}; | |
| 363 | | ^^^^ | |
| 364 | | | |
| 365 | help: try renaming it with a name | |
| 366 | | | |
| 367 | LL | use crate::{self as name}; | |
| 368 | | +++++++ | |
| 369 | ||
| 370 | error[E0429]: `self` imports are only allowed within a { } list | |
| 371 | --> $DIR/use-path-segment-kw.rs:202:18 | |
| 372 | | | |
| 373 | LL | use super::self; | |
| 374 | | ^^^^^^ | |
| 375 | | | |
| 376 | help: consider importing the module directly | |
| 377 | | | |
| 378 | LL - use super::self; | |
| 379 | LL + use super; | |
| 380 | | | |
| 381 | help: alternatively, use the multi-path `use` syntax to import `self` | |
| 382 | | | |
| 383 | LL | use super::{self}; | |
| 384 | | + + | |
| 385 | ||
| 386 | error: imports need to be explicitly named | |
| 387 | --> $DIR/use-path-segment-kw.rs:202:20 | |
| 388 | | | |
| 389 | LL | use super::self; | |
| 390 | | ^^^^ | |
| 391 | ||
| 392 | error[E0429]: `self` imports are only allowed within a { } list | |
| 393 | --> $DIR/use-path-segment-kw.rs:204:22 | |
| 394 | | | |
| 395 | LL | pub use super::self as _self5; | |
| 396 | | ^^^^^^ | |
| 397 | | | |
| 398 | help: consider importing the module directly | |
| 399 | | | |
| 400 | LL - pub use super::self as _self5; | |
| 401 | LL + pub use super as _self5; | |
| 402 | | | |
| 403 | help: alternatively, use the multi-path `use` syntax to import `self` | |
| 404 | | | |
| 405 | LL | pub use super::{self as _self5}; | |
| 406 | | + + | |
| 407 | ||
| 408 | error: imports need to be explicitly named | |
| 409 | --> $DIR/use-path-segment-kw.rs:205:21 | |
| 410 | | | |
| 411 | LL | use super::{self}; | |
| 412 | | ^^^^ | |
| 413 | | | |
| 414 | help: try renaming it with a name | |
| 415 | | | |
| 416 | LL | use super::{self as name}; | |
| 417 | | +++++++ | |
| 418 | ||
| 419 | error[E0429]: `self` imports are only allowed within a { } list | |
| 420 | --> $DIR/use-path-segment-kw.rs:209:17 | |
| 421 | | | |
| 422 | LL | use self::self; | |
| 423 | | ^^^^^^ | |
| 424 | | | |
| 425 | help: consider importing the module directly | |
| 426 | | | |
| 427 | LL - use self::self; | |
| 428 | LL + use self; | |
| 429 | | | |
| 430 | help: alternatively, use the multi-path `use` syntax to import `self` | |
| 431 | | | |
| 432 | LL | use self::{self}; | |
| 433 | | + + | |
| 434 | ||
| 435 | error: imports need to be explicitly named | |
| 436 | --> $DIR/use-path-segment-kw.rs:209:19 | |
| 437 | | | |
| 438 | LL | use self::self; | |
| 439 | | ^^^^ | |
| 440 | ||
| 441 | error[E0429]: `self` imports are only allowed within a { } list | |
| 442 | --> $DIR/use-path-segment-kw.rs:211:21 | |
| 443 | | | |
| 444 | LL | pub use self::self as _self6; | |
| 445 | | ^^^^^^ | |
| 446 | | | |
| 447 | help: consider importing the module directly | |
| 448 | | | |
| 449 | LL - pub use self::self as _self6; | |
| 450 | LL + pub use self as _self6; | |
| 451 | | | |
| 452 | help: alternatively, use the multi-path `use` syntax to import `self` | |
| 453 | | | |
| 454 | LL | pub use self::{self as _self6}; | |
| 455 | | + + | |
| 456 | ||
| 457 | error: imports need to be explicitly named | |
| 458 | --> $DIR/use-path-segment-kw.rs:212:20 | |
| 459 | | | |
| 460 | LL | use self::{self}; | |
| 461 | | ^^^^ | |
| 462 | | | |
| 463 | help: try renaming it with a name | |
| 464 | | | |
| 465 | LL | use self::{self as name}; | |
| 466 | | +++++++ | |
| 467 | ||
| 468 | error[E0429]: `self` imports are only allowed within a { } list | |
| 469 | --> $DIR/use-path-segment-kw.rs:216:28 | |
| 470 | | | |
| 471 | LL | use crate::foo::bar::self; | |
| 472 | | ^^^^^^ | |
| 473 | | | |
| 474 | help: consider importing the module directly | |
| 475 | | | |
| 476 | LL - use crate::foo::bar::self; | |
| 477 | LL + use crate::foo::bar; | |
| 478 | | | |
| 479 | help: alternatively, use the multi-path `use` syntax to import `self` | |
| 480 | | | |
| 481 | LL | use crate::foo::bar::{self}; | |
| 482 | | + + | |
| 483 | ||
| 484 | error[E0429]: `self` imports are only allowed within a { } list | |
| 485 | --> $DIR/use-path-segment-kw.rs:217:28 | |
| 486 | | | |
| 487 | LL | use crate::foo::bar::self as _self7; | |
| 488 | | ^^^^^^ | |
| 489 | | | |
| 490 | help: consider importing the module directly | |
| 491 | | | |
| 492 | LL - use crate::foo::bar::self as _self7; | |
| 493 | LL + use crate::foo::bar as _self7; | |
| 494 | | | |
| 495 | help: alternatively, use the multi-path `use` syntax to import `self` | |
| 496 | | | |
| 497 | LL | use crate::foo::bar::{self as _self7}; | |
| 498 | | + + | |
| 499 | ||
| 500 | error: imports need to be explicitly named | |
| 501 | --> $DIR/use-path-segment-kw.rs:11:13 | |
| 502 | | | |
| 503 | LL | use $crate; | |
| 504 | | ^^^^^^ | |
| 505 | ... | |
| 506 | LL | macro_dollar_crate!(); | |
| 507 | | --------------------- in this macro invocation | |
| 508 | | | |
| 509 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 510 | help: try renaming it with a name | |
| 511 | | | |
| 512 | LL | use $crate as name; | |
| 513 | | +++++++ | |
| 514 | ||
| 515 | error: `$crate` in paths can only be used in start position | |
| 516 | --> $DIR/use-path-segment-kw.rs:15:15 | |
| 517 | | | |
| 518 | LL | use ::$crate; | |
| 519 | | ^^^^^^ | |
| 520 | ... | |
| 521 | LL | macro_dollar_crate!(); | |
| 522 | | --------------------- in this macro invocation | |
| 523 | | | |
| 524 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 525 | ||
| 526 | error: `$crate` in paths can only be used in start position | |
| 527 | --> $DIR/use-path-segment-kw.rs:16:15 | |
| 528 | | | |
| 529 | LL | use ::$crate as _dollar_crate2; | |
| 530 | | ^^^^^^ | |
| 531 | ... | |
| 532 | LL | macro_dollar_crate!(); | |
| 533 | | --------------------- in this macro invocation | |
| 534 | | | |
| 535 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 536 | ||
| 537 | error: `$crate` in paths can only be used in start position | |
| 538 | --> $DIR/use-path-segment-kw.rs:17:16 | |
| 539 | | | |
| 540 | LL | use ::{$crate}; | |
| 541 | | ^^^^^^ | |
| 542 | ... | |
| 543 | LL | macro_dollar_crate!(); | |
| 544 | | --------------------- in this macro invocation | |
| 545 | | | |
| 546 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 547 | ||
| 548 | error: `$crate` in paths can only be used in start position | |
| 549 | --> $DIR/use-path-segment-kw.rs:18:16 | |
| 550 | | | |
| 551 | LL | use ::{$crate as _nested_dollar_crate2}; | |
| 552 | | ^^^^^^ | |
| 553 | ... | |
| 554 | LL | macro_dollar_crate!(); | |
| 555 | | --------------------- in this macro invocation | |
| 556 | | | |
| 557 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 558 | ||
| 559 | error: `$crate` in paths can only be used in start position | |
| 560 | --> $DIR/use-path-segment-kw.rs:21:21 | |
| 561 | | | |
| 562 | LL | use foobar::$crate; | |
| 563 | | ^^^^^^ | |
| 564 | ... | |
| 565 | LL | macro_dollar_crate!(); | |
| 566 | | --------------------- in this macro invocation | |
| 567 | | | |
| 568 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 569 | ||
| 570 | error: `$crate` in paths can only be used in start position | |
| 571 | --> $DIR/use-path-segment-kw.rs:22:21 | |
| 572 | | | |
| 573 | LL | use foobar::$crate as _dollar_crate3; | |
| 574 | | ^^^^^^ | |
| 575 | ... | |
| 576 | LL | macro_dollar_crate!(); | |
| 577 | | --------------------- in this macro invocation | |
| 578 | | | |
| 579 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 580 | ||
| 581 | error: `$crate` in paths can only be used in start position | |
| 582 | --> $DIR/use-path-segment-kw.rs:23:22 | |
| 583 | | | |
| 584 | LL | use foobar::{$crate}; | |
| 585 | | ^^^^^^ | |
| 586 | ... | |
| 587 | LL | macro_dollar_crate!(); | |
| 588 | | --------------------- in this macro invocation | |
| 589 | | | |
| 590 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 591 | ||
| 592 | error: `$crate` in paths can only be used in start position | |
| 593 | --> $DIR/use-path-segment-kw.rs:24:22 | |
| 594 | | | |
| 595 | LL | use foobar::{$crate as _nested_dollar_crate3}; | |
| 596 | | ^^^^^^ | |
| 597 | ... | |
| 598 | LL | macro_dollar_crate!(); | |
| 599 | | --------------------- in this macro invocation | |
| 600 | | | |
| 601 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 602 | ||
| 603 | error: `$crate` in paths can only be used in start position | |
| 604 | --> $DIR/use-path-segment-kw.rs:27:20 | |
| 605 | | | |
| 606 | LL | use crate::$crate; | |
| 607 | | ^^^^^^ | |
| 608 | ... | |
| 609 | LL | macro_dollar_crate!(); | |
| 610 | | --------------------- in this macro invocation | |
| 611 | | | |
| 612 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 613 | ||
| 614 | error: `$crate` in paths can only be used in start position | |
| 615 | --> $DIR/use-path-segment-kw.rs:28:20 | |
| 616 | | | |
| 617 | LL | use crate::$crate as _dollar_crate4; | |
| 618 | | ^^^^^^ | |
| 619 | ... | |
| 620 | LL | macro_dollar_crate!(); | |
| 621 | | --------------------- in this macro invocation | |
| 622 | | | |
| 623 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 624 | ||
| 625 | error: `$crate` in paths can only be used in start position | |
| 626 | --> $DIR/use-path-segment-kw.rs:29:21 | |
| 627 | | | |
| 628 | LL | use crate::{$crate}; | |
| 629 | | ^^^^^^ | |
| 630 | ... | |
| 631 | LL | macro_dollar_crate!(); | |
| 632 | | --------------------- in this macro invocation | |
| 633 | | | |
| 634 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 635 | ||
| 636 | error: `$crate` in paths can only be used in start position | |
| 637 | --> $DIR/use-path-segment-kw.rs:30:21 | |
| 638 | | | |
| 639 | LL | use crate::{$crate as _nested_dollar_crate4}; | |
| 640 | | ^^^^^^ | |
| 641 | ... | |
| 642 | LL | macro_dollar_crate!(); | |
| 643 | | --------------------- in this macro invocation | |
| 644 | | | |
| 645 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 646 | ||
| 647 | error: `$crate` in paths can only be used in start position | |
| 648 | --> $DIR/use-path-segment-kw.rs:33:20 | |
| 649 | | | |
| 650 | LL | use super::$crate; | |
| 651 | | ^^^^^^ | |
| 652 | ... | |
| 653 | LL | macro_dollar_crate!(); | |
| 654 | | --------------------- in this macro invocation | |
| 655 | | | |
| 656 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 657 | ||
| 658 | error: `$crate` in paths can only be used in start position | |
| 659 | --> $DIR/use-path-segment-kw.rs:34:20 | |
| 660 | | | |
| 661 | LL | use super::$crate as _dollar_crate5; | |
| 662 | | ^^^^^^ | |
| 663 | ... | |
| 664 | LL | macro_dollar_crate!(); | |
| 665 | | --------------------- in this macro invocation | |
| 666 | | | |
| 667 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 668 | ||
| 669 | error: `$crate` in paths can only be used in start position | |
| 670 | --> $DIR/use-path-segment-kw.rs:35:21 | |
| 671 | | | |
| 672 | LL | use super::{$crate}; | |
| 673 | | ^^^^^^ | |
| 674 | ... | |
| 675 | LL | macro_dollar_crate!(); | |
| 676 | | --------------------- in this macro invocation | |
| 677 | | | |
| 678 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 679 | ||
| 680 | error: `$crate` in paths can only be used in start position | |
| 681 | --> $DIR/use-path-segment-kw.rs:36:21 | |
| 682 | | | |
| 683 | LL | use super::{$crate as _nested_dollar_crate5}; | |
| 684 | | ^^^^^^ | |
| 685 | ... | |
| 686 | LL | macro_dollar_crate!(); | |
| 687 | | --------------------- in this macro invocation | |
| 688 | | | |
| 689 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 690 | ||
| 691 | error: `$crate` in paths can only be used in start position | |
| 692 | --> $DIR/use-path-segment-kw.rs:39:19 | |
| 693 | | | |
| 694 | LL | use self::$crate; | |
| 695 | | ^^^^^^ | |
| 696 | ... | |
| 697 | LL | macro_dollar_crate!(); | |
| 698 | | --------------------- in this macro invocation | |
| 699 | | | |
| 700 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 701 | ||
| 702 | error: `$crate` in paths can only be used in start position | |
| 703 | --> $DIR/use-path-segment-kw.rs:40:19 | |
| 704 | | | |
| 705 | LL | use self::$crate as _dollar_crate6; | |
| 706 | | ^^^^^^ | |
| 707 | ... | |
| 708 | LL | macro_dollar_crate!(); | |
| 709 | | --------------------- in this macro invocation | |
| 710 | | | |
| 711 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 712 | ||
| 713 | error: `$crate` in paths can only be used in start position | |
| 714 | --> $DIR/use-path-segment-kw.rs:41:20 | |
| 715 | | | |
| 716 | LL | use self::{$crate}; | |
| 717 | | ^^^^^^ | |
| 718 | ... | |
| 719 | LL | macro_dollar_crate!(); | |
| 720 | | --------------------- in this macro invocation | |
| 721 | | | |
| 722 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 723 | ||
| 724 | error: `$crate` in paths can only be used in start position | |
| 725 | --> $DIR/use-path-segment-kw.rs:42:20 | |
| 726 | | | |
| 727 | LL | use self::{$crate as _nested_dollar_crate6}; | |
| 728 | | ^^^^^^ | |
| 729 | ... | |
| 730 | LL | macro_dollar_crate!(); | |
| 731 | | --------------------- in this macro invocation | |
| 732 | | | |
| 733 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 734 | ||
| 735 | error: `$crate` in paths can only be used in start position | |
| 736 | --> $DIR/use-path-segment-kw.rs:45:21 | |
| 737 | | | |
| 738 | LL | use $crate::$crate; | |
| 739 | | ^^^^^^ | |
| 740 | ... | |
| 741 | LL | macro_dollar_crate!(); | |
| 742 | | --------------------- in this macro invocation | |
| 743 | | | |
| 744 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 745 | ||
| 746 | error: `$crate` in paths can only be used in start position | |
| 747 | --> $DIR/use-path-segment-kw.rs:46:21 | |
| 748 | | | |
| 749 | LL | use $crate::$crate as _dollar_crate7; | |
| 750 | | ^^^^^^ | |
| 751 | ... | |
| 752 | LL | macro_dollar_crate!(); | |
| 753 | | --------------------- in this macro invocation | |
| 754 | | | |
| 755 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 756 | ||
| 757 | error: `$crate` in paths can only be used in start position | |
| 758 | --> $DIR/use-path-segment-kw.rs:47:22 | |
| 759 | | | |
| 760 | LL | use $crate::{$crate}; | |
| 761 | | ^^^^^^ | |
| 762 | ... | |
| 763 | LL | macro_dollar_crate!(); | |
| 764 | | --------------------- in this macro invocation | |
| 765 | | | |
| 766 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 767 | ||
| 768 | error: `$crate` in paths can only be used in start position | |
| 769 | --> $DIR/use-path-segment-kw.rs:48:22 | |
| 770 | | | |
| 771 | LL | use $crate::{$crate as _nested_dollar_crate7}; | |
| 772 | | ^^^^^^ | |
| 773 | ... | |
| 774 | LL | macro_dollar_crate!(); | |
| 775 | | --------------------- in this macro invocation | |
| 776 | | | |
| 777 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 778 | ||
| 779 | error: `crate` in paths can only be used in start position | |
| 780 | --> $DIR/use-path-segment-kw.rs:51:21 | |
| 781 | | | |
| 782 | LL | use $crate::crate; | |
| 783 | | ^^^^^ | |
| 784 | ... | |
| 785 | LL | macro_dollar_crate!(); | |
| 786 | | --------------------- in this macro invocation | |
| 787 | | | |
| 788 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 789 | ||
| 790 | error: `crate` in paths can only be used in start position | |
| 791 | --> $DIR/use-path-segment-kw.rs:52:21 | |
| 792 | | | |
| 793 | LL | use $crate::crate as _m_crate8; | |
| 794 | | ^^^^^ | |
| 795 | ... | |
| 796 | LL | macro_dollar_crate!(); | |
| 797 | | --------------------- in this macro invocation | |
| 798 | | | |
| 799 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 800 | ||
| 801 | error: `crate` in paths can only be used in start position | |
| 802 | --> $DIR/use-path-segment-kw.rs:53:22 | |
| 803 | | | |
| 804 | LL | use $crate::{crate}; | |
| 805 | | ^^^^^ | |
| 806 | ... | |
| 807 | LL | macro_dollar_crate!(); | |
| 808 | | --------------------- in this macro invocation | |
| 809 | | | |
| 810 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 811 | ||
| 812 | error: `crate` in paths can only be used in start position | |
| 813 | --> $DIR/use-path-segment-kw.rs:54:22 | |
| 814 | | | |
| 815 | LL | use $crate::{crate as _m_nested_crate8}; | |
| 816 | | ^^^^^ | |
| 817 | ... | |
| 818 | LL | macro_dollar_crate!(); | |
| 819 | | --------------------- in this macro invocation | |
| 820 | | | |
| 821 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 822 | ||
| 823 | error: `super` in paths can only be used in start position, after `self`, or after another `super` | |
| 824 | --> $DIR/use-path-segment-kw.rs:57:21 | |
| 825 | | | |
| 826 | LL | use $crate::super; | |
| 827 | | ^^^^^ | |
| 828 | ... | |
| 829 | LL | macro_dollar_crate!(); | |
| 830 | | --------------------- in this macro invocation | |
| 831 | | | |
| 832 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 833 | ||
| 834 | error: `super` in paths can only be used in start position, after `self`, or after another `super` | |
| 835 | --> $DIR/use-path-segment-kw.rs:58:21 | |
| 836 | | | |
| 837 | LL | ... use $crate::super as _m_super8; | |
| 838 | | ^^^^^ | |
| 839 | ... | |
| 840 | LL | ... macro_dollar_crate!(); | |
| 841 | | --------------------- in this macro invocation | |
| 842 | | | |
| 843 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 844 | ||
| 845 | error: `super` in paths can only be used in start position, after `self`, or after another `super` | |
| 846 | --> $DIR/use-path-segment-kw.rs:59:22 | |
| 847 | | | |
| 848 | LL | use $crate::{super}; | |
| 849 | | ^^^^^ | |
| 850 | ... | |
| 851 | LL | macro_dollar_crate!(); | |
| 852 | | --------------------- in this macro invocation | |
| 853 | | | |
| 854 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 855 | ||
| 856 | error: `super` in paths can only be used in start position, after `self`, or after another `super` | |
| 857 | --> $DIR/use-path-segment-kw.rs:60:22 | |
| 858 | | | |
| 859 | LL | ... use $crate::{super as _m_nested_super8}; | |
| 860 | | ^^^^^ | |
| 861 | ... | |
| 862 | LL | ... macro_dollar_crate!(); | |
| 863 | | --------------------- in this macro invocation | |
| 864 | | | |
| 865 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 866 | ||
| 867 | error[E0429]: `self` imports are only allowed within a { } list | |
| 868 | --> $DIR/use-path-segment-kw.rs:63:19 | |
| 869 | | | |
| 870 | LL | use $crate::self; | |
| 871 | | ^^^^^^ | |
| 872 | ... | |
| 873 | LL | macro_dollar_crate!(); | |
| 874 | | --------------------- in this macro invocation | |
| 875 | | | |
| 876 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 877 | help: consider importing the module directly | |
| 878 | | | |
| 879 | LL - use $crate::self; | |
| 880 | LL + use $crate; | |
| 881 | | | |
| 882 | help: alternatively, use the multi-path `use` syntax to import `self` | |
| 883 | | | |
| 884 | LL | use $crate::{self}; | |
| 885 | | + + | |
| 886 | ||
| 887 | error: imports need to be explicitly named | |
| 888 | --> $DIR/use-path-segment-kw.rs:63:21 | |
| 889 | | | |
| 890 | LL | use $crate::self; | |
| 891 | | ^^^^ | |
| 892 | ... | |
| 893 | LL | macro_dollar_crate!(); | |
| 894 | | --------------------- in this macro invocation | |
| 895 | | | |
| 896 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 897 | ||
| 898 | error[E0429]: `self` imports are only allowed within a { } list | |
| 899 | --> $DIR/use-path-segment-kw.rs:65:23 | |
| 900 | | | |
| 901 | LL | pub use $crate::self as _m_self8; | |
| 902 | | ^^^^^^ | |
| 903 | ... | |
| 904 | LL | macro_dollar_crate!(); | |
| 905 | | --------------------- in this macro invocation | |
| 906 | | | |
| 907 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 908 | help: consider importing the module directly | |
| 909 | | | |
| 910 | LL - pub use $crate::self as _m_self8; | |
| 911 | LL + pub use $crate as _m_self8; | |
| 912 | | | |
| 913 | help: alternatively, use the multi-path `use` syntax to import `self` | |
| 914 | | | |
| 915 | LL | pub use $crate::{self as _m_self8}; | |
| 916 | | + + | |
| 917 | ||
| 918 | error: imports need to be explicitly named | |
| 919 | --> $DIR/use-path-segment-kw.rs:66:22 | |
| 920 | | | |
| 921 | LL | use $crate::{self}; | |
| 922 | | ^^^^ | |
| 923 | ... | |
| 924 | LL | macro_dollar_crate!(); | |
| 925 | | --------------------- in this macro invocation | |
| 926 | | | |
| 927 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 928 | help: try renaming it with a name | |
| 929 | | | |
| 930 | LL | use $crate::{self as name}; | |
| 931 | | +++++++ | |
| 932 | ||
| 933 | error[E0433]: `self` in paths can only be used in start position | |
| 934 | --> $DIR/use-path-segment-kw.rs:215:36 | |
| 935 | | | |
| 936 | LL | type D7 = crate::foo::bar::self; | |
| 937 | | ^^^^ can only be used in path start position | |
| 938 | ||
| 939 | error[E0433]: cannot find `_nested_self2` in `bar` | |
| 940 | --> $DIR/use-path-segment-kw.rs:241:15 | |
| 941 | | | |
| 942 | LL | foo::bar::_nested_self2::outer(); | |
| 943 | | ^^^^^^^^^^^^^ could not find `_nested_self2` in `bar` | |
| 944 | ||
| 945 | error[E0573]: expected type, found module `$crate` | |
| 946 | --> $DIR/use-path-segment-kw.rs:10:19 | |
| 947 | | | |
| 948 | LL | type A1 = $crate; | |
| 949 | | ^^^^^^ not a type | |
| 950 | ... | |
| 951 | LL | macro_dollar_crate!(); | |
| 952 | | --------------------- in this macro invocation | |
| 953 | | | |
| 954 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 955 | ||
| 956 | error[E0573]: expected type, found module `crate` | |
| 957 | --> $DIR/use-path-segment-kw.rs:96:19 | |
| 958 | | | |
| 959 | LL | type B1 = crate; | |
| 960 | | ^^^^^ not a type | |
| 961 | ||
| 962 | error[E0573]: expected type, found module `super` | |
| 963 | --> $DIR/use-path-segment-kw.rs:134:19 | |
| 964 | | | |
| 965 | LL | type C1 = super; | |
| 966 | | ^^^^^ not a type | |
| 967 | ||
| 968 | error[E0573]: expected type, found module `super::super` | |
| 969 | --> $DIR/use-path-segment-kw.rs:156:19 | |
| 970 | | | |
| 971 | LL | type C5 = super::super; | |
| 972 | | ^^^^^^^^^^^^ not a type | |
| 973 | ||
| 974 | error[E0573]: expected type, found module `self::super` | |
| 975 | --> $DIR/use-path-segment-kw.rs:162:19 | |
| 976 | | | |
| 977 | LL | type C6 = self::super; | |
| 978 | | ^^^^^^^^^^^ not a type | |
| 979 | ||
| 980 | error[E0573]: expected type, found module `self` | |
| 981 | --> $DIR/use-path-segment-kw.rs:172:19 | |
| 982 | | | |
| 983 | LL | type D1 = self; | |
| 984 | | ^^^^ not a type | |
| 985 | ||
| 986 | error[E0433]: global paths cannot start with `$crate` | |
| 987 | --> $DIR/use-path-segment-kw.rs:14:21 | |
| 988 | | | |
| 989 | LL | type A2 = ::$crate; | |
| 990 | | ^^^^^^ cannot start with this | |
| 991 | ... | |
| 992 | LL | macro_dollar_crate!(); | |
| 993 | | --------------------- in this macro invocation | |
| 994 | | | |
| 995 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 996 | ||
| 997 | error[E0433]: `$crate` in paths can only be used in start position | |
| 998 | --> $DIR/use-path-segment-kw.rs:20:27 | |
| 999 | | | |
| 1000 | LL | type A3 = foobar::$crate; | |
| 1001 | | ^^^^^^ can only be used in path start position | |
| 1002 | ... | |
| 1003 | LL | macro_dollar_crate!(); | |
| 1004 | | --------------------- in this macro invocation | |
| 1005 | | | |
| 1006 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 1007 | ||
| 1008 | error[E0433]: `$crate` in paths can only be used in start position | |
| 1009 | --> $DIR/use-path-segment-kw.rs:26:26 | |
| 1010 | | | |
| 1011 | LL | type A4 = crate::$crate; | |
| 1012 | | ^^^^^^ can only be used in path start position | |
| 1013 | ... | |
| 1014 | LL | macro_dollar_crate!(); | |
| 1015 | | --------------------- in this macro invocation | |
| 1016 | | | |
| 1017 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 1018 | ||
| 1019 | error[E0433]: `$crate` in paths can only be used in start position | |
| 1020 | --> $DIR/use-path-segment-kw.rs:32:26 | |
| 1021 | | | |
| 1022 | LL | type A5 = super::$crate; | |
| 1023 | | ^^^^^^ can only be used in path start position | |
| 1024 | ... | |
| 1025 | LL | macro_dollar_crate!(); | |
| 1026 | | --------------------- in this macro invocation | |
| 1027 | | | |
| 1028 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 1029 | ||
| 1030 | error[E0433]: `$crate` in paths can only be used in start position | |
| 1031 | --> $DIR/use-path-segment-kw.rs:38:25 | |
| 1032 | | | |
| 1033 | LL | type A6 = self::$crate; | |
| 1034 | | ^^^^^^ can only be used in path start position | |
| 1035 | ... | |
| 1036 | LL | macro_dollar_crate!(); | |
| 1037 | | --------------------- in this macro invocation | |
| 1038 | | | |
| 1039 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 1040 | ||
| 1041 | error[E0433]: `$crate` in paths can only be used in start position | |
| 1042 | --> $DIR/use-path-segment-kw.rs:44:27 | |
| 1043 | | | |
| 1044 | LL | type A7 = $crate::$crate; | |
| 1045 | | ^^^^^^ can only be used in path start position | |
| 1046 | ... | |
| 1047 | LL | macro_dollar_crate!(); | |
| 1048 | | --------------------- in this macro invocation | |
| 1049 | | | |
| 1050 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 1051 | ||
| 1052 | error[E0433]: `crate` in paths can only be used in start position | |
| 1053 | --> $DIR/use-path-segment-kw.rs:50:27 | |
| 1054 | | | |
| 1055 | LL | type A8 = $crate::crate; | |
| 1056 | | ^^^^^ can only be used in path start position | |
| 1057 | ... | |
| 1058 | LL | macro_dollar_crate!(); | |
| 1059 | | --------------------- in this macro invocation | |
| 1060 | | | |
| 1061 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 1062 | ||
| 1063 | error[E0433]: `super` in paths can only be used in start position | |
| 1064 | --> $DIR/use-path-segment-kw.rs:56:27 | |
| 1065 | | | |
| 1066 | LL | type A9 = $crate::super; | |
| 1067 | | ^^^^^ can only be used in path start position | |
| 1068 | ... | |
| 1069 | LL | macro_dollar_crate!(); | |
| 1070 | | --------------------- in this macro invocation | |
| 1071 | | | |
| 1072 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 1073 | ||
| 1074 | error[E0433]: `self` in paths can only be used in start position | |
| 1075 | --> $DIR/use-path-segment-kw.rs:62:28 | |
| 1076 | | | |
| 1077 | LL | type A10 = $crate::self; | |
| 1078 | | ^^^^ can only be used in path start position | |
| 1079 | ... | |
| 1080 | LL | macro_dollar_crate!(); | |
| 1081 | | --------------------- in this macro invocation | |
| 1082 | | | |
| 1083 | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 1084 | ||
| 1085 | error[E0433]: global paths cannot start with `crate` | |
| 1086 | --> $DIR/use-path-segment-kw.rs:100:21 | |
| 1087 | | | |
| 1088 | LL | type B2 = ::crate; | |
| 1089 | | ^^^^^ cannot start with this | |
| 1090 | ||
| 1091 | error[E0433]: `crate` in paths can only be used in start position | |
| 1092 | --> $DIR/use-path-segment-kw.rs:106:27 | |
| 1093 | | | |
| 1094 | LL | type B3 = foobar::crate; | |
| 1095 | | ^^^^^ can only be used in path start position | |
| 1096 | ||
| 1097 | error[E0433]: `crate` in paths can only be used in start position | |
| 1098 | --> $DIR/use-path-segment-kw.rs:112:26 | |
| 1099 | | | |
| 1100 | LL | type B4 = crate::crate; | |
| 1101 | | ^^^^^ can only be used in path start position | |
| 1102 | ||
| 1103 | error[E0433]: `crate` in paths can only be used in start position | |
| 1104 | --> $DIR/use-path-segment-kw.rs:118:26 | |
| 1105 | | | |
| 1106 | LL | type B5 = super::crate; | |
| 1107 | | ^^^^^ can only be used in path start position | |
| 1108 | ||
| 1109 | error[E0433]: `crate` in paths can only be used in start position | |
| 1110 | --> $DIR/use-path-segment-kw.rs:124:25 | |
| 1111 | | | |
| 1112 | LL | type B6 = self::crate; | |
| 1113 | | ^^^^^ can only be used in path start position | |
| 1114 | ||
| 1115 | error[E0433]: global paths cannot start with `super` | |
| 1116 | --> $DIR/use-path-segment-kw.rs:138:21 | |
| 1117 | | | |
| 1118 | LL | type C2 = ::super; | |
| 1119 | | ^^^^^ cannot start with this | |
| 1120 | ||
| 1121 | error[E0433]: `super` in paths can only be used in start position | |
| 1122 | --> $DIR/use-path-segment-kw.rs:144:27 | |
| 1123 | | | |
| 1124 | LL | type C3 = foobar::super; | |
| 1125 | | ^^^^^ can only be used in path start position | |
| 1126 | ||
| 1127 | error[E0433]: `super` in paths can only be used in start position | |
| 1128 | --> $DIR/use-path-segment-kw.rs:150:26 | |
| 1129 | | | |
| 1130 | LL | type C4 = crate::super; | |
| 1131 | | ^^^^^ can only be used in path start position | |
| 1132 | ||
| 1133 | error[E0433]: global paths cannot start with `self` | |
| 1134 | --> $DIR/use-path-segment-kw.rs:176:21 | |
| 1135 | | | |
| 1136 | LL | type D2 = ::self; | |
| 1137 | | ^^^^ cannot start with this | |
| 1138 | ||
| 1139 | error[E0433]: `self` in paths can only be used in start position | |
| 1140 | --> $DIR/use-path-segment-kw.rs:186:27 | |
| 1141 | | | |
| 1142 | LL | type D3 = foobar::self; | |
| 1143 | | ^^^^ can only be used in path start position | |
| 1144 | ||
| 1145 | error[E0433]: `self` in paths can only be used in start position | |
| 1146 | --> $DIR/use-path-segment-kw.rs:194:26 | |
| 1147 | | | |
| 1148 | LL | type D4 = crate::self; | |
| 1149 | | ^^^^ can only be used in path start position | |
| 1150 | ||
| 1151 | error[E0433]: `self` in paths can only be used in start position | |
| 1152 | --> $DIR/use-path-segment-kw.rs:201:26 | |
| 1153 | | | |
| 1154 | LL | type D5 = super::self; | |
| 1155 | | ^^^^ can only be used in path start position | |
| 1156 | ||
| 1157 | error[E0433]: `self` in paths can only be used in start position | |
| 1158 | --> $DIR/use-path-segment-kw.rs:208:25 | |
| 1159 | | | |
| 1160 | LL | type D6 = self::self; | |
| 1161 | | ^^^^ can only be used in path start position | |
| 1162 | ||
| 1163 | error: aborting due to 126 previous errors | |
| 1164 | ||
| 1165 | Some errors have detailed explanations: E0429, E0433, E0573. | |
| 1166 | For more information about an error, try `rustc --explain E0429`. |
tests/ui/use/use-path-segment-kw.rs+118-118| ... | ... | @@ -1,4 +1,6 @@ |
| 1 | //@ edition: 2018.. | |
| 1 | //@ revisions: e2015 e2018 | |
| 2 | //@ [e2015] edition: 2015 | |
| 3 | //@ [e2018] edition: 2018.. | |
| 2 | 4 | |
| 3 | 5 | macro_rules! macro_dollar_crate { |
| 4 | 6 | () => { |
| ... | ... | @@ -6,67 +8,62 @@ macro_rules! macro_dollar_crate { |
| 6 | 8 | use $crate::{}; |
| 7 | 9 | |
| 8 | 10 | 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 | use $crate; //~ ERROR imports need to be explicitly named | |
| 12 | pub use $crate as _dollar_crate; | |
| 11 | 13 | |
| 12 | 14 | type A2 = ::$crate; //~ ERROR 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` | |
| 15 | use ::$crate; //~ ERROR `$crate` in paths can only be used in start position | |
| 16 | use ::$crate as _dollar_crate2; //~ ERROR `$crate` in paths can only be used in start position | |
| 17 | use ::{$crate}; //~ ERROR `$crate` in paths can only be used in start position | |
| 18 | use ::{$crate as _nested_dollar_crate2}; //~ ERROR `$crate` in paths can only be used in start position | |
| 17 | 19 | |
| 18 | 20 | type A3 = foobar::$crate; //~ ERROR `$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` | |
| 21 | use foobar::$crate; //~ ERROR `$crate` in paths can only be used in start position | |
| 22 | use foobar::$crate as _dollar_crate3; //~ ERROR `$crate` in paths can only be used in start position | |
| 23 | use foobar::{$crate}; //~ ERROR `$crate` in paths can only be used in start position | |
| 24 | use foobar::{$crate as _nested_dollar_crate3}; //~ ERROR `$crate` in paths can only be used in start position | |
| 23 | 25 | |
| 24 | 26 | type A4 = crate::$crate; //~ ERROR `$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` | |
| 27 | use crate::$crate; //~ ERROR `$crate` in paths can only be used in start position | |
| 28 | use crate::$crate as _dollar_crate4; //~ ERROR `$crate` in paths can only be used in start position | |
| 29 | use crate::{$crate}; //~ ERROR `$crate` in paths can only be used in start position | |
| 30 | use crate::{$crate as _nested_dollar_crate4}; //~ ERROR `$crate` in paths can only be used in start position | |
| 29 | 31 | |
| 30 | 32 | type A5 = super::$crate; //~ ERROR `$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` | |
| 33 | use super::$crate; //~ ERROR `$crate` in paths can only be used in start position | |
| 34 | use super::$crate as _dollar_crate5; //~ ERROR `$crate` in paths can only be used in start position | |
| 35 | use super::{$crate}; //~ ERROR `$crate` in paths can only be used in start position | |
| 36 | use super::{$crate as _nested_dollar_crate5}; //~ ERROR `$crate` in paths can only be used in start position | |
| 35 | 37 | |
| 36 | 38 | type A6 = self::$crate; //~ ERROR `$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}; | |
| 39 | use self::$crate; //~ ERROR `$crate` in paths can only be used in start position | |
| 40 | use self::$crate as _dollar_crate6; //~ ERROR `$crate` in paths can only be used in start position | |
| 41 | use self::{$crate}; //~ ERROR `$crate` in paths can only be used in start position | |
| 42 | use self::{$crate as _nested_dollar_crate6}; //~ ERROR `$crate` in paths can only be used in start position | |
| 41 | 43 | |
| 42 | 44 | type A7 = $crate::$crate; //~ ERROR `$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` | |
| 45 | use $crate::$crate; //~ ERROR `$crate` in paths can only be used in start position | |
| 46 | use $crate::$crate as _dollar_crate7; //~ ERROR `$crate` in paths can only be used in start position | |
| 47 | use $crate::{$crate}; //~ ERROR `$crate` in paths can only be used in start position | |
| 48 | use $crate::{$crate as _nested_dollar_crate7}; //~ ERROR `$crate` in paths can only be used in start position | |
| 47 | 49 | |
| 48 | 50 | type A8 = $crate::crate; //~ ERROR `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` | |
| 51 | use $crate::crate; //~ ERROR `crate` in paths can only be used in start position | |
| 52 | use $crate::crate as _m_crate8; //~ ERROR `crate` in paths can only be used in start position | |
| 53 | use $crate::{crate}; //~ ERROR `crate` in paths can only be used in start position | |
| 54 | use $crate::{crate as _m_nested_crate8}; //~ ERROR `crate` in paths can only be used in start position | |
| 55 | 55 | |
| 56 | 56 | type A9 = $crate::super; //~ ERROR `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` | |
| 57 | use $crate::super; //~ ERROR `super` in paths can only be used in start position, after `self`, or after another `super` | |
| 58 | use $crate::super as _m_super8; //~ ERROR `super` in paths can only be used in start position, after `self`, or after another `super` | |
| 59 | use $crate::{super}; //~ ERROR `super` in paths can only be used in start position, after `self`, or after another `super` | |
| 60 | use $crate::{super as _m_nested_super8}; //~ ERROR `super` in paths can only be used in start position, after `self`, or after another `super` | |
| 61 | 61 | |
| 62 | 62 | type A10 = $crate::self; //~ ERROR `self` in paths can only be used in start position |
| 63 | use $crate::self; //~ ERROR `$crate` may not be imported | |
| 63 | use $crate::self; //~ ERROR imports need to be explicitly named | |
| 64 | 64 | //~^ ERROR `self` imports are only allowed within a { } list |
| 65 | //~^^ ERROR the name `<!dummy!>` is defined multiple times | |
| 66 | 65 | 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 | |
| 66 | use $crate::{self}; //~ ERROR imports need to be explicitly named | |
| 70 | 67 | pub use $crate::{self as _m_nested_self8}; // Good |
| 71 | 68 | } |
| 72 | 69 | } |
| ... | ... | @@ -84,6 +81,8 @@ mod foo { |
| 84 | 81 | pub use super::inner; |
| 85 | 82 | } |
| 86 | 83 | |
| 84 | pub mod quxbaz {} | |
| 85 | ||
| 87 | 86 | pub fn inner() {} |
| 88 | 87 | } |
| 89 | 88 | |
| ... | ... | @@ -95,131 +94,129 @@ mod foo { |
| 95 | 94 | use crate::{}; |
| 96 | 95 | |
| 97 | 96 | 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;` | |
| 97 | use crate; //~ ERROR imports need to be explicitly named | |
| 99 | 98 | pub use crate as _crate; // Good |
| 100 | 99 | |
| 101 | type B2 = ::crate; //~ ERROR `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` | |
| 100 | type B2 = ::crate; //~ ERROR global paths cannot start with `crate` | |
| 101 | use ::crate; //~ ERROR `crate` in paths can only be used in start position | |
| 102 | use ::crate as _crate2; //~ ERROR `crate` in paths can only be used in start position | |
| 103 | use ::{crate}; //~ ERROR `crate` in paths can only be used in start position | |
| 104 | use ::{crate as _nested_crate2}; //~ ERROR `crate` in paths can only be used in start position | |
| 108 | 105 | |
| 109 | 106 | type B3 = foobar::crate; //~ ERROR `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` | |
| 107 | use foobar::crate; //~ ERROR `crate` in paths can only be used in start position | |
| 108 | use foobar::crate as _crate3; //~ ERROR `crate` in paths can only be used in start position | |
| 109 | use foobar::{crate}; //~ ERROR `crate` in paths can only be used in start position | |
| 110 | use foobar::{crate as _nested_crate3}; //~ ERROR `crate` in paths can only be used in start position | |
| 116 | 111 | |
| 117 | 112 | type B4 = crate::crate; //~ ERROR `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` | |
| 113 | use crate::crate; //~ ERROR `crate` in paths can only be used in start position | |
| 114 | use crate::crate as _crate4; //~ ERROR `crate` in paths can only be used in start position | |
| 115 | use crate::{crate}; //~ ERROR `crate` in paths can only be used in start position | |
| 116 | use crate::{crate as _nested_crate4}; //~ ERROR `crate` in paths can only be used in start position | |
| 124 | 117 | |
| 125 | 118 | type B5 = super::crate; //~ ERROR `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` | |
| 119 | use super::crate; //~ ERROR `crate` in paths can only be used in start position | |
| 120 | use super::crate as _crate5; //~ ERROR `crate` in paths can only be used in start position | |
| 121 | use super::{crate}; //~ ERROR `crate` in paths can only be used in start position | |
| 122 | use super::{crate as _nested_crate5}; //~ ERROR `crate` in paths can only be used in start position | |
| 132 | 123 | |
| 133 | 124 | type B6 = self::crate; //~ ERROR `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}; | |
| 125 | use self::crate; //~ ERROR `crate` in paths can only be used in start position | |
| 126 | use self::crate as _crate6; //~ ERROR `crate` in paths can only be used in start position | |
| 127 | use self::{crate}; //~ ERROR `crate` in paths can only be used in start position | |
| 128 | use self::{crate as _nested_crate6}; //~ ERROR `crate` in paths can only be used in start position | |
| 140 | 129 | |
| 141 | 130 | // --- super --- |
| 142 | 131 | use super::*; |
| 143 | use super::{}; //~ ERROR unresolved import `super` | |
| 132 | use super::{}; | |
| 144 | 133 | |
| 145 | 134 | 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` | |
| 135 | use super; //~ ERROR imports need to be explicitly named | |
| 136 | pub use super as _super; | |
| 148 | 137 | |
| 149 | 138 | type C2 = ::super; //~ ERROR 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` | |
| 139 | use ::super; //~ ERROR `super` in paths can only be used in start position, after `self`, or after another `super` | |
| 140 | use ::super as _super2; //~ ERROR `super` in paths can only be used in start position, after `self`, or after another `super` | |
| 141 | use ::{super}; //~ ERROR `super` in paths can only be used in start position, after `self`, or after another `super` | |
| 142 | use ::{super as _nested_super2}; //~ ERROR `super` in paths can only be used in start position, after `self`, or after another `super` | |
| 154 | 143 | |
| 155 | 144 | type C3 = foobar::super; //~ ERROR `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` | |
| 145 | use foobar::super; //~ ERROR `super` in paths can only be used in start position, after `self`, or after another `super` | |
| 146 | use foobar::super as _super3; //~ ERROR `super` in paths can only be used in start position, after `self`, or after another `super` | |
| 147 | use foobar::{super}; //~ ERROR `super` in paths can only be used in start position, after `self`, or after another `super` | |
| 148 | use foobar::{super as _nested_super3}; //~ ERROR `super` in paths can only be used in start position, after `self`, or after another `super` | |
| 160 | 149 | |
| 161 | 150 | type C4 = crate::super; //~ ERROR `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` | |
| 151 | use crate::super; //~ ERROR `super` in paths can only be used in start position, after `self`, or after another `super` | |
| 152 | use crate::super as _super4; //~ ERROR `super` in paths can only be used in start position, after `self`, or after another `super` | |
| 153 | use crate::{super}; //~ ERROR `super` in paths can only be used in start position, after `self`, or after another `super` | |
| 154 | use crate::{super as _nested_super4}; //~ ERROR `super` in paths can only be used in start position, after `self`, or after another `super` | |
| 166 | 155 | |
| 167 | 156 | 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` | |
| 157 | use super::super; //~ ERROR imports need to be explicitly named | |
| 158 | pub use super::super as _super5; | |
| 159 | use super::{super}; //~ ERROR imports need to be explicitly named | |
| 160 | pub use super::{super as _nested_super5}; | |
| 172 | 161 | |
| 173 | 162 | 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}; | |
| 163 | use self::super; //~ ERROR imports need to be explicitly named | |
| 164 | pub use self::super as _super6; | |
| 165 | use self::{super}; //~ ERROR imports need to be explicitly named | |
| 166 | pub use self::{super as _nested_super6}; | |
| 178 | 167 | |
| 179 | 168 | // --- self --- |
| 180 | 169 | // use self::*; // Suppress other errors |
| 181 | use self::{}; //~ ERROR unresolved import `self` | |
| 170 | use self::{}; | |
| 182 | 171 | |
| 183 | 172 | 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 | |
| 173 | use self; //~ ERROR imports need to be explicitly named | |
| 174 | pub use self as _self; | |
| 186 | 175 | |
| 187 | 176 | type D2 = ::self; //~ ERROR 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 | |
| 177 | use ::self; //[e2018]~ ERROR extern prelude cannot be imported | |
| 178 | //[e2015]~^ ERROR imports need to be explicitly named | |
| 179 | //[e2015]~^^ ERROR `self` imports are only allowed within a { } list | |
| 180 | use ::self as _self2; //[e2018]~ ERROR extern prelude cannot be imported | |
| 181 | //[e2015]~^ ERROR `self` imports are only allowed within a { } list | |
| 182 | use ::{self}; //[e2018]~ ERROR extern prelude cannot be imported | |
| 183 | //[e2015]~^ ERROR imports need to be explicitly named | |
| 184 | pub use ::{self as _nested_self2}; //[e2018]~ ERROR extern prelude cannot be imported | |
| 194 | 185 | |
| 195 | 186 | type D3 = foobar::self; //~ ERROR `self` in paths can only be used in start position |
| 196 | 187 | pub use foobar::qux::self; //~ ERROR `self` imports are only allowed within a { } list |
| 188 | //[e2015]~^ ERROR unresolved import `foobar` | |
| 197 | 189 | 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 | |
| 190 | //[e2015]~^ ERROR unresolved import `foobar` | |
| 191 | pub use foobar::baz::{self}; //[e2015]~ ERROR unresolved import `foobar` | |
| 192 | pub use foobar::{self as _nested_self3}; //[e2015]~ ERROR unresolved import `foobar` | |
| 200 | 193 | |
| 201 | 194 | type D4 = crate::self; //~ ERROR `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;` | |
| 195 | use crate::self; //~ ERROR imports need to be explicitly named | |
| 203 | 196 | //~^ ERROR `self` imports are only allowed within a { } list |
| 204 | //~^^ ERROR the name `crate` is defined multiple times | |
| 205 | 197 | 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 | |
| 198 | use crate::{self}; //~ ERROR imports need to be explicitly named | |
| 208 | 199 | pub use crate::{self as _nested_self4}; // Good |
| 209 | 200 | |
| 210 | 201 | type D5 = super::self; //~ ERROR `self` in paths can only be used in start position |
| 211 | use super::self; //~ ERROR unresolved import `super` | |
| 202 | use super::self; //~ ERROR imports need to be explicitly named | |
| 212 | 203 | //~^ ERROR `self` imports are only allowed within a { } list |
| 213 | 204 | 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` | |
| 205 | use super::{self}; //~ ERROR imports need to be explicitly named | |
| 206 | pub use super::{self as _nested_self5}; | |
| 217 | 207 | |
| 218 | 208 | type D6 = self::self; //~ ERROR `self` in paths can only be used in start position |
| 219 | 209 | use self::self; //~ ERROR `self` imports are only allowed within a { } list |
| 210 | //~^ ERROR imports need to be explicitly named | |
| 220 | 211 | 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` | |
| 212 | use self::{self}; //~ ERROR imports need to be explicitly named | |
| 213 | pub use self::{self as _nested_self6}; | |
| 214 | ||
| 215 | type D7 = crate::foo::bar::self; //~ ERROR `self` in paths can only be used in start position | |
| 216 | use crate::foo::bar::self; //~ ERROR `self` imports are only allowed within a { } list | |
| 217 | use crate::foo::bar::self as _self7; //~ ERROR `self` imports are only allowed within a { } list | |
| 218 | use crate::foo::{bar::foobar::quxbaz::self}; | |
| 219 | use crate::foo::{bar::foobar::quxbaz::self as _nested_self7}; | |
| 223 | 220 | } |
| 224 | 221 | } |
| 225 | 222 | |
| ... | ... | @@ -235,10 +232,13 @@ fn main() { |
| 235 | 232 | foo::bar::_super::bar::foobar::inner(); |
| 236 | 233 | foo::bar::_super5::outer(); |
| 237 | 234 | foo::bar::_nested_super5::outer(); |
| 235 | foo::bar::_super6::bar::foobar::inner(); | |
| 236 | foo::bar::_nested_super6::bar::foobar::inner(); | |
| 238 | 237 | |
| 239 | 238 | foo::bar::_self::foobar::inner(); |
| 240 | 239 | foo::bar::qux::inner(); // Works after recovery |
| 241 | 240 | foo::bar::baz::inner(); |
| 241 | foo::bar::_nested_self2::outer(); //[e2018]~ ERROR cannot find `_nested_self2` in `bar` | |
| 242 | 242 | foo::bar::_self3::inner(); // Works after recovery |
| 243 | 243 | foo::bar::_nested_self3::inner(); |
| 244 | 244 | foo::bar::_self4::outer(); // Works after recovery |
tests/ui/use/use-path-segment-kw.stderr deleted-1245| ... | ... | @@ -1,1245 +0,0 @@ |
| 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]: global paths cannot start with `$crate` | |
| 1066 | --> $DIR/use-path-segment-kw.rs:12:21 | |
| 1067 | | | |
| 1068 | LL | type A2 = ::$crate; | |
| 1069 | | ^^^^^^ cannot start with this | |
| 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]: `$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 | | ^^^^^^ can only be used in path 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]: `$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 | | ^^^^^^ can only be used in path 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]: `$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 | | ^^^^^^ can only be used in path 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]: `$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 | | ^^^^^^ can only be used in path 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]: `$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 | | ^^^^^^ can only be used in path 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]: `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 | | ^^^^^ can only be used in path 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]: `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 | | ^^^^^ can only be used in path 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]: `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 | | ^^^^ can only be used in path 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]: global paths cannot start with `crate` | |
| 1165 | --> $DIR/use-path-segment-kw.rs:101:21 | |
| 1166 | | | |
| 1167 | LL | type B2 = ::crate; | |
| 1168 | | ^^^^^ cannot start with this | |
| 1169 | ||
| 1170 | error[E0433]: `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 | | ^^^^^ can only be used in path start position | |
| 1175 | ||
| 1176 | error[E0433]: `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 | | ^^^^^ can only be used in path start position | |
| 1181 | ||
| 1182 | error[E0433]: `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 | | ^^^^^ can only be used in path start position | |
| 1187 | ||
| 1188 | error[E0433]: `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 | | ^^^^^ can only be used in path start position | |
| 1193 | ||
| 1194 | error[E0433]: global paths cannot start with `super` | |
| 1195 | --> $DIR/use-path-segment-kw.rs:149:21 | |
| 1196 | | | |
| 1197 | LL | type C2 = ::super; | |
| 1198 | | ^^^^^ cannot start with this | |
| 1199 | ||
| 1200 | error[E0433]: `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 | | ^^^^^ can only be used in path start position | |
| 1205 | ||
| 1206 | error[E0433]: `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 | | ^^^^^ can only be used in path start position | |
| 1211 | ||
| 1212 | error[E0433]: global paths cannot start with `self` | |
| 1213 | --> $DIR/use-path-segment-kw.rs:187:21 | |
| 1214 | | | |
| 1215 | LL | type D2 = ::self; | |
| 1216 | | ^^^^ cannot start with this | |
| 1217 | ||
| 1218 | error[E0433]: `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 | | ^^^^ can only be used in path start position | |
| 1223 | ||
| 1224 | error[E0433]: `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 | | ^^^^ can only be used in path start position | |
| 1229 | ||
| 1230 | error[E0433]: `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 | | ^^^^ can only be used in path start position | |
| 1235 | ||
| 1236 | error[E0433]: `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 | | ^^^^ can only be used in path 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`. |