authorbors <bors@rust-lang.org> 2026-02-21 02:52:40 UTC
committerbors <bors@rust-lang.org> 2026-02-21 02:52:40 UTC
log1c00e989ca032d57e815e930fad00b61e65a1826
tree83fd9571a27e8e3d994126a34ac3f5a41a8eb969
parent0376d43d443cba463a0b6a6ec9140ea17d7b7130
parent7655d9370d3ddd99f6c7ad79a3accd0a709784b8

Auto merge of #152924 - JonathanBrouwer:rollup-vnwkCh0, r=JonathanBrouwer

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:
9494 CACHE_DOMAIN: ci-caches.rust-lang.org
9595 continue-on-error: ${{ matrix.continue_on_error || false }}
9696 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' }}
97101 matrix:
98102 # Check the `calculate_matrix` job to see how is the matrix defined.
99103 include: ${{ fromJSON(needs.calculate_matrix.outputs.jobs) }}
Cargo.lock-2
......@@ -3807,7 +3807,6 @@ name = "rustc_error_messages"
38073807version = "0.0.0"
38083808dependencies = [
38093809 "fluent-bundle",
3810 "fluent-syntax",
38113810 "icu_list",
38123811 "icu_locale",
38133812 "intl-memoizer",
......@@ -3818,7 +3817,6 @@ dependencies = [
38183817 "rustc_macros",
38193818 "rustc_serialize",
38203819 "rustc_span",
3821 "tracing",
38223820 "unic-langid",
38233821]
38243822
compiler/rustc_codegen_llvm/src/back/write.rs+1-2
......@@ -786,7 +786,6 @@ pub(crate) unsafe fn llvm_optimize(
786786 config.verify_llvm_ir,
787787 config.lint_llvm_ir,
788788 thin_lto_buffer,
789 config.emit_thin_lto,
790789 config.emit_thin_lto_summary,
791790 merge_functions,
792791 unroll_loops,
......@@ -1033,7 +1032,7 @@ pub(crate) fn codegen(
10331032 "LLVM_module_codegen_make_bitcode",
10341033 &*module.name,
10351034 );
1036 ThinBuffer::new(llmod, config.emit_thin_lto)
1035 ThinBuffer::new(llmod, cgcx.lto != Lto::Fat)
10371036 };
10381037 let data = thin.data();
10391038 let _timer = prof
compiler/rustc_codegen_llvm/src/llvm/ffi.rs-1
......@@ -2376,7 +2376,6 @@ unsafe extern "C" {
23762376 VerifyIR: bool,
23772377 LintIR: bool,
23782378 ThinLTOBuffer: Option<&mut *mut ThinLTOBuffer>,
2379 EmitThinLTO: bool,
23802379 EmitThinLTOSummary: bool,
23812380 MergeFunctions: bool,
23822381 UnrollLoops: bool,
compiler/rustc_codegen_ssa/src/back/write.rs-9
......@@ -12,7 +12,6 @@ use rustc_data_structures::jobserver::{self, Acquired};
1212use rustc_data_structures::memmap::Mmap;
1313use rustc_data_structures::profiling::{SelfProfilerRef, VerboseTimingGuard};
1414use rustc_errors::emitter::Emitter;
15use rustc_errors::translation::Translator;
1615use rustc_errors::{
1716 Diag, DiagArgMap, DiagCtxt, DiagCtxtHandle, DiagMessage, ErrCode, FatalError, FatalErrorMarker,
1817 Level, MultiSpan, Style, Suggestions, catch_fatal_errors,
......@@ -100,7 +99,6 @@ pub struct ModuleConfig {
10099 pub emit_ir: bool,
101100 pub emit_asm: bool,
102101 pub emit_obj: EmitObj,
103 pub emit_thin_lto: bool,
104102 pub emit_thin_lto_summary: bool,
105103
106104 // Miscellaneous flags. These are mostly copied from command-line
......@@ -211,9 +209,6 @@ impl ModuleConfig {
211209 false
212210 ),
213211 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,
217212 emit_thin_lto_summary: if_regular!(
218213 sess.opts.output_types.contains_key(&OutputType::ThinLinkBitcode),
219214 false
......@@ -2040,10 +2035,6 @@ impl Emitter for SharedEmitter {
20402035 fn source_map(&self) -> Option<&SourceMap> {
20412036 None
20422037 }
2043
2044 fn translator(&self) -> &Translator {
2045 panic!("shared emitter attempted to translate a diagnostic");
2046 }
20472038}
20482039
20492040impl SharedEmitterMain {
compiler/rustc_driver_impl/src/lib.rs-7
......@@ -34,7 +34,6 @@ use rustc_data_structures::profiling::{
3434};
3535pub use rustc_errors::catch_fatal_errors;
3636use rustc_errors::emitter::stderr_destination;
37use rustc_errors::translation::Translator;
3837use rustc_errors::{ColorConfig, DiagCtxt, ErrCode, PResult, markdown};
3938use rustc_feature::find_gated_cfg;
4039// This avoids a false positive with `-Wunused_crate_dependencies`.
......@@ -107,10 +106,6 @@ use crate::session_diagnostics::{
107106 RLinkWrongFileType, RlinkCorruptFile, RlinkNotAFile, RlinkUnableToRead, UnstableFeatureUsage,
108107};
109108
110pub fn default_translator() -> Translator {
111 Translator::new()
112}
113
114109/// Exit status code used for successful compilation and help output.
115110pub const EXIT_SUCCESS: i32 = 0;
116111
......@@ -1525,11 +1520,9 @@ fn report_ice(
15251520 extra_info: fn(&DiagCtxt),
15261521 using_internal_features: &AtomicBool,
15271522) {
1528 let translator = Translator::new();
15291523 let emitter =
15301524 Box::new(rustc_errors::annotate_snippet_emitter_writer::AnnotateSnippetEmitter::new(
15311525 stderr_destination(rustc_errors::ColorConfig::Auto),
1532 translator,
15331526 ));
15341527 let dcx = rustc_errors::DiagCtxt::new(emitter);
15351528 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
13The `self` import appears more than once in the list.
24
35Erroneous code example:
46
5```compile_fail,E0430
7```ignore (error is no longer emitted)
68use something::{self, self}; // error: `self` import can only appear once in
79 // the list
810```
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
13An invalid `self` import was made.
24
35Erroneous code example:
46
5```compile_fail,E0431
7```ignore (error is no longer emitted)
68use {self}; // error: `self` import can only appear in an import list with a
79 // non-empty prefix
810```
compiler/rustc_error_messages/Cargo.toml-2
......@@ -6,7 +6,6 @@ edition = "2024"
66[dependencies]
77# tidy-alphabetical-start
88fluent-bundle = "0.16"
9fluent-syntax = "0.12"
109icu_list = { version = "2.0", default-features = false, features = ["alloc"] }
1110icu_locale = { version = "2.0", default-features = false }
1211intl-memoizer = "0.5.1"
......@@ -17,6 +16,5 @@ rustc_data_structures = { path = "../rustc_data_structures" }
1716rustc_macros = { path = "../rustc_macros" }
1817rustc_serialize = { path = "../rustc_serialize" }
1918rustc_span = { path = "../rustc_span" }
20tracing = "0.1"
2119unic-langid = { version = "0.9.0", features = ["macros"] }
2220# tidy-alphabetical-end
compiler/rustc_error_messages/src/lib.rs-207
......@@ -4,194 +4,16 @@
44// tidy-alphabetical-end
55
66use std::borrow::Cow;
7use std::error::Error;
8use std::path::Path;
9use std::sync::{Arc, LazyLock};
10use std::{fmt, fs, io};
117
12use fluent_bundle::FluentResource;
138pub use fluent_bundle::types::FluentType;
149pub use fluent_bundle::{self, FluentArgs, FluentError, FluentValue};
15use fluent_syntax::parser::ParserError;
16use intl_memoizer::concurrent::IntlLangMemoizer;
17use rustc_data_structures::sync::{DynSend, IntoDynSyncSend};
1810use rustc_macros::{Decodable, Encodable};
1911use rustc_span::Span;
20use tracing::{instrument, trace};
2112pub use unic_langid::{LanguageIdentifier, langid};
2213
2314mod diagnostic_impls;
2415pub use diagnostic_impls::DiagArgFromDisplay;
2516
26pub type FluentBundle =
27 IntoDynSyncSend<fluent_bundle::bundle::FluentBundle<FluentResource, IntlLangMemoizer>>;
28
29fn new_bundle(locales: Vec<LanguageIdentifier>) -> FluentBundle {
30 IntoDynSyncSend(fluent_bundle::bundle::FluentBundle::new_concurrent(locales))
31}
32
33#[derive(Debug)]
34pub 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
51impl 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
73impl 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
87impl 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
93impl 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")]
107pub 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
19517pub fn register_functions<R, M>(bundle: &mut fluent_bundle::bundle::FluentBundle<R, M>) {
19618 bundle
19719 .add_function("STREQ", |positional, _named| match positional {
......@@ -201,35 +23,6 @@ pub fn register_functions<R, M>(bundle: &mut fluent_bundle::bundle::FluentBundle
20123 .expect("Failed to add a function to the bundle.");
20224}
20325
204/// Type alias for the result of `fallback_fluent_bundle` - a reference-counted pointer to a lazily
205/// evaluated fluent bundle.
206pub 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))]
211pub 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
23326/// Abstraction over a message in a diagnostic to support both translatable and non-translatable
23427/// diagnostic messages.
23528///
compiler/rustc_errors/src/annotate_snippet_emitter_writer.rs+14-25
......@@ -27,7 +27,7 @@ use crate::emitter::{
2727 ConfusionType, Destination, MAX_SUGGESTIONS, OutputTheme, detect_confusion_type, is_different,
2828 normalize_whitespace, should_show_source_code,
2929};
30use crate::translation::{Translator, to_fluent_args};
30use crate::translation::{format_diag_message, format_diag_messages, to_fluent_args};
3131use crate::{
3232 CodeSuggestion, DiagInner, DiagMessage, Emitter, ErrCode, Level, MultiSpan, Style, Subdiag,
3333 SuggestionStyle, TerminalUrl,
......@@ -39,8 +39,6 @@ pub struct AnnotateSnippetEmitter {
3939 #[setters(skip)]
4040 dst: IntoDynSyncSend<Destination>,
4141 sm: Option<Arc<SourceMap>>,
42 #[setters(skip)]
43 translator: Translator,
4442 short_message: bool,
4543 ui_testing: bool,
4644 ignored_directories_in_source_blocks: Vec<String>,
......@@ -108,10 +106,6 @@ impl Emitter for AnnotateSnippetEmitter {
108106 !self.short_message
109107 }
110108
111 fn translator(&self) -> &Translator {
112 &self.translator
113 }
114
115109 fn supports_color(&self) -> bool {
116110 false
117111 }
......@@ -133,11 +127,10 @@ fn annotation_level_for_level(level: Level) -> annotate_snippets::level::Level<'
133127}
134128
135129impl AnnotateSnippetEmitter {
136 pub fn new(dst: Destination, translator: Translator) -> Self {
130 pub fn new(dst: Destination) -> Self {
137131 Self {
138132 dst: IntoDynSyncSend(dst),
139133 sm: None,
140 translator,
141134 short_message: false,
142135 ui_testing: false,
143136 ignored_directories_in_source_blocks: Vec::new(),
......@@ -169,7 +162,7 @@ impl AnnotateSnippetEmitter {
169162 .clone()
170163 .secondary_title(Cow::Owned(self.pre_style_msgs(msgs, *level, args)))
171164 } else {
172 annotation_level.clone().primary_title(self.translator.translate_messages(msgs, args))
165 annotation_level.clone().primary_title(format_diag_messages(msgs, args))
173166 };
174167
175168 if let Some(c) = code {
......@@ -185,7 +178,7 @@ impl AnnotateSnippetEmitter {
185178 // If we don't have span information, emit and exit
186179 let Some(sm) = self.sm.as_ref() else {
187180 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();
189182 let level = annotation_level_for_level(c.level);
190183 level.message(msg)
191184 }));
......@@ -202,7 +195,7 @@ impl AnnotateSnippetEmitter {
202195 return;
203196 };
204197
205 let mut file_ann = collect_annotations(args, msp, sm, &self.translator);
198 let mut file_ann = collect_annotations(args, msp, sm);
206199
207200 // Make sure our primary file comes first
208201 let primary_span = msp.primary_span().unwrap_or_default();
......@@ -256,7 +249,7 @@ impl AnnotateSnippetEmitter {
256249 let msg = if c.messages.iter().any(|(_, style)| style != &crate::Style::NoStyle) {
257250 Cow::Owned(self.pre_style_msgs(&c.messages, c.level, args))
258251 } else {
259 self.translator.translate_messages(&c.messages, args)
252 format_diag_messages(&c.messages, args)
260253 };
261254
262255 // This is a secondary message with no span info
......@@ -270,7 +263,7 @@ impl AnnotateSnippetEmitter {
270263 Group::with_title(level.clone().secondary_title(msg)),
271264 ));
272265
273 let mut file_ann = collect_annotations(args, &c.span, sm, &self.translator);
266 let mut file_ann = collect_annotations(args, &c.span, sm);
274267 let primary_span = c.span.primary_span().unwrap_or_default();
275268 if !primary_span.is_dummy() {
276269 let primary_lo = sm.lookup_char_pos(primary_span.lo());
......@@ -308,9 +301,10 @@ impl AnnotateSnippetEmitter {
308301 // do not display this suggestion, it is meant only for tools
309302 }
310303 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 );
314308 group = group.element(annotate_snippets::Level::HELP.message(msg));
315309 }
316310 SuggestionStyle::HideCodeInline
......@@ -367,9 +361,7 @@ impl AnnotateSnippetEmitter {
367361 if substitutions.is_empty() {
368362 continue;
369363 }
370 let mut msg = self
371 .translator
372 .translate_message(&suggestion.msg, args)
364 let mut msg = format_diag_message(&suggestion.msg, args)
373365 .map_err(Report::new)
374366 .unwrap()
375367 .to_string();
......@@ -555,7 +547,7 @@ impl AnnotateSnippetEmitter {
555547 ) -> String {
556548 msgs.iter()
557549 .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();
559551 let style = style.anstyle(level);
560552 if text.is_empty() { None } else { Some(format!("{style}{text}{style:#}")) }
561553 })
......@@ -688,7 +680,6 @@ fn collect_annotations(
688680 args: &FluentArgs<'_>,
689681 msp: &MultiSpan,
690682 sm: &Arc<SourceMap>,
691 translator: &Translator,
692683) -> Vec<(Arc<SourceFile>, Vec<Annotation>)> {
693684 let mut output: Vec<(Arc<SourceFile>, Vec<Annotation>)> = vec![];
694685
......@@ -704,9 +695,7 @@ fn collect_annotations(
704695 let kind = if is_primary { AnnotationKind::Primary } else { AnnotationKind::Context };
705696
706697 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())
710699 });
711700
712701 let ann = Annotation { kind, span, label };
compiler/rustc_errors/src/emitter.rs+3-19
......@@ -25,7 +25,7 @@ use rustc_span::{FileName, SourceFile, Span};
2525use tracing::{debug, warn};
2626
2727use crate::timings::TimingRecord;
28use crate::translation::Translator;
28use crate::translation::format_diag_message;
2929use crate::{
3030 CodeSuggestion, DiagInner, DiagMessage, Level, MultiSpan, Style, Subdiag, SuggestionStyle,
3131};
......@@ -88,8 +88,6 @@ pub trait Emitter {
8888
8989 fn source_map(&self) -> Option<&SourceMap>;
9090
91 fn translator(&self) -> &Translator;
92
9391 /// Formats the substitutions of the primary_span
9492 ///
9593 /// There are a lot of conditions to this method, but in short:
......@@ -108,11 +106,7 @@ pub trait Emitter {
108106 fluent_args: &FluentArgs<'_>,
109107 ) {
110108 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();
116110 if rest.is_empty()
117111 // ^ if there is only one suggestion
118112 // don't display multi-suggestions as labels
......@@ -383,15 +377,9 @@ impl Emitter for EmitterWithNote {
383377 diag.sub(Level::Note, self.note.clone(), MultiSpan::new());
384378 self.emitter.emit_diagnostic(diag);
385379 }
386
387 fn translator(&self) -> &Translator {
388 self.emitter.translator()
389 }
390380}
391381
392pub struct SilentEmitter {
393 pub translator: Translator,
394}
382pub struct SilentEmitter;
395383
396384impl Emitter for SilentEmitter {
397385 fn source_map(&self) -> Option<&SourceMap> {
......@@ -399,10 +387,6 @@ impl Emitter for SilentEmitter {
399387 }
400388
401389 fn emit_diagnostic(&mut self, _diag: DiagInner) {}
402
403 fn translator(&self) -> &Translator {
404 &self.translator
405 }
406390}
407391
408392/// Maximum number of suggestions to be shown
compiler/rustc_errors/src/json.rs+6-14
......@@ -32,7 +32,7 @@ use crate::emitter::{
3232 should_show_source_code,
3333};
3434use crate::timings::{TimingRecord, TimingSection};
35use crate::translation::{Translator, to_fluent_args};
35use crate::translation::{format_diag_message, format_diag_messages, to_fluent_args};
3636use crate::{CodeSuggestion, MultiSpan, SpanLabel, Subdiag, Suggestions, TerminalUrl};
3737
3838#[cfg(test)]
......@@ -45,8 +45,6 @@ pub struct JsonEmitter {
4545 #[setters(skip)]
4646 sm: Option<Arc<SourceMap>>,
4747 #[setters(skip)]
48 translator: Translator,
49 #[setters(skip)]
5048 pretty: bool,
5149 ui_testing: bool,
5250 ignored_directories_in_source_blocks: Vec<String>,
......@@ -63,7 +61,6 @@ impl JsonEmitter {
6361 pub fn new(
6462 dst: Box<dyn Write + Send>,
6563 sm: Option<Arc<SourceMap>>,
66 translator: Translator,
6764 pretty: bool,
6865 json_rendered: HumanReadableErrorType,
6966 color_config: ColorConfig,
......@@ -71,7 +68,6 @@ impl JsonEmitter {
7168 JsonEmitter {
7269 dst: IntoDynSyncSend(dst),
7370 sm,
74 translator,
7571 pretty,
7672 ui_testing: false,
7773 ignored_directories_in_source_blocks: Vec::new(),
......@@ -180,10 +176,6 @@ impl Emitter for JsonEmitter {
180176 fn should_show_explain(&self) -> bool {
181177 !self.json_rendered.short()
182178 }
183
184 fn translator(&self) -> &Translator {
185 &self.translator
186 }
187179}
188180
189181// The following data types are provided just for serialisation.
......@@ -310,7 +302,7 @@ impl Diagnostic {
310302 let args = to_fluent_args(diag.args.iter());
311303 let sugg_to_diag = |sugg: &CodeSuggestion| {
312304 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();
314306 Diagnostic {
315307 message: translated_message.to_string(),
316308 code: None,
......@@ -341,7 +333,7 @@ impl Diagnostic {
341333 }
342334 }
343335
344 let translated_message = je.translator.translate_messages(&diag.messages, &args);
336 let translated_message = format_diag_messages(&diag.messages, &args);
345337
346338 let code = if let Some(code) = diag.code {
347339 Some(DiagnosticCode {
......@@ -373,7 +365,7 @@ impl Diagnostic {
373365 choice => choice,
374366 },
375367 );
376 AnnotateSnippetEmitter::new(dst, je.translator.clone())
368 AnnotateSnippetEmitter::new(dst)
377369 .short_message(je.json_rendered.short)
378370 .sm(je.sm.clone())
379371 .diagnostic_width(je.diagnostic_width)
......@@ -403,7 +395,7 @@ impl Diagnostic {
403395 args: &FluentArgs<'_>,
404396 je: &JsonEmitter,
405397 ) -> Diagnostic {
406 let translated_message = je.translator.translate_messages(&subdiag.messages, args);
398 let translated_message = format_diag_messages(&subdiag.messages, args);
407399 Diagnostic {
408400 message: translated_message.to_string(),
409401 code: None,
......@@ -427,7 +419,7 @@ impl DiagnosticSpan {
427419 span.is_primary,
428420 span.label
429421 .as_ref()
430 .map(|m| je.translator.translate_message(m, args).unwrap())
422 .map(|m| format_diag_message(m, args).unwrap())
431423 .map(|m| m.to_string()),
432424 suggestion,
433425 je,
compiler/rustc_errors/src/json/tests.rs-2
......@@ -45,13 +45,11 @@ fn test_positions(code: &str, span: (u32, u32), expected_output: SpanTestData) {
4545 rustc_span::create_default_session_globals_then(|| {
4646 let sm = Arc::new(SourceMap::new(FilePathMapping::empty()));
4747 sm.new_source_file(filename(&sm, "test.rs"), code.to_owned());
48 let translator = Translator::new();
4948
5049 let output = Arc::new(Mutex::new(Vec::new()));
5150 let je = JsonEmitter::new(
5251 Box::new(Shared { data: output.clone() }),
5352 Some(sm),
54 translator,
5553 true, // pretty
5654 HumanReadableErrorType { short: true, unicode: false },
5755 ColorConfig::Never,
compiler/rustc_errors/src/lib.rs+5-11
......@@ -54,9 +54,8 @@ use rustc_data_structures::stable_hasher::StableHasher;
5454use rustc_data_structures::sync::{DynSend, Lock};
5555use rustc_data_structures::{AtomicRef, assert_matches};
5656pub 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,
6059};
6160use rustc_hashes::Hash128;
6261use rustc_lint_defs::LintExpectationId;
......@@ -71,6 +70,7 @@ use tracing::debug;
7170
7271use crate::emitter::TimingEvent;
7372use crate::timings::TimingRecord;
73use crate::translation::format_diag_message;
7474
7575pub mod annotate_snippet_emitter_writer;
7676pub mod codes;
......@@ -479,8 +479,7 @@ impl DiagCtxt {
479479
480480 pub fn make_silent(&self) {
481481 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 {});
484483 }
485484
486485 pub fn set_emitter(&self, emitter: Box<dyn Emitter + DynSend>) {
......@@ -1438,12 +1437,7 @@ impl DiagCtxtInner {
14381437 args: impl Iterator<Item = DiagArg<'a>>,
14391438 ) -> String {
14401439 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()
14471441 }
14481442
14491443 fn eagerly_translate_for_subdiag(
compiler/rustc_errors/src/translation.rs+41-57
......@@ -1,14 +1,13 @@
11use std::borrow::Cow;
22use std::error::Report;
3use std::sync::Arc;
43
5pub use rustc_error_messages::{FluentArgs, LazyFallbackBundle};
4pub use rustc_error_messages::FluentArgs;
65use rustc_error_messages::{langid, register_functions};
76use tracing::{debug, trace};
87
98use crate::error::TranslateError;
109use crate::fluent_bundle::FluentResource;
11use crate::{DiagArg, DiagMessage, FluentBundle, Style, fluent_bundle};
10use crate::{DiagArg, DiagMessage, Style, fluent_bundle};
1211
1312/// Convert diagnostic arguments (a rustc internal type that exists to implement
1413/// `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
2928 args
3029}
3130
32#[derive(Clone)]
33pub 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
32pub 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 )
3742}
3843
39impl 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
45pub 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();
8065
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))
8973 }
9074 }
9175 }
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
435435
436436 let temps_dir = config.opts.unstable_opts.temps_dir.as_deref().map(PathBuf::from);
437437
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
448438 let mut sess = rustc_session::build_session(
449439 config.opts,
450440 CompilerIO {
......@@ -453,7 +443,6 @@ pub fn run_compiler<R: Send>(config: Config, f: impl FnOnce(&Compiler) -> R + Se
453443 output_file: config.output_file,
454444 temps_dir,
455445 },
456 bundle,
457446 config.lint_caps,
458447 target,
459448 util::rustc_version_str().unwrap_or("unknown"),
compiler/rustc_interface/src/tests.rs-2
......@@ -71,7 +71,6 @@ where
7171 let sess = build_session(
7272 sessopts,
7373 io,
74 None,
7574 Default::default(),
7675 target,
7776 "",
......@@ -796,7 +795,6 @@ fn test_unstable_options_tracking_hash() {
796795 tracked!(dwarf_version, Some(5));
797796 tracked!(embed_metadata, false);
798797 tracked!(embed_source, true);
799 tracked!(emit_thin_lto, false);
800798 tracked!(emscripten_wasm_eh, false);
801799 tracked!(export_executable_symbols, true);
802800 tracked!(fewer_names, Some(true));
compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp+14-20
......@@ -566,7 +566,7 @@ extern "C" LLVMRustResult LLVMRustOptimize(
566566 LLVMModuleRef ModuleRef, LLVMTargetMachineRef TMRef,
567567 LLVMRustPassBuilderOptLevel OptLevelRust, LLVMRustOptStage OptStage,
568568 bool IsLinkerPluginLTO, bool NoPrepopulatePasses, bool VerifyIR,
569 bool LintIR, LLVMRustThinLTOBuffer **ThinLTOBufferRef, bool EmitThinLTO,
569 bool LintIR, LLVMRustThinLTOBuffer **ThinLTOBufferRef,
570570 bool EmitThinLTOSummary, bool MergeFunctions, bool UnrollLoops,
571571 bool SLPVectorize, bool LoopVectorize, bool DisableSimplifyLibCalls,
572572 bool EmitLifetimeMarkers, registerEnzymeAndPassPipelineFn EnzymePtr,
......@@ -808,31 +808,26 @@ extern "C" LLVMRustResult LLVMRustOptimize(
808808 }
809809
810810 ModulePassManager MPM;
811 bool NeedThinLTOBufferPasses = EmitThinLTO;
811 bool NeedThinLTOBufferPasses = true;
812812 auto ThinLTOBuffer = std::make_unique<LLVMRustThinLTOBuffer>();
813813 raw_string_ostream ThinLTODataOS(ThinLTOBuffer->data);
814814 raw_string_ostream ThinLinkDataOS(ThinLTOBuffer->thin_link_data);
815815 bool IsLTO = OptStage == LLVMRustOptStage::ThinLTO ||
816816 OptStage == LLVMRustOptStage::FatLTO;
817817 if (!NoPrepopulatePasses) {
818 for (const auto &C : PipelineStartEPCallbacks)
819 PB.registerPipelineStartEPCallback(C);
820 for (const auto &C : OptimizerLastEPCallbacks)
821 PB.registerOptimizerLastEPCallback(C);
822
818823 // The pre-link pipelines don't support O0 and require using
819824 // buildO0DefaultPipeline() instead. At the same time, the LTO pipelines do
820825 // support O0 and using them is required.
821826 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
827827 // We manually schedule ThinLTOBufferPasses below, so don't pass the value
828828 // to enable it here.
829829 MPM = PB.buildO0DefaultPipeline(OptLevel);
830830 } else {
831 for (const auto &C : PipelineStartEPCallbacks)
832 PB.registerPipelineStartEPCallback(C);
833 for (const auto &C : OptimizerLastEPCallbacks)
834 PB.registerOptimizerLastEPCallback(C);
835
836831 switch (OptStage) {
837832 case LLVMRustOptStage::PreLinkNoLTO:
838833 if (ThinLTOBufferRef) {
......@@ -840,12 +835,8 @@ extern "C" LLVMRustResult LLVMRustOptimize(
840835 // bitcode for embedding is obtained after performing
841836 // `ThinLTOPreLinkDefaultPipeline`.
842837 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));
849840 *ThinLTOBufferRef = ThinLTOBuffer.release();
850841 MPM.addPass(PB.buildModuleOptimizationPipeline(
851842 OptLevel, ThinOrFullLTOPhase::None));
......@@ -870,6 +861,7 @@ extern "C" LLVMRustResult LLVMRustOptimize(
870861 break;
871862 case LLVMRustOptStage::FatLTO:
872863 MPM = PB.buildLTODefaultPipeline(OptLevel, nullptr);
864 NeedThinLTOBufferPasses = false;
873865 break;
874866 }
875867 }
......@@ -895,9 +887,11 @@ extern "C" LLVMRustResult LLVMRustOptimize(
895887 MPM.addPass(CanonicalizeAliasesPass());
896888 MPM.addPass(NameAnonGlobalPass());
897889 }
898 // For `-Copt-level=0`, ThinLTO, or LTO.
890 // For `-Copt-level=0`, and the pre-link fat/thin LTO stages.
899891 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) {
901895 MPM.addPass(ThinLTOBitcodeWriterPass(
902896 ThinLTODataOS, EmitThinLTOSummary ? &ThinLinkDataOS : nullptr));
903897 } else {
compiler/rustc_mir_build/src/errors.rs-46
......@@ -874,52 +874,6 @@ pub(crate) struct UpperRangeBoundCannotBeMin {
874874 pub(crate) span: Span,
875875}
876876
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)]
896pub(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)]
919pub(crate) struct TrailingIrrefutableLetPatterns {
920 pub(crate) count: usize,
921}
922
923877#[derive(LintDiagnostic)]
924878#[diag("pattern binding `{$name}` is named the same as one of the variants of the type `{$ty_path}`", code = E0170)]
925879pub(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> {
167167 {
168168 let mut chain_refutabilities = Vec::new();
169169 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);
173173 }
174174 return;
175175 }
......@@ -430,18 +430,9 @@ impl<'p, 'tcx> MatchVisitor<'p, 'tcx> {
430430 assert!(self.let_source != LetSource::None);
431431 let scrut = scrutinee.map(|id| &self.thir[id]);
432432 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);
445436 }
446437 }
447438
......@@ -549,74 +540,8 @@ impl<'p, 'tcx> MatchVisitor<'p, 'tcx> {
549540 }
550541
551542 #[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);
620545 }
621546
622547 fn analyze_binding(
compiler/rustc_mir_transform/src/check_alignment.rs+1-1
......@@ -82,7 +82,7 @@ fn insert_alignment_check<'tcx>(
8282
8383 // If this target does not have reliable alignment, further limit the mask by anding it with
8484 // the mask for the highest reliable alignment.
85 #[allow(irrefutable_let_patterns)]
85 #[cfg_attr(bootstrap, expect(irrefutable_let_patterns))]
8686 if let max_align = tcx.sess.target.max_reliable_alignment()
8787 && max_align < Align::MAX
8888 {
compiler/rustc_parse/src/parser/tests.rs+1-3
......@@ -13,7 +13,6 @@ use rustc_ast_pretty::pprust::item_to_string;
1313use rustc_data_structures::assert_matches;
1414use rustc_errors::annotate_snippet_emitter_writer::AnnotateSnippetEmitter;
1515use rustc_errors::emitter::OutputTheme;
16use rustc_errors::translation::Translator;
1716use rustc_errors::{AutoStream, DiagCtxt, MultiSpan, PResult};
1817use rustc_session::parse::ParseSess;
1918use rustc_span::source_map::{FilePathMapping, SourceMap};
......@@ -42,11 +41,10 @@ fn string_to_parser(psess: &ParseSess, source_str: String) -> Parser<'_> {
4241fn create_test_handler(theme: OutputTheme) -> (DiagCtxt, Arc<SourceMap>, Arc<Mutex<Vec<u8>>>) {
4342 let output = Arc::new(Mutex::new(Vec::new()));
4443 let source_map = Arc::new(SourceMap::new(FilePathMapping::empty()));
45 let translator = Translator::new();
4644 let shared: Box<dyn Write + Send> = Box::new(Shared { data: output.clone() });
4745 let auto_stream = AutoStream::never(shared);
4846 let dcx = DiagCtxt::new(Box::new(
49 AnnotateSnippetEmitter::new(auto_stream, translator)
47 AnnotateSnippetEmitter::new(auto_stream)
5048 .sm(Some(source_map.clone()))
5149 .diagnostic_width(Some(140))
5250 .theme(theme),
compiler/rustc_public/src/compiler_interface.rs+3-3
......@@ -562,12 +562,12 @@ impl<'tcx> CompilerInterface<'tcx> {
562562 cnst.internal(&mut *tables, cx.tcx).to_string()
563563 }
564564
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 {
567567 let mut tables = self.tables.borrow_mut();
568568 let cx = &*self.cx.borrow();
569569 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)
571571 }
572572
573573 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 {
3434 pub fn parent(&self) -> Option<DefId> {
3535 with(|cx| cx.def_parent(*self))
3636 }
37
38 pub fn span(&self) -> Span {
39 with(|cx| cx.span_of_a_def(*self))
40 }
3741}
3842
3943/// A trait for retrieving information about a particular definition.
......@@ -68,8 +72,7 @@ pub trait CrateDef {
6872
6973 /// Return the span of this definition.
7074 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()
7376 }
7477
7578 /// Return registered tool attributes with the given attribute name.
compiler/rustc_public/src/lib.rs+1-1
......@@ -155,7 +155,7 @@ impl CrateItem {
155155 }
156156
157157 pub fn span(&self) -> Span {
158 with(|cx| cx.span_of_an_item(self.0))
158 self.0.span()
159159 }
160160
161161 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 {
8282 }
8383}
8484
85impl<'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
8597impl<'tcx> Stable<'tcx> for rustc_span::Span {
8698 type T = crate::ty::Span;
8799
compiler/rustc_public_bridge/src/context/impls.rs+2-2
......@@ -554,8 +554,8 @@ impl<'tcx, B: Bridge> CompilerCtxt<'tcx, B> {
554554 )
555555 }
556556
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 {
559559 self.tcx.def_span(def_id)
560560 }
561561
compiler/rustc_resolve/src/build_reduced_graph.rs+80-97
......@@ -620,97 +620,103 @@ impl<'a, 'ra, 'tcx> BuildReducedGraphVisitor<'a, 'ra, 'tcx> {
620620 let prefix = crate_root.into_iter().chain(prefix_iter).collect::<Vec<_>>();
621621 debug!("build_reduced_graph_for_use_tree: prefix={:?}", prefix);
622622
623 let empty_for_self = |prefix: &[Segment]| {
624 prefix.is_empty() || prefix.len() == 1 && prefix[0].ident.name == kw::PathRoot
625 };
626623 match use_tree.kind {
627624 ast::UseTreeKind::Simple(rename) => {
628625 let mut ident = use_tree.ident();
629626 let mut module_path = prefix;
630627 let mut source = module_path.pop().unwrap();
631 let mut type_ns_only = false;
632628
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;
637631
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",
642638 );
643639 return;
644640 }
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;
652649 }
653650 }
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 => {
678668 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;
679689 source = parent;
680690 if rename.is_none() {
681 ident = source.ident;
691 ident = Ident::new(source.ident.name, self_span);
682692 }
683693 }
684694 }
695 _ => {}
696 }
685697
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;
710704 }
711705
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;
714720 }
715721
716722 let kind = ImportKind::Single {
......@@ -740,32 +746,6 @@ impl<'a, 'ra, 'tcx> BuildReducedGraphVisitor<'a, 'ra, 'tcx> {
740746 }
741747 }
742748 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
769749 for &(ref tree, id) in items {
770750 self.build_reduced_graph_for_use_tree(
771751 // This particular use tree
......@@ -777,7 +757,10 @@ impl<'a, 'ra, 'tcx> BuildReducedGraphVisitor<'a, 'ra, 'tcx> {
777757 // Empty groups `a::b::{}` are turned into synthetic `self` imports
778758 // `a::b::c::{self as _}`, so that their prefixes are correctly
779759 // 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 {
781764 let new_span = prefix[prefix.len() - 1].ident.span;
782765 let tree = ast::UseTree {
783766 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> {
893893 mpart_suggestion,
894894 })
895895 }
896 ResolutionError::SelfImportCanOnlyAppearOnceInTheList => {
897 self.dcx().create_err(errs::SelfImportCanOnlyAppearOnceInTheList { span })
898 }
899 ResolutionError::SelfImportOnlyInImportListWithNonEmptyPrefix => {
900 self.dcx().create_err(errs::SelfImportOnlyInImportListWithNonEmptyPrefix { span })
901 }
902896 ResolutionError::FailedToResolve { segment, label, suggestion, module, message } => {
903897 let mut err = struct_span_code_err!(self.dcx(), span, E0433, "{message}");
904898 err.span_label(span, label);
compiler/rustc_resolve/src/errors.rs+16-25
......@@ -248,22 +248,6 @@ pub(crate) struct UnreachableLabelWithSimilarNameExists {
248248 pub(crate) ident_span: Span,
249249}
250250
251#[derive(Diagnostic)]
252#[diag("`self` import can only appear once in an import list", code = E0430)]
253pub(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)]
261pub(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
267251#[derive(Diagnostic)]
268252#[diag("can't capture dynamic environment in a fn item", code = E0434)]
269253#[help("use the `|| {\"{\"} ... {\"}\"}` closure form instead")]
......@@ -638,13 +622,6 @@ pub(crate) struct MacroExpandedMacroExportsAccessedByAbsolutePaths {
638622 pub definition: Span,
639623}
640624
641#[derive(Diagnostic)]
642#[diag("`$crate` may not be imported")]
643pub(crate) struct CrateImported {
644 #[primary_span]
645 pub(crate) span: Span,
646}
647
648625#[derive(Diagnostic)]
649626#[diag("`#[macro_use]` is not supported on `extern crate self`")]
650627pub(crate) struct MacroUseExternCrateSelf {
......@@ -973,11 +950,25 @@ pub(crate) struct ArgumentsMacroUseNotAllowed {
973950 pub(crate) span: Span,
974951}
975952
953#[derive(Subdiagnostic)]
954#[multipart_suggestion(
955 "try renaming it with a name",
956 applicability = "maybe-incorrect",
957 style = "verbose"
958)]
959pub(crate) struct UnnamedImportSugg {
960 #[suggestion_part(code = "{ident} as name")]
961 pub(crate) span: Span,
962 pub(crate) ident: Ident,
963}
964
976965#[derive(Diagnostic)]
977#[diag("crate root imports need to be explicitly named: `use crate as name;`")]
978pub(crate) struct UnnamedCrateRootImport {
966#[diag("imports need to be explicitly named")]
967pub(crate) struct UnnamedImport {
979968 #[primary_span]
980969 pub(crate) span: Span,
970 #[subdiagnostic]
971 pub(crate) sugg: Option<UnnamedImportSugg>,
981972}
982973
983974#[derive(Diagnostic)]
compiler/rustc_resolve/src/ident.rs+48-13
......@@ -923,6 +923,23 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
923923 self.resolve_ident_in_module(module, ident, ns, parent_scope, None, None, ignore_import)
924924 }
925925
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
926943 #[instrument(level = "debug", skip(self))]
927944 pub(crate) fn resolve_ident_in_module<'r>(
928945 self: CmResolver<'r, 'ra, 'tcx>,
......@@ -936,6 +953,14 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
936953 ) -> Result<Decl<'ra>, Determinacy> {
937954 match module {
938955 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
939964 let (ident_key, def) = IdentKey::new_adjusted(ident, module.expansion);
940965 let adjusted_parent_scope = match def {
941966 Some(def) => ParentScope { module: self.expn_def_scope(def), ..*parent_scope },
......@@ -976,7 +1001,21 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
9761001 }
9771002 ModuleOrUniformRoot::CurrentScope => {
9781003 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 {
9801019 let module = self.resolve_crate_root(ident);
9811020 return Ok(module.self_decl.unwrap());
9821021 } else if ident.name == kw::Super || ident.name == kw::SelfLower {
......@@ -1754,19 +1793,15 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
17541793
17551794 if ns == TypeNS {
17561795 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
17641802 };
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));
17701805 continue;
17711806 }
17721807 return PathResult::failed(
compiler/rustc_resolve/src/lib.rs-14
......@@ -274,10 +274,6 @@ enum ResolutionError<'ra> {
274274 UndeclaredLabel { name: Symbol, suggestion: Option<LabelSuggestion> },
275275 /// Error E0429: `self` imports are only allowed within a `{ }` list.
276276 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,
281277 /// Error E0433: failed to resolve.
282278 FailedToResolve {
283279 segment: Symbol,
......@@ -378,16 +374,6 @@ impl Segment {
378374 }
379375 }
380376
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
391377 fn names_to_string(segments: &[Segment]) -> String {
392378 names_to_string(segments.iter().map(|seg| seg.ident.name))
393379 }
compiler/rustc_session/src/options.rs+1-24
......@@ -7,7 +7,7 @@ use rustc_abi::Align;
77use rustc_data_structures::fx::FxIndexMap;
88use rustc_data_structures::profiling::TimePassesFormat;
99use rustc_data_structures::stable_hasher::StableHasher;
10use rustc_errors::{ColorConfig, LanguageIdentifier, TerminalUrl};
10use rustc_errors::{ColorConfig, TerminalUrl};
1111use rustc_feature::UnstableFeatures;
1212use rustc_hashes::Hash64;
1313use rustc_hir::attrs::CollapseMacroDebuginfo;
......@@ -790,7 +790,6 @@ mod desc {
790790 pub(crate) const parse_string: &str = "a string";
791791 pub(crate) const parse_opt_string: &str = parse_string;
792792 pub(crate) const parse_string_push: &str = parse_string;
793 pub(crate) const parse_opt_langid: &str = "a language identifier";
794793 pub(crate) const parse_opt_pathbuf: &str = "a path";
795794 pub(crate) const parse_list: &str = "a space-separated list of strings";
796795 pub(crate) const parse_list_with_polarity: &str =
......@@ -998,17 +997,6 @@ pub mod parse {
998997 }
999998 }
1000999
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
10121000 pub(crate) fn parse_opt_pathbuf(slot: &mut Option<PathBuf>, v: Option<&str>) -> bool {
10131001 match v {
10141002 Some(s) => {
......@@ -2335,8 +2323,6 @@ options! {
23352323 "embed source text in DWARF debug sections (default: no)"),
23362324 emit_stack_sizes: bool = (false, parse_bool, [UNTRACKED],
23372325 "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)"),
23402326 emscripten_wasm_eh: bool = (true, parse_bool, [TRACKED],
23412327 "Use WebAssembly error handling for wasm32-unknown-emscripten"),
23422328 enforce_type_length_limit: bool = (false, parse_bool, [TRACKED],
......@@ -2713,15 +2699,6 @@ written to standard error output)"),
27132699 "for every macro invocation, print its name and arguments (default: no)"),
27142700 track_diagnostics: bool = (false, parse_bool, [UNTRACKED],
27152701 "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"),
27252702 translate_remapped_path_to_local_path: bool = (true, parse_bool, [TRACKED],
27262703 "translate remapped paths into local paths when possible (default: yes)"),
27272704 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};
1010use rustc_data_structures::sync::{AppendOnlyVec, Lock};
1111use rustc_errors::annotate_snippet_emitter_writer::AnnotateSnippetEmitter;
1212use rustc_errors::emitter::{EmitterWithNote, stderr_destination};
13use rustc_errors::translation::Translator;
1413use rustc_errors::{
1514 BufferedEarlyLint, ColorConfig, DecorateDiagCompat, Diag, DiagCtxt, DiagCtxtHandle,
1615 DiagMessage, EmissionGuarantee, MultiSpan, StashKey,
......@@ -281,10 +280,9 @@ pub struct ParseSess {
281280impl ParseSess {
282281 /// Used for testing.
283282 pub fn new() -> Self {
284 let translator = Translator::new();
285283 let sm = Arc::new(SourceMap::new(FilePathMapping::empty()));
286284 let emitter = Box::new(
287 AnnotateSnippetEmitter::new(stderr_destination(ColorConfig::Auto), translator)
285 AnnotateSnippetEmitter::new(stderr_destination(ColorConfig::Auto))
288286 .sm(Some(Arc::clone(&sm))),
289287 );
290288 let dcx = DiagCtxt::new(emitter);
......@@ -314,12 +312,8 @@ impl ParseSess {
314312 }
315313
316314 pub fn emitter_with_note(note: String) -> Self {
317 let translator = Translator::new();
318315 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)));
323317 let dcx = DiagCtxt::new(Box::new(EmitterWithNote { emitter, note }));
324318 ParseSess::with_dcx(dcx, sm)
325319 }
compiler/rustc_session/src/session.rs+14-30
......@@ -16,7 +16,6 @@ use rustc_errors::codes::*;
1616use rustc_errors::emitter::{DynEmitter, HumanReadableErrorType, OutputTheme, stderr_destination};
1717use rustc_errors::json::JsonEmitter;
1818use rustc_errors::timings::TimingSectionHandler;
19use rustc_errors::translation::Translator;
2019use rustc_errors::{
2120 Diag, DiagCtxt, DiagCtxtHandle, DiagMessage, Diagnostic, ErrorGuaranteed, FatalAbort,
2221 TerminalUrl,
......@@ -914,11 +913,7 @@ impl Session {
914913
915914// JUSTIFICATION: part of session construction
916915#[allow(rustc::bad_opt_access)]
917fn default_emitter(
918 sopts: &config::Options,
919 source_map: Arc<SourceMap>,
920 translator: Translator,
921) -> Box<DynEmitter> {
916fn default_emitter(sopts: &config::Options, source_map: Arc<SourceMap>) -> Box<DynEmitter> {
922917 let macro_backtrace = sopts.unstable_opts.macro_backtrace;
923918 let track_diagnostics = sopts.unstable_opts.track_diagnostics;
924919 let terminal_url = match sopts.unstable_opts.terminal_urls {
......@@ -940,21 +935,17 @@ fn default_emitter(
940935 match sopts.error_format {
941936 config::ErrorOutputType::HumanReadable { kind, color_config } => match kind {
942937 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 );
958949 Box::new(emitter.ui_testing(sopts.unstable_opts.ui_testing))
959950 }
960951 },
......@@ -962,7 +953,6 @@ fn default_emitter(
962953 JsonEmitter::new(
963954 Box::new(io::BufWriter::new(io::stderr())),
964955 source_map,
965 translator,
966956 pretty,
967957 json_rendered,
968958 color_config,
......@@ -984,7 +974,6 @@ fn default_emitter(
984974pub fn build_session(
985975 sopts: config::Options,
986976 io: CompilerIO,
987 fluent_bundle: Option<Arc<rustc_errors::FluentBundle>>,
988977 driver_lint_caps: FxHashMap<lint::LintId, lint::Level>,
989978 target: Target,
990979 cfg_version: &'static str,
......@@ -1002,9 +991,8 @@ pub fn build_session(
1002991 let cap_lints_allow = sopts.lint_cap.is_some_and(|cap| cap == lint::Allow);
1003992 let can_emit_warnings = !(warnings_allow || cap_lints_allow);
1004993
1005 let translator = Translator { fluent_bundle };
1006994 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));
1008996
1009997 let mut dcx =
1010998 DiagCtxt::new(emitter).with_flags(sopts.unstable_opts.dcx_flags(can_emit_warnings));
......@@ -1441,13 +1429,10 @@ impl EarlyDiagCtxt {
14411429}
14421430
14431431fn 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();
14471432 let emitter: Box<DynEmitter> = match output {
14481433 config::ErrorOutputType::HumanReadable { kind, color_config } => match kind {
14491434 HumanReadableErrorType { short, unicode } => Box::new(
1450 AnnotateSnippetEmitter::new(stderr_destination(color_config), translator)
1435 AnnotateSnippetEmitter::new(stderr_destination(color_config))
14511436 .theme(if unicode { OutputTheme::Unicode } else { OutputTheme::Ascii })
14521437 .short_message(short),
14531438 ),
......@@ -1456,7 +1441,6 @@ fn mk_emitter(output: ErrorOutputType) -> Box<DynEmitter> {
14561441 Box::new(JsonEmitter::new(
14571442 Box::new(io::BufWriter::new(io::stderr())),
14581443 Some(Arc::new(SourceMap::new(FilePathMapping::empty()))),
1459 translator,
14601444 pretty,
14611445 json_rendered,
14621446 color_config,
compiler/rustc_type_ir/src/predicate.rs+1
......@@ -420,6 +420,7 @@ pub struct ExistentialProjection<I: Interner> {
420420
421421 /// This field exists to prevent the creation of `ExistentialProjection`
422422 /// without using [`ExistentialProjection::new_from_args`].
423 #[derive_where(skip(Debug))]
423424 use_existential_projection_new_instead: (),
424425}
425426
library/unwind/src/lib.rs+1-1
......@@ -6,7 +6,7 @@
66#![feature(staged_api)]
77#![cfg_attr(
88 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)
1010)]
1111#![allow(internal_features)]
1212#![allow(unused_features)]
library/unwind/src/wasm.rs+24
......@@ -2,6 +2,30 @@
22
33#![allow(nonstandard_style)]
44
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"))]
20core::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
529#[repr(C)]
630#[derive(Debug, Copy, Clone, PartialEq)]
731pub enum _Unwind_Reason_Code {
src/doc/rustc-dev-guide/src/diagnostics/translation.md-42
......@@ -159,48 +159,6 @@ have such implementations.
159159`set_arg` calls are handled transparently by diagnostic derives but need to be
160160added manually when using diagnostic builder APIs.
161161
162### Loading
163
164rustc makes a distinction between the "fallback bundle" for `en-US` that is used
165by default and when another locale is missing a message; and the primary fluent
166bundle which is requested by the user.
167
168Diagnostic emitters implement the `Emitter` trait which has two functions for
169accessing 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
173translation of a `DiagMessage` using the results of
174`fallback_fluent_bundle` and `fluent_bundle`.
175
176All of the emitters in rustc load the fallback Fluent bundle lazily, only
177reading Fluent resources and parsing them when an error message is first being
178translated (for performance reasons - it doesn't make sense to do this if no
179error is being emitted). `rustc_error_messages::fallback_fluent_bundle` returns
180a `std::lazy::Lazy<FluentBundle>` which is provided to emitters and evaluated
181in the first call to `Emitter::fallback_fluent_bundle`.
182
183The primary Fluent bundle (for the user's desired locale) is expected to be
184returned by `Emitter::fluent_bundle`. This bundle is used preferentially when
185translating messages, the fallback bundle is only used if the primary bundle is
186missing a message or not provided.
187
188There are no locale bundles distributed with the compiler,
189but 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
198Primary bundles are not currently loaded lazily and if requested will be loaded
199at the start of compilation regardless of whether an error occurs. Lazily
200loading primary bundles is possible if it can be assumed that loading a bundle
201won't fail. Bundle loading can fail if a requested locale is missing, Fluent
202files are malformed, or a message is duplicated in multiple resources.
203
204162[Fluent]: https://projectfluent.org
205163[`compiler/rustc_borrowck/messages.ftl`]: https://github.com/rust-lang/rust/blob/HEAD/compiler/rustc_borrowck/messages.ftl
206164[`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
267267passing the appropriate flags to rustc.
268268
269269[`-Zbuild-std`]: ../../cargo/reference/unstable.html#build-std
270
271### The exception tag for panics
272
273Rust panics are currently implemented as a specific class of C++ exceptions.
274This is because llvm only supports throwing and catching the C++ exception tag
275from `wasm_throw` intrinsic and the lowering for the catchpads emitted by the
276Rust try intrinsic.
277
278In particular, llvm throw and catch blocks expect a `WebAssembly.Tag` symbol
279called `__cpp_exception`. If it is not defined somewhere, llvm will generate an
280Emscripten style import from `env.__cpp_exception`. We don't want this, so we
281define the symbol in `libunwind` but only for wasm32-unknown-unknown. WASI
282doesn't currently support unwinding at all, and the Emscripten linker provides
283the tag in an appropriate manner depending on what sort of binary is being
284linked.
src/librustdoc/core.rs+1-3
......@@ -157,11 +157,10 @@ pub(crate) fn new_dcx(
157157 diagnostic_width: Option<usize>,
158158 unstable_opts: &UnstableOptions,
159159) -> rustc_errors::DiagCtxt {
160 let translator = rustc_driver::default_translator();
161160 let emitter: Box<DynEmitter> = match error_format {
162161 ErrorOutputType::HumanReadable { kind, color_config } => match kind {
163162 HumanReadableErrorType { short, unicode } => Box::new(
164 AnnotateSnippetEmitter::new(stderr_destination(color_config), translator)
163 AnnotateSnippetEmitter::new(stderr_destination(color_config))
165164 .sm(source_map.map(|sm| sm as _))
166165 .short_message(short)
167166 .diagnostic_width(diagnostic_width)
......@@ -178,7 +177,6 @@ pub(crate) fn new_dcx(
178177 JsonEmitter::new(
179178 Box::new(io::BufWriter::new(io::stderr())),
180179 Some(source_map),
181 translator,
182180 pretty,
183181 json_rendered,
184182 color_config,
src/librustdoc/doctest/make.rs+1-2
......@@ -467,7 +467,6 @@ fn parse_source(
467467 let filename = FileName::anon_source_code(&wrapped_source);
468468
469469 let sm = Arc::new(SourceMap::new(FilePathMapping::empty()));
470 let translator = rustc_driver::default_translator();
471470 let supports_color = match get_stderr_color_choice(ColorConfig::Auto, &std::io::stderr()) {
472471 ColorChoice::Auto => unreachable!(),
473472 ColorChoice::AlwaysAnsi | ColorChoice::Always => true,
......@@ -476,7 +475,7 @@ fn parse_source(
476475 info.supports_color = supports_color;
477476 // Any errors in parsing should also appear when the doctest is compiled for real, so just
478477 // 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())));
480479
481480 // FIXME(misdreavus): pass `-Z treat-err-as-bug` to the doctest parser
482481 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;
55
66use rustc_data_structures::sync::Lock;
77use rustc_errors::emitter::Emitter;
8use rustc_errors::translation::{Translator, to_fluent_args};
8use rustc_errors::translation::{format_diag_message, to_fluent_args};
99use rustc_errors::{Applicability, DiagCtxt, DiagInner};
1010use rustc_parse::{source_str_to_stream, unwrap_or_emit_fatal};
1111use rustc_resolve::rustdoc::source_span_for_markdown_range;
......@@ -35,8 +35,7 @@ fn check_rust_syntax(
3535 code_block: RustCodeBlock,
3636) {
3737 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) };
4039
4140 let sm = Arc::new(SourceMap::new(FilePathMapping::empty()));
4241 let dcx = DiagCtxt::new(Box::new(emitter)).disable_warnings();
......@@ -145,7 +144,6 @@ struct Buffer {
145144
146145struct BufferEmitter {
147146 buffer: Arc<Lock<Buffer>>,
148 translator: Translator,
149147}
150148
151149impl Emitter for BufferEmitter {
......@@ -153,9 +151,7 @@ impl Emitter for BufferEmitter {
153151 let mut buffer = self.buffer.borrow_mut();
154152
155153 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)
159155 .unwrap_or_else(|e| panic!("{e}"));
160156
161157 buffer.messages.push(format!("error from rustc: {translated_main_message}"));
......@@ -167,8 +163,4 @@ impl Emitter for BufferEmitter {
167163 fn source_map(&self) -> Option<&SourceMap> {
168164 None
169165 }
170
171 fn translator(&self) -> &Translator {
172 &self.translator
173 }
174166}
src/tools/miri/src/shims/foreign_items.rs+1-1
......@@ -851,7 +851,7 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> {
851851 // Fallback to shims in submodules.
852852 _ => {
853853 // Math shims
854 #[expect(irrefutable_let_patterns)]
854 #[cfg_attr(bootstrap, expect(irrefutable_let_patterns))]
855855 if let res = shims::math::EvalContextExt::emulate_foreign_item_inner(
856856 this, link_name, abi, args, dest,
857857 )? && !matches!(res, EmulateItemResult::NotSupported)
src/tools/rustfmt/src/parse/session.rs+2-13
......@@ -5,7 +5,6 @@ use std::sync::atomic::{AtomicBool, Ordering};
55use rustc_data_structures::sync::IntoDynSyncSend;
66use rustc_errors::annotate_snippet_emitter_writer::AnnotateSnippetEmitter;
77use rustc_errors::emitter::{DynEmitter, Emitter, SilentEmitter, stderr_destination};
8use rustc_errors::translation::Translator;
98use rustc_errors::{ColorConfig, Diag, DiagCtxt, DiagInner, Level as DiagnosticLevel};
109use rustc_session::parse::ParseSess as RawParseSess;
1110use rustc_span::{
......@@ -74,10 +73,6 @@ impl Emitter for SilentOnIgnoredFilesEmitter {
7473 }
7574 self.handle_non_ignoreable_error(diag);
7675 }
77
78 fn translator(&self) -> &Translator {
79 self.emitter.translator()
80 }
8176}
8277
8378impl From<Color> for ColorConfig {
......@@ -104,15 +99,13 @@ fn default_dcx(
10499 ColorConfig::Never
105100 };
106101
107 let translator = rustc_driver::default_translator();
108
109102 let emitter: Box<DynEmitter> = if show_parse_errors {
110103 Box::new(
111 AnnotateSnippetEmitter::new(stderr_destination(emit_color), translator)
104 AnnotateSnippetEmitter::new(stderr_destination(emit_color))
112105 .sm(Some(source_map.clone())),
113106 )
114107 } else {
115 Box::new(SilentEmitter { translator })
108 Box::new(SilentEmitter)
116109 };
117110 DiagCtxt::new(Box::new(SilentOnIgnoredFilesEmitter {
118111 has_non_ignorable_parser_errors: false,
......@@ -342,10 +335,6 @@ mod tests {
342335 fn emit_diagnostic(&mut self, _diag: DiagInner) {
343336 self.num_emitted_errors.fetch_add(1, Ordering::Release);
344337 }
345
346 fn translator(&self) -> &Translator {
347 panic!("test emitter attempted to translate a diagnostic");
348 }
349338 }
350339
351340 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() {
1818 .arg("-Clinker-plugin-lto")
1919 .arg(format!("-Clinker={}", env_var("CLANG")))
2020 .arg("-Clink-arg=-Wl,--plugin-opt=-lto-embed-bitcode=optimized")
21 .arg("-Zemit-thin-lto=no")
21 .arg("-Clto=fat")
2222 .run();
2323
2424 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.
2parse_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.
3foo = 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
18use std::path::{Path, PathBuf};
19
20use run_make_support::rustc::sysroot;
21use run_make_support::{cwd, rfs, run_in_tmpdir, rustc};
22
23fn 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.
34fn 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.
39fn 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.
48fn 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.
58fn 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]
71fn 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]
88fn 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]
121fn 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.
145fn 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.
172fn 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.
184fn 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
4struct Foo {
5 val: (),
6}
7
8fn foo() -> Foo {
9 val: (),
10}
11
12fn 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 @@
1parse_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`.
440440
441441Exercises `#[diagnostic::*]` namespaced attributes. See [RFC 3368 Diagnostic attribute namespace](https://github.com/rust-lang/rfcs/blob/master/text/3368-diagnostic-attribute-namespace.md).
442442
443## `tests/ui/diagnostics-infra`
444
445This directory contains tests and infrastructure related to the diagnostics system, including support for translatable diagnostics
446
447443## `tests/ui/did_you_mean/`
448444
449445Tests 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
7use std::ops::Range;
8
9fn 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 @@
1warning: irrefutable `if let` pattern
2 --> $DIR/irrefutable-in-let-chains.rs:13:8
3 |
4LL | 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
11warning: irrefutable `if let` pattern
12 --> $DIR/irrefutable-in-let-chains.rs:30:8
13 |
14LL | 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
20warning: irrefutable `if let` pattern
21 --> $DIR/irrefutable-in-let-chains.rs:37:8
22 |
23LL | 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
29warning: irrefutable `if let` pattern
30 --> $DIR/irrefutable-in-let-chains.rs:49:15
31 |
32LL | } 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
38warning: irrefutable `if let` guard pattern
39 --> $DIR/irrefutable-in-let-chains.rs:70:28
40 |
41LL | 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
47warning: irrefutable `while let` pattern
48 --> $DIR/irrefutable-in-let-chains.rs:99:11
49 |
50LL | 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
56warning: 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
4trait 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
11reuse Trait::foo;
12//~^ ERROR: type annotations needed
13
14fn main() {}
tests/ui/delegation/generics/generic-params-defaults.stderr created+35
......@@ -0,0 +1,35 @@
1error: defaults for generic parameters are not allowed here
2 --> $DIR/generic-params-defaults.rs:5:12
3 |
4LL | 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
11error[E0282]: type annotations needed
12 --> $DIR/generic-params-defaults.rs:11:14
13 |
14LL | reuse Trait::foo;
15 | ^^^ cannot infer type of the type parameter `T` declared on the method `foo`
16 |
17help: consider specifying the generic argument
18 |
19LL | reuse Trait::foo::<T>;
20 | +++++
21
22error: aborting due to 2 previous errors
23
24For more information about this error, try `rustc --explain E0282`.
25Future incompatibility report: Future breakage diagnostic:
26error: defaults for generic parameters are not allowed here
27 --> $DIR/generic-params-defaults.rs:5:12
28 |
29LL | 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
4trait 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
16reuse Trait::foo;
17//~^ ERROR: type annotations needed
18
19fn main() {}
tests/ui/delegation/generics/generic-params-same-names.stderr created+76
......@@ -0,0 +1,76 @@
1error[E0496]: lifetime name `'a` shadows a lifetime name that is already in scope
2 --> $DIR/generic-params-same-names.rs:5:12
3 |
4LL | trait Trait<'a, 'b, 'c, A, B, C, const N: usize> {
5 | -- first declared here
6LL | fn foo<'a, 'b, 'c, A, B, C, const N: usize>(&self) {
7 | ^^ lifetime `'a` already in scope
8
9error[E0496]: lifetime name `'b` shadows a lifetime name that is already in scope
10 --> $DIR/generic-params-same-names.rs:5:16
11 |
12LL | trait Trait<'a, 'b, 'c, A, B, C, const N: usize> {
13 | -- first declared here
14LL | fn foo<'a, 'b, 'c, A, B, C, const N: usize>(&self) {
15 | ^^ lifetime `'b` already in scope
16
17error[E0496]: lifetime name `'c` shadows a lifetime name that is already in scope
18 --> $DIR/generic-params-same-names.rs:5:20
19 |
20LL | trait Trait<'a, 'b, 'c, A, B, C, const N: usize> {
21 | -- first declared here
22LL | fn foo<'a, 'b, 'c, A, B, C, const N: usize>(&self) {
23 | ^^ lifetime `'c` already in scope
24
25error[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 |
28LL | trait Trait<'a, 'b, 'c, A, B, C, const N: usize> {
29 | - first use of `A`
30LL | fn foo<'a, 'b, 'c, A, B, C, const N: usize>(&self) {
31 | ^ already used
32
33error[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 |
36LL | trait Trait<'a, 'b, 'c, A, B, C, const N: usize> {
37 | - first use of `B`
38LL | fn foo<'a, 'b, 'c, A, B, C, const N: usize>(&self) {
39 | ^ already used
40
41error[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 |
44LL | trait Trait<'a, 'b, 'c, A, B, C, const N: usize> {
45 | - first use of `C`
46LL | fn foo<'a, 'b, 'c, A, B, C, const N: usize>(&self) {
47 | ^ already used
48
49error[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 |
52LL | trait Trait<'a, 'b, 'c, A, B, C, const N: usize> {
53 | - first use of `N`
54LL | fn foo<'a, 'b, 'c, A, B, C, const N: usize>(&self) {
55 | ^ already used
56
57error[E0284]: type annotations needed
58 --> $DIR/generic-params-same-names.rs:16:14
59 |
60LL | reuse Trait::foo;
61 | ^^^ cannot infer the value of the const parameter `N` declared on the method `foo`
62 |
63note: required by a const generic parameter in `Trait::foo`
64 --> $DIR/generic-params-same-names.rs:5:33
65 |
66LL | fn foo<'a, 'b, 'c, A, B, C, const N: usize>(&self) {
67 | ^^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
68help: consider specifying the generic arguments
69 |
70LL | reuse Trait::foo::<A, B, C, N>;
71 | ++++++++++++++
72
73error: aborting due to 8 previous errors
74
75Some errors have detailed explanations: E0284, E0403, E0496.
76For 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
6mod 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
43mod 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
76mod 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
114fn main() {}
tests/ui/delegation/generics/generics-gen-args-errors.stderr created+563
......@@ -0,0 +1,563 @@
1error[E0401]: can't use generic parameters from outer item
2 --> $DIR/generics-gen-args-errors.rs:35:21
3 |
4LL | fn check<A, B, C>() {
5 | - type parameter from outer item
6...
7LL | 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
14error[E0401]: can't use generic parameters from outer item
15 --> $DIR/generics-gen-args-errors.rs:35:24
16 |
17LL | fn check<A, B, C>() {
18 | - type parameter from outer item
19...
20LL | 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
27error[E0401]: can't use generic parameters from outer item
28 --> $DIR/generics-gen-args-errors.rs:35:27
29 |
30LL | fn check<A, B, C>() {
31 | - type parameter from outer item
32...
33LL | 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
40error[E0261]: use of undeclared lifetime name `'asdasd`
41 --> $DIR/generics-gen-args-errors.rs:52:29
42 |
43LL | reuse foo::<'static, _, 'asdasd, 'static, 'static, 'static, _> as bar3;
44 | ^^^^^^^ undeclared lifetime
45 |
46help: consider introducing lifetime `'asdasd` here
47 |
48LL | reuse foo'asdasd, ::<'static, _, 'asdasd, 'static, 'static, 'static, _> as bar3;
49 | ++++++++
50
51error[E0261]: use of undeclared lifetime name `'a`
52 --> $DIR/generics-gen-args-errors.rs:67:50
53 |
54LL | reuse foo::<"asdasd", asd, "askdn", 'static, 'a> as bar7;
55 | ^^ undeclared lifetime
56 |
57help: consider introducing lifetime `'a` here
58 |
59LL | reuse foo'a, ::<"asdasd", asd, "askdn", 'static, 'a> as bar7;
60 | +++
61
62error[E0106]: missing lifetime specifiers
63 --> $DIR/generics-gen-args-errors.rs:107:19
64 |
65LL | reuse Trait::<Trait, Clone, _, 'static, dyn Send, _>::foo::<1, 2, 3, _, 6> as bar7;
66 | ^^^^^ expected 3 lifetime parameters
67 |
68help: consider introducing a named lifetime parameter
69 |
70LL | reuse Trait::<Trait<'a, 'a, 'a>, Clone, _, 'static, dyn Send, _>::foo'a, ::<1, 2, 3, _, 6> as bar7;
71 | ++++++++++++ +++
72
73error[E0423]: expected value, found struct `String`
74 --> $DIR/generics-gen-args-errors.rs:15:33
75 |
76LL | bar::<String, String, { String }>();
77 | ^^^^^^
78 |
79 --> $SRC_DIR/alloc/src/string.rs:LL:COL
80 |
81 = note: `String` defined here
82
83error[E0425]: cannot find type `asd` in this scope
84 --> $DIR/generics-gen-args-errors.rs:29:15
85 |
86LL | bar::<asd, asd, asd>();
87 | ^^^ not found in this scope
88 |
89help: you might be missing a type parameter
90 |
91LL | fn check<A, B, C, asd>() {
92 | +++++
93
94error[E0425]: cannot find type `asd` in this scope
95 --> $DIR/generics-gen-args-errors.rs:29:20
96 |
97LL | bar::<asd, asd, asd>();
98 | ^^^ not found in this scope
99 |
100help: you might be missing a type parameter
101 |
102LL | fn check<A, B, C, asd>() {
103 | +++++
104
105error[E0425]: cannot find type `asd` in this scope
106 --> $DIR/generics-gen-args-errors.rs:29:25
107 |
108LL | bar::<asd, asd, asd>();
109 | ^^^ not found in this scope
110 |
111help: you might be missing a type parameter
112 |
113LL | fn check<A, B, C, asd>() {
114 | +++++
115
116error[E0425]: cannot find type `asdasd` in this scope
117 --> $DIR/generics-gen-args-errors.rs:56:39
118 |
119LL | reuse foo::<String, 'static, 123, asdasd> as bar4;
120 | ^^^^^^ not found in this scope
121
122error[E0425]: cannot find type `asd` in this scope
123 --> $DIR/generics-gen-args-errors.rs:63:22
124 |
125LL | reuse foo::<1, 2,asd,String, { let x = 0; }> as bar6;
126 | ^^^ not found in this scope
127
128error[E0425]: cannot find type `asd` in this scope
129 --> $DIR/generics-gen-args-errors.rs:67:27
130 |
131LL | reuse foo::<"asdasd", asd, "askdn", 'static, 'a> as bar7;
132 | ^^^ not found in this scope
133
134error[E0425]: cannot find type `asd` in this scope
135 --> $DIR/generics-gen-args-errors.rs:81:19
136 |
137LL | reuse Trait::<asd, asd, asd, asd, asd, asdasa>::foo as bar1;
138 | ^^^ not found in this scope
139
140error[E0425]: cannot find type `asd` in this scope
141 --> $DIR/generics-gen-args-errors.rs:81:24
142 |
143LL | reuse Trait::<asd, asd, asd, asd, asd, asdasa>::foo as bar1;
144 | ^^^ not found in this scope
145
146error[E0425]: cannot find type `asd` in this scope
147 --> $DIR/generics-gen-args-errors.rs:81:29
148 |
149LL | reuse Trait::<asd, asd, asd, asd, asd, asdasa>::foo as bar1;
150 | ^^^ not found in this scope
151
152error[E0425]: cannot find type `asd` in this scope
153 --> $DIR/generics-gen-args-errors.rs:81:34
154 |
155LL | reuse Trait::<asd, asd, asd, asd, asd, asdasa>::foo as bar1;
156 | ^^^ not found in this scope
157
158error[E0425]: cannot find type `asd` in this scope
159 --> $DIR/generics-gen-args-errors.rs:81:39
160 |
161LL | reuse Trait::<asd, asd, asd, asd, asd, asdasa>::foo as bar1;
162 | ^^^ not found in this scope
163
164error[E0425]: cannot find type `asdasa` in this scope
165 --> $DIR/generics-gen-args-errors.rs:81:44
166 |
167LL | reuse Trait::<asd, asd, asd, asd, asd, asdasa>::foo as bar1;
168 | ^^^^^^ not found in this scope
169
170error[E0425]: cannot find type `DDDD` in this scope
171 --> $DIR/generics-gen-args-errors.rs:101:34
172 |
173LL | reuse Trait::<1, 2, 'static, DDDD>::foo::<1, 2, 3, 4, 5, 6> as bar6;
174 | ^^^^ not found in this scope
175
176error[E0284]: type annotations needed
177 --> $DIR/generics-gen-args-errors.rs:8:11
178 |
179LL | reuse foo as bar;
180 | ^^^ cannot infer the value of the const parameter `N` declared on the function `foo`
181 |
182note: required by a const generic parameter in `test_1::foo`
183 --> $DIR/generics-gen-args-errors.rs:7:48
184 |
185LL | fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {}
186 | ^^^^^^^^^^^^^^ required by this const generic parameter in `foo`
187help: consider specifying the generic arguments
188 |
189LL | reuse foo::<T, U, N> as bar;
190 | +++++++++++
191
192error[E0107]: function takes 3 generic arguments but 6 generic arguments were supplied
193 --> $DIR/generics-gen-args-errors.rs:12:9
194 |
195LL | bar::<1, 2, 3, 4, 5, 6>();
196 | ^^^ --------- help: remove the unnecessary generic arguments
197 | |
198 | expected 3 generic arguments
199 |
200note: function defined here, with 3 generic parameters: `T`, `U`, `N`
201 --> $DIR/generics-gen-args-errors.rs:8:18
202 |
203LL | fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {}
204 | - - --------------
205LL | reuse foo as bar;
206 | ^^^
207
208error[E0107]: function takes 2 lifetime arguments but 5 lifetime arguments were supplied
209 --> $DIR/generics-gen-args-errors.rs:18:9
210 |
211LL | bar::<'static, 'static, 'static, 'static, 'static>();
212 | ^^^ --------------------------- help: remove the lifetime arguments
213 | |
214 | expected 2 lifetime arguments
215 |
216note: function defined here, with 2 lifetime parameters: `'a`, `'b`
217 --> $DIR/generics-gen-args-errors.rs:8:18
218 |
219LL | fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {}
220 | -- --
221LL | reuse foo as bar;
222 | ^^^
223
224error[E0747]: constant provided when a type was expected
225 --> $DIR/generics-gen-args-errors.rs:21:23
226 |
227LL | bar::<String, 1, 'static, i32, 'static>();
228 | ^
229
230error[E0107]: function takes 3 generic arguments but 5 generic arguments were supplied
231 --> $DIR/generics-gen-args-errors.rs:26:9
232 |
233LL | bar::<_, _, _, _, _>();
234 | ^^^ ------ help: remove the unnecessary generic arguments
235 | |
236 | expected 3 generic arguments
237 |
238note: function defined here, with 3 generic parameters: `T`, `U`, `N`
239 --> $DIR/generics-gen-args-errors.rs:8:18
240 |
241LL | fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {}
242 | - - --------------
243LL | reuse foo as bar;
244 | ^^^
245
246error[E0747]: unresolved item provided when a constant was expected
247 --> $DIR/generics-gen-args-errors.rs:29:25
248 |
249LL | bar::<asd, asd, asd>();
250 | ^^^
251 |
252help: if this generic argument was intended as a const parameter, surround it with braces
253 |
254LL | bar::<asd, asd, { asd }>();
255 | + +
256
257error[E0747]: unresolved item provided when a constant was expected
258 --> $DIR/generics-gen-args-errors.rs:35:27
259 |
260LL | reuse foo::<A, B, C> as xd;
261 | ^
262 |
263help: if this generic argument was intended as a const parameter, surround it with braces
264 |
265LL | reuse foo::<A, B, { C }> as xd;
266 | + +
267
268error[E0284]: type annotations needed
269 --> $DIR/generics-gen-args-errors.rs:46:11
270 |
271LL | reuse foo::<> as bar1;
272 | ^^^ cannot infer the value of the const parameter `N` declared on the function `foo`
273 |
274note: required by a const generic parameter in `test_2::foo`
275 --> $DIR/generics-gen-args-errors.rs:44:48
276 |
277LL | fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {}
278 | ^^^^^^^^^^^^^^ required by this const generic parameter in `foo`
279help: consider specifying the generic arguments
280 |
281LL | reuse foo::<T, U, N> as bar1;
282 | +++++++
283
284error[E0107]: function takes 3 generic arguments but 2 generic arguments were supplied
285 --> $DIR/generics-gen-args-errors.rs:49:11
286 |
287LL | reuse foo::<String, String> as bar2;
288 | ^^^ ------ ------ supplied 2 generic arguments
289 | |
290 | expected 3 generic arguments
291 |
292note: function defined here, with 3 generic parameters: `T`, `U`, `N`
293 --> $DIR/generics-gen-args-errors.rs:44:8
294 |
295LL | fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {}
296 | ^^^ - - --------------
297help: add missing generic argument
298 |
299LL | reuse foo::<String, String, N> as bar2;
300 | +++
301
302error[E0107]: function takes 2 lifetime arguments but 5 lifetime arguments were supplied
303 --> $DIR/generics-gen-args-errors.rs:52:11
304 |
305LL | reuse foo::<'static, _, 'asdasd, 'static, 'static, 'static, _> as bar3;
306 | ^^^ --------------------------- help: remove the lifetime arguments
307 | |
308 | expected 2 lifetime arguments
309 |
310note: function defined here, with 2 lifetime parameters: `'a`, `'b`
311 --> $DIR/generics-gen-args-errors.rs:44:8
312 |
313LL | fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {}
314 | ^^^ -- --
315
316error[E0107]: function takes 3 generic arguments but 2 generic arguments were supplied
317 --> $DIR/generics-gen-args-errors.rs:52:11
318 |
319LL | reuse foo::<'static, _, 'asdasd, 'static, 'static, 'static, _> as bar3;
320 | ^^^ expected 3 generic arguments ------- - supplied 2 generic arguments
321 |
322note: function defined here, with 3 generic parameters: `T`, `U`, `N`
323 --> $DIR/generics-gen-args-errors.rs:44:8
324 |
325LL | fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {}
326 | ^^^ - - --------------
327help: add missing generic argument
328 |
329LL | reuse foo::<'static, _, 'asdasd, 'static, 'static, 'static, _, N> as bar3;
330 | +++
331
332error[E0107]: function takes 2 lifetime arguments but 1 lifetime argument was supplied
333 --> $DIR/generics-gen-args-errors.rs:56:11
334 |
335LL | reuse foo::<String, 'static, 123, asdasd> as bar4;
336 | ^^^ ------ supplied 1 lifetime argument
337 | |
338 | expected 2 lifetime arguments
339 |
340note: function defined here, with 2 lifetime parameters: `'a`, `'b`
341 --> $DIR/generics-gen-args-errors.rs:44:8
342 |
343LL | fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {}
344 | ^^^ -- --
345help: add missing lifetime argument
346 |
347LL | reuse foo::<String, 'static, 'static, 123, asdasd> as bar4;
348 | +++++++++
349
350error[E0107]: function takes 3 generic arguments but 6 generic arguments were supplied
351 --> $DIR/generics-gen-args-errors.rs:60:11
352 |
353LL | reuse foo::<1, 2, _, 4, 5, _> as bar5;
354 | ^^^ --------- help: remove the unnecessary generic arguments
355 | |
356 | expected 3 generic arguments
357 |
358note: function defined here, with 3 generic parameters: `T`, `U`, `N`
359 --> $DIR/generics-gen-args-errors.rs:44:8
360 |
361LL | fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {}
362 | ^^^ - - --------------
363
364error[E0107]: function takes 3 generic arguments but 5 generic arguments were supplied
365 --> $DIR/generics-gen-args-errors.rs:63:11
366 |
367LL | 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 |
372note: function defined here, with 3 generic parameters: `T`, `U`, `N`
373 --> $DIR/generics-gen-args-errors.rs:44:8
374 |
375LL | fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {}
376 | ^^^ - - --------------
377
378error[E0747]: constant provided when a type was expected
379 --> $DIR/generics-gen-args-errors.rs:67:17
380 |
381LL | reuse foo::<"asdasd", asd, "askdn", 'static, 'a> as bar7;
382 | ^^^^^^^^
383
384error[E0747]: constant provided when a type was expected
385 --> $DIR/generics-gen-args-errors.rs:72:17
386 |
387LL | reuse foo::<{}, {}, {}> as bar8;
388 | ^^
389
390error[E0107]: trait takes 2 generic arguments but 6 generic arguments were supplied
391 --> $DIR/generics-gen-args-errors.rs:81:11
392 |
393LL | 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 |
398note: trait defined here, with 2 generic parameters: `T`, `N`
399 --> $DIR/generics-gen-args-errors.rs:77:11
400 |
401LL | trait Trait<'b, 'c, 'a, T, const N: usize>: Sized {
402 | ^^^^^ - --------------
403
404error[E0107]: trait takes 3 lifetime arguments but 2 lifetime arguments were supplied
405 --> $DIR/generics-gen-args-errors.rs:90:11
406 |
407LL | reuse Trait::<'static, 'static>::foo as bar2;
408 | ^^^^^ ------- ------- supplied 2 lifetime arguments
409 | |
410 | expected 3 lifetime arguments
411 |
412note: trait defined here, with 3 lifetime parameters: `'b`, `'c`, `'a`
413 --> $DIR/generics-gen-args-errors.rs:77:11
414 |
415LL | trait Trait<'b, 'c, 'a, T, const N: usize>: Sized {
416 | ^^^^^ -- -- --
417help: add missing lifetime argument
418 |
419LL | reuse Trait::<'static, 'static, 'static>::foo as bar2;
420 | +++++++++
421
422error[E0107]: trait takes 2 generic arguments but 5 generic arguments were supplied
423 --> $DIR/generics-gen-args-errors.rs:92:11
424 |
425LL | reuse Trait::<1, 2, 3, 4, 5>::foo as bar3;
426 | ^^^^^ --------- help: remove the unnecessary generic arguments
427 | |
428 | expected 2 generic arguments
429 |
430note: trait defined here, with 2 generic parameters: `T`, `N`
431 --> $DIR/generics-gen-args-errors.rs:77:11
432 |
433LL | trait Trait<'b, 'c, 'a, T, const N: usize>: Sized {
434 | ^^^^^ - --------------
435
436error[E0107]: trait takes 2 generic arguments but 3 generic arguments were supplied
437 --> $DIR/generics-gen-args-errors.rs:95:11
438 |
439LL | reuse Trait::<1, 2, true>::foo as bar4;
440 | ^^^^^ ------ help: remove the unnecessary generic argument
441 | |
442 | expected 2 generic arguments
443 |
444note: trait defined here, with 2 generic parameters: `T`, `N`
445 --> $DIR/generics-gen-args-errors.rs:77:11
446 |
447LL | trait Trait<'b, 'c, 'a, T, const N: usize>: Sized {
448 | ^^^^^ - --------------
449
450error[E0107]: trait takes 3 lifetime arguments but 1 lifetime argument was supplied
451 --> $DIR/generics-gen-args-errors.rs:98:11
452 |
453LL | reuse Trait::<'static>::foo as bar5;
454 | ^^^^^ ------- supplied 1 lifetime argument
455 | |
456 | expected 3 lifetime arguments
457 |
458note: trait defined here, with 3 lifetime parameters: `'b`, `'c`, `'a`
459 --> $DIR/generics-gen-args-errors.rs:77:11
460 |
461LL | trait Trait<'b, 'c, 'a, T, const N: usize>: Sized {
462 | ^^^^^ -- -- --
463help: add missing lifetime arguments
464 |
465LL | reuse Trait::<'static, 'static, 'static>::foo as bar5;
466 | ++++++++++++++++++
467
468error[E0107]: trait takes 3 lifetime arguments but 1 lifetime argument was supplied
469 --> $DIR/generics-gen-args-errors.rs:101:11
470 |
471LL | 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 |
476note: trait defined here, with 3 lifetime parameters: `'b`, `'c`, `'a`
477 --> $DIR/generics-gen-args-errors.rs:77:11
478 |
479LL | trait Trait<'b, 'c, 'a, T, const N: usize>: Sized {
480 | ^^^^^ -- -- --
481help: add missing lifetime arguments
482 |
483LL | reuse Trait::<1, 'static, 'static, 2, 'static, DDDD>::foo::<1, 2, 3, 4, 5, 6> as bar6;
484 | ++++++++++++++++++
485
486error[E0107]: trait takes 2 generic arguments but 3 generic arguments were supplied
487 --> $DIR/generics-gen-args-errors.rs:101:11
488 |
489LL | 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 |
494note: trait defined here, with 2 generic parameters: `T`, `N`
495 --> $DIR/generics-gen-args-errors.rs:77:11
496 |
497LL | trait Trait<'b, 'c, 'a, T, const N: usize>: Sized {
498 | ^^^^^ - --------------
499
500error[E0107]: method takes 2 generic arguments but 6 generic arguments were supplied
501 --> $DIR/generics-gen-args-errors.rs:101:41
502 |
503LL | 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 |
508note: method defined here, with 2 generic parameters: `U`, `M`
509 --> $DIR/generics-gen-args-errors.rs:78:12
510 |
511LL | fn foo<'d: 'd, U, const M: bool>(self) {}
512 | ^^^ - -------------
513
514error[E0107]: trait takes 3 lifetime arguments but 1 lifetime argument was supplied
515 --> $DIR/generics-gen-args-errors.rs:107:11
516 |
517LL | 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 |
522note: trait defined here, with 3 lifetime parameters: `'b`, `'c`, `'a`
523 --> $DIR/generics-gen-args-errors.rs:77:11
524 |
525LL | trait Trait<'b, 'c, 'a, T, const N: usize>: Sized {
526 | ^^^^^ -- -- --
527help: add missing lifetime arguments
528 |
529LL | reuse Trait::<Trait, 'static, 'static, Clone, _, 'static, dyn Send, _>::foo::<1, 2, 3, _, 6> as bar7;
530 | ++++++++++++++++++
531
532error[E0107]: trait takes 2 generic arguments but 5 generic arguments were supplied
533 --> $DIR/generics-gen-args-errors.rs:107:11
534 |
535LL | 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 |
540note: trait defined here, with 2 generic parameters: `T`, `N`
541 --> $DIR/generics-gen-args-errors.rs:77:11
542 |
543LL | trait Trait<'b, 'c, 'a, T, const N: usize>: Sized {
544 | ^^^^^ - --------------
545
546error[E0107]: method takes 2 generic arguments but 5 generic arguments were supplied
547 --> $DIR/generics-gen-args-errors.rs:107:59
548 |
549LL | 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 |
554note: method defined here, with 2 generic parameters: `U`, `M`
555 --> $DIR/generics-gen-args-errors.rs:78:12
556 |
557LL | fn foo<'d: 'd, U, const M: bool>(self) {}
558 | ^^^ - -------------
559
560error: aborting due to 47 previous errors
561
562Some errors have detailed explanations: E0106, E0107, E0261, E0284, E0401, E0423, E0425, E0747.
563For 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
4mod 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
10trait 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
18struct X<'x1, 'x2, 'x3, 'x4, X1, X2, const X3: usize>(
19 &'x1 X1, &'x2 X2, &'x3 X1, &'x4 [usize; X3]);
20type XX = X::<'static, 'static, 'static, 'static, i32, i32, 3>;
21
22impl<'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
37fn main() {
38}
tests/ui/delegation/generics/impl-trait-wrong-args-count.stderr created+47
......@@ -0,0 +1,47 @@
1error[E0282]: type annotations needed
2 --> $DIR/impl-trait-wrong-args-count.rs:23:21
3 |
4LL | reuse to_reuse::bar;
5 | ^^^ cannot infer type of the type parameter `A` declared on the function `bar`
6 |
7help: consider specifying the generic arguments
8 |
9LL | reuse to_reuse::bar::<A, B>;
10 | ++++++++
11
12error[E0284]: type annotations needed
13 --> $DIR/impl-trait-wrong-args-count.rs:28:21
14 |
15LL | reuse to_reuse::bar2;
16 | ^^^^ cannot infer the value of the const parameter `X` declared on the function `bar2`
17 |
18note: required by a const generic parameter in `bar2`
19 --> $DIR/impl-trait-wrong-args-count.rs:7:35
20 |
21LL | 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`
23help: consider specifying the generic arguments
24 |
25LL | reuse to_reuse::bar2::<A, B, C, D, E, F, X, Y>;
26 | ++++++++++++++++++++++++++
27
28error[E0284]: type annotations needed
29 --> $DIR/impl-trait-wrong-args-count.rs:28:21
30 |
31LL | reuse to_reuse::bar2;
32 | ^^^^ cannot infer the value of the const parameter `Y` declared on the function `bar2`
33 |
34note: required by a const generic parameter in `bar2`
35 --> $DIR/impl-trait-wrong-args-count.rs:7:51
36 |
37LL | 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`
39help: consider specifying the generic arguments
40 |
41LL | reuse to_reuse::bar2::<A, B, C, D, E, F, X, Y>;
42 | ++++++++++++++++++++++++++
43
44error: aborting due to 3 previous errors
45
46Some errors have detailed explanations: E0282, E0284.
47For 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
13mod 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
25mod 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
37mod 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
50mod 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
63mod 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
75mod 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
102mod 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
116mod 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
131pub 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 @@
1error[E0284]: type annotations needed
2 --> $DIR/free-to-free.rs:17:15
3 |
4LL | reuse foo as bar;
5 | ^^^ cannot infer the value of the const parameter `N` declared on the function `foo`
6 |
7note: required by a const generic parameter in `test_1::foo`
8 --> $DIR/free-to-free.rs:14:48
9 |
10LL | fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {}
11 | ^^^^^^^^^^^^^^ required by this const generic parameter in `foo`
12help: consider specifying the generic arguments
13 |
14LL | reuse foo::<T, U, N> as bar;
15 | +++++++++++
16
17error[E0284]: type annotations needed
18 --> $DIR/free-to-free.rs:29:15
19 |
20LL | reuse foo as bar;
21 | ^^^ cannot infer the value of the const parameter `N` declared on the function `foo`
22 |
23note: required by a const generic parameter in `test_2::foo`
24 --> $DIR/free-to-free.rs:26:48
25 |
26LL | fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {}
27 | ^^^^^^^^^^^^^^ required by this const generic parameter in `foo`
28help: consider specifying the generic arguments
29 |
30LL | reuse foo::<T, U, N> as bar;
31 | +++++++++++
32
33error[E0284]: type annotations needed
34 --> $DIR/free-to-free.rs:41:15
35 |
36LL | reuse foo as bar;
37 | ^^^ cannot infer the value of the const parameter `N` declared on the function `foo`
38 |
39note: required by a const generic parameter in `test_3::foo`
40 --> $DIR/free-to-free.rs:38:48
41 |
42LL | fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {}
43 | ^^^^^^^^^^^^^^ required by this const generic parameter in `foo`
44help: consider specifying the generic arguments
45 |
46LL | reuse foo::<T, U, N> as bar;
47 | +++++++++++
48
49error[E0284]: type annotations needed
50 --> $DIR/free-to-free.rs:54:15
51 |
52LL | reuse foo as bar;
53 | ^^^ cannot infer the value of the const parameter `N` declared on the function `foo`
54 |
55note: required by a const generic parameter in `test_4::foo`
56 --> $DIR/free-to-free.rs:51:40
57 |
58LL | 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`
60help: consider specifying the generic arguments
61 |
62LL | reuse foo::<T, U, N> as bar;
63 | +++++++++++
64
65error[E0284]: type annotations needed
66 --> $DIR/free-to-free.rs:67:15
67 |
68LL | reuse foo as bar;
69 | ^^^ cannot infer the value of the const parameter `N` declared on the function `foo`
70 |
71note: required by a const generic parameter in `test_5::foo`
72 --> $DIR/free-to-free.rs:64:30
73 |
74LL | 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`
76help: consider specifying the generic arguments
77 |
78LL | reuse foo::<T, N, U> as bar;
79 | +++++++++++
80
81error[E0284]: type annotations needed
82 --> $DIR/free-to-free.rs:81:9
83 |
84LL | bar(&"".to_string(), &"".to_string());
85 | ^^^ cannot infer the value of the const parameter `N` declared on the function `bar`
86 |
87note: required by a const generic parameter in `test_6::check::bar`
88 --> $DIR/free-to-free.rs:76:30
89 |
90LL | 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...
93LL | reuse foo::<String, 1, String> as bar;
94 | --- required by a bound in this function
95help: consider specifying the generic arguments
96 |
97LL | bar::<String, N, String>(&"".to_string(), &"".to_string());
98 | +++++++++++++++++++++
99
100error[E0308]: arguments to this function are incorrect
101 --> $DIR/free-to-free.rs:79:15
102 |
103LL | 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...
108LL | 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`
118note: function defined here
119 --> $DIR/free-to-free.rs:76:8
120 |
121LL | fn foo<'a, 'b, T: Clone, const N: usize, U: Clone>(_t: &'a T, _u: &'b U) {}
122 | ^^^ --------- ---------
123
124error[E0284]: type annotations needed
125 --> $DIR/free-to-free.rs:108:9
126 |
127LL | bar(&"".to_string(), &"".to_string());
128 | ^^^ cannot infer the value of the const parameter `N` declared on the function `bar`
129 |
130note: required by a const generic parameter in `test_8::check::bar`
131 --> $DIR/free-to-free.rs:104:24
132 |
133LL | 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`
135LL |
136LL | reuse foo::<1, String, String> as bar;
137 | --- required by a bound in this function
138help: consider specifying the generic arguments
139 |
140LL | bar::<N, String, String>(&"".to_string(), &"".to_string());
141 | +++++++++++++++++++++
142
143error[E0308]: arguments to this function are incorrect
144 --> $DIR/free-to-free.rs:106:15
145 |
146LL | 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
150LL |
151LL | 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`
161note: function defined here
162 --> $DIR/free-to-free.rs:104:12
163 |
164LL | fn foo<'a, 'b, const N: usize, T: Clone, U: Clone>(_t: &'a T, _u: &'b U) {}
165 | ^^^ --------- ---------
166
167error[E0284]: type annotations needed
168 --> $DIR/free-to-free.rs:123:13
169 |
170LL | bar(&"".to_string(), &"".to_string());
171 | ^^^ cannot infer the value of the const parameter `N` declared on the function `bar`
172 |
173note: required by a const generic parameter in `test_9::check::{closure#0}::bar`
174 --> $DIR/free-to-free.rs:119:38
175 |
176LL | 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`
178LL |
179LL | reuse foo::<String, 1, String> as bar;
180 | --- required by a bound in this function
181help: consider specifying the generic arguments
182 |
183LL | bar::<String, N, String>(&"".to_string(), &"".to_string());
184 | +++++++++++++++++++++
185
186error[E0308]: arguments to this function are incorrect
187 --> $DIR/free-to-free.rs:121:19
188 |
189LL | 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
193LL |
194LL | 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`
204note: function defined here
205 --> $DIR/free-to-free.rs:119:16
206 |
207LL | fn foo<'a, 'b, T: Clone, const N: usize, U: Clone>(_t: &'a T, _u: &'b U) {}
208 | ^^^ --------- ---------
209
210error: aborting due to 11 previous errors
211
212Some errors have detailed explanations: E0284, E0308.
213For 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
13mod 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
39mod 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
58mod 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
76mod 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
92mod 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
109mod 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
126mod 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
143mod 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
160mod 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
179mod 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
211mod 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
241mod 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
255pub 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 @@
1error[E0284]: type annotations needed
2 --> $DIR/free-to-trait.rs:22:26
3 |
4LL | reuse Trait::foo as bar;
5 | ^^^ cannot infer the value of the const parameter `M` declared on the method `foo`
6 |
7note: required by a const generic parameter in `test_1::Trait::foo`
8 --> $DIR/free-to-trait.rs:15:27
9 |
10LL | fn foo<'d: 'd, U, const M: bool>(self) {}
11 | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
12help: consider specifying the generic arguments
13 |
14LL | reuse Trait::foo::<U, M> as bar;
15 | ++++++++
16
17error[E0284]: type annotations needed
18 --> $DIR/free-to-trait.rs:28:26
19 |
20LL | reuse Trait::foo as bar;
21 | ^^^ cannot infer the value of the const parameter `M` declared on the method `foo`
22 |
23note: required by a const generic parameter in `test_1::Trait::foo`
24 --> $DIR/free-to-trait.rs:15:27
25 |
26LL | fn foo<'d: 'd, U, const M: bool>(self) {}
27 | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
28help: consider specifying the generic arguments
29 |
30LL | reuse Trait::foo::<U, M> as bar;
31 | ++++++++
32
33error[E0107]: function takes 2 lifetime arguments but 1 lifetime argument was supplied
34 --> $DIR/free-to-trait.rs:50:9
35 |
36LL | bar::<'static, u8, String, true>(123);
37 | ^^^ ------- supplied 1 lifetime argument
38 | |
39 | expected 2 lifetime arguments
40 |
41note: function defined here, with 2 lifetime parameters: `'a`, `'b`
42 --> $DIR/free-to-trait.rs:47:48
43 |
44LL | trait Trait<'a, T, const N: usize>: Sized {
45 | --
46LL | fn foo<'b: 'b, U, const M: bool>(self) {}
47 | --
48...
49LL | reuse Trait::<'static, i32, 1>::foo as bar;
50 | ^^^
51help: add missing lifetime argument
52 |
53LL | bar::<'static, 'static, u8, String, true>(123);
54 | +++++++++
55
56error[E0107]: function takes 5 generic arguments but 3 generic arguments were supplied
57 --> $DIR/free-to-trait.rs:50:9
58 |
59LL | bar::<'static, u8, String, true>(123);
60 | ^^^ -- ------ ---- supplied 3 generic arguments
61 | |
62 | expected 5 generic arguments
63 |
64note: function defined here, with 5 generic parameters: `Self`, `T`, `N`, `U`, `M`
65 --> $DIR/free-to-trait.rs:47:48
66 |
67LL | trait Trait<'a, T, const N: usize>: Sized {
68 | -----------------------------------------
69LL | fn foo<'b: 'b, U, const M: bool>(self) {}
70 | - -------------
71...
72LL | reuse Trait::<'static, i32, 1>::foo as bar;
73 | ^^^
74help: add missing generic arguments
75 |
76LL | bar::<'static, u8, String, true, U, M>(123);
77 | ++++++
78
79error[E0277]: the trait bound `Self: test_2::Trait<'static, i32, 1>` is not satisfied
80 --> $DIR/free-to-trait.rs:47:41
81 |
82LL | reuse Trait::<'static, i32, 1>::foo as bar;
83 | ^^^ the trait `test_2::Trait<'static, i32, 1>` is not implemented for `Self`
84
85error[E0107]: function takes 2 lifetime arguments but 1 lifetime argument was supplied
86 --> $DIR/free-to-trait.rs:68:9
87 |
88LL | bar::<'static, u8, String, 1>(123);
89 | ^^^ ------- supplied 1 lifetime argument
90 | |
91 | expected 2 lifetime arguments
92 |
93note: function defined here, with 2 lifetime parameters: `'a`, `'b`
94 --> $DIR/free-to-trait.rs:66:51
95 |
96LL | trait Trait<'a, T, const N: usize>: Sized {
97 | --
98LL | fn foo<'b: 'b, U, const M: bool>(self) {}
99 | --
100...
101LL | reuse Trait::foo::<'static, i32, true> as bar;
102 | ^^^
103help: add missing lifetime argument
104 |
105LL | bar::<'static, 'static, u8, String, 1>(123);
106 | +++++++++
107
108error[E0107]: function takes 5 generic arguments but 3 generic arguments were supplied
109 --> $DIR/free-to-trait.rs:68:9
110 |
111LL | bar::<'static, u8, String, 1>(123);
112 | ^^^ -- ------ - supplied 3 generic arguments
113 | |
114 | expected 5 generic arguments
115 |
116note: function defined here, with 5 generic parameters: `Self`, `T`, `N`, `U`, `M`
117 --> $DIR/free-to-trait.rs:66:51
118 |
119LL | trait Trait<'a, T, const N: usize>: Sized {
120 | -----------------------------------------
121LL | fn foo<'b: 'b, U, const M: bool>(self) {}
122 | - -------------
123...
124LL | reuse Trait::foo::<'static, i32, true> as bar;
125 | ^^^
126help: add missing generic arguments
127 |
128LL | bar::<'static, u8, String, 1, U, M>(123);
129 | ++++++
130
131error[E0107]: function takes 5 generic arguments but 3 generic arguments were supplied
132 --> $DIR/free-to-trait.rs:86:9
133 |
134LL | bar::<u8, String, 1>(123);
135 | ^^^ -- ------ - supplied 3 generic arguments
136 | |
137 | expected 5 generic arguments
138 |
139note: function defined here, with 5 generic parameters: `Self`, `T`, `N`, `U`, `M`
140 --> $DIR/free-to-trait.rs:84:51
141 |
142LL | trait Trait<T, const N: usize>: Sized {
143 | -------------------------------------
144LL | fn foo<'b: 'b, U, const M: bool>(self) {}
145 | - -------------
146...
147LL | reuse Trait::foo::<'static, i32, true> as bar;
148 | ^^^
149help: add missing generic arguments
150 |
151LL | bar::<u8, String, 1, U, M>(123);
152 | ++++++
153
154error[E0107]: function takes 4 generic arguments but 2 generic arguments were supplied
155 --> $DIR/free-to-trait.rs:102:9
156 |
157LL | bar::<u8, 1>(123);
158 | ^^^ -- - supplied 2 generic arguments
159 | |
160 | expected 4 generic arguments
161 |
162note: function defined here, with 4 generic parameters: `Self`, `N`, `U`, `M`
163 --> $DIR/free-to-trait.rs:100:51
164 |
165LL | trait Trait<const N: usize>: Sized {
166 | ----------------------------------
167LL | fn foo<'b: 'b, U, const M: bool>(self) {}
168 | - -------------
169...
170LL | reuse Trait::foo::<'static, i32, true> as bar;
171 | ^^^
172help: add missing generic arguments
173 |
174LL | bar::<u8, 1, U, M>(123);
175 | ++++++
176
177error[E0107]: function takes 3 generic arguments but 1 generic argument was supplied
178 --> $DIR/free-to-trait.rs:119:9
179 |
180LL | bar::<u8>(123);
181 | ^^^ -- supplied 1 generic argument
182 | |
183 | expected 3 generic arguments
184 |
185note: function defined here, with 3 generic parameters: `Self`, `U`, `M`
186 --> $DIR/free-to-trait.rs:117:51
187 |
188LL | trait Trait: Sized {
189 | ------------------
190LL | fn foo<'b: 'b, U, const M: bool>(self) {}
191 | - -------------
192...
193LL | reuse Trait::foo::<'static, i32, true> as bar;
194 | ^^^
195help: add missing generic arguments
196 |
197LL | bar::<u8, U, M>(123);
198 | ++++++
199
200error[E0107]: function takes 5 generic arguments but 3 generic arguments were supplied
201 --> $DIR/free-to-trait.rs:137:9
202 |
203LL | bar::<u8, String, true>(123);
204 | ^^^ -- ------ ---- supplied 3 generic arguments
205 | |
206 | expected 5 generic arguments
207 |
208note: function defined here, with 5 generic parameters: `Self`, `T`, `N`, `U`, `M`
209 --> $DIR/free-to-trait.rs:134:48
210 |
211LL | trait Trait<'a, T, const N: usize>: Sized {
212 | -----------------------------------------
213LL | fn foo<U, const M: bool>(self) {}
214 | - -------------
215...
216LL | reuse Trait::<'static, i32, 1>::foo as bar;
217 | ^^^
218help: add missing generic arguments
219 |
220LL | bar::<u8, String, true, U, M>(123);
221 | ++++++
222
223error[E0277]: the trait bound `Self: test_7::Trait<'static, i32, 1>` is not satisfied
224 --> $DIR/free-to-trait.rs:134:41
225 |
226LL | reuse Trait::<'static, i32, 1>::foo as bar;
227 | ^^^ the trait `test_7::Trait<'static, i32, 1>` is not implemented for `Self`
228
229error[E0107]: function takes 4 generic arguments but 2 generic arguments were supplied
230 --> $DIR/free-to-trait.rs:154:9
231 |
232LL | bar::<u8, true>(123);
233 | ^^^ -- ---- supplied 2 generic arguments
234 | |
235 | expected 4 generic arguments
236 |
237note: function defined here, with 4 generic parameters: `Self`, `T`, `N`, `M`
238 --> $DIR/free-to-trait.rs:151:48
239 |
240LL | trait Trait<'a, T, const N: usize>: Sized {
241 | -----------------------------------------
242LL | fn foo<const M: bool>(self) {}
243 | -------------
244...
245LL | reuse Trait::<'static, i32, 1>::foo as bar;
246 | ^^^
247help: add missing generic arguments
248 |
249LL | bar::<u8, true, N, M>(123);
250 | ++++++
251
252error[E0277]: the trait bound `Self: test_8::Trait<'static, i32, 1>` is not satisfied
253 --> $DIR/free-to-trait.rs:151:41
254 |
255LL | reuse Trait::<'static, i32, 1>::foo as bar;
256 | ^^^ the trait `test_8::Trait<'static, i32, 1>` is not implemented for `Self`
257
258error[E0107]: function takes 3 generic arguments but 1 generic argument was supplied
259 --> $DIR/free-to-trait.rs:171:9
260 |
261LL | bar::<u8>(123);
262 | ^^^ -- supplied 1 generic argument
263 | |
264 | expected 3 generic arguments
265 |
266note: function defined here, with 3 generic parameters: `Self`, `T`, `N`
267 --> $DIR/free-to-trait.rs:168:48
268 |
269LL | trait Trait<'a, T, const N: usize>: Sized {
270 | -----------------------------------------
271...
272LL | reuse Trait::<'static, i32, 1>::foo as bar;
273 | ^^^
274help: add missing generic arguments
275 |
276LL | bar::<u8, T, N>(123);
277 | ++++++
278
279error[E0277]: the trait bound `Self: test_9::Trait<'static, i32, 1>` is not satisfied
280 --> $DIR/free-to-trait.rs:168:41
281 |
282LL | reuse Trait::<'static, i32, 1>::foo as bar;
283 | ^^^ the trait `test_9::Trait<'static, i32, 1>` is not implemented for `Self`
284
285error[E0107]: function takes 3 lifetime arguments but 1 lifetime argument was supplied
286 --> $DIR/free-to-trait.rs:195:13
287 |
288LL | bar1::<'static, u8, i32, true>();
289 | ^^^^ ------- supplied 1 lifetime argument
290 | |
291 | expected 3 lifetime arguments
292 |
293note: function defined here, with 3 lifetime parameters: `'b`, `'c`, `'d`
294 --> $DIR/free-to-trait.rs:193:66
295 |
296LL | trait Trait<'b, 'c, T> {
297 | -- --
298LL | fn foo<'d: 'd, U, const M: bool>() {}
299 | --
300...
301LL | reuse <u8 as Trait::<'static, 'static, i32>>::foo as bar1;
302 | ^^^^
303help: add missing lifetime arguments
304 |
305LL | bar1::<'static, 'static, 'static, u8, i32, true>();
306 | ++++++++++++++++++
307
308error[E0107]: function takes 4 generic arguments but 3 generic arguments were supplied
309 --> $DIR/free-to-trait.rs:195:13
310 |
311LL | bar1::<'static, u8, i32, true>();
312 | ^^^^ -- --- ---- supplied 3 generic arguments
313 | |
314 | expected 4 generic arguments
315 |
316note: function defined here, with 4 generic parameters: `Self`, `T`, `U`, `M`
317 --> $DIR/free-to-trait.rs:193:66
318 |
319LL | trait Trait<'b, 'c, T> {
320 | ----------------------
321LL | fn foo<'d: 'd, U, const M: bool>() {}
322 | - -------------
323...
324LL | reuse <u8 as Trait::<'static, 'static, i32>>::foo as bar1;
325 | ^^^^
326help: add missing generic argument
327 |
328LL | bar1::<'static, u8, i32, true, M>();
329 | +++
330
331error[E0107]: function takes 4 generic arguments but 1 generic argument was supplied
332 --> $DIR/free-to-trait.rs:200:13
333 |
334LL | bar2::<u8>();
335 | ^^^^ -- supplied 1 generic argument
336 | |
337 | expected 4 generic arguments
338 |
339note: function defined here, with 4 generic parameters: `Self`, `T`, `U`, `M`
340 --> $DIR/free-to-trait.rs:199:88
341 |
342LL | trait Trait<'b, 'c, T> {
343 | ----------------------
344LL | fn foo<'d: 'd, U, const M: bool>() {}
345 | - -------------
346...
347LL | reuse <u8 as Trait::<'static, 'static, i32>>::foo::<'static, u32, true> as bar2;
348 | ^^^^
349help: add missing generic arguments
350 |
351LL | bar2::<u8, T, U, M>();
352 | +++++++++
353
354error[E0107]: missing generics for trait `test_10::Trait`
355 --> $DIR/free-to-trait.rs:188:26
356 |
357LL | reuse <u8 as Trait>::foo as bar;
358 | ^^^^^ expected 1 generic argument
359 |
360note: trait defined here, with 1 generic parameter: `T`
361 --> $DIR/free-to-trait.rs:180:11
362 |
363LL | trait Trait<'b, 'c, T> {
364 | ^^^^^ -
365help: add missing generic argument
366 |
367LL | reuse <u8 as Trait<T>>::foo as bar;
368 | +++
369
370error[E0284]: type annotations needed
371 --> $DIR/free-to-trait.rs:193:59
372 |
373LL | 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 |
376note: required by a const generic parameter in `test_10::Trait::foo`
377 --> $DIR/free-to-trait.rs:181:27
378 |
379LL | fn foo<'d: 'd, U, const M: bool>() {}
380 | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
381
382error[E0107]: missing generics for trait `test_11::Trait`
383 --> $DIR/free-to-trait.rs:233:25
384 |
385LL | reuse <usize as Trait>::foo;
386 | ^^^^^ expected 2 generic arguments
387 |
388note: trait defined here, with 2 generic parameters: `T`, `P`
389 --> $DIR/free-to-trait.rs:216:11
390 |
391LL | trait Trait<'a: 'static, T, P>
392 | ^^^^^ - -
393help: add missing generic arguments
394 |
395LL | reuse <usize as Trait<T, P>>::foo;
396 | ++++++
397
398error: aborting due to 22 previous errors
399
400Some errors have detailed explanations: E0107, E0277, E0284.
401For 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
13mod 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
54mod 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
88mod 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
113mod 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
147mod 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
174mod 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
208mod 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
232mod 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
257fn 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 @@
1error[E0284]: type annotations needed
2 --> $DIR/impl-trait-to-free.rs:31:25
3 |
4LL | reuse to_reuse::foo;
5 | ^^^ cannot infer the value of the const parameter `N` declared on the function `foo`
6 |
7note: required by a const generic parameter in `test_1::to_reuse::foo`
8 --> $DIR/impl-trait-to-free.rs:15:42
9 |
10LL | pub fn foo<'a: 'a, 'b: 'b, A, B, const N: usize>() {}
11 | ^^^^^^^^^^^^^^ required by this const generic parameter in `foo`
12help: consider specifying the generic arguments
13 |
14LL | reuse to_reuse::foo::<A, B, N>;
15 | +++++++++++
16
17error[E0284]: type annotations needed
18 --> $DIR/impl-trait-to-free.rs:33:25
19 |
20LL | reuse to_reuse::bar;
21 | ^^^ cannot infer the value of the const parameter `N` declared on the function `bar`
22 |
23note: required by a const generic parameter in `test_1::to_reuse::bar`
24 --> $DIR/impl-trait-to-free.rs:16:42
25 |
26LL | pub fn bar<'a: 'a, 'b: 'b, A, B, const N: usize>(x: &super::XX) {}
27 | ^^^^^^^^^^^^^^ required by this const generic parameter in `bar`
28help: consider specifying the generic arguments
29 |
30LL | reuse to_reuse::bar::<A, B, N>;
31 | +++++++++++
32
33error[E0284]: type annotations needed
34 --> $DIR/impl-trait-to-free.rs:69:25
35 |
36LL | reuse to_reuse::foo;
37 | ^^^ cannot infer the value of the const parameter `N` declared on the function `foo`
38 |
39note: required by a const generic parameter in `test_2::to_reuse::foo`
40 --> $DIR/impl-trait-to-free.rs:56:26
41 |
42LL | pub fn foo<A, B, const N: usize>() {}
43 | ^^^^^^^^^^^^^^ required by this const generic parameter in `foo`
44help: consider specifying the generic arguments
45 |
46LL | reuse to_reuse::foo::<A, B, N>;
47 | +++++++++++
48
49error[E0284]: type annotations needed
50 --> $DIR/impl-trait-to-free.rs:71:25
51 |
52LL | reuse to_reuse::bar;
53 | ^^^ cannot infer the value of the const parameter `N` declared on the function `bar`
54 |
55note: required by a const generic parameter in `test_2::to_reuse::bar`
56 --> $DIR/impl-trait-to-free.rs:57:26
57 |
58LL | pub fn bar<A, B, const N: usize>(x: &super::X) {}
59 | ^^^^^^^^^^^^^^ required by this const generic parameter in `bar`
60help: consider specifying the generic arguments
61 |
62LL | reuse to_reuse::bar::<A, B, N>;
63 | +++++++++++
64
65error[E0284]: type annotations needed
66 --> $DIR/impl-trait-to-free.rs:128:25
67 |
68LL | reuse to_reuse::foo;
69 | ^^^ cannot infer the value of the const parameter `N` declared on the function `foo`
70 |
71note: required by a const generic parameter in `test_4::to_reuse::foo`
72 --> $DIR/impl-trait-to-free.rs:115:42
73 |
74LL | pub fn foo<'a: 'a, 'b: 'b, A, B, const N: usize>() {}
75 | ^^^^^^^^^^^^^^ required by this const generic parameter in `foo`
76help: consider specifying the generic arguments
77 |
78LL | reuse to_reuse::foo::<A, B, N>;
79 | +++++++++++
80
81error[E0284]: type annotations needed
82 --> $DIR/impl-trait-to-free.rs:130:25
83 |
84LL | reuse to_reuse::bar;
85 | ^^^ cannot infer the value of the const parameter `N` declared on the function `bar`
86 |
87note: required by a const generic parameter in `test_4::to_reuse::bar`
88 --> $DIR/impl-trait-to-free.rs:116:42
89 |
90LL | pub fn bar<'a: 'a, 'b: 'b, A, B, const N: usize>(x: &super::X) {}
91 | ^^^^^^^^^^^^^^ required by this const generic parameter in `bar`
92help: consider specifying the generic arguments
93 |
94LL | reuse to_reuse::bar::<A, B, N>;
95 | +++++++++++
96
97error[E0284]: type annotations needed
98 --> $DIR/impl-trait-to-free.rs:189:25
99 |
100LL | reuse to_reuse::foo;
101 | ^^^ cannot infer the value of the const parameter `N` declared on the function `foo`
102 |
103note: required by a const generic parameter in `test_6::to_reuse::foo`
104 --> $DIR/impl-trait-to-free.rs:176:26
105 |
106LL | pub fn foo<A, B, const N: usize>() {}
107 | ^^^^^^^^^^^^^^ required by this const generic parameter in `foo`
108help: consider specifying the generic arguments
109 |
110LL | reuse to_reuse::foo::<A, B, N>;
111 | +++++++++++
112
113error[E0284]: type annotations needed
114 --> $DIR/impl-trait-to-free.rs:191:25
115 |
116LL | reuse to_reuse::bar;
117 | ^^^ cannot infer the value of the const parameter `N` declared on the function `bar`
118 |
119note: required by a const generic parameter in `test_6::to_reuse::bar`
120 --> $DIR/impl-trait-to-free.rs:177:26
121 |
122LL | pub fn bar<A, B, const N: usize>(x: &super::X) {}
123 | ^^^^^^^^^^^^^^ required by this const generic parameter in `bar`
124help: consider specifying the generic arguments
125 |
126LL | reuse to_reuse::bar::<A, B, N>;
127 | +++++++++++
128
129error: aborting due to 8 previous errors
130
131For 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
14mod 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
46mod 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
68mod 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
92mod 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
118mod 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
142mod 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
165mod 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
187mod 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
209mod 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
231fn 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 @@
1error[E0283]: type annotations needed
2 --> $DIR/impl-trait-to-trait.rs:32:28
3 |
4LL | 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`
8help: the trait `Trait0` is implemented for `u16`
9 --> $DIR/impl-trait-to-trait.rs:36:5
10 |
11LL | impl Trait0 for u16 {}
12 | ^^^^^^^^^^^^^^^^^^^
13note: required by a bound in `Trait1::foo`
14 --> $DIR/impl-trait-to-trait.rs:21:16
15 |
16LL | fn foo<U>(&self)
17 | --- required by a bound in this associated function
18...
19LL | U: Trait0,
20 | ^^^^^^ required by this bound in `Trait1::foo`
21
22error[E0284]: type annotations needed
23 --> $DIR/impl-trait-to-trait.rs:104:58
24 |
25LL | 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 |
28note: required by a const generic parameter in `test_4::Trait::foo`
29 --> $DIR/impl-trait-to-trait.rs:94:49
30 |
31LL | 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
34error[E0282]: type annotations needed
35 --> $DIR/impl-trait-to-trait.rs:153:41
36 |
37LL | reuse Trait::<A, String, bool>::foo { &self.0 }
38 | ^^^ cannot infer type of the type parameter `A` declared on the method `foo`
39
40error: aborting due to 3 previous errors
41
42Some errors have detailed explanations: E0282, E0283, E0284.
43For 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
14mod 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
58mod 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
99mod 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
126fn 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 @@
1error[E0284]: type annotations needed
2 --> $DIR/inherent-impl-to-free.rs:21:25
3 |
4LL | reuse to_reuse::foo;
5 | ^^^ cannot infer the value of the const parameter `N` declared on the function `foo`
6 |
7note: required by a const generic parameter in `to_reuse::foo`
8 --> $DIR/inherent-impl-to-free.rs:16:42
9 |
10LL | pub fn foo<'a: 'a, 'b: 'b, A, B, const N: usize>() {}
11 | ^^^^^^^^^^^^^^ required by this const generic parameter in `foo`
12help: consider specifying the generic arguments
13 |
14LL | reuse to_reuse::foo::<A, B, N>;
15 | +++++++++++
16
17error[E0284]: type annotations needed
18 --> $DIR/inherent-impl-to-free.rs:28:25
19 |
20LL | reuse to_reuse::foo;
21 | ^^^ cannot infer the value of the const parameter `N` declared on the function `foo`
22 |
23note: required by a const generic parameter in `to_reuse::foo`
24 --> $DIR/inherent-impl-to-free.rs:16:42
25 |
26LL | pub fn foo<'a: 'a, 'b: 'b, A, B, const N: usize>() {}
27 | ^^^^^^^^^^^^^^ required by this const generic parameter in `foo`
28help: consider specifying the generic arguments
29 |
30LL | reuse to_reuse::foo::<A, B, N>;
31 | +++++++++++
32
33error[E0284]: type annotations needed
34 --> $DIR/inherent-impl-to-free.rs:35:25
35 |
36LL | reuse to_reuse::foo;
37 | ^^^ cannot infer the value of the const parameter `N` declared on the function `foo`
38 |
39note: required by a const generic parameter in `to_reuse::foo`
40 --> $DIR/inherent-impl-to-free.rs:16:42
41 |
42LL | pub fn foo<'a: 'a, 'b: 'b, A, B, const N: usize>() {}
43 | ^^^^^^^^^^^^^^ required by this const generic parameter in `foo`
44help: consider specifying the generic arguments
45 |
46LL | reuse to_reuse::foo::<A, B, N>;
47 | +++++++++++
48
49error[E0284]: type annotations needed
50 --> $DIR/inherent-impl-to-free.rs:43:9
51 |
52LL | X1::<'static, 'static, i32, i32, 1>::bar();
53 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `N` declared on the associated function `bar`
54 |
55note: 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 |
58LL | 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...
61LL | reuse to_reuse::foo::<'static, 'static, i32, String, 1> as bar;
62 | --- required by a bound in this associated function
63help: consider specifying the generic arguments
64 |
65LL | X1::<'static, 'static, i32, i32, 1>::bar::<A, B, N>();
66 | +++++++++++
67
68error[E0284]: type annotations needed
69 --> $DIR/inherent-impl-to-free.rs:47:9
70 |
71LL | X2::<i32, i32, 1>::bar();
72 | ^^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `N` declared on the associated function `bar`
73 |
74note: required by a const generic parameter in `test_1::X2::<T, E, N>::bar`
75 --> $DIR/inherent-impl-to-free.rs:16:42
76 |
77LL | 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...
80LL | reuse to_reuse::foo::<'static, 'static, i32, String, 1> as bar;
81 | --- required by a bound in this associated function
82help: consider specifying the generic arguments
83 |
84LL | X2::<i32, i32, 1>::bar::<A, B, N>();
85 | +++++++++++
86
87error[E0284]: type annotations needed
88 --> $DIR/inherent-impl-to-free.rs:51:9
89 |
90LL | X3::bar();
91 | ^^^^^^^ cannot infer the value of the const parameter `N` declared on the associated function `bar`
92 |
93note: required by a const generic parameter in `test_1::X3::bar`
94 --> $DIR/inherent-impl-to-free.rs:16:42
95 |
96LL | pub fn foo<'a: 'a, 'b: 'b, A, B, const N: usize>() {}
97 | ^^^^^^^^^^^^^^ required by this const generic parameter in `X3::bar`
98...
99LL | reuse to_reuse::foo::<'static, 'static, i32, String, 1> as bar;
100 | --- required by a bound in this associated function
101help: consider specifying the generic arguments
102 |
103LL | X3::bar::<A, B, N>();
104 | +++++++++++
105
106error[E0284]: type annotations needed
107 --> $DIR/inherent-impl-to-free.rs:63:15
108 |
109LL | reuse foo;
110 | ^^^ cannot infer the value of the const parameter `N` declared on the function `foo`
111 |
112note: required by a const generic parameter in `test_2::foo`
113 --> $DIR/inherent-impl-to-free.rs:59:18
114 |
115LL | fn foo<A, B, const N: usize>() {}
116 | ^^^^^^^^^^^^^^ required by this const generic parameter in `foo`
117help: consider specifying the generic arguments
118 |
119LL | reuse foo::<A, B, N>;
120 | +++++++++++
121
122error[E0284]: type annotations needed
123 --> $DIR/inherent-impl-to-free.rs:70:15
124 |
125LL | reuse foo;
126 | ^^^ cannot infer the value of the const parameter `N` declared on the function `foo`
127 |
128note: required by a const generic parameter in `test_2::foo`
129 --> $DIR/inherent-impl-to-free.rs:59:18
130 |
131LL | fn foo<A, B, const N: usize>() {}
132 | ^^^^^^^^^^^^^^ required by this const generic parameter in `foo`
133help: consider specifying the generic arguments
134 |
135LL | reuse foo::<A, B, N>;
136 | +++++++++++
137
138error[E0284]: type annotations needed
139 --> $DIR/inherent-impl-to-free.rs:77:15
140 |
141LL | reuse foo;
142 | ^^^ cannot infer the value of the const parameter `N` declared on the function `foo`
143 |
144note: required by a const generic parameter in `test_2::foo`
145 --> $DIR/inherent-impl-to-free.rs:59:18
146 |
147LL | fn foo<A, B, const N: usize>() {}
148 | ^^^^^^^^^^^^^^ required by this const generic parameter in `foo`
149help: consider specifying the generic arguments
150 |
151LL | reuse foo::<A, B, N>;
152 | +++++++++++
153
154error[E0284]: type annotations needed
155 --> $DIR/inherent-impl-to-free.rs:84:9
156 |
157LL | X1::<'static, 'static, i32, i32, 1>::bar();
158 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `N` declared on the associated function `bar`
159 |
160note: 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 |
163LL | fn foo<A, B, const N: usize>() {}
164 | ^^^^^^^^^^^^^^ required by this const generic parameter in `X1::<'a, 'b, T, E, N>::bar`
165...
166LL | reuse foo::<i32, String, 1> as bar;
167 | --- required by a bound in this associated function
168help: consider specifying the generic arguments
169 |
170LL | X1::<'static, 'static, i32, i32, 1>::bar::<A, B, N>();
171 | +++++++++++
172
173error[E0284]: type annotations needed
174 --> $DIR/inherent-impl-to-free.rs:88:9
175 |
176LL | X2::<i32, i32, 1>::bar();
177 | ^^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `N` declared on the associated function `bar`
178 |
179note: required by a const generic parameter in `test_2::X2::<T, E, N>::bar`
180 --> $DIR/inherent-impl-to-free.rs:59:18
181 |
182LL | fn foo<A, B, const N: usize>() {}
183 | ^^^^^^^^^^^^^^ required by this const generic parameter in `X2::<T, E, N>::bar`
184...
185LL | reuse foo::<i32, String, 1> as bar;
186 | --- required by a bound in this associated function
187help: consider specifying the generic arguments
188 |
189LL | X2::<i32, i32, 1>::bar::<A, B, N>();
190 | +++++++++++
191
192error[E0284]: type annotations needed
193 --> $DIR/inherent-impl-to-free.rs:92:9
194 |
195LL | X3::bar();
196 | ^^^^^^^ cannot infer the value of the const parameter `N` declared on the associated function `bar`
197 |
198note: required by a const generic parameter in `test_2::X3::bar`
199 --> $DIR/inherent-impl-to-free.rs:59:18
200 |
201LL | fn foo<A, B, const N: usize>() {}
202 | ^^^^^^^^^^^^^^ required by this const generic parameter in `X3::bar`
203...
204LL | reuse foo::<i32, String, 1> as bar;
205 | --- required by a bound in this associated function
206help: consider specifying the generic arguments
207 |
208LL | X3::bar::<A, B, N>();
209 | +++++++++++
210
211error: aborting due to 12 previous errors
212
213For 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
14mod 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
37mod 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
61mod 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
83mod 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
105mod 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
127mod 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
150mod 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
173mod 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
197mod 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
218pub 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 @@
1error[E0283]: type annotations needed
2 --> $DIR/inherent-impl-to-trait.rs:29:9
3 |
4LL | 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`
8note: required by a bound in `test_1::S::<'a, 'b, 'c, A, B>::foo`
9 --> $DIR/inherent-impl-to-trait.rs:15:20
10 |
11LL | trait Trait<T: ToString> {
12 | ^^^^^^^^ required by this bound in `S::<'a, 'b, 'c, A, B>::foo`
13...
14LL | reuse Trait::<String>::foo { &self.0 }
15 | --- required by a bound in this associated function
16help: consider specifying the generic argument
17 |
18LL | S::<'static, 'static, 'static, i32, i32>::foo::<T>(&s);
19 | +++++
20
21error[E0284]: type annotations needed
22 --> $DIR/inherent-impl-to-trait.rs:52:9
23 |
24LL | S::<'static, 'static, 'static, i32, i32>::foo(&s);
25 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `B` declared on the method `foo`
26 |
27note: 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 |
30LL | trait Trait<'x, 'y, T, const B: bool> {
31 | ^^^^^^^^^^^^^ required by this const generic parameter in `S::<'a, 'b, 'c, A, B>::foo`
32...
33LL | reuse Trait::<'a, 'b, String, true>::foo { &self.0 }
34 | --- required by a bound in this associated function
35help: consider specifying the generic arguments
36 |
37LL | S::<'static, 'static, 'static, i32, i32>::foo::<T, B>(&s);
38 | ++++++++
39
40error[E0284]: type annotations needed
41 --> $DIR/inherent-impl-to-trait.rs:54:11
42 |
43LL | s.foo();
44 | ^^^ cannot infer the value of the const parameter `B` declared on the method `foo`
45 |
46note: 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 |
49LL | trait Trait<'x, 'y, T, const B: bool> {
50 | ^^^^^^^^^^^^^ required by this const generic parameter in `S::<'a, 'b, 'c, A, B>::foo`
51...
52LL | reuse Trait::<'a, 'b, String, true>::foo { &self.0 }
53 | --- required by a bound in this associated function
54help: consider specifying the generic arguments
55 |
56LL | s.foo::<T, B>();
57 | ++++++++
58
59error[E0282]: type annotations needed
60 --> $DIR/inherent-impl-to-trait.rs:142:9
61 |
62LL | S::<'static, 'static, 'static, i32, i32>::foo(&s);
63 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `A` declared on the method `foo`
64 |
65help: consider specifying the generic arguments
66 |
67LL | S::<'static, 'static, 'static, i32, i32>::foo::<A, B, C>(&s);
68 | +++++++++++
69
70error[E0282]: type annotations needed
71 --> $DIR/inherent-impl-to-trait.rs:165:9
72 |
73LL | S::<'static, 'static, 'static, i32, i32>::foo(&s);
74 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `A` declared on the method `foo`
75 |
76help: consider specifying the generic arguments
77 |
78LL | S::<'static, 'static, 'static, i32, i32>::foo::<A, B, C>(&s);
79 | +++++++++++
80
81error[E0282]: type annotations needed
82 --> $DIR/inherent-impl-to-trait.rs:188:9
83 |
84LL | S::<'static, 'static, 'static, i32, i32>::foo(&s);
85 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `X` declared on the method `foo`
86 |
87help: consider specifying the generic arguments
88 |
89LL | S::<'static, 'static, 'static, i32, i32>::foo::<X, Y, Z, A, B, C>(&s);
90 | ++++++++++++++++++++
91
92error[E0282]: type annotations needed
93 --> $DIR/inherent-impl-to-trait.rs:212:9
94 |
95LL | S::<'static, 'static, 'static, i32, i32>::foo(&s);
96 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `X` declared on the method `foo`
97 |
98help: consider specifying the generic arguments
99 |
100LL | S::<'static, 'static, 'static, i32, i32>::foo::<X, Y, Z, A, B, C>(&s);
101 | ++++++++++++++++++++
102
103error: aborting due to 7 previous errors
104
105Some errors have detailed explanations: E0282, E0283, E0284.
106For 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
13mod 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
32mod 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
51mod 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
66mod 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
85mod 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
103mod 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
121mod 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
134pub 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 @@
1error[E0284]: type annotations needed
2 --> $DIR/trait-to-free.rs:17:15
3 |
4LL | reuse foo;
5 | ^^^ cannot infer the value of the const parameter `N` declared on the function `foo`
6 |
7note: required by a const generic parameter in `test_1::foo`
8 --> $DIR/trait-to-free.rs:14:59
9 |
10LL | fn foo<'a: 'a, 'b: 'b, T: Clone + ToString, U: Clone, const N: usize>() {}
11 | ^^^^^^^^^^^^^^ required by this const generic parameter in `foo`
12help: consider specifying the generic arguments
13 |
14LL | reuse foo::<T, U, N>;
15 | +++++++++++
16
17error[E0284]: type annotations needed
18 --> $DIR/trait-to-free.rs:25:9
19 |
20LL | <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 |
23note: required by a const generic parameter in `test_1::Trait::bar`
24 --> $DIR/trait-to-free.rs:14:59
25 |
26LL | 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...
29LL | reuse foo::<'static, 'static, i32, String, 1> as bar;
30 | --- required by a bound in this associated function
31
32error[E0284]: type annotations needed
33 --> $DIR/trait-to-free.rs:36:15
34 |
35LL | reuse foo;
36 | ^^^ cannot infer the value of the const parameter `N` declared on the function `foo`
37 |
38note: required by a const generic parameter in `test_2::foo`
39 --> $DIR/trait-to-free.rs:33:32
40 |
41LL | fn foo<T: Clone, U: Clone, const N: usize>() {}
42 | ^^^^^^^^^^^^^^ required by this const generic parameter in `foo`
43help: consider specifying the generic arguments
44 |
45LL | reuse foo::<T, U, N>;
46 | +++++++++++
47
48error[E0284]: type annotations needed
49 --> $DIR/trait-to-free.rs:44:9
50 |
51LL | <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 |
54note: required by a const generic parameter in `test_2::Trait::bar`
55 --> $DIR/trait-to-free.rs:33:32
56 |
57LL | fn foo<T: Clone, U: Clone, const N: usize>() {}
58 | ^^^^^^^^^^^^^^ required by this const generic parameter in `Trait::bar`
59...
60LL | reuse foo::<i32, String, 1> as bar;
61 | --- required by a bound in this associated function
62
63error[E0284]: type annotations needed
64 --> $DIR/trait-to-free.rs:70:15
65 |
66LL | reuse foo;
67 | ^^^ cannot infer the value of the const parameter `N` declared on the function `foo`
68 |
69note: required by a const generic parameter in `test_4::foo`
70 --> $DIR/trait-to-free.rs:67:48
71 |
72LL | fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {}
73 | ^^^^^^^^^^^^^^ required by this const generic parameter in `foo`
74help: consider specifying the generic arguments
75 |
76LL | reuse foo::<T, U, N>;
77 | +++++++++++
78
79error[E0284]: type annotations needed
80 --> $DIR/trait-to-free.rs:78:9
81 |
82LL | <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 |
85note: required by a const generic parameter in `test_4::Trait::bar`
86 --> $DIR/trait-to-free.rs:67:48
87 |
88LL | fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {}
89 | ^^^^^^^^^^^^^^ required by this const generic parameter in `Trait::bar`
90...
91LL | reuse foo::<'static, 'static, i32, String, 1> as bar;
92 | --- required by a bound in this associated function
93
94error[E0284]: type annotations needed
95 --> $DIR/trait-to-free.rs:89:15
96 |
97LL | reuse foo;
98 | ^^^ cannot infer the value of the const parameter `N` declared on the function `foo`
99 |
100note: required by a const generic parameter in `test_5::foo`
101 --> $DIR/trait-to-free.rs:86:48
102 |
103LL | fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {}
104 | ^^^^^^^^^^^^^^ required by this const generic parameter in `foo`
105help: consider specifying the generic arguments
106 |
107LL | reuse foo::<T, U, N>;
108 | +++++++++++
109
110error[E0284]: type annotations needed
111 --> $DIR/trait-to-free.rs:97:9
112 |
113LL | <u32 as Trait>::bar();
114 | ^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `N` declared on the associated function `bar`
115 |
116note: required by a const generic parameter in `test_5::Trait::bar`
117 --> $DIR/trait-to-free.rs:86:48
118 |
119LL | fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {}
120 | ^^^^^^^^^^^^^^ required by this const generic parameter in `Trait::bar`
121...
122LL | reuse foo::<'static, 'static, i32, String, 1> as bar;
123 | --- required by a bound in this associated function
124help: consider specifying the generic arguments
125 |
126LL | <u32 as Trait>::bar::<T, U, N>();
127 | +++++++++++
128
129error[E0284]: type annotations needed
130 --> $DIR/trait-to-free.rs:107:15
131 |
132LL | reuse foo;
133 | ^^^ cannot infer the value of the const parameter `N` declared on the function `foo`
134 |
135note: required by a const generic parameter in `test_6::foo`
136 --> $DIR/trait-to-free.rs:104:32
137 |
138LL | fn foo<T: Clone, U: Clone, const N: usize>() {}
139 | ^^^^^^^^^^^^^^ required by this const generic parameter in `foo`
140help: consider specifying the generic arguments
141 |
142LL | reuse foo::<T, U, N>;
143 | +++++++++++
144
145error[E0284]: type annotations needed
146 --> $DIR/trait-to-free.rs:115:9
147 |
148LL | <u32 as Trait>::bar();
149 | ^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `N` declared on the associated function `bar`
150 |
151note: required by a const generic parameter in `test_6::Trait::bar`
152 --> $DIR/trait-to-free.rs:104:32
153 |
154LL | fn foo<T: Clone, U: Clone, const N: usize>() {}
155 | ^^^^^^^^^^^^^^ required by this const generic parameter in `Trait::bar`
156...
157LL | reuse foo::<i32, String, 1> as bar;
158 | --- required by a bound in this associated function
159help: consider specifying the generic arguments
160 |
161LL | <u32 as Trait>::bar::<T, U, N>();
162 | +++++++++++
163
164error: aborting due to 10 previous errors
165
166For 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
16mod 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
136mod 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
230mod 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
338mod 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
432mod 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
540mod 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
599mod 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
658mod 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
716mod 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
795mod 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
884pub 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 @@
1error[E0284]: type annotations needed
2 --> $DIR/trait-to-trait.rs:26:56
3 |
4LL | 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 |
7note: required by a const generic parameter in `test_1::Trait::foo`
8 --> $DIR/trait-to-trait.rs:18:27
9 |
10LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
11 | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
12
13error[E0284]: type annotations needed
14 --> $DIR/trait-to-trait.rs:32:56
15 |
16LL | 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 |
19note: required by a const generic parameter in `test_1::Trait::foo`
20 --> $DIR/trait-to-trait.rs:18:27
21 |
22LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
23 | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
24
25error[E0284]: type annotations needed
26 --> $DIR/trait-to-trait.rs:49:56
27 |
28LL | 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 |
31note: required by a const generic parameter in `test_1::Trait::foo`
32 --> $DIR/trait-to-trait.rs:18:27
33 |
34LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
35 | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
36
37error[E0284]: type annotations needed
38 --> $DIR/trait-to-trait.rs:53:56
39 |
40LL | 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 |
43note: required by a const generic parameter in `test_1::Trait::foo`
44 --> $DIR/trait-to-trait.rs:18:27
45 |
46LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
47 | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
48
49error[E0284]: type annotations needed
50 --> $DIR/trait-to-trait.rs:62:56
51 |
52LL | 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 |
55note: required by a const generic parameter in `test_1::Trait::foo`
56 --> $DIR/trait-to-trait.rs:18:27
57 |
58LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
59 | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
60
61error[E0284]: type annotations needed
62 --> $DIR/trait-to-trait.rs:66:56
63 |
64LL | 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 |
67note: required by a const generic parameter in `test_1::Trait::foo`
68 --> $DIR/trait-to-trait.rs:18:27
69 |
70LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
71 | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
72
73error[E0284]: type annotations needed
74 --> $DIR/trait-to-trait.rs:75:56
75 |
76LL | 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 |
79note: required by a const generic parameter in `test_1::Trait::foo`
80 --> $DIR/trait-to-trait.rs:18:27
81 |
82LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
83 | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
84
85error[E0284]: type annotations needed
86 --> $DIR/trait-to-trait.rs:79:56
87 |
88LL | 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 |
91note: required by a const generic parameter in `test_1::Trait::foo`
92 --> $DIR/trait-to-trait.rs:18:27
93 |
94LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
95 | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
96
97error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
98 --> $DIR/trait-to-trait.rs:92:22
99 |
100LL | ::bar1::<'static, String, true>(&123);
101 | ^^^^^^^
102 |
103note: the late bound lifetime parameter is introduced here
104 --> $DIR/trait-to-trait.rs:18:42
105 |
106LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
107 | ^
108
109error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied
110 --> $DIR/trait-to-trait.rs:92:15
111 |
112LL | ::bar1::<'static, String, true>(&123);
113 | ^^^^ ------ ---- supplied 2 generic arguments
114 | |
115 | expected 3 generic arguments
116 |
117note: method defined here, with 3 generic parameters: `T`, `U`, `M`
118 --> $DIR/trait-to-trait.rs:26:63
119 |
120LL | trait Trait<'b, 'c, 'a, T>: Sized {
121 | -
122LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
123 | - -------------
124...
125LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar1 { Self::get() }
126 | ^^^^
127help: add missing generic argument
128 |
129LL | ::bar1::<'static, String, true, M>(&123);
130 | +++
131
132error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
133 --> $DIR/trait-to-trait.rs:95:33
134 |
135LL | <u32 as Trait3>::bar1::<'static, String, true>(&123);
136 | ^^^^^^^
137 |
138note: the late bound lifetime parameter is introduced here
139 --> $DIR/trait-to-trait.rs:18:42
140 |
141LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
142 | ^
143
144error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied
145 --> $DIR/trait-to-trait.rs:95:26
146 |
147LL | <u32 as Trait3>::bar1::<'static, String, true>(&123);
148 | ^^^^ ------ ---- supplied 2 generic arguments
149 | |
150 | expected 3 generic arguments
151 |
152note: method defined here, with 3 generic parameters: `T`, `U`, `M`
153 --> $DIR/trait-to-trait.rs:49:63
154 |
155LL | trait Trait<'b, 'c, 'a, T>: Sized {
156 | -
157LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
158 | - -------------
159...
160LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar1 { Self::get() }
161 | ^^^^
162help: add missing generic argument
163 |
164LL | <u32 as Trait3>::bar1::<'static, String, true, M>(&123);
165 | +++
166
167error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
168 --> $DIR/trait-to-trait.rs:98:50
169 |
170LL | <u32 as Trait4<'a, 'a, 'static>>::bar1::<'static, String, true>(&123);
171 | ^^^^^^^
172 |
173note: the late bound lifetime parameter is introduced here
174 --> $DIR/trait-to-trait.rs:18:42
175 |
176LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
177 | ^
178
179error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied
180 --> $DIR/trait-to-trait.rs:98:43
181 |
182LL | <u32 as Trait4<'a, 'a, 'static>>::bar1::<'static, String, true>(&123);
183 | ^^^^ ------ ---- supplied 2 generic arguments
184 | |
185 | expected 3 generic arguments
186 |
187note: method defined here, with 3 generic parameters: `T`, `U`, `M`
188 --> $DIR/trait-to-trait.rs:62:63
189 |
190LL | trait Trait<'b, 'c, 'a, T>: Sized {
191 | -
192LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
193 | - -------------
194...
195LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar1 { Self::get() }
196 | ^^^^
197help: add missing generic argument
198 |
199LL | <u32 as Trait4<'a, 'a, 'static>>::bar1::<'static, String, true, M>(&123);
200 | +++
201
202error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
203 --> $DIR/trait-to-trait.rs:101:51
204 |
205LL | <u32 as Trait5<i32, u64, String>>::bar1::<'static, String, true>(&123);
206 | ^^^^^^^
207 |
208note: the late bound lifetime parameter is introduced here
209 --> $DIR/trait-to-trait.rs:18:42
210 |
211LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
212 | ^
213
214error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied
215 --> $DIR/trait-to-trait.rs:101:44
216 |
217LL | <u32 as Trait5<i32, u64, String>>::bar1::<'static, String, true>(&123);
218 | ^^^^ ------ ---- supplied 2 generic arguments
219 | |
220 | expected 3 generic arguments
221 |
222note: method defined here, with 3 generic parameters: `T`, `U`, `M`
223 --> $DIR/trait-to-trait.rs:75:63
224 |
225LL | trait Trait<'b, 'c, 'a, T>: Sized {
226 | -
227LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
228 | - -------------
229...
230LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar1 { Self::get() }
231 | ^^^^
232help: add missing generic argument
233 |
234LL | <u32 as Trait5<i32, u64, String>>::bar1::<'static, String, true, M>(&123);
235 | +++
236
237error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
238 --> $DIR/trait-to-trait.rs:111:22
239 |
240LL | ::bar3::<'static, String, true>(&123);
241 | ^^^^^^^
242 |
243note: the late bound lifetime parameter is introduced here
244 --> $DIR/trait-to-trait.rs:18:42
245 |
246LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
247 | ^
248
249error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied
250 --> $DIR/trait-to-trait.rs:111:15
251 |
252LL | ::bar3::<'static, String, true>(&123);
253 | ^^^^ ------ ---- supplied 2 generic arguments
254 | |
255 | expected 3 generic arguments
256 |
257note: method defined here, with 3 generic parameters: `T`, `U`, `M`
258 --> $DIR/trait-to-trait.rs:32:63
259 |
260LL | trait Trait<'b, 'c, 'a, T>: Sized {
261 | -
262LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
263 | - -------------
264...
265LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar3 { self.get_self() }
266 | ^^^^
267help: add missing generic argument
268 |
269LL | ::bar3::<'static, String, true, M>(&123);
270 | +++
271
272error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
273 --> $DIR/trait-to-trait.rs:114:33
274 |
275LL | <u32 as Trait3>::bar3::<'static, String, true>(&123);
276 | ^^^^^^^
277 |
278note: the late bound lifetime parameter is introduced here
279 --> $DIR/trait-to-trait.rs:18:42
280 |
281LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
282 | ^
283
284error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied
285 --> $DIR/trait-to-trait.rs:114:26
286 |
287LL | <u32 as Trait3>::bar3::<'static, String, true>(&123);
288 | ^^^^ ------ ---- supplied 2 generic arguments
289 | |
290 | expected 3 generic arguments
291 |
292note: method defined here, with 3 generic parameters: `T`, `U`, `M`
293 --> $DIR/trait-to-trait.rs:53:63
294 |
295LL | trait Trait<'b, 'c, 'a, T>: Sized {
296 | -
297LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
298 | - -------------
299...
300LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar3 { self.get_self() }
301 | ^^^^
302help: add missing generic argument
303 |
304LL | <u32 as Trait3>::bar3::<'static, String, true, M>(&123);
305 | +++
306
307error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
308 --> $DIR/trait-to-trait.rs:117:50
309 |
310LL | <u32 as Trait4<'a, 'a, 'static>>::bar3::<'static, String, true>(&123);
311 | ^^^^^^^
312 |
313note: the late bound lifetime parameter is introduced here
314 --> $DIR/trait-to-trait.rs:18:42
315 |
316LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
317 | ^
318
319error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied
320 --> $DIR/trait-to-trait.rs:117:43
321 |
322LL | <u32 as Trait4<'a, 'a, 'static>>::bar3::<'static, String, true>(&123);
323 | ^^^^ ------ ---- supplied 2 generic arguments
324 | |
325 | expected 3 generic arguments
326 |
327note: method defined here, with 3 generic parameters: `T`, `U`, `M`
328 --> $DIR/trait-to-trait.rs:66:63
329 |
330LL | trait Trait<'b, 'c, 'a, T>: Sized {
331 | -
332LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
333 | - -------------
334...
335LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar3 { self.get_self() }
336 | ^^^^
337help: add missing generic argument
338 |
339LL | <u32 as Trait4<'a, 'a, 'static>>::bar3::<'static, String, true, M>(&123);
340 | +++
341
342error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
343 --> $DIR/trait-to-trait.rs:120:51
344 |
345LL | <u32 as Trait5<i32, u64, String>>::bar3::<'static, String, true>(&123);
346 | ^^^^^^^
347 |
348note: the late bound lifetime parameter is introduced here
349 --> $DIR/trait-to-trait.rs:18:42
350 |
351LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
352 | ^
353
354error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied
355 --> $DIR/trait-to-trait.rs:120:44
356 |
357LL | <u32 as Trait5<i32, u64, String>>::bar3::<'static, String, true>(&123);
358 | ^^^^ ------ ---- supplied 2 generic arguments
359 | |
360 | expected 3 generic arguments
361 |
362note: method defined here, with 3 generic parameters: `T`, `U`, `M`
363 --> $DIR/trait-to-trait.rs:79:63
364 |
365LL | trait Trait<'b, 'c, 'a, T>: Sized {
366 | -
367LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
368 | - -------------
369...
370LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar3 { self.get_self() }
371 | ^^^^
372help: add missing generic argument
373 |
374LL | <u32 as Trait5<i32, u64, String>>::bar3::<'static, String, true, M>(&123);
375 | +++
376
377error[E0284]: type annotations needed
378 --> $DIR/trait-to-trait.rs:146:29
379 |
380LL | reuse Trait::<i32>::foo as bar1 { Self::get() }
381 | ^^^ cannot infer the value of the const parameter `M` declared on the method `foo`
382 |
383note: required by a const generic parameter in `test_2::Trait::foo`
384 --> $DIR/trait-to-trait.rs:138:27
385 |
386LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
387 | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
388
389error[E0284]: type annotations needed
390 --> $DIR/trait-to-trait.rs:149:29
391 |
392LL | 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 |
395note: required by a const generic parameter in `test_2::Trait::foo`
396 --> $DIR/trait-to-trait.rs:138:27
397 |
398LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
399 | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
400
401error[E0284]: type annotations needed
402 --> $DIR/trait-to-trait.rs:157:29
403 |
404LL | reuse Trait::<i32>::foo as bar1 { Self::get() }
405 | ^^^ cannot infer the value of the const parameter `M` declared on the method `foo`
406 |
407note: required by a const generic parameter in `test_2::Trait::foo`
408 --> $DIR/trait-to-trait.rs:138:27
409 |
410LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
411 | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
412
413error[E0284]: type annotations needed
414 --> $DIR/trait-to-trait.rs:160:29
415 |
416LL | 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 |
419note: required by a const generic parameter in `test_2::Trait::foo`
420 --> $DIR/trait-to-trait.rs:138:27
421 |
422LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
423 | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
424
425error[E0284]: type annotations needed
426 --> $DIR/trait-to-trait.rs:168:29
427 |
428LL | reuse Trait::<i32>::foo as bar1 { Self::get() }
429 | ^^^ cannot infer the value of the const parameter `M` declared on the method `foo`
430 |
431note: required by a const generic parameter in `test_2::Trait::foo`
432 --> $DIR/trait-to-trait.rs:138:27
433 |
434LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
435 | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
436
437error[E0284]: type annotations needed
438 --> $DIR/trait-to-trait.rs:171:29
439 |
440LL | 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 |
443note: required by a const generic parameter in `test_2::Trait::foo`
444 --> $DIR/trait-to-trait.rs:138:27
445 |
446LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
447 | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
448
449error[E0284]: type annotations needed
450 --> $DIR/trait-to-trait.rs:179:29
451 |
452LL | reuse Trait::<i32>::foo as bar1 { Self::get() }
453 | ^^^ cannot infer the value of the const parameter `M` declared on the method `foo`
454 |
455note: required by a const generic parameter in `test_2::Trait::foo`
456 --> $DIR/trait-to-trait.rs:138:27
457 |
458LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
459 | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
460
461error[E0284]: type annotations needed
462 --> $DIR/trait-to-trait.rs:182:29
463 |
464LL | 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 |
467note: required by a const generic parameter in `test_2::Trait::foo`
468 --> $DIR/trait-to-trait.rs:138:27
469 |
470LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
471 | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
472
473error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied
474 --> $DIR/trait-to-trait.rs:194:15
475 |
476LL | ::bar1::<'static, String, true>(&123);
477 | ^^^^ ------ ---- supplied 2 generic arguments
478 | |
479 | expected 3 generic arguments
480 |
481note: method defined here, with 3 generic parameters: `T`, `U`, `M`
482 --> $DIR/trait-to-trait.rs:146:36
483 |
484LL | trait Trait<T>: Sized {
485 | -
486LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
487 | - -------------
488...
489LL | reuse Trait::<i32>::foo as bar1 { Self::get() }
490 | ^^^^
491help: add missing generic argument
492 |
493LL | ::bar1::<'static, String, true, M>(&123);
494 | +++
495
496error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied
497 --> $DIR/trait-to-trait.rs:196:26
498 |
499LL | <u32 as Trait3>::bar1::<'static, String, true>(&123);
500 | ^^^^ ------ ---- supplied 2 generic arguments
501 | |
502 | expected 3 generic arguments
503 |
504note: method defined here, with 3 generic parameters: `T`, `U`, `M`
505 --> $DIR/trait-to-trait.rs:157:36
506 |
507LL | trait Trait<T>: Sized {
508 | -
509LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
510 | - -------------
511...
512LL | reuse Trait::<i32>::foo as bar1 { Self::get() }
513 | ^^^^
514help: add missing generic argument
515 |
516LL | <u32 as Trait3>::bar1::<'static, String, true, M>(&123);
517 | +++
518
519error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied
520 --> $DIR/trait-to-trait.rs:198:43
521 |
522LL | <u32 as Trait4<'a, 'a, 'static>>::bar1::<'static, String, true>(&123);
523 | ^^^^ ------ ---- supplied 2 generic arguments
524 | |
525 | expected 3 generic arguments
526 |
527note: method defined here, with 3 generic parameters: `T`, `U`, `M`
528 --> $DIR/trait-to-trait.rs:168:36
529 |
530LL | trait Trait<T>: Sized {
531 | -
532LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
533 | - -------------
534...
535LL | reuse Trait::<i32>::foo as bar1 { Self::get() }
536 | ^^^^
537help: add missing generic argument
538 |
539LL | <u32 as Trait4<'a, 'a, 'static>>::bar1::<'static, String, true, M>(&123);
540 | +++
541
542error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied
543 --> $DIR/trait-to-trait.rs:200:44
544 |
545LL | <u32 as Trait5<i32, u64, String>>::bar1::<'static, String, true>(&123);
546 | ^^^^ ------ ---- supplied 2 generic arguments
547 | |
548 | expected 3 generic arguments
549 |
550note: method defined here, with 3 generic parameters: `T`, `U`, `M`
551 --> $DIR/trait-to-trait.rs:179:36
552 |
553LL | trait Trait<T>: Sized {
554 | -
555LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
556 | - -------------
557...
558LL | reuse Trait::<i32>::foo as bar1 { Self::get() }
559 | ^^^^
560help: add missing generic argument
561 |
562LL | <u32 as Trait5<i32, u64, String>>::bar1::<'static, String, true, M>(&123);
563 | +++
564
565error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied
566 --> $DIR/trait-to-trait.rs:209:15
567 |
568LL | ::bar3::<'static, String, true>(&123);
569 | ^^^^ ------ ---- supplied 2 generic arguments
570 | |
571 | expected 3 generic arguments
572 |
573note: method defined here, with 3 generic parameters: `T`, `U`, `M`
574 --> $DIR/trait-to-trait.rs:149:36
575 |
576LL | trait Trait<T>: Sized {
577 | -
578LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
579 | - -------------
580...
581LL | reuse Trait::<i32>::foo as bar3 { self.get_self() }
582 | ^^^^
583help: add missing generic argument
584 |
585LL | ::bar3::<'static, String, true, M>(&123);
586 | +++
587
588error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied
589 --> $DIR/trait-to-trait.rs:211:26
590 |
591LL | <u32 as Trait3>::bar3::<'static, String, true>(&123);
592 | ^^^^ ------ ---- supplied 2 generic arguments
593 | |
594 | expected 3 generic arguments
595 |
596note: method defined here, with 3 generic parameters: `T`, `U`, `M`
597 --> $DIR/trait-to-trait.rs:160:36
598 |
599LL | trait Trait<T>: Sized {
600 | -
601LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
602 | - -------------
603...
604LL | reuse Trait::<i32>::foo as bar3 { self.get_self() }
605 | ^^^^
606help: add missing generic argument
607 |
608LL | <u32 as Trait3>::bar3::<'static, String, true, M>(&123);
609 | +++
610
611error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied
612 --> $DIR/trait-to-trait.rs:213:43
613 |
614LL | <u32 as Trait4<'a, 'a, 'static>>::bar3::<'static, String, true>(&123);
615 | ^^^^ ------ ---- supplied 2 generic arguments
616 | |
617 | expected 3 generic arguments
618 |
619note: method defined here, with 3 generic parameters: `T`, `U`, `M`
620 --> $DIR/trait-to-trait.rs:171:36
621 |
622LL | trait Trait<T>: Sized {
623 | -
624LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
625 | - -------------
626...
627LL | reuse Trait::<i32>::foo as bar3 { self.get_self() }
628 | ^^^^
629help: add missing generic argument
630 |
631LL | <u32 as Trait4<'a, 'a, 'static>>::bar3::<'static, String, true, M>(&123);
632 | +++
633
634error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied
635 --> $DIR/trait-to-trait.rs:215:44
636 |
637LL | <u32 as Trait5<i32, u64, String>>::bar3::<'static, String, true>(&123);
638 | ^^^^ ------ ---- supplied 2 generic arguments
639 | |
640 | expected 3 generic arguments
641 |
642note: method defined here, with 3 generic parameters: `T`, `U`, `M`
643 --> $DIR/trait-to-trait.rs:182:36
644 |
645LL | trait Trait<T>: Sized {
646 | -
647LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
648 | - -------------
649...
650LL | reuse Trait::<i32>::foo as bar3 { self.get_self() }
651 | ^^^^
652help: add missing generic argument
653 |
654LL | <u32 as Trait5<i32, u64, String>>::bar3::<'static, String, true, M>(&123);
655 | +++
656
657error[E0284]: type annotations needed
658 --> $DIR/trait-to-trait.rs:240:51
659 |
660LL | 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 |
663note: required by a const generic parameter in `test_3::Trait::foo`
664 --> $DIR/trait-to-trait.rs:232:27
665 |
666LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
667 | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
668help: consider specifying the generic arguments
669 |
670LL | reuse Trait::<'static, 'static, 'static>::foo::<U, M> as bar1 { Self::get() }
671 | ++++++++
672
673error[E0284]: type annotations needed
674 --> $DIR/trait-to-trait.rs:245:51
675 |
676LL | 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 |
679note: required by a const generic parameter in `test_3::Trait::foo`
680 --> $DIR/trait-to-trait.rs:232:27
681 |
682LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
683 | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
684help: consider specifying the generic arguments
685 |
686LL | reuse Trait::<'static, 'static, 'static>::foo::<U, M> as bar3 { self.get_self() }
687 | ++++++++
688
689error[E0284]: type annotations needed
690 --> $DIR/trait-to-trait.rs:255:51
691 |
692LL | 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 |
695note: required by a const generic parameter in `test_3::Trait::foo`
696 --> $DIR/trait-to-trait.rs:232:27
697 |
698LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
699 | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
700help: consider specifying the generic arguments
701 |
702LL | reuse Trait::<'static, 'static, 'static>::foo::<U, M> as bar1 { Self::get() }
703 | ++++++++
704
705error[E0284]: type annotations needed
706 --> $DIR/trait-to-trait.rs:260:51
707 |
708LL | 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 |
711note: required by a const generic parameter in `test_3::Trait::foo`
712 --> $DIR/trait-to-trait.rs:232:27
713 |
714LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
715 | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
716help: consider specifying the generic arguments
717 |
718LL | reuse Trait::<'static, 'static, 'static>::foo::<U, M> as bar3 { self.get_self() }
719 | ++++++++
720
721error[E0284]: type annotations needed
722 --> $DIR/trait-to-trait.rs:270:51
723 |
724LL | 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 |
727note: required by a const generic parameter in `test_3::Trait::foo`
728 --> $DIR/trait-to-trait.rs:232:27
729 |
730LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
731 | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
732help: consider specifying the generic arguments
733 |
734LL | reuse Trait::<'static, 'static, 'static>::foo::<U, M> as bar1 { Self::get() }
735 | ++++++++
736
737error[E0284]: type annotations needed
738 --> $DIR/trait-to-trait.rs:275:51
739 |
740LL | 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 |
743note: required by a const generic parameter in `test_3::Trait::foo`
744 --> $DIR/trait-to-trait.rs:232:27
745 |
746LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
747 | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
748help: consider specifying the generic arguments
749 |
750LL | reuse Trait::<'static, 'static, 'static>::foo::<U, M> as bar3 { self.get_self() }
751 | ++++++++
752
753error[E0284]: type annotations needed
754 --> $DIR/trait-to-trait.rs:285:51
755 |
756LL | 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 |
759note: required by a const generic parameter in `test_3::Trait::foo`
760 --> $DIR/trait-to-trait.rs:232:27
761 |
762LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
763 | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
764help: consider specifying the generic arguments
765 |
766LL | reuse Trait::<'static, 'static, 'static>::foo::<U, M> as bar1 { Self::get() }
767 | ++++++++
768
769error[E0284]: type annotations needed
770 --> $DIR/trait-to-trait.rs:289:51
771 |
772LL | 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 |
775note: required by a const generic parameter in `test_3::Trait::foo`
776 --> $DIR/trait-to-trait.rs:232:27
777 |
778LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
779 | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
780help: consider specifying the generic arguments
781 |
782LL | reuse Trait::<'static, 'static, 'static>::foo::<U, M> as bar3 { self.get_self() }
783 | ++++++++
784
785error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
786 --> $DIR/trait-to-trait.rs:302:22
787 |
788LL | ::bar1::<'static, String, true>(&123);
789 | ^^^^^^^
790 |
791note: the late bound lifetime parameter is introduced here
792 --> $DIR/trait-to-trait.rs:232:42
793 |
794LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
795 | ^
796
797error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
798 --> $DIR/trait-to-trait.rs:304:33
799 |
800LL | <u32 as Trait3>::bar1::<'static, String, true>(&123);
801 | ^^^^^^^
802 |
803note: the late bound lifetime parameter is introduced here
804 --> $DIR/trait-to-trait.rs:232:42
805 |
806LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
807 | ^
808
809error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
810 --> $DIR/trait-to-trait.rs:306:50
811 |
812LL | <u32 as Trait4<'a, 'a, 'static>>::bar1::<'static, String, true>(&123);
813 | ^^^^^^^
814 |
815note: the late bound lifetime parameter is introduced here
816 --> $DIR/trait-to-trait.rs:232:42
817 |
818LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
819 | ^
820
821error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
822 --> $DIR/trait-to-trait.rs:308:51
823 |
824LL | <u32 as Trait5<i32, u64, String>>::bar1::<'static, String, true>(&123);
825 | ^^^^^^^
826 |
827note: the late bound lifetime parameter is introduced here
828 --> $DIR/trait-to-trait.rs:232:42
829 |
830LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
831 | ^
832
833error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
834 --> $DIR/trait-to-trait.rs:317:22
835 |
836LL | ::bar3::<'static, String, true>(&123);
837 | ^^^^^^^
838 |
839note: the late bound lifetime parameter is introduced here
840 --> $DIR/trait-to-trait.rs:232:42
841 |
842LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
843 | ^
844
845error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
846 --> $DIR/trait-to-trait.rs:319:33
847 |
848LL | <u32 as Trait3>::bar3::<'static, String, true>(&123);
849 | ^^^^^^^
850 |
851note: the late bound lifetime parameter is introduced here
852 --> $DIR/trait-to-trait.rs:232:42
853 |
854LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
855 | ^
856
857error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
858 --> $DIR/trait-to-trait.rs:321:50
859 |
860LL | <u32 as Trait4<'a, 'a, 'static>>::bar3::<'static, String, true>(&123);
861 | ^^^^^^^
862 |
863note: the late bound lifetime parameter is introduced here
864 --> $DIR/trait-to-trait.rs:232:42
865 |
866LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
867 | ^
868
869error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
870 --> $DIR/trait-to-trait.rs:323:51
871 |
872LL | <u32 as Trait5<i32, u64, String>>::bar3::<'static, String, true>(&123);
873 | ^^^^^^^
874 |
875note: the late bound lifetime parameter is introduced here
876 --> $DIR/trait-to-trait.rs:232:42
877 |
878LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
879 | ^
880
881error[E0284]: type annotations needed
882 --> $DIR/trait-to-trait.rs:348:22
883 |
884LL | reuse Trait::foo as bar1 { Self::get() }
885 | ^^^ cannot infer the value of the const parameter `M` declared on the method `foo`
886 |
887note: required by a const generic parameter in `test_4::Trait::foo`
888 --> $DIR/trait-to-trait.rs:340:27
889 |
890LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
891 | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
892help: consider specifying the generic arguments
893 |
894LL | reuse Trait::foo::<U, M> as bar1 { Self::get() }
895 | ++++++++
896
897error[E0284]: type annotations needed
898 --> $DIR/trait-to-trait.rs:351:22
899 |
900LL | reuse Trait::foo as bar3 { self.get_self() }
901 | ^^^ cannot infer the value of the const parameter `M` declared on the method `foo`
902 |
903note: required by a const generic parameter in `test_4::Trait::foo`
904 --> $DIR/trait-to-trait.rs:340:27
905 |
906LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
907 | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
908help: consider specifying the generic arguments
909 |
910LL | reuse Trait::foo::<U, M> as bar3 { self.get_self() }
911 | ++++++++
912
913error[E0284]: type annotations needed
914 --> $DIR/trait-to-trait.rs:359:22
915 |
916LL | reuse Trait::foo as bar1 { Self::get() }
917 | ^^^ cannot infer the value of the const parameter `M` declared on the method `foo`
918 |
919note: required by a const generic parameter in `test_4::Trait::foo`
920 --> $DIR/trait-to-trait.rs:340:27
921 |
922LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
923 | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
924help: consider specifying the generic arguments
925 |
926LL | reuse Trait::foo::<U, M> as bar1 { Self::get() }
927 | ++++++++
928
929error[E0284]: type annotations needed
930 --> $DIR/trait-to-trait.rs:362:22
931 |
932LL | reuse Trait::foo as bar3 { self.get_self() }
933 | ^^^ cannot infer the value of the const parameter `M` declared on the method `foo`
934 |
935note: required by a const generic parameter in `test_4::Trait::foo`
936 --> $DIR/trait-to-trait.rs:340:27
937 |
938LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
939 | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
940help: consider specifying the generic arguments
941 |
942LL | reuse Trait::foo::<U, M> as bar3 { self.get_self() }
943 | ++++++++
944
945error[E0284]: type annotations needed
946 --> $DIR/trait-to-trait.rs:370:22
947 |
948LL | reuse Trait::foo as bar1 { Self::get() }
949 | ^^^ cannot infer the value of the const parameter `M` declared on the method `foo`
950 |
951note: required by a const generic parameter in `test_4::Trait::foo`
952 --> $DIR/trait-to-trait.rs:340:27
953 |
954LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
955 | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
956help: consider specifying the generic arguments
957 |
958LL | reuse Trait::foo::<U, M> as bar1 { Self::get() }
959 | ++++++++
960
961error[E0284]: type annotations needed
962 --> $DIR/trait-to-trait.rs:373:22
963 |
964LL | reuse Trait::foo as bar3 { self.get_self() }
965 | ^^^ cannot infer the value of the const parameter `M` declared on the method `foo`
966 |
967note: required by a const generic parameter in `test_4::Trait::foo`
968 --> $DIR/trait-to-trait.rs:340:27
969 |
970LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
971 | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
972help: consider specifying the generic arguments
973 |
974LL | reuse Trait::foo::<U, M> as bar3 { self.get_self() }
975 | ++++++++
976
977error[E0284]: type annotations needed
978 --> $DIR/trait-to-trait.rs:381:22
979 |
980LL | reuse Trait::foo as bar1 { Self::get() }
981 | ^^^ cannot infer the value of the const parameter `M` declared on the method `foo`
982 |
983note: required by a const generic parameter in `test_4::Trait::foo`
984 --> $DIR/trait-to-trait.rs:340:27
985 |
986LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
987 | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
988help: consider specifying the generic arguments
989 |
990LL | reuse Trait::foo::<U, M> as bar1 { Self::get() }
991 | ++++++++
992
993error[E0284]: type annotations needed
994 --> $DIR/trait-to-trait.rs:384:22
995 |
996LL | reuse Trait::foo as bar3 { self.get_self() }
997 | ^^^ cannot infer the value of the const parameter `M` declared on the method `foo`
998 |
999note: required by a const generic parameter in `test_4::Trait::foo`
1000 --> $DIR/trait-to-trait.rs:340:27
1001 |
1002LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
1003 | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
1004help: consider specifying the generic arguments
1005 |
1006LL | reuse Trait::foo::<U, M> as bar3 { self.get_self() }
1007 | ++++++++
1008
1009error[E0284]: type annotations needed
1010 --> $DIR/trait-to-trait.rs:401:9
1011 |
1012LL | <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 |
1015note: required by a const generic parameter in `test_4::Trait2::bar2`
1016 --> $DIR/trait-to-trait.rs:340:27
1017 |
1018LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
1019 | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait2::bar2`
1020...
1021LL | reuse Trait::foo::<'static, String, false> as bar2 { Self::get() }
1022 | ---- required by a bound in this associated function
1023
1024error[E0284]: type annotations needed
1025 --> $DIR/trait-to-trait.rs:403:9
1026 |
1027LL | <u32 as Trait3>::bar2(&123);
1028 | ^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `M` declared on the method `bar2`
1029 |
1030note: required by a const generic parameter in `test_4::Trait3::bar2`
1031 --> $DIR/trait-to-trait.rs:340:27
1032 |
1033LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
1034 | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait3::bar2`
1035...
1036LL | reuse Trait::foo::<'static, String, false> as bar2 { Self::get() }
1037 | ---- required by a bound in this associated function
1038help: consider specifying the generic arguments
1039 |
1040LL | <u32 as Trait3>::bar2::<U, M>(&123);
1041 | ++++++++
1042
1043error[E0284]: type annotations needed
1044 --> $DIR/trait-to-trait.rs:405:9
1045 |
1046LL | <u32 as Trait4<'a, 'a, 'static>>::bar2(&123);
1047 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `M` declared on the method `bar2`
1048 |
1049note: required by a const generic parameter in `test_4::Trait4::bar2`
1050 --> $DIR/trait-to-trait.rs:340:27
1051 |
1052LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
1053 | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait4::bar2`
1054...
1055LL | reuse Trait::foo::<'static, String, false> as bar2 { Self::get() }
1056 | ---- required by a bound in this associated function
1057help: consider specifying the generic arguments
1058 |
1059LL | <u32 as Trait4<'a, 'a, 'static>>::bar2::<U, M>(&123);
1060 | ++++++++
1061
1062error[E0284]: type annotations needed
1063 --> $DIR/trait-to-trait.rs:407:9
1064 |
1065LL | <u32 as Trait5<i32, u64, String>>::bar2(&123);
1066 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `M` declared on the method `bar2`
1067 |
1068note: required by a const generic parameter in `test_4::Trait5::bar2`
1069 --> $DIR/trait-to-trait.rs:340:27
1070 |
1071LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
1072 | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait5::bar2`
1073...
1074LL | reuse Trait::foo::<'static, String, false> as bar2 { Self::get() }
1075 | ---- required by a bound in this associated function
1076
1077error[E0284]: type annotations needed
1078 --> $DIR/trait-to-trait.rs:416:9
1079 |
1080LL | <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 |
1083note: required by a const generic parameter in `test_4::Trait2::bar4`
1084 --> $DIR/trait-to-trait.rs:340:27
1085 |
1086LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
1087 | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait2::bar4`
1088...
1089LL | reuse Trait::foo::<'static, String, false> as bar4 { self.get_self() }
1090 | ---- required by a bound in this associated function
1091
1092error[E0284]: type annotations needed
1093 --> $DIR/trait-to-trait.rs:418:9
1094 |
1095LL | <u32 as Trait3>::bar4(&123);
1096 | ^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `M` declared on the method `bar4`
1097 |
1098note: required by a const generic parameter in `test_4::Trait3::bar4`
1099 --> $DIR/trait-to-trait.rs:340:27
1100 |
1101LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
1102 | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait3::bar4`
1103...
1104LL | reuse Trait::foo::<'static, String, false> as bar4 { self.get_self() }
1105 | ---- required by a bound in this associated function
1106help: consider specifying the generic arguments
1107 |
1108LL | <u32 as Trait3>::bar4::<U, M>(&123);
1109 | ++++++++
1110
1111error[E0284]: type annotations needed
1112 --> $DIR/trait-to-trait.rs:420:9
1113 |
1114LL | <u32 as Trait4<'a, 'a, 'static>>::bar4(&123);
1115 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `M` declared on the method `bar4`
1116 |
1117note: required by a const generic parameter in `test_4::Trait4::bar4`
1118 --> $DIR/trait-to-trait.rs:340:27
1119 |
1120LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
1121 | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait4::bar4`
1122...
1123LL | reuse Trait::foo::<'static, String, false> as bar4 { self.get_self() }
1124 | ---- required by a bound in this associated function
1125help: consider specifying the generic arguments
1126 |
1127LL | <u32 as Trait4<'a, 'a, 'static>>::bar4::<U, M>(&123);
1128 | ++++++++
1129
1130error[E0284]: type annotations needed
1131 --> $DIR/trait-to-trait.rs:422:9
1132 |
1133LL | <u32 as Trait5<i32, u64, String>>::bar4(&123);
1134 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `M` declared on the method `bar4`
1135 |
1136note: required by a const generic parameter in `test_4::Trait5::bar4`
1137 --> $DIR/trait-to-trait.rs:340:27
1138 |
1139LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
1140 | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait5::bar4`
1141...
1142LL | reuse Trait::foo::<'static, String, false> as bar4 { self.get_self() }
1143 | ---- required by a bound in this associated function
1144
1145error[E0284]: type annotations needed
1146 --> $DIR/trait-to-trait.rs:442:56
1147 |
1148LL | 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 |
1151note: required by a const generic parameter in `test_5::Trait::foo`
1152 --> $DIR/trait-to-trait.rs:434:19
1153 |
1154LL | fn foo<U, const M: bool>(&self) {}
1155 | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
1156
1157error[E0284]: type annotations needed
1158 --> $DIR/trait-to-trait.rs:447:56
1159 |
1160LL | 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 |
1163note: required by a const generic parameter in `test_5::Trait::foo`
1164 --> $DIR/trait-to-trait.rs:434:19
1165 |
1166LL | fn foo<U, const M: bool>(&self) {}
1167 | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
1168
1169error[E0284]: type annotations needed
1170 --> $DIR/trait-to-trait.rs:457:56
1171 |
1172LL | 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 |
1175note: required by a const generic parameter in `test_5::Trait::foo`
1176 --> $DIR/trait-to-trait.rs:434:19
1177 |
1178LL | fn foo<U, const M: bool>(&self) {}
1179 | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
1180
1181error[E0284]: type annotations needed
1182 --> $DIR/trait-to-trait.rs:462:56
1183 |
1184LL | 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 |
1187note: required by a const generic parameter in `test_5::Trait::foo`
1188 --> $DIR/trait-to-trait.rs:434:19
1189 |
1190LL | fn foo<U, const M: bool>(&self) {}
1191 | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
1192
1193error[E0284]: type annotations needed
1194 --> $DIR/trait-to-trait.rs:472:56
1195 |
1196LL | 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 |
1199note: required by a const generic parameter in `test_5::Trait::foo`
1200 --> $DIR/trait-to-trait.rs:434:19
1201 |
1202LL | fn foo<U, const M: bool>(&self) {}
1203 | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
1204
1205error[E0284]: type annotations needed
1206 --> $DIR/trait-to-trait.rs:477:56
1207 |
1208LL | 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 |
1211note: required by a const generic parameter in `test_5::Trait::foo`
1212 --> $DIR/trait-to-trait.rs:434:19
1213 |
1214LL | fn foo<U, const M: bool>(&self) {}
1215 | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
1216
1217error[E0284]: type annotations needed
1218 --> $DIR/trait-to-trait.rs:487:56
1219 |
1220LL | 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 |
1223note: required by a const generic parameter in `test_5::Trait::foo`
1224 --> $DIR/trait-to-trait.rs:434:19
1225 |
1226LL | fn foo<U, const M: bool>(&self) {}
1227 | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
1228
1229error[E0284]: type annotations needed
1230 --> $DIR/trait-to-trait.rs:492:56
1231 |
1232LL | 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 |
1235note: required by a const generic parameter in `test_5::Trait::foo`
1236 --> $DIR/trait-to-trait.rs:434:19
1237 |
1238LL | fn foo<U, const M: bool>(&self) {}
1239 | ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
1240
1241error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied
1242 --> $DIR/trait-to-trait.rs:505:68
1243 |
1244LL | <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 |
1249note: method defined here, with 3 generic parameters: `T`, `U`, `M`
1250 --> $DIR/trait-to-trait.rs:442:63
1251 |
1252LL | trait Trait<'b, 'c, 'a, T>: Sized {
1253 | -
1254LL | fn foo<U, const M: bool>(&self) {}
1255 | - -------------
1256...
1257LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar1 { Self::get() }
1258 | ^^^^
1259help: add missing generic argument
1260 |
1261LL | <u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>::bar1::<String, true, M>(&123);
1262 | +++
1263
1264error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied
1265 --> $DIR/trait-to-trait.rs:507:26
1266 |
1267LL | <u32 as Trait3>::bar1::<String, true>(&123);
1268 | ^^^^ ------ ---- supplied 2 generic arguments
1269 | |
1270 | expected 3 generic arguments
1271 |
1272note: method defined here, with 3 generic parameters: `T`, `U`, `M`
1273 --> $DIR/trait-to-trait.rs:457:63
1274 |
1275LL | trait Trait<'b, 'c, 'a, T>: Sized {
1276 | -
1277LL | fn foo<U, const M: bool>(&self) {}
1278 | - -------------
1279...
1280LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar1 { Self::get() }
1281 | ^^^^
1282help: add missing generic argument
1283 |
1284LL | <u32 as Trait3>::bar1::<String, true, M>(&123);
1285 | +++
1286
1287error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied
1288 --> $DIR/trait-to-trait.rs:509:43
1289 |
1290LL | <u32 as Trait4<'a, 'a, 'static>>::bar1::<String, true>(&123);
1291 | ^^^^ ------ ---- supplied 2 generic arguments
1292 | |
1293 | expected 3 generic arguments
1294 |
1295note: method defined here, with 3 generic parameters: `T`, `U`, `M`
1296 --> $DIR/trait-to-trait.rs:472:63
1297 |
1298LL | trait Trait<'b, 'c, 'a, T>: Sized {
1299 | -
1300LL | fn foo<U, const M: bool>(&self) {}
1301 | - -------------
1302...
1303LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar1 { Self::get() }
1304 | ^^^^
1305help: add missing generic argument
1306 |
1307LL | <u32 as Trait4<'a, 'a, 'static>>::bar1::<String, true, M>(&123);
1308 | +++
1309
1310error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied
1311 --> $DIR/trait-to-trait.rs:511:44
1312 |
1313LL | <u32 as Trait5<i32, u64, String>>::bar1::<String, true>(&123);
1314 | ^^^^ ------ ---- supplied 2 generic arguments
1315 | |
1316 | expected 3 generic arguments
1317 |
1318note: method defined here, with 3 generic parameters: `T`, `U`, `M`
1319 --> $DIR/trait-to-trait.rs:487:63
1320 |
1321LL | trait Trait<'b, 'c, 'a, T>: Sized {
1322 | -
1323LL | fn foo<U, const M: bool>(&self) {}
1324 | - -------------
1325...
1326LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar1 { Self::get() }
1327 | ^^^^
1328help: add missing generic argument
1329 |
1330LL | <u32 as Trait5<i32, u64, String>>::bar1::<String, true, M>(&123);
1331 | +++
1332
1333error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied
1334 --> $DIR/trait-to-trait.rs:519:68
1335 |
1336LL | <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 |
1341note: method defined here, with 3 generic parameters: `T`, `U`, `M`
1342 --> $DIR/trait-to-trait.rs:447:63
1343 |
1344LL | trait Trait<'b, 'c, 'a, T>: Sized {
1345 | -
1346LL | fn foo<U, const M: bool>(&self) {}
1347 | - -------------
1348...
1349LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar3 { self.get_self() }
1350 | ^^^^
1351help: add missing generic argument
1352 |
1353LL | <u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>::bar3::<String, true, M>(&123);
1354 | +++
1355
1356error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied
1357 --> $DIR/trait-to-trait.rs:521:26
1358 |
1359LL | <u32 as Trait3>::bar3::<String, true>(&123);
1360 | ^^^^ ------ ---- supplied 2 generic arguments
1361 | |
1362 | expected 3 generic arguments
1363 |
1364note: method defined here, with 3 generic parameters: `T`, `U`, `M`
1365 --> $DIR/trait-to-trait.rs:462:63
1366 |
1367LL | trait Trait<'b, 'c, 'a, T>: Sized {
1368 | -
1369LL | fn foo<U, const M: bool>(&self) {}
1370 | - -------------
1371...
1372LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar3 { self.get_self() }
1373 | ^^^^
1374help: add missing generic argument
1375 |
1376LL | <u32 as Trait3>::bar3::<String, true, M>(&123);
1377 | +++
1378
1379error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied
1380 --> $DIR/trait-to-trait.rs:523:43
1381 |
1382LL | <u32 as Trait4<'a, 'a, 'static>>::bar3::<String, true>(&123);
1383 | ^^^^ ------ ---- supplied 2 generic arguments
1384 | |
1385 | expected 3 generic arguments
1386 |
1387note: method defined here, with 3 generic parameters: `T`, `U`, `M`
1388 --> $DIR/trait-to-trait.rs:477:63
1389 |
1390LL | trait Trait<'b, 'c, 'a, T>: Sized {
1391 | -
1392LL | fn foo<U, const M: bool>(&self) {}
1393 | - -------------
1394...
1395LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar3 { self.get_self() }
1396 | ^^^^
1397help: add missing generic argument
1398 |
1399LL | <u32 as Trait4<'a, 'a, 'static>>::bar3::<String, true, M>(&123);
1400 | +++
1401
1402error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied
1403 --> $DIR/trait-to-trait.rs:525:44
1404 |
1405LL | <u32 as Trait5<i32, u64, String>>::bar3::<String, true>(&123);
1406 | ^^^^ ------ ---- supplied 2 generic arguments
1407 | |
1408 | expected 3 generic arguments
1409 |
1410note: method defined here, with 3 generic parameters: `T`, `U`, `M`
1411 --> $DIR/trait-to-trait.rs:492:63
1412 |
1413LL | trait Trait<'b, 'c, 'a, T>: Sized {
1414 | -
1415LL | fn foo<U, const M: bool>(&self) {}
1416 | - -------------
1417...
1418LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar3 { self.get_self() }
1419 | ^^^^
1420help: add missing generic argument
1421 |
1422LL | <u32 as Trait5<i32, u64, String>>::bar3::<String, true, M>(&123);
1423 | +++
1424
1425error[E0282]: type annotations needed
1426 --> $DIR/trait-to-trait.rs:581:9
1427 |
1428LL | <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
1431error[E0282]: type annotations needed
1432 --> $DIR/trait-to-trait.rs:640:9
1433 |
1434LL | <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
1437error[E0282]: type annotations needed
1438 --> $DIR/trait-to-trait.rs:765:9
1439 |
1440LL | / <u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>
1441LL | |
1442LL | | ::bar1::<'static, 'static>(&123);
1443 | |______________________________________^ cannot infer type of the type parameter `T` declared on the method `bar1`
1444
1445error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
1446 --> $DIR/trait-to-trait.rs:853:22
1447 |
1448LL | ::bar1::<'static, 'static>(&123);
1449 | ^^^^^^^
1450 |
1451note: the late bound lifetime parameter is introduced here
1452 --> $DIR/trait-to-trait.rs:797:32
1453 |
1454LL | fn foo<'a: 'a, 'b: 'b>(&self) {}
1455 | ^
1456
1457error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
1458 --> $DIR/trait-to-trait.rs:855:33
1459 |
1460LL | <u32 as Trait3>::bar1::<'static, 'static>(&123);
1461 | ^^^^^^^
1462 |
1463note: the late bound lifetime parameter is introduced here
1464 --> $DIR/trait-to-trait.rs:797:32
1465 |
1466LL | fn foo<'a: 'a, 'b: 'b>(&self) {}
1467 | ^
1468
1469error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
1470 --> $DIR/trait-to-trait.rs:857:50
1471 |
1472LL | <u32 as Trait4<'a, 'a, 'static>>::bar1::<'a, 'a>(&123);
1473 | ^^
1474 |
1475note: the late bound lifetime parameter is introduced here
1476 --> $DIR/trait-to-trait.rs:797:32
1477 |
1478LL | fn foo<'a: 'a, 'b: 'b>(&self) {}
1479 | ^
1480
1481error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
1482 --> $DIR/trait-to-trait.rs:859:51
1483 |
1484LL | <u32 as Trait5<i32, u64, String>>::bar1::<'a, 'a>(&123);
1485 | ^^
1486 |
1487note: the late bound lifetime parameter is introduced here
1488 --> $DIR/trait-to-trait.rs:797:32
1489 |
1490LL | fn foo<'a: 'a, 'b: 'b>(&self) {}
1491 | ^
1492
1493error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
1494 --> $DIR/trait-to-trait.rs:868:22
1495 |
1496LL | ::bar3::<'static, 'static>(&123);
1497 | ^^^^^^^
1498 |
1499note: the late bound lifetime parameter is introduced here
1500 --> $DIR/trait-to-trait.rs:797:32
1501 |
1502LL | fn foo<'a: 'a, 'b: 'b>(&self) {}
1503 | ^
1504
1505error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
1506 --> $DIR/trait-to-trait.rs:870:33
1507 |
1508LL | <u32 as Trait3>::bar3::<'static, 'static>(&123);
1509 | ^^^^^^^
1510 |
1511note: the late bound lifetime parameter is introduced here
1512 --> $DIR/trait-to-trait.rs:797:32
1513 |
1514LL | fn foo<'a: 'a, 'b: 'b>(&self) {}
1515 | ^
1516
1517error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
1518 --> $DIR/trait-to-trait.rs:872:50
1519 |
1520LL | <u32 as Trait4<'a, 'a, 'static>>::bar3::<'static, 'static>(&123);
1521 | ^^^^^^^
1522 |
1523note: the late bound lifetime parameter is introduced here
1524 --> $DIR/trait-to-trait.rs:797:32
1525 |
1526LL | fn foo<'a: 'a, 'b: 'b>(&self) {}
1527 | ^
1528
1529error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
1530 --> $DIR/trait-to-trait.rs:874:51
1531 |
1532LL | <u32 as Trait5<i32, u64, String>>::bar3::<'static, 'static>(&123);
1533 | ^^^^^^^
1534 |
1535note: the late bound lifetime parameter is introduced here
1536 --> $DIR/trait-to-trait.rs:797:32
1537 |
1538LL | fn foo<'a: 'a, 'b: 'b>(&self) {}
1539 | ^
1540
1541error: aborting due to 99 previous errors
1542
1543Some errors have detailed explanations: E0107, E0282, E0284, E0794.
1544For 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
2525impl Trait for S {
2626 reuse <F as Trait>::bar {
2727 #[allow(unused_imports)]
28 use self::to_reuse::{foo, inner::self};
28 use self::to_reuse::{foo, inner::{self}};
2929 let x = foo(12);
3030 assert_eq!(x, 12);
3131 &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]
9trait MyTrait {}
10
11struct TestType<T>(::std::marker::PhantomData<T>);
12
13unsafe impl<T: MyTrait + 'static> Send for TestType<T> {}
14
15impl<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
19unsafe impl<T: 'static> Send for TestType<T> {} //~ ERROR conflicting implementations
20
21impl !Send for TestType<i32> {}
22//~^ ERROR `!Send` impls cannot be specialized
23
24fn main() {}
tests/ui/diagnostics-infra/primary-fluent-bundle-missing.stderr deleted-47
......@@ -1,47 +0,0 @@
1error[E0751]: found both positive and negative implementation of trait `Send` for type `TestType<_>`:
2 --> $DIR/primary-fluent-bundle-missing.rs:15:1
3 |
4LL | unsafe impl<T: MyTrait + 'static> Send for TestType<T> {}
5 | ------------------------------------------------------ positive implementation here
6LL |
7LL | impl<T: MyTrait> !Send for TestType<T> {}
8 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ negative implementation here
9
10error[E0119]: conflicting implementations of trait `Send` for type `TestType<_>`
11 --> $DIR/primary-fluent-bundle-missing.rs:19:1
12 |
13LL | unsafe impl<T: MyTrait + 'static> Send for TestType<T> {}
14 | ------------------------------------------------------ first implementation here
15...
16LL | unsafe impl<T: 'static> Send for TestType<T> {}
17 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `TestType<_>`
18
19error[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 |
22LL | impl<T: MyTrait> !Send for TestType<T> {}
23 | ^^^^^^^
24 |
25note: the implementor must specify the same requirement
26 --> $DIR/primary-fluent-bundle-missing.rs:11:1
27 |
28LL | struct TestType<T>(::std::marker::PhantomData<T>);
29 | ^^^^^^^^^^^^^^^^^^
30
31error[E0366]: `!Send` impls cannot be specialized
32 --> $DIR/primary-fluent-bundle-missing.rs:21:1
33 |
34LL | impl !Send for TestType<i32> {}
35 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
36 |
37 = note: `i32` is not a generic parameter
38note: 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 |
41LL | struct TestType<T>(::std::marker::PhantomData<T>);
42 | ^^^^^^^^^^^^^^^^^^
43
44error: aborting due to 4 previous errors
45
46Some errors have detailed explanations: E0119, E0366, E0367, E0751.
47For 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 {}
22
33macro_rules! m {
44 () => {
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
76 use a::$crate::b; //~ ERROR: `$crate` in paths can only be used in start position
87 //~^ NOTE: can only be used in path start position
98 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 @@
1error[E0433]: `$crate` in paths can only be used in start position
2 --> $DIR/dollar-crate-is-keyword-2.rs:7:16
1error: `$crate` in paths can only be used in start position
2 --> $DIR/dollar-crate-is-keyword-2.rs:5:16
33 |
4LL | use a::$crate::b;
5 | ^^^^^^ can only be used in path start position
4LL | use a::$crate;
5 | ^^^^^^
66...
77LL | m!();
88 | ---- in this macro invocation
99 |
1010 = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
1111
12error[E0432]: unresolved import `a::$crate`
13 --> $DIR/dollar-crate-is-keyword-2.rs:5:13
12error[E0433]: `$crate` in paths can only be used in start position
13 --> $DIR/dollar-crate-is-keyword-2.rs:6:16
1414 |
15LL | use a::$crate;
16 | ^^^^^^^^^ no `$crate` in `a`
15LL | use a::$crate::b;
16 | ^^^^^^ can only be used in path start position
1717...
1818LL | m!();
1919 | ---- in this macro invocation
......@@ -21,7 +21,7 @@ LL | m!();
2121 = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
2222
2323error[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
2525 |
2626LL | type A = a::$crate;
2727 | ^^^^^^ can only be used in path start position
......@@ -33,5 +33,4 @@ LL | m!();
3333
3434error: aborting due to 3 previous errors
3535
36Some errors have detailed explanations: E0432, E0433.
37For more information about an error, try `rustc --explain E0432`.
36For 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 {
66 struct $crate {} //~ ERROR expected identifier, found reserved identifier `$crate`
77 }
88
9 use $crate; //~ ERROR `$crate` may not be imported
9 use $crate; //~ ERROR imports need to be explicitly named
1010 use $crate as $crate; //~ ERROR expected identifier, found reserved identifier `$crate`
11 //~^ ERROR `$crate` may not be imported
1211 }
1312}
1413
tests/ui/dollar-crate/dollar-crate-is-keyword.stderr+7-14
......@@ -20,27 +20,20 @@ LL | m!();
2020 |
2121 = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
2222
23error: `$crate` may not be imported
24 --> $DIR/dollar-crate-is-keyword.rs:9:9
23error: imports need to be explicitly named
24 --> $DIR/dollar-crate-is-keyword.rs:9:13
2525 |
2626LL | use $crate;
27 | ^^^^^^^^^^^
27 | ^^^^^^
2828...
2929LL | m!();
3030 | ---- in this macro invocation
3131 |
3232 = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
33
34error: `$crate` may not be imported
35 --> $DIR/dollar-crate-is-keyword.rs:10:9
33help: try renaming it with a name
3634 |
37LL | use $crate as $crate;
38 | ^^^^^^^^^^^^^^^^^^^^^
39...
40LL | 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)
35LL | use $crate as name;
36 | +++++++
4437
45error: aborting due to 4 previous errors
38error: aborting due to 3 previous errors
4639
tests/ui/error-codes/E0430.rs+1-2
......@@ -1,5 +1,4 @@
1use std::fmt::{self, self}; //~ ERROR E0430
2 //~^ ERROR E0252
1use std::fmt::{self, self}; //~ ERROR the name `fmt` is defined multiple times
32
43fn main () {
54}
tests/ui/error-codes/E0430.stderr+2-11
......@@ -1,11 +1,3 @@
1error[E0430]: `self` import can only appear once in an import list
2 --> $DIR/E0430.rs:1:16
3 |
4LL | use std::fmt::{self, self};
5 | ^^^^ ---- another `self` import appears here
6 | |
7 | can only appear once in an import list
8
91error[E0252]: the name `fmt` is defined multiple times
102 --> $DIR/E0430.rs:1:22
113 |
......@@ -16,7 +8,6 @@ LL | use std::fmt::{self, self};
168 |
179 = note: `fmt` must be defined only once in the type namespace of this module
1810
19error: aborting due to 2 previous errors
11error: aborting due to 1 previous error
2012
21Some errors have detailed explanations: E0252, E0430.
22For more information about an error, try `rustc --explain E0252`.
13For more information about this error, try `rustc --explain E0252`.
tests/ui/error-codes/E0431.rs+1-1
......@@ -1,4 +1,4 @@
1use {self}; //~ ERROR E0431
1use {self}; //~ ERROR imports need to be explicitly named
22
33fn main () {
44}
tests/ui/error-codes/E0431.stderr+7-3
......@@ -1,9 +1,13 @@
1error[E0431]: `self` import can only appear in an import list with a non-empty prefix
1error: imports need to be explicitly named
22 --> $DIR/E0431.rs:1:6
33 |
44LL | use {self};
5 | ^^^^ can only appear in an import list with a non-empty prefix
5 | ^^^^
6 |
7help: try renaming it with a name
8 |
9LL | use {self as name};
10 | +++++++
611
712error: aborting due to 1 previous error
813
9For more information about this error, try `rustc --explain E0431`.
tests/ui/imports/import-crate-var.rs+1-1
......@@ -4,5 +4,5 @@
44
55fn main() {
66 m!();
7 //~^ ERROR `$crate` may not be imported
7 //~^ ERROR imports need to be explicitly named
88}
tests/ui/imports/import-crate-var.stderr+6-1
......@@ -1,10 +1,15 @@
1error: `$crate` may not be imported
1error: imports need to be explicitly named
22 --> $DIR/import-crate-var.rs:6:5
33 |
44LL | m!();
55 | ^^^^
66 |
77 = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
8help: try renaming it with a name
9 --> $DIR/auxiliary/import_crate_var.rs:5:15
10 |
11LL | use $crate as name;
12 | +++++++
813
914error: aborting due to 1 previous error
1015
tests/ui/imports/issue-47623.rs+1-1
......@@ -1,3 +1,3 @@
1use self; //~ERROR `self` imports are only allowed within a { } list
1use self; //~ERROR imports need to be explicitly named
22
33fn main() {}
tests/ui/imports/issue-47623.stderr+1-2
......@@ -1,4 +1,4 @@
1error[E0429]: `self` imports are only allowed within a { } list
1error: imports need to be explicitly named
22 --> $DIR/issue-47623.rs:1:5
33 |
44LL | use self;
......@@ -6,4 +6,3 @@ LL | use self;
66
77error: aborting due to 1 previous error
88
9For 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
31#![feature(negative_impls)]
42#![feature(marker_trait_attr)]
53
tests/ui/marker_trait_attr/conflicting-send-impls-for-marker-trait-106755.stderr+6-6
......@@ -1,5 +1,5 @@
11error[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
33 |
44LL | unsafe impl<T: MyTrait + 'static> Send for TestType<T> {}
55 | ------------------------------------------------------ positive implementation here
......@@ -8,7 +8,7 @@ LL | impl<T: MyTrait> !Send for TestType<T> {}
88 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ negative implementation here
99
1010error[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
1212 |
1313LL | unsafe impl<T: MyTrait + 'static> Send for TestType<T> {}
1414 | ------------------------------------------------------ first implementation here
......@@ -17,26 +17,26 @@ LL | unsafe impl<T: 'static> Send for TestType<T> {}
1717 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `TestType<_>`
1818
1919error[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
2121 |
2222LL | impl<T: MyTrait> !Send for TestType<T> {}
2323 | ^^^^^^^
2424 |
2525note: 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
2727 |
2828LL | struct TestType<T>(::std::marker::PhantomData<T>);
2929 | ^^^^^^^^^^^^^^^^^^
3030
3131error[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
3333 |
3434LL | impl !Send for TestType<i32> {}
3535 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3636 |
3737 = note: `i32` is not a generic parameter
3838note: 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
4040 |
4141LL | struct TestType<T>(::std::marker::PhantomData<T>);
4242 | ^^^^^^^^^^^^^^^^^^
tests/ui/rfcs/rfc-2126-extern-absolute-paths/single-segment.rs+1-1
......@@ -2,7 +2,7 @@
22//@ compile-flags:--extern xcrate
33//@ edition:2018
44
5use crate; //~ ERROR crate root imports need to be explicitly named: `use crate as name;`
5use crate; //~ ERROR imports need to be explicitly named
66use *; //~ ERROR cannot glob-import all possible crates
77
88fn main() {
tests/ui/rfcs/rfc-2126-extern-absolute-paths/single-segment.stderr+6-1
......@@ -1,8 +1,13 @@
1error: crate root imports need to be explicitly named: `use crate as name;`
1error: imports need to be explicitly named
22 --> $DIR/single-segment.rs:5:5
33 |
44LL | use crate;
55 | ^^^^^
6 |
7help: try renaming it with a name
8 |
9LL | use crate as name;
10 | +++++++
611
712error: cannot glob-import all possible crates
813 --> $DIR/single-segment.rs:6:5
tests/ui/rfcs/rfc-2294-if-let-guard/warns.rs-2
......@@ -1,5 +1,4 @@
11#[deny(irrefutable_let_patterns)]
2
32fn irrefutable_let_guard() {
43 match Some(()) {
54 Some(x) if let () = x => {}
......@@ -21,7 +20,6 @@ fn trailing_irrefutable_pattern_binding() {
2120fn trailing_irrefutable_in_let_chain() {
2221 match Some(5) {
2322 Some(x) if let Some(y) = Some(x) && let z = 0 => {}
24 //~^ ERROR trailing irrefutable pattern in let chain
2523 _ => {}
2624 }
2725}
tests/ui/rfcs/rfc-2294-if-let-guard/warns.stderr+6-20
......@@ -1,5 +1,5 @@
11error: irrefutable `if let` guard pattern
2 --> $DIR/warns.rs:5:20
2 --> $DIR/warns.rs:4:20
33 |
44LL | Some(x) if let () = x => {}
55 | ^^^^^^^^^^
......@@ -13,7 +13,7 @@ LL | #[deny(irrefutable_let_patterns)]
1313 | ^^^^^^^^^^^^^^^^^^^^^^^^
1414
1515error: irrefutable `if let` guard pattern
16 --> $DIR/warns.rs:14:14
16 --> $DIR/warns.rs:13:14
1717 |
1818LL | o if let x = 0 => {}
1919 | ^^^^^^^^^
......@@ -21,27 +21,13 @@ LL | o if let x = 0 => {}
2121 = note: this pattern will always match, so the guard is useless
2222 = help: consider removing the guard and adding a `let` inside the match arm
2323note: the lint level is defined here
24 --> $DIR/warns.rs:11:8
25 |
26LL | #[deny(irrefutable_let_patterns)]
27 | ^^^^^^^^^^^^^^^^^^^^^^^^
28
29error: trailing irrefutable pattern in let chain
30 --> $DIR/warns.rs:23:45
31 |
32LL | 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
37note: the lint level is defined here
38 --> $DIR/warns.rs:20:8
24 --> $DIR/warns.rs:10:8
3925 |
4026LL | #[deny(irrefutable_let_patterns)]
4127 | ^^^^^^^^^^^^^^^^^^^^^^^^
4228
4329error: unreachable pattern
44 --> $DIR/warns.rs:32:25
30 --> $DIR/warns.rs:30:25
4531 |
4632LL | x if let None | None = x => {}
4733 | ---- ^^^^ no value can reach this
......@@ -49,10 +35,10 @@ LL | x if let None | None = x => {}
4935 | matches all the relevant values
5036 |
5137note: the lint level is defined here
52 --> $DIR/warns.rs:29:8
38 --> $DIR/warns.rs:27:8
5339 |
5440LL | #[deny(unreachable_patterns)]
5541 | ^^^^^^^^^^^^^^^^^^^^
5642
57error: aborting due to 4 previous errors
43error: aborting due to 3 previous errors
5844
tests/ui/rfcs/rfc-2497-if-let-chains/irrefutable-lets.disallowed.stderr deleted-133
......@@ -1,133 +0,0 @@
1error: leading irrefutable pattern in let chain
2 --> $DIR/irrefutable-lets.rs:13:8
3 |
4LL | 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
9note: the lint level is defined here
10 --> $DIR/irrefutable-lets.rs:6:30
11 |
12LL | #![cfg_attr(disallowed, deny(irrefutable_let_patterns))]
13 | ^^^^^^^^^^^^^^^^^^^^^^^^
14
15error: irrefutable `if let` patterns
16 --> $DIR/irrefutable-lets.rs:19:8
17 |
18LL | 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
24error: leading irrefutable pattern in let chain
25 --> $DIR/irrefutable-lets.rs:22:8
26 |
27LL | 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
33error: trailing irrefutable pattern in let chain
34 --> $DIR/irrefutable-lets.rs:22:83
35 |
36LL | 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
42error: trailing irrefutable patterns in let chain
43 --> $DIR/irrefutable-lets.rs:26:37
44 |
45LL | 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
51error: leading irrefutable pattern in let chain
52 --> $DIR/irrefutable-lets.rs:29:8
53 |
54LL | 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
60error: leading irrefutable pattern in let chain
61 --> $DIR/irrefutable-lets.rs:32:8
62 |
63LL | 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
69error: leading irrefutable pattern in let chain
70 --> $DIR/irrefutable-lets.rs:35:8
71 |
72LL | 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
78error: irrefutable `if let` guard patterns
79 --> $DIR/irrefutable-lets.rs:44:28
80 |
81LL | 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
87error: trailing irrefutable patterns in let chain
88 --> $DIR/irrefutable-lets.rs:59:16
89 |
90LL | && 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
96error: irrefutable `while let` patterns
97 --> $DIR/irrefutable-lets.rs:68:11
98 |
99LL | 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
105error: trailing irrefutable patterns in let chain
106 --> $DIR/irrefutable-lets.rs:71:40
107 |
108LL | 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
114error: trailing irrefutable pattern in let chain
115 --> $DIR/irrefutable-lets.rs:87:12
116 |
117LL | && let x = &opt
118 | ^^^^^^^^^^^^
119 |
120 = note: this pattern will always match
121 = help: consider moving it into the body
122
123error: leading irrefutable pattern in let chain
124 --> $DIR/irrefutable-lets.rs:93:12
125 |
126LL | 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
132error: 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
32//@ edition: 2024
43
5#![cfg_attr(allowed, allow(irrefutable_let_patterns))]
6#![cfg_attr(disallowed, deny(irrefutable_let_patterns))]
7
84use std::ops::Range;
95
106fn main() {
117 let opt = Some(None..Some(1));
128
139 if let first = &opt && let Some(second) = first && let None = second.start {}
14 //[disallowed]~^ ERROR leading irrefutable pattern in let chain
1510
1611 // No lint as the irrefutable pattern is surrounded by other stuff
1712 if 4 * 2 == 0 && let first = &opt && let Some(second) = first && let None = second.start {}
1813
1914 if let first = &opt && let (a, b) = (1, 2) {}
20 //[disallowed]~^ ERROR irrefutable `if let` patterns
2115
2216 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
2517
2618 if let Some(ref first) = opt && let second = first && let _third = second {}
27 //[disallowed]~^ ERROR trailing irrefutable patterns in let chain
2819
2920 if let Range { start: local_start, end: _ } = (None..Some(1)) && let None = local_start {}
30 //[disallowed]~^ ERROR leading irrefutable pattern in let chain
3121
3222 if let (a, b, c) = (Some(1), Some(1), Some(1)) && let None = Some(1) {}
33 //[disallowed]~^ ERROR leading irrefutable pattern in let chain
3423
3524 if let first = &opt && let None = Some(1) {}
36 //[disallowed]~^ ERROR leading irrefutable pattern in let chain
3725
3826 if let Some(ref first) = opt
3927 && let Range { start: local_start, end: _ } = first
......@@ -42,7 +30,6 @@ fn main() {
4230
4331 match opt {
4432 Some(ref first) if let second = first && let _third = second && let v = 4 + 4 => {},
45 //[disallowed]~^ ERROR irrefutable `if let` guard patterns
4633 _ => {}
4734 }
4835
......@@ -57,7 +44,6 @@ fn main() {
5744 match opt {
5845 Some(ref first) if let Range { start: Some(_), end: local_end } = first
5946 && let v = local_end && let w = v => {},
60 //[disallowed]~^ ERROR trailing irrefutable patterns in let chain
6147 _ => {}
6248 }
6349
......@@ -66,15 +52,13 @@ fn main() {
6652 while let first = &opt && let Some(second) = first && let None = second.start {}
6753
6854 while let first = &opt && let (a, b) = (1, 2) {}
69 //[disallowed]~^ ERROR irrefutable `while let` patterns
7055
7156 while let Some(ref first) = opt && let second = first && let _third = second {}
72 //[disallowed]~^ ERROR trailing irrefutable patterns in let chain
7357
7458 while let Some(ref first) = opt
7559 && let Range { start: local_start, end: _ } = first
76 && let None = local_start {
77 }
60 && let None = local_start
61 {}
7862
7963 // No error. An extra nesting level would be required for the `else if`.
8064 if opt == Some(None..None) {
......@@ -85,13 +69,11 @@ fn main() {
8569 if opt == Some(None..None) {
8670 } else if opt.is_some()
8771 && let x = &opt
88 //[disallowed]~^ ERROR trailing irrefutable pattern in let chain
8972 {}
9073
9174 if opt == Some(None..None) {
9275 } else {
9376 if let x = opt.clone().map(|_| 1)
94 //[disallowed]~^ ERROR leading irrefutable pattern in let chain
9577 && x == Some(1)
9678 {}
9779 }
tests/ui/use/use-crate-self.rs+1-1
......@@ -1,4 +1,4 @@
11use crate::{self};
2 //~^ ERROR crate root imports need to be explicitly named: `use crate as name;`
2 //~^ ERROR imports need to be explicitly named
33
44fn main() {}
tests/ui/use/use-crate-self.stderr+6-1
......@@ -1,8 +1,13 @@
1error: crate root imports need to be explicitly named: `use crate as name;`
1error: imports need to be explicitly named
22 --> $DIR/use-crate-self.rs:1:13
33 |
44LL | use crate::{self};
55 | ^^^^
6 |
7help: try renaming it with a name
8 |
9LL | use crate::{self as name};
10 | +++++++
611
712error: aborting due to 1 previous error
813
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
32
43mod a {
54 mod b {
65 use self as A;
7 //~^ ERROR `self` imports are only allowed within a { } list
86 use super as B;
9 //~^ ERROR unresolved import `super` [E0432]
10 //~| NOTE no `super` in the root
117 use super::{self as C};
12 //~^ ERROR unresolved import `super` [E0432]
13 //~| NOTE no `super` in the root
148 }
159}
1610
tests/ui/use/use-keyword.stderr deleted-22
......@@ -1,22 +0,0 @@
1error[E0429]: `self` imports are only allowed within a { } list
2 --> $DIR/use-keyword.rs:6:13
3 |
4LL | use self as A;
5 | ^^^^
6
7error[E0432]: unresolved import `super`
8 --> $DIR/use-keyword.rs:8:13
9 |
10LL | use super as B;
11 | ^^^^^^^^^^ no `super` in the root
12
13error[E0432]: unresolved import `super`
14 --> $DIR/use-keyword.rs:11:21
15 |
16LL | use super::{self as C};
17 | ^^^^^^^^^ no `super` in the root
18
19error: aborting due to 3 previous errors
20
21Some errors have detailed explanations: E0429, E0432.
22For more information about an error, try `rustc --explain E0429`.
tests/ui/use/use-mod/use-mod-2.rs+2-4
......@@ -1,11 +1,9 @@
11mod foo {
22 use self::{self};
3 //~^ ERROR unresolved import `self` [E0432]
4 //~| NOTE no `self` in the root
3 //~^ ERROR imports need to be explicitly named
54
65 use super::{self};
7 //~^ ERROR unresolved import `super` [E0432]
8 //~| NOTE no `super` in the root
6 //~^ ERROR imports need to be explicitly named
97}
108
119fn main() {}
tests/ui/use/use-mod/use-mod-2.stderr+15-6
......@@ -1,15 +1,24 @@
1error[E0432]: unresolved import `self`
1error: imports need to be explicitly named
22 --> $DIR/use-mod-2.rs:2:16
33 |
44LL | use self::{self};
5 | ^^^^ no `self` in the root
5 | ^^^^
6 |
7help: try renaming it with a name
8 |
9LL | use self::{self as name};
10 | +++++++
611
7error[E0432]: unresolved import `super`
8 --> $DIR/use-mod-2.rs:6:17
12error: imports need to be explicitly named
13 --> $DIR/use-mod-2.rs:5:17
914 |
1015LL | use super::{self};
11 | ^^^^ no `super` in the root
16 | ^^^^
17 |
18help: try renaming it with a name
19 |
20LL | use super::{self as name};
21 | +++++++
1222
1323error: aborting due to 2 previous errors
1424
15For more information about this error, try `rustc --explain E0432`.
tests/ui/use/use-mod/use-mod.rs+1-2
......@@ -1,13 +1,12 @@
11use foo::bar::{
22 self,
3//~^ ERROR `self` import can only appear once in an import list
43 Bar,
54 self
65//~^ ERROR the name `bar` is defined multiple times
76};
87
98use {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
1110
1211mod foo {
1312 pub mod bar {
tests/ui/use/use-mod/use-mod.stderr+12-17
......@@ -1,24 +1,20 @@
1error[E0430]: `self` import can only appear once in an import list
2 --> $DIR/use-mod.rs:2:5
3 |
4LL | self,
5 | ^^^^ can only appear once in an import list
6...
7LL | self
8 | ---- another `self` import appears here
9
10error[E0431]: `self` import can only appear in an import list with a non-empty prefix
11 --> $DIR/use-mod.rs:9:6
1error: imports need to be explicitly named
2 --> $DIR/use-mod.rs:8:6
123 |
134LL | use {self};
14 | ^^^^ can only appear in an import list with a non-empty prefix
5 | ^^^^
6 |
7help: try renaming it with a name
8 |
9LL | use {self as name};
10 | +++++++
1511
1612error[E0252]: the name `bar` is defined multiple times
17 --> $DIR/use-mod.rs:5:5
13 --> $DIR/use-mod.rs:4:5
1814 |
1915LL | self,
2016 | ---- previous import of the module `bar` here
21...
17LL | Bar,
2218LL | self
2319 | ^^^^
2420 | |
......@@ -27,7 +23,6 @@ LL | self
2723 |
2824 = note: `bar` must be defined only once in the type namespace of this module
2925
30error: aborting due to 3 previous errors
26error: aborting due to 2 previous errors
3127
32Some errors have detailed explanations: E0252, E0430, E0431.
33For more information about an error, try `rustc --explain E0252`.
28For more information about this error, try `rustc --explain E0252`.
tests/ui/use/use-path-segment-kw.e2015.stderr created+1199
......@@ -0,0 +1,1199 @@
1error: imports need to be explicitly named
2 --> $DIR/use-path-segment-kw.rs:97:13
3 |
4LL | use crate;
5 | ^^^^^
6 |
7help: try renaming it with a name
8 |
9LL | use crate as name;
10 | +++++++
11
12error: `crate` in paths can only be used in start position
13 --> $DIR/use-path-segment-kw.rs:101:15
14 |
15LL | use ::crate;
16 | ^^^^^
17
18error: `crate` in paths can only be used in start position
19 --> $DIR/use-path-segment-kw.rs:102:15
20 |
21LL | use ::crate as _crate2;
22 | ^^^^^
23
24error: `crate` in paths can only be used in start position
25 --> $DIR/use-path-segment-kw.rs:103:16
26 |
27LL | use ::{crate};
28 | ^^^^^
29
30error: `crate` in paths can only be used in start position
31 --> $DIR/use-path-segment-kw.rs:104:16
32 |
33LL | use ::{crate as _nested_crate2};
34 | ^^^^^
35
36error: `crate` in paths can only be used in start position
37 --> $DIR/use-path-segment-kw.rs:107:21
38 |
39LL | use foobar::crate;
40 | ^^^^^
41
42error: `crate` in paths can only be used in start position
43 --> $DIR/use-path-segment-kw.rs:108:21
44 |
45LL | use foobar::crate as _crate3;
46 | ^^^^^
47
48error: `crate` in paths can only be used in start position
49 --> $DIR/use-path-segment-kw.rs:109:22
50 |
51LL | use foobar::{crate};
52 | ^^^^^
53
54error: `crate` in paths can only be used in start position
55 --> $DIR/use-path-segment-kw.rs:110:22
56 |
57LL | use foobar::{crate as _nested_crate3};
58 | ^^^^^
59
60error: `crate` in paths can only be used in start position
61 --> $DIR/use-path-segment-kw.rs:113:20
62 |
63LL | use crate::crate;
64 | ^^^^^
65
66error: `crate` in paths can only be used in start position
67 --> $DIR/use-path-segment-kw.rs:114:20
68 |
69LL | use crate::crate as _crate4;
70 | ^^^^^
71
72error: `crate` in paths can only be used in start position
73 --> $DIR/use-path-segment-kw.rs:115:21
74 |
75LL | use crate::{crate};
76 | ^^^^^
77
78error: `crate` in paths can only be used in start position
79 --> $DIR/use-path-segment-kw.rs:116:21
80 |
81LL | use crate::{crate as _nested_crate4};
82 | ^^^^^
83
84error: `crate` in paths can only be used in start position
85 --> $DIR/use-path-segment-kw.rs:119:20
86 |
87LL | use super::crate;
88 | ^^^^^
89
90error: `crate` in paths can only be used in start position
91 --> $DIR/use-path-segment-kw.rs:120:20
92 |
93LL | use super::crate as _crate5;
94 | ^^^^^
95
96error: `crate` in paths can only be used in start position
97 --> $DIR/use-path-segment-kw.rs:121:21
98 |
99LL | use super::{crate};
100 | ^^^^^
101
102error: `crate` in paths can only be used in start position
103 --> $DIR/use-path-segment-kw.rs:122:21
104 |
105LL | use super::{crate as _nested_crate5};
106 | ^^^^^
107
108error: `crate` in paths can only be used in start position
109 --> $DIR/use-path-segment-kw.rs:125:19
110 |
111LL | use self::crate;
112 | ^^^^^
113
114error: `crate` in paths can only be used in start position
115 --> $DIR/use-path-segment-kw.rs:126:19
116 |
117LL | use self::crate as _crate6;
118 | ^^^^^
119
120error: `crate` in paths can only be used in start position
121 --> $DIR/use-path-segment-kw.rs:127:20
122 |
123LL | use self::{crate};
124 | ^^^^^
125
126error: `crate` in paths can only be used in start position
127 --> $DIR/use-path-segment-kw.rs:128:20
128 |
129LL | use self::{crate as _nested_crate6};
130 | ^^^^^
131
132error: imports need to be explicitly named
133 --> $DIR/use-path-segment-kw.rs:135:13
134 |
135LL | use super;
136 | ^^^^^
137 |
138help: try renaming it with a name
139 |
140LL | use super as name;
141 | +++++++
142
143error: `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 |
146LL | use ::super;
147 | ^^^^^
148
149error: `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 |
152LL | use ::super as _super2;
153 | ^^^^^
154
155error: `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 |
158LL | use ::{super};
159 | ^^^^^
160
161error: `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 |
164LL | ... use ::{super as _nested_super2};
165 | ^^^^^
166
167error: `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 |
170LL | use foobar::super;
171 | ^^^^^
172
173error: `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 |
176LL | ... use foobar::super as _super3;
177 | ^^^^^
178
179error: `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 |
182LL | use foobar::{super};
183 | ^^^^^
184
185error: `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 |
188LL | ... use foobar::{super as _nested_super3};
189 | ^^^^^
190
191error: `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 |
194LL | use crate::super;
195 | ^^^^^
196
197error: `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 |
200LL | ... use crate::super as _super4;
201 | ^^^^^
202
203error: `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 |
206LL | use crate::{super};
207 | ^^^^^
208
209error: `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 |
212LL | ... use crate::{super as _nested_super4};
213 | ^^^^^
214
215error: imports need to be explicitly named
216 --> $DIR/use-path-segment-kw.rs:157:20
217 |
218LL | use super::super;
219 | ^^^^^
220 |
221help: try renaming it with a name
222 |
223LL | use super::super as name;
224 | +++++++
225
226error: imports need to be explicitly named
227 --> $DIR/use-path-segment-kw.rs:159:21
228 |
229LL | use super::{super};
230 | ^^^^^
231 |
232help: try renaming it with a name
233 |
234LL | use super::{super as name};
235 | +++++++
236
237error: imports need to be explicitly named
238 --> $DIR/use-path-segment-kw.rs:163:19
239 |
240LL | use self::super;
241 | ^^^^^
242 |
243help: try renaming it with a name
244 |
245LL | use self::super as name;
246 | +++++++
247
248error: imports need to be explicitly named
249 --> $DIR/use-path-segment-kw.rs:165:20
250 |
251LL | use self::{super};
252 | ^^^^^
253 |
254help: try renaming it with a name
255 |
256LL | use self::{super as name};
257 | +++++++
258
259error: imports need to be explicitly named
260 --> $DIR/use-path-segment-kw.rs:173:13
261 |
262LL | use self;
263 | ^^^^
264
265error[E0429]: `self` imports are only allowed within a { } list
266 --> $DIR/use-path-segment-kw.rs:177:13
267 |
268LL | use ::self;
269 | ^^^^^^
270
271error: imports need to be explicitly named
272 --> $DIR/use-path-segment-kw.rs:177:15
273 |
274LL | use ::self;
275 | ^^^^
276
277error[E0429]: `self` imports are only allowed within a { } list
278 --> $DIR/use-path-segment-kw.rs:180:13
279 |
280LL | use ::self as _self2;
281 | ^^^^^^
282
283error: imports need to be explicitly named
284 --> $DIR/use-path-segment-kw.rs:182:16
285 |
286LL | use ::{self};
287 | ^^^^
288 |
289help: try renaming it with a name
290 |
291LL | use ::{self as name};
292 | +++++++
293
294error[E0429]: `self` imports are only allowed within a { } list
295 --> $DIR/use-path-segment-kw.rs:187:28
296 |
297LL | pub use foobar::qux::self;
298 | ^^^^^^
299 |
300help: consider importing the module directly
301 |
302LL - pub use foobar::qux::self;
303LL + pub use foobar::qux;
304 |
305help: alternatively, use the multi-path `use` syntax to import `self`
306 |
307LL | pub use foobar::qux::{self};
308 | + +
309
310error[E0429]: `self` imports are only allowed within a { } list
311 --> $DIR/use-path-segment-kw.rs:189:23
312 |
313LL | pub use foobar::self as _self3;
314 | ^^^^^^
315 |
316help: consider importing the module directly
317 |
318LL - pub use foobar::self as _self3;
319LL + pub use foobar as _self3;
320 |
321help: alternatively, use the multi-path `use` syntax to import `self`
322 |
323LL | pub use foobar::{self as _self3};
324 | + +
325
326error[E0429]: `self` imports are only allowed within a { } list
327 --> $DIR/use-path-segment-kw.rs:195:18
328 |
329LL | use crate::self;
330 | ^^^^^^
331 |
332help: consider importing the module directly
333 |
334LL - use crate::self;
335LL + use crate;
336 |
337help: alternatively, use the multi-path `use` syntax to import `self`
338 |
339LL | use crate::{self};
340 | + +
341
342error: imports need to be explicitly named
343 --> $DIR/use-path-segment-kw.rs:195:20
344 |
345LL | use crate::self;
346 | ^^^^
347
348error[E0429]: `self` imports are only allowed within a { } list
349 --> $DIR/use-path-segment-kw.rs:197:22
350 |
351LL | pub use crate::self as _self4;
352 | ^^^^^^
353 |
354help: consider importing the module directly
355 |
356LL - pub use crate::self as _self4;
357LL + pub use crate as _self4;
358 |
359help: alternatively, use the multi-path `use` syntax to import `self`
360 |
361LL | pub use crate::{self as _self4};
362 | + +
363
364error: imports need to be explicitly named
365 --> $DIR/use-path-segment-kw.rs:198:21
366 |
367LL | use crate::{self};
368 | ^^^^
369 |
370help: try renaming it with a name
371 |
372LL | use crate::{self as name};
373 | +++++++
374
375error[E0429]: `self` imports are only allowed within a { } list
376 --> $DIR/use-path-segment-kw.rs:202:18
377 |
378LL | use super::self;
379 | ^^^^^^
380 |
381help: consider importing the module directly
382 |
383LL - use super::self;
384LL + use super;
385 |
386help: alternatively, use the multi-path `use` syntax to import `self`
387 |
388LL | use super::{self};
389 | + +
390
391error: imports need to be explicitly named
392 --> $DIR/use-path-segment-kw.rs:202:20
393 |
394LL | use super::self;
395 | ^^^^
396
397error[E0429]: `self` imports are only allowed within a { } list
398 --> $DIR/use-path-segment-kw.rs:204:22
399 |
400LL | pub use super::self as _self5;
401 | ^^^^^^
402 |
403help: consider importing the module directly
404 |
405LL - pub use super::self as _self5;
406LL + pub use super as _self5;
407 |
408help: alternatively, use the multi-path `use` syntax to import `self`
409 |
410LL | pub use super::{self as _self5};
411 | + +
412
413error: imports need to be explicitly named
414 --> $DIR/use-path-segment-kw.rs:205:21
415 |
416LL | use super::{self};
417 | ^^^^
418 |
419help: try renaming it with a name
420 |
421LL | use super::{self as name};
422 | +++++++
423
424error[E0429]: `self` imports are only allowed within a { } list
425 --> $DIR/use-path-segment-kw.rs:209:17
426 |
427LL | use self::self;
428 | ^^^^^^
429 |
430help: consider importing the module directly
431 |
432LL - use self::self;
433LL + use self;
434 |
435help: alternatively, use the multi-path `use` syntax to import `self`
436 |
437LL | use self::{self};
438 | + +
439
440error: imports need to be explicitly named
441 --> $DIR/use-path-segment-kw.rs:209:19
442 |
443LL | use self::self;
444 | ^^^^
445
446error[E0429]: `self` imports are only allowed within a { } list
447 --> $DIR/use-path-segment-kw.rs:211:21
448 |
449LL | pub use self::self as _self6;
450 | ^^^^^^
451 |
452help: consider importing the module directly
453 |
454LL - pub use self::self as _self6;
455LL + pub use self as _self6;
456 |
457help: alternatively, use the multi-path `use` syntax to import `self`
458 |
459LL | pub use self::{self as _self6};
460 | + +
461
462error: imports need to be explicitly named
463 --> $DIR/use-path-segment-kw.rs:212:20
464 |
465LL | use self::{self};
466 | ^^^^
467 |
468help: try renaming it with a name
469 |
470LL | use self::{self as name};
471 | +++++++
472
473error[E0429]: `self` imports are only allowed within a { } list
474 --> $DIR/use-path-segment-kw.rs:216:28
475 |
476LL | use crate::foo::bar::self;
477 | ^^^^^^
478 |
479help: consider importing the module directly
480 |
481LL - use crate::foo::bar::self;
482LL + use crate::foo::bar;
483 |
484help: alternatively, use the multi-path `use` syntax to import `self`
485 |
486LL | use crate::foo::bar::{self};
487 | + +
488
489error[E0429]: `self` imports are only allowed within a { } list
490 --> $DIR/use-path-segment-kw.rs:217:28
491 |
492LL | use crate::foo::bar::self as _self7;
493 | ^^^^^^
494 |
495help: consider importing the module directly
496 |
497LL - use crate::foo::bar::self as _self7;
498LL + use crate::foo::bar as _self7;
499 |
500help: alternatively, use the multi-path `use` syntax to import `self`
501 |
502LL | use crate::foo::bar::{self as _self7};
503 | + +
504
505error: imports need to be explicitly named
506 --> $DIR/use-path-segment-kw.rs:11:13
507 |
508LL | use $crate;
509 | ^^^^^^
510...
511LL | 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)
515help: try renaming it with a name
516 |
517LL | use $crate as name;
518 | +++++++
519
520error: `$crate` in paths can only be used in start position
521 --> $DIR/use-path-segment-kw.rs:15:15
522 |
523LL | use ::$crate;
524 | ^^^^^^
525...
526LL | 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
531error: `$crate` in paths can only be used in start position
532 --> $DIR/use-path-segment-kw.rs:16:15
533 |
534LL | use ::$crate as _dollar_crate2;
535 | ^^^^^^
536...
537LL | 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
542error: `$crate` in paths can only be used in start position
543 --> $DIR/use-path-segment-kw.rs:17:16
544 |
545LL | use ::{$crate};
546 | ^^^^^^
547...
548LL | 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
553error: `$crate` in paths can only be used in start position
554 --> $DIR/use-path-segment-kw.rs:18:16
555 |
556LL | use ::{$crate as _nested_dollar_crate2};
557 | ^^^^^^
558...
559LL | 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
564error: `$crate` in paths can only be used in start position
565 --> $DIR/use-path-segment-kw.rs:21:21
566 |
567LL | use foobar::$crate;
568 | ^^^^^^
569...
570LL | 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
575error: `$crate` in paths can only be used in start position
576 --> $DIR/use-path-segment-kw.rs:22:21
577 |
578LL | use foobar::$crate as _dollar_crate3;
579 | ^^^^^^
580...
581LL | 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
586error: `$crate` in paths can only be used in start position
587 --> $DIR/use-path-segment-kw.rs:23:22
588 |
589LL | use foobar::{$crate};
590 | ^^^^^^
591...
592LL | 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
597error: `$crate` in paths can only be used in start position
598 --> $DIR/use-path-segment-kw.rs:24:22
599 |
600LL | use foobar::{$crate as _nested_dollar_crate3};
601 | ^^^^^^
602...
603LL | 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
608error: `$crate` in paths can only be used in start position
609 --> $DIR/use-path-segment-kw.rs:27:20
610 |
611LL | use crate::$crate;
612 | ^^^^^^
613...
614LL | 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
619error: `$crate` in paths can only be used in start position
620 --> $DIR/use-path-segment-kw.rs:28:20
621 |
622LL | use crate::$crate as _dollar_crate4;
623 | ^^^^^^
624...
625LL | 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
630error: `$crate` in paths can only be used in start position
631 --> $DIR/use-path-segment-kw.rs:29:21
632 |
633LL | use crate::{$crate};
634 | ^^^^^^
635...
636LL | 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
641error: `$crate` in paths can only be used in start position
642 --> $DIR/use-path-segment-kw.rs:30:21
643 |
644LL | use crate::{$crate as _nested_dollar_crate4};
645 | ^^^^^^
646...
647LL | 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
652error: `$crate` in paths can only be used in start position
653 --> $DIR/use-path-segment-kw.rs:33:20
654 |
655LL | use super::$crate;
656 | ^^^^^^
657...
658LL | 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
663error: `$crate` in paths can only be used in start position
664 --> $DIR/use-path-segment-kw.rs:34:20
665 |
666LL | use super::$crate as _dollar_crate5;
667 | ^^^^^^
668...
669LL | 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
674error: `$crate` in paths can only be used in start position
675 --> $DIR/use-path-segment-kw.rs:35:21
676 |
677LL | use super::{$crate};
678 | ^^^^^^
679...
680LL | 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
685error: `$crate` in paths can only be used in start position
686 --> $DIR/use-path-segment-kw.rs:36:21
687 |
688LL | use super::{$crate as _nested_dollar_crate5};
689 | ^^^^^^
690...
691LL | 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
696error: `$crate` in paths can only be used in start position
697 --> $DIR/use-path-segment-kw.rs:39:19
698 |
699LL | use self::$crate;
700 | ^^^^^^
701...
702LL | 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
707error: `$crate` in paths can only be used in start position
708 --> $DIR/use-path-segment-kw.rs:40:19
709 |
710LL | use self::$crate as _dollar_crate6;
711 | ^^^^^^
712...
713LL | 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
718error: `$crate` in paths can only be used in start position
719 --> $DIR/use-path-segment-kw.rs:41:20
720 |
721LL | use self::{$crate};
722 | ^^^^^^
723...
724LL | 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
729error: `$crate` in paths can only be used in start position
730 --> $DIR/use-path-segment-kw.rs:42:20
731 |
732LL | use self::{$crate as _nested_dollar_crate6};
733 | ^^^^^^
734...
735LL | 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
740error: `$crate` in paths can only be used in start position
741 --> $DIR/use-path-segment-kw.rs:45:21
742 |
743LL | use $crate::$crate;
744 | ^^^^^^
745...
746LL | 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
751error: `$crate` in paths can only be used in start position
752 --> $DIR/use-path-segment-kw.rs:46:21
753 |
754LL | use $crate::$crate as _dollar_crate7;
755 | ^^^^^^
756...
757LL | 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
762error: `$crate` in paths can only be used in start position
763 --> $DIR/use-path-segment-kw.rs:47:22
764 |
765LL | use $crate::{$crate};
766 | ^^^^^^
767...
768LL | 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
773error: `$crate` in paths can only be used in start position
774 --> $DIR/use-path-segment-kw.rs:48:22
775 |
776LL | use $crate::{$crate as _nested_dollar_crate7};
777 | ^^^^^^
778...
779LL | 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
784error: `crate` in paths can only be used in start position
785 --> $DIR/use-path-segment-kw.rs:51:21
786 |
787LL | use $crate::crate;
788 | ^^^^^
789...
790LL | 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
795error: `crate` in paths can only be used in start position
796 --> $DIR/use-path-segment-kw.rs:52:21
797 |
798LL | use $crate::crate as _m_crate8;
799 | ^^^^^
800...
801LL | 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
806error: `crate` in paths can only be used in start position
807 --> $DIR/use-path-segment-kw.rs:53:22
808 |
809LL | use $crate::{crate};
810 | ^^^^^
811...
812LL | 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
817error: `crate` in paths can only be used in start position
818 --> $DIR/use-path-segment-kw.rs:54:22
819 |
820LL | use $crate::{crate as _m_nested_crate8};
821 | ^^^^^
822...
823LL | 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
828error: `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 |
831LL | use $crate::super;
832 | ^^^^^
833...
834LL | 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
839error: `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 |
842LL | ... use $crate::super as _m_super8;
843 | ^^^^^
844...
845LL | ... 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
850error: `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 |
853LL | use $crate::{super};
854 | ^^^^^
855...
856LL | 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
861error: `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 |
864LL | ... use $crate::{super as _m_nested_super8};
865 | ^^^^^
866...
867LL | ... 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
872error[E0429]: `self` imports are only allowed within a { } list
873 --> $DIR/use-path-segment-kw.rs:63:19
874 |
875LL | use $crate::self;
876 | ^^^^^^
877...
878LL | 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)
882help: consider importing the module directly
883 |
884LL - use $crate::self;
885LL + use $crate;
886 |
887help: alternatively, use the multi-path `use` syntax to import `self`
888 |
889LL | use $crate::{self};
890 | + +
891
892error: imports need to be explicitly named
893 --> $DIR/use-path-segment-kw.rs:63:21
894 |
895LL | use $crate::self;
896 | ^^^^
897...
898LL | 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
903error[E0429]: `self` imports are only allowed within a { } list
904 --> $DIR/use-path-segment-kw.rs:65:23
905 |
906LL | pub use $crate::self as _m_self8;
907 | ^^^^^^
908...
909LL | 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)
913help: consider importing the module directly
914 |
915LL - pub use $crate::self as _m_self8;
916LL + pub use $crate as _m_self8;
917 |
918help: alternatively, use the multi-path `use` syntax to import `self`
919 |
920LL | pub use $crate::{self as _m_self8};
921 | + +
922
923error: imports need to be explicitly named
924 --> $DIR/use-path-segment-kw.rs:66:22
925 |
926LL | use $crate::{self};
927 | ^^^^
928...
929LL | 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)
933help: try renaming it with a name
934 |
935LL | use $crate::{self as name};
936 | +++++++
937
938error[E0432]: unresolved import `foobar`
939 --> $DIR/use-path-segment-kw.rs:187:17
940 |
941LL | pub use foobar::qux::self;
942 | ^^^^^^
943 |
944help: a similar path exists
945 |
946LL | pub use self::foobar::qux::self;
947 | ++++++
948
949error[E0432]: unresolved import `foobar`
950 --> $DIR/use-path-segment-kw.rs:189:17
951 |
952LL | pub use foobar::self as _self3;
953 | ^^^^^^^^^^^^^^^^^^^^^^ no `foobar` in the root
954
955error[E0432]: unresolved import `foobar`
956 --> $DIR/use-path-segment-kw.rs:191:17
957 |
958LL | pub use foobar::baz::{self};
959 | ^^^^^^
960 |
961help: a similar path exists
962 |
963LL | pub use self::foobar::baz::{self};
964 | ++++++
965
966error[E0432]: unresolved import `foobar`
967 --> $DIR/use-path-segment-kw.rs:192:26
968 |
969LL | pub use foobar::{self as _nested_self3};
970 | ^^^^^^^^^^^^^^^^^^^^^ no `foobar` in the root
971
972error[E0433]: `self` in paths can only be used in start position
973 --> $DIR/use-path-segment-kw.rs:215:36
974 |
975LL | type D7 = crate::foo::bar::self;
976 | ^^^^ can only be used in path start position
977
978error[E0573]: expected type, found module `$crate`
979 --> $DIR/use-path-segment-kw.rs:10:19
980 |
981LL | type A1 = $crate;
982 | ^^^^^^ not a type
983...
984LL | 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
989error[E0573]: expected type, found module `crate`
990 --> $DIR/use-path-segment-kw.rs:96:19
991 |
992LL | type B1 = crate;
993 | ^^^^^ not a type
994
995error[E0573]: expected type, found module `super`
996 --> $DIR/use-path-segment-kw.rs:134:19
997 |
998LL | type C1 = super;
999 | ^^^^^ not a type
1000
1001error[E0573]: expected type, found module `super::super`
1002 --> $DIR/use-path-segment-kw.rs:156:19
1003 |
1004LL | type C5 = super::super;
1005 | ^^^^^^^^^^^^ not a type
1006
1007error[E0573]: expected type, found module `self::super`
1008 --> $DIR/use-path-segment-kw.rs:162:19
1009 |
1010LL | type C6 = self::super;
1011 | ^^^^^^^^^^^ not a type
1012
1013error[E0573]: expected type, found module `self`
1014 --> $DIR/use-path-segment-kw.rs:172:19
1015 |
1016LL | type D1 = self;
1017 | ^^^^ not a type
1018
1019error[E0433]: global paths cannot start with `$crate`
1020 --> $DIR/use-path-segment-kw.rs:14:21
1021 |
1022LL | type A2 = ::$crate;
1023 | ^^^^^^ cannot start with this
1024...
1025LL | 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
1030error[E0433]: `$crate` in paths can only be used in start position
1031 --> $DIR/use-path-segment-kw.rs:20:27
1032 |
1033LL | type A3 = foobar::$crate;
1034 | ^^^^^^ can only be used in path start position
1035...
1036LL | 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
1041error[E0433]: `$crate` in paths can only be used in start position
1042 --> $DIR/use-path-segment-kw.rs:26:26
1043 |
1044LL | type A4 = crate::$crate;
1045 | ^^^^^^ can only be used in path start position
1046...
1047LL | 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
1052error[E0433]: `$crate` in paths can only be used in start position
1053 --> $DIR/use-path-segment-kw.rs:32:26
1054 |
1055LL | type A5 = super::$crate;
1056 | ^^^^^^ can only be used in path start position
1057...
1058LL | 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
1063error[E0433]: `$crate` in paths can only be used in start position
1064 --> $DIR/use-path-segment-kw.rs:38:25
1065 |
1066LL | type A6 = self::$crate;
1067 | ^^^^^^ can only be used in path start position
1068...
1069LL | 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
1074error[E0433]: `$crate` in paths can only be used in start position
1075 --> $DIR/use-path-segment-kw.rs:44:27
1076 |
1077LL | type A7 = $crate::$crate;
1078 | ^^^^^^ can only be used in path start position
1079...
1080LL | 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
1085error[E0433]: `crate` in paths can only be used in start position
1086 --> $DIR/use-path-segment-kw.rs:50:27
1087 |
1088LL | type A8 = $crate::crate;
1089 | ^^^^^ can only be used in path start position
1090...
1091LL | 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
1096error[E0433]: `super` in paths can only be used in start position
1097 --> $DIR/use-path-segment-kw.rs:56:27
1098 |
1099LL | type A9 = $crate::super;
1100 | ^^^^^ can only be used in path start position
1101...
1102LL | 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
1107error[E0433]: `self` in paths can only be used in start position
1108 --> $DIR/use-path-segment-kw.rs:62:28
1109 |
1110LL | type A10 = $crate::self;
1111 | ^^^^ can only be used in path start position
1112...
1113LL | 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
1118error[E0433]: global paths cannot start with `crate`
1119 --> $DIR/use-path-segment-kw.rs:100:21
1120 |
1121LL | type B2 = ::crate;
1122 | ^^^^^ cannot start with this
1123
1124error[E0433]: `crate` in paths can only be used in start position
1125 --> $DIR/use-path-segment-kw.rs:106:27
1126 |
1127LL | type B3 = foobar::crate;
1128 | ^^^^^ can only be used in path start position
1129
1130error[E0433]: `crate` in paths can only be used in start position
1131 --> $DIR/use-path-segment-kw.rs:112:26
1132 |
1133LL | type B4 = crate::crate;
1134 | ^^^^^ can only be used in path start position
1135
1136error[E0433]: `crate` in paths can only be used in start position
1137 --> $DIR/use-path-segment-kw.rs:118:26
1138 |
1139LL | type B5 = super::crate;
1140 | ^^^^^ can only be used in path start position
1141
1142error[E0433]: `crate` in paths can only be used in start position
1143 --> $DIR/use-path-segment-kw.rs:124:25
1144 |
1145LL | type B6 = self::crate;
1146 | ^^^^^ can only be used in path start position
1147
1148error[E0433]: global paths cannot start with `super`
1149 --> $DIR/use-path-segment-kw.rs:138:21
1150 |
1151LL | type C2 = ::super;
1152 | ^^^^^ cannot start with this
1153
1154error[E0433]: `super` in paths can only be used in start position
1155 --> $DIR/use-path-segment-kw.rs:144:27
1156 |
1157LL | type C3 = foobar::super;
1158 | ^^^^^ can only be used in path start position
1159
1160error[E0433]: `super` in paths can only be used in start position
1161 --> $DIR/use-path-segment-kw.rs:150:26
1162 |
1163LL | type C4 = crate::super;
1164 | ^^^^^ can only be used in path start position
1165
1166error[E0433]: global paths cannot start with `self`
1167 --> $DIR/use-path-segment-kw.rs:176:21
1168 |
1169LL | type D2 = ::self;
1170 | ^^^^ cannot start with this
1171
1172error[E0433]: `self` in paths can only be used in start position
1173 --> $DIR/use-path-segment-kw.rs:186:27
1174 |
1175LL | type D3 = foobar::self;
1176 | ^^^^ can only be used in path start position
1177
1178error[E0433]: `self` in paths can only be used in start position
1179 --> $DIR/use-path-segment-kw.rs:194:26
1180 |
1181LL | type D4 = crate::self;
1182 | ^^^^ can only be used in path start position
1183
1184error[E0433]: `self` in paths can only be used in start position
1185 --> $DIR/use-path-segment-kw.rs:201:26
1186 |
1187LL | type D5 = super::self;
1188 | ^^^^ can only be used in path start position
1189
1190error[E0433]: `self` in paths can only be used in start position
1191 --> $DIR/use-path-segment-kw.rs:208:25
1192 |
1193LL | type D6 = self::self;
1194 | ^^^^ can only be used in path start position
1195
1196error: aborting due to 129 previous errors
1197
1198Some errors have detailed explanations: E0429, E0432, E0433, E0573.
1199For more information about an error, try `rustc --explain E0429`.
tests/ui/use/use-path-segment-kw.e2018.stderr created+1166
......@@ -0,0 +1,1166 @@
1error: imports need to be explicitly named
2 --> $DIR/use-path-segment-kw.rs:97:13
3 |
4LL | use crate;
5 | ^^^^^
6 |
7help: try renaming it with a name
8 |
9LL | use crate as name;
10 | +++++++
11
12error: `crate` in paths can only be used in start position
13 --> $DIR/use-path-segment-kw.rs:101:15
14 |
15LL | use ::crate;
16 | ^^^^^
17
18error: `crate` in paths can only be used in start position
19 --> $DIR/use-path-segment-kw.rs:102:15
20 |
21LL | use ::crate as _crate2;
22 | ^^^^^
23
24error: `crate` in paths can only be used in start position
25 --> $DIR/use-path-segment-kw.rs:103:16
26 |
27LL | use ::{crate};
28 | ^^^^^
29
30error: `crate` in paths can only be used in start position
31 --> $DIR/use-path-segment-kw.rs:104:16
32 |
33LL | use ::{crate as _nested_crate2};
34 | ^^^^^
35
36error: `crate` in paths can only be used in start position
37 --> $DIR/use-path-segment-kw.rs:107:21
38 |
39LL | use foobar::crate;
40 | ^^^^^
41
42error: `crate` in paths can only be used in start position
43 --> $DIR/use-path-segment-kw.rs:108:21
44 |
45LL | use foobar::crate as _crate3;
46 | ^^^^^
47
48error: `crate` in paths can only be used in start position
49 --> $DIR/use-path-segment-kw.rs:109:22
50 |
51LL | use foobar::{crate};
52 | ^^^^^
53
54error: `crate` in paths can only be used in start position
55 --> $DIR/use-path-segment-kw.rs:110:22
56 |
57LL | use foobar::{crate as _nested_crate3};
58 | ^^^^^
59
60error: `crate` in paths can only be used in start position
61 --> $DIR/use-path-segment-kw.rs:113:20
62 |
63LL | use crate::crate;
64 | ^^^^^
65
66error: `crate` in paths can only be used in start position
67 --> $DIR/use-path-segment-kw.rs:114:20
68 |
69LL | use crate::crate as _crate4;
70 | ^^^^^
71
72error: `crate` in paths can only be used in start position
73 --> $DIR/use-path-segment-kw.rs:115:21
74 |
75LL | use crate::{crate};
76 | ^^^^^
77
78error: `crate` in paths can only be used in start position
79 --> $DIR/use-path-segment-kw.rs:116:21
80 |
81LL | use crate::{crate as _nested_crate4};
82 | ^^^^^
83
84error: `crate` in paths can only be used in start position
85 --> $DIR/use-path-segment-kw.rs:119:20
86 |
87LL | use super::crate;
88 | ^^^^^
89
90error: `crate` in paths can only be used in start position
91 --> $DIR/use-path-segment-kw.rs:120:20
92 |
93LL | use super::crate as _crate5;
94 | ^^^^^
95
96error: `crate` in paths can only be used in start position
97 --> $DIR/use-path-segment-kw.rs:121:21
98 |
99LL | use super::{crate};
100 | ^^^^^
101
102error: `crate` in paths can only be used in start position
103 --> $DIR/use-path-segment-kw.rs:122:21
104 |
105LL | use super::{crate as _nested_crate5};
106 | ^^^^^
107
108error: `crate` in paths can only be used in start position
109 --> $DIR/use-path-segment-kw.rs:125:19
110 |
111LL | use self::crate;
112 | ^^^^^
113
114error: `crate` in paths can only be used in start position
115 --> $DIR/use-path-segment-kw.rs:126:19
116 |
117LL | use self::crate as _crate6;
118 | ^^^^^
119
120error: `crate` in paths can only be used in start position
121 --> $DIR/use-path-segment-kw.rs:127:20
122 |
123LL | use self::{crate};
124 | ^^^^^
125
126error: `crate` in paths can only be used in start position
127 --> $DIR/use-path-segment-kw.rs:128:20
128 |
129LL | use self::{crate as _nested_crate6};
130 | ^^^^^
131
132error: imports need to be explicitly named
133 --> $DIR/use-path-segment-kw.rs:135:13
134 |
135LL | use super;
136 | ^^^^^
137 |
138help: try renaming it with a name
139 |
140LL | use super as name;
141 | +++++++
142
143error: `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 |
146LL | use ::super;
147 | ^^^^^
148
149error: `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 |
152LL | use ::super as _super2;
153 | ^^^^^
154
155error: `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 |
158LL | use ::{super};
159 | ^^^^^
160
161error: `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 |
164LL | ... use ::{super as _nested_super2};
165 | ^^^^^
166
167error: `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 |
170LL | use foobar::super;
171 | ^^^^^
172
173error: `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 |
176LL | ... use foobar::super as _super3;
177 | ^^^^^
178
179error: `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 |
182LL | use foobar::{super};
183 | ^^^^^
184
185error: `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 |
188LL | ... use foobar::{super as _nested_super3};
189 | ^^^^^
190
191error: `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 |
194LL | use crate::super;
195 | ^^^^^
196
197error: `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 |
200LL | ... use crate::super as _super4;
201 | ^^^^^
202
203error: `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 |
206LL | use crate::{super};
207 | ^^^^^
208
209error: `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 |
212LL | ... use crate::{super as _nested_super4};
213 | ^^^^^
214
215error: imports need to be explicitly named
216 --> $DIR/use-path-segment-kw.rs:157:20
217 |
218LL | use super::super;
219 | ^^^^^
220 |
221help: try renaming it with a name
222 |
223LL | use super::super as name;
224 | +++++++
225
226error: imports need to be explicitly named
227 --> $DIR/use-path-segment-kw.rs:159:21
228 |
229LL | use super::{super};
230 | ^^^^^
231 |
232help: try renaming it with a name
233 |
234LL | use super::{super as name};
235 | +++++++
236
237error: imports need to be explicitly named
238 --> $DIR/use-path-segment-kw.rs:163:19
239 |
240LL | use self::super;
241 | ^^^^^
242 |
243help: try renaming it with a name
244 |
245LL | use self::super as name;
246 | +++++++
247
248error: imports need to be explicitly named
249 --> $DIR/use-path-segment-kw.rs:165:20
250 |
251LL | use self::{super};
252 | ^^^^^
253 |
254help: try renaming it with a name
255 |
256LL | use self::{super as name};
257 | +++++++
258
259error: imports need to be explicitly named
260 --> $DIR/use-path-segment-kw.rs:173:13
261 |
262LL | use self;
263 | ^^^^
264
265error: extern prelude cannot be imported
266 --> $DIR/use-path-segment-kw.rs:177:13
267 |
268LL | use ::self;
269 | ^^^^^^
270
271error: extern prelude cannot be imported
272 --> $DIR/use-path-segment-kw.rs:180:13
273 |
274LL | use ::self as _self2;
275 | ^^^^^^^^^^^^^^^^
276
277error: extern prelude cannot be imported
278 --> $DIR/use-path-segment-kw.rs:182:16
279 |
280LL | use ::{self};
281 | ^^^^
282
283error: extern prelude cannot be imported
284 --> $DIR/use-path-segment-kw.rs:184:20
285 |
286LL | pub use ::{self as _nested_self2};
287 | ^^^^^^^^^^^^^^^^^^^^^
288
289error[E0429]: `self` imports are only allowed within a { } list
290 --> $DIR/use-path-segment-kw.rs:187:28
291 |
292LL | pub use foobar::qux::self;
293 | ^^^^^^
294 |
295help: consider importing the module directly
296 |
297LL - pub use foobar::qux::self;
298LL + pub use foobar::qux;
299 |
300help: alternatively, use the multi-path `use` syntax to import `self`
301 |
302LL | pub use foobar::qux::{self};
303 | + +
304
305error[E0429]: `self` imports are only allowed within a { } list
306 --> $DIR/use-path-segment-kw.rs:189:23
307 |
308LL | pub use foobar::self as _self3;
309 | ^^^^^^
310 |
311help: consider importing the module directly
312 |
313LL - pub use foobar::self as _self3;
314LL + pub use foobar as _self3;
315 |
316help: alternatively, use the multi-path `use` syntax to import `self`
317 |
318LL | pub use foobar::{self as _self3};
319 | + +
320
321error[E0429]: `self` imports are only allowed within a { } list
322 --> $DIR/use-path-segment-kw.rs:195:18
323 |
324LL | use crate::self;
325 | ^^^^^^
326 |
327help: consider importing the module directly
328 |
329LL - use crate::self;
330LL + use crate;
331 |
332help: alternatively, use the multi-path `use` syntax to import `self`
333 |
334LL | use crate::{self};
335 | + +
336
337error: imports need to be explicitly named
338 --> $DIR/use-path-segment-kw.rs:195:20
339 |
340LL | use crate::self;
341 | ^^^^
342
343error[E0429]: `self` imports are only allowed within a { } list
344 --> $DIR/use-path-segment-kw.rs:197:22
345 |
346LL | pub use crate::self as _self4;
347 | ^^^^^^
348 |
349help: consider importing the module directly
350 |
351LL - pub use crate::self as _self4;
352LL + pub use crate as _self4;
353 |
354help: alternatively, use the multi-path `use` syntax to import `self`
355 |
356LL | pub use crate::{self as _self4};
357 | + +
358
359error: imports need to be explicitly named
360 --> $DIR/use-path-segment-kw.rs:198:21
361 |
362LL | use crate::{self};
363 | ^^^^
364 |
365help: try renaming it with a name
366 |
367LL | use crate::{self as name};
368 | +++++++
369
370error[E0429]: `self` imports are only allowed within a { } list
371 --> $DIR/use-path-segment-kw.rs:202:18
372 |
373LL | use super::self;
374 | ^^^^^^
375 |
376help: consider importing the module directly
377 |
378LL - use super::self;
379LL + use super;
380 |
381help: alternatively, use the multi-path `use` syntax to import `self`
382 |
383LL | use super::{self};
384 | + +
385
386error: imports need to be explicitly named
387 --> $DIR/use-path-segment-kw.rs:202:20
388 |
389LL | use super::self;
390 | ^^^^
391
392error[E0429]: `self` imports are only allowed within a { } list
393 --> $DIR/use-path-segment-kw.rs:204:22
394 |
395LL | pub use super::self as _self5;
396 | ^^^^^^
397 |
398help: consider importing the module directly
399 |
400LL - pub use super::self as _self5;
401LL + pub use super as _self5;
402 |
403help: alternatively, use the multi-path `use` syntax to import `self`
404 |
405LL | pub use super::{self as _self5};
406 | + +
407
408error: imports need to be explicitly named
409 --> $DIR/use-path-segment-kw.rs:205:21
410 |
411LL | use super::{self};
412 | ^^^^
413 |
414help: try renaming it with a name
415 |
416LL | use super::{self as name};
417 | +++++++
418
419error[E0429]: `self` imports are only allowed within a { } list
420 --> $DIR/use-path-segment-kw.rs:209:17
421 |
422LL | use self::self;
423 | ^^^^^^
424 |
425help: consider importing the module directly
426 |
427LL - use self::self;
428LL + use self;
429 |
430help: alternatively, use the multi-path `use` syntax to import `self`
431 |
432LL | use self::{self};
433 | + +
434
435error: imports need to be explicitly named
436 --> $DIR/use-path-segment-kw.rs:209:19
437 |
438LL | use self::self;
439 | ^^^^
440
441error[E0429]: `self` imports are only allowed within a { } list
442 --> $DIR/use-path-segment-kw.rs:211:21
443 |
444LL | pub use self::self as _self6;
445 | ^^^^^^
446 |
447help: consider importing the module directly
448 |
449LL - pub use self::self as _self6;
450LL + pub use self as _self6;
451 |
452help: alternatively, use the multi-path `use` syntax to import `self`
453 |
454LL | pub use self::{self as _self6};
455 | + +
456
457error: imports need to be explicitly named
458 --> $DIR/use-path-segment-kw.rs:212:20
459 |
460LL | use self::{self};
461 | ^^^^
462 |
463help: try renaming it with a name
464 |
465LL | use self::{self as name};
466 | +++++++
467
468error[E0429]: `self` imports are only allowed within a { } list
469 --> $DIR/use-path-segment-kw.rs:216:28
470 |
471LL | use crate::foo::bar::self;
472 | ^^^^^^
473 |
474help: consider importing the module directly
475 |
476LL - use crate::foo::bar::self;
477LL + use crate::foo::bar;
478 |
479help: alternatively, use the multi-path `use` syntax to import `self`
480 |
481LL | use crate::foo::bar::{self};
482 | + +
483
484error[E0429]: `self` imports are only allowed within a { } list
485 --> $DIR/use-path-segment-kw.rs:217:28
486 |
487LL | use crate::foo::bar::self as _self7;
488 | ^^^^^^
489 |
490help: consider importing the module directly
491 |
492LL - use crate::foo::bar::self as _self7;
493LL + use crate::foo::bar as _self7;
494 |
495help: alternatively, use the multi-path `use` syntax to import `self`
496 |
497LL | use crate::foo::bar::{self as _self7};
498 | + +
499
500error: imports need to be explicitly named
501 --> $DIR/use-path-segment-kw.rs:11:13
502 |
503LL | use $crate;
504 | ^^^^^^
505...
506LL | 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)
510help: try renaming it with a name
511 |
512LL | use $crate as name;
513 | +++++++
514
515error: `$crate` in paths can only be used in start position
516 --> $DIR/use-path-segment-kw.rs:15:15
517 |
518LL | use ::$crate;
519 | ^^^^^^
520...
521LL | 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
526error: `$crate` in paths can only be used in start position
527 --> $DIR/use-path-segment-kw.rs:16:15
528 |
529LL | use ::$crate as _dollar_crate2;
530 | ^^^^^^
531...
532LL | 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
537error: `$crate` in paths can only be used in start position
538 --> $DIR/use-path-segment-kw.rs:17:16
539 |
540LL | use ::{$crate};
541 | ^^^^^^
542...
543LL | 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
548error: `$crate` in paths can only be used in start position
549 --> $DIR/use-path-segment-kw.rs:18:16
550 |
551LL | use ::{$crate as _nested_dollar_crate2};
552 | ^^^^^^
553...
554LL | 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
559error: `$crate` in paths can only be used in start position
560 --> $DIR/use-path-segment-kw.rs:21:21
561 |
562LL | use foobar::$crate;
563 | ^^^^^^
564...
565LL | 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
570error: `$crate` in paths can only be used in start position
571 --> $DIR/use-path-segment-kw.rs:22:21
572 |
573LL | use foobar::$crate as _dollar_crate3;
574 | ^^^^^^
575...
576LL | 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
581error: `$crate` in paths can only be used in start position
582 --> $DIR/use-path-segment-kw.rs:23:22
583 |
584LL | use foobar::{$crate};
585 | ^^^^^^
586...
587LL | 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
592error: `$crate` in paths can only be used in start position
593 --> $DIR/use-path-segment-kw.rs:24:22
594 |
595LL | use foobar::{$crate as _nested_dollar_crate3};
596 | ^^^^^^
597...
598LL | 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
603error: `$crate` in paths can only be used in start position
604 --> $DIR/use-path-segment-kw.rs:27:20
605 |
606LL | use crate::$crate;
607 | ^^^^^^
608...
609LL | 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
614error: `$crate` in paths can only be used in start position
615 --> $DIR/use-path-segment-kw.rs:28:20
616 |
617LL | use crate::$crate as _dollar_crate4;
618 | ^^^^^^
619...
620LL | 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
625error: `$crate` in paths can only be used in start position
626 --> $DIR/use-path-segment-kw.rs:29:21
627 |
628LL | use crate::{$crate};
629 | ^^^^^^
630...
631LL | 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
636error: `$crate` in paths can only be used in start position
637 --> $DIR/use-path-segment-kw.rs:30:21
638 |
639LL | use crate::{$crate as _nested_dollar_crate4};
640 | ^^^^^^
641...
642LL | 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
647error: `$crate` in paths can only be used in start position
648 --> $DIR/use-path-segment-kw.rs:33:20
649 |
650LL | use super::$crate;
651 | ^^^^^^
652...
653LL | 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
658error: `$crate` in paths can only be used in start position
659 --> $DIR/use-path-segment-kw.rs:34:20
660 |
661LL | use super::$crate as _dollar_crate5;
662 | ^^^^^^
663...
664LL | 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
669error: `$crate` in paths can only be used in start position
670 --> $DIR/use-path-segment-kw.rs:35:21
671 |
672LL | use super::{$crate};
673 | ^^^^^^
674...
675LL | 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
680error: `$crate` in paths can only be used in start position
681 --> $DIR/use-path-segment-kw.rs:36:21
682 |
683LL | use super::{$crate as _nested_dollar_crate5};
684 | ^^^^^^
685...
686LL | 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
691error: `$crate` in paths can only be used in start position
692 --> $DIR/use-path-segment-kw.rs:39:19
693 |
694LL | use self::$crate;
695 | ^^^^^^
696...
697LL | 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
702error: `$crate` in paths can only be used in start position
703 --> $DIR/use-path-segment-kw.rs:40:19
704 |
705LL | use self::$crate as _dollar_crate6;
706 | ^^^^^^
707...
708LL | 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
713error: `$crate` in paths can only be used in start position
714 --> $DIR/use-path-segment-kw.rs:41:20
715 |
716LL | use self::{$crate};
717 | ^^^^^^
718...
719LL | 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
724error: `$crate` in paths can only be used in start position
725 --> $DIR/use-path-segment-kw.rs:42:20
726 |
727LL | use self::{$crate as _nested_dollar_crate6};
728 | ^^^^^^
729...
730LL | 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
735error: `$crate` in paths can only be used in start position
736 --> $DIR/use-path-segment-kw.rs:45:21
737 |
738LL | use $crate::$crate;
739 | ^^^^^^
740...
741LL | 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
746error: `$crate` in paths can only be used in start position
747 --> $DIR/use-path-segment-kw.rs:46:21
748 |
749LL | use $crate::$crate as _dollar_crate7;
750 | ^^^^^^
751...
752LL | 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
757error: `$crate` in paths can only be used in start position
758 --> $DIR/use-path-segment-kw.rs:47:22
759 |
760LL | use $crate::{$crate};
761 | ^^^^^^
762...
763LL | 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
768error: `$crate` in paths can only be used in start position
769 --> $DIR/use-path-segment-kw.rs:48:22
770 |
771LL | use $crate::{$crate as _nested_dollar_crate7};
772 | ^^^^^^
773...
774LL | 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
779error: `crate` in paths can only be used in start position
780 --> $DIR/use-path-segment-kw.rs:51:21
781 |
782LL | use $crate::crate;
783 | ^^^^^
784...
785LL | 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
790error: `crate` in paths can only be used in start position
791 --> $DIR/use-path-segment-kw.rs:52:21
792 |
793LL | use $crate::crate as _m_crate8;
794 | ^^^^^
795...
796LL | 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
801error: `crate` in paths can only be used in start position
802 --> $DIR/use-path-segment-kw.rs:53:22
803 |
804LL | use $crate::{crate};
805 | ^^^^^
806...
807LL | 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
812error: `crate` in paths can only be used in start position
813 --> $DIR/use-path-segment-kw.rs:54:22
814 |
815LL | use $crate::{crate as _m_nested_crate8};
816 | ^^^^^
817...
818LL | 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
823error: `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 |
826LL | use $crate::super;
827 | ^^^^^
828...
829LL | 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
834error: `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 |
837LL | ... use $crate::super as _m_super8;
838 | ^^^^^
839...
840LL | ... 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
845error: `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 |
848LL | use $crate::{super};
849 | ^^^^^
850...
851LL | 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
856error: `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 |
859LL | ... use $crate::{super as _m_nested_super8};
860 | ^^^^^
861...
862LL | ... 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
867error[E0429]: `self` imports are only allowed within a { } list
868 --> $DIR/use-path-segment-kw.rs:63:19
869 |
870LL | use $crate::self;
871 | ^^^^^^
872...
873LL | 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)
877help: consider importing the module directly
878 |
879LL - use $crate::self;
880LL + use $crate;
881 |
882help: alternatively, use the multi-path `use` syntax to import `self`
883 |
884LL | use $crate::{self};
885 | + +
886
887error: imports need to be explicitly named
888 --> $DIR/use-path-segment-kw.rs:63:21
889 |
890LL | use $crate::self;
891 | ^^^^
892...
893LL | 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
898error[E0429]: `self` imports are only allowed within a { } list
899 --> $DIR/use-path-segment-kw.rs:65:23
900 |
901LL | pub use $crate::self as _m_self8;
902 | ^^^^^^
903...
904LL | 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)
908help: consider importing the module directly
909 |
910LL - pub use $crate::self as _m_self8;
911LL + pub use $crate as _m_self8;
912 |
913help: alternatively, use the multi-path `use` syntax to import `self`
914 |
915LL | pub use $crate::{self as _m_self8};
916 | + +
917
918error: imports need to be explicitly named
919 --> $DIR/use-path-segment-kw.rs:66:22
920 |
921LL | use $crate::{self};
922 | ^^^^
923...
924LL | 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)
928help: try renaming it with a name
929 |
930LL | use $crate::{self as name};
931 | +++++++
932
933error[E0433]: `self` in paths can only be used in start position
934 --> $DIR/use-path-segment-kw.rs:215:36
935 |
936LL | type D7 = crate::foo::bar::self;
937 | ^^^^ can only be used in path start position
938
939error[E0433]: cannot find `_nested_self2` in `bar`
940 --> $DIR/use-path-segment-kw.rs:241:15
941 |
942LL | foo::bar::_nested_self2::outer();
943 | ^^^^^^^^^^^^^ could not find `_nested_self2` in `bar`
944
945error[E0573]: expected type, found module `$crate`
946 --> $DIR/use-path-segment-kw.rs:10:19
947 |
948LL | type A1 = $crate;
949 | ^^^^^^ not a type
950...
951LL | 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
956error[E0573]: expected type, found module `crate`
957 --> $DIR/use-path-segment-kw.rs:96:19
958 |
959LL | type B1 = crate;
960 | ^^^^^ not a type
961
962error[E0573]: expected type, found module `super`
963 --> $DIR/use-path-segment-kw.rs:134:19
964 |
965LL | type C1 = super;
966 | ^^^^^ not a type
967
968error[E0573]: expected type, found module `super::super`
969 --> $DIR/use-path-segment-kw.rs:156:19
970 |
971LL | type C5 = super::super;
972 | ^^^^^^^^^^^^ not a type
973
974error[E0573]: expected type, found module `self::super`
975 --> $DIR/use-path-segment-kw.rs:162:19
976 |
977LL | type C6 = self::super;
978 | ^^^^^^^^^^^ not a type
979
980error[E0573]: expected type, found module `self`
981 --> $DIR/use-path-segment-kw.rs:172:19
982 |
983LL | type D1 = self;
984 | ^^^^ not a type
985
986error[E0433]: global paths cannot start with `$crate`
987 --> $DIR/use-path-segment-kw.rs:14:21
988 |
989LL | type A2 = ::$crate;
990 | ^^^^^^ cannot start with this
991...
992LL | 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
997error[E0433]: `$crate` in paths can only be used in start position
998 --> $DIR/use-path-segment-kw.rs:20:27
999 |
1000LL | type A3 = foobar::$crate;
1001 | ^^^^^^ can only be used in path start position
1002...
1003LL | 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
1008error[E0433]: `$crate` in paths can only be used in start position
1009 --> $DIR/use-path-segment-kw.rs:26:26
1010 |
1011LL | type A4 = crate::$crate;
1012 | ^^^^^^ can only be used in path start position
1013...
1014LL | 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
1019error[E0433]: `$crate` in paths can only be used in start position
1020 --> $DIR/use-path-segment-kw.rs:32:26
1021 |
1022LL | type A5 = super::$crate;
1023 | ^^^^^^ can only be used in path start position
1024...
1025LL | 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
1030error[E0433]: `$crate` in paths can only be used in start position
1031 --> $DIR/use-path-segment-kw.rs:38:25
1032 |
1033LL | type A6 = self::$crate;
1034 | ^^^^^^ can only be used in path start position
1035...
1036LL | 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
1041error[E0433]: `$crate` in paths can only be used in start position
1042 --> $DIR/use-path-segment-kw.rs:44:27
1043 |
1044LL | type A7 = $crate::$crate;
1045 | ^^^^^^ can only be used in path start position
1046...
1047LL | 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
1052error[E0433]: `crate` in paths can only be used in start position
1053 --> $DIR/use-path-segment-kw.rs:50:27
1054 |
1055LL | type A8 = $crate::crate;
1056 | ^^^^^ can only be used in path start position
1057...
1058LL | 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
1063error[E0433]: `super` in paths can only be used in start position
1064 --> $DIR/use-path-segment-kw.rs:56:27
1065 |
1066LL | type A9 = $crate::super;
1067 | ^^^^^ can only be used in path start position
1068...
1069LL | 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
1074error[E0433]: `self` in paths can only be used in start position
1075 --> $DIR/use-path-segment-kw.rs:62:28
1076 |
1077LL | type A10 = $crate::self;
1078 | ^^^^ can only be used in path start position
1079...
1080LL | 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
1085error[E0433]: global paths cannot start with `crate`
1086 --> $DIR/use-path-segment-kw.rs:100:21
1087 |
1088LL | type B2 = ::crate;
1089 | ^^^^^ cannot start with this
1090
1091error[E0433]: `crate` in paths can only be used in start position
1092 --> $DIR/use-path-segment-kw.rs:106:27
1093 |
1094LL | type B3 = foobar::crate;
1095 | ^^^^^ can only be used in path start position
1096
1097error[E0433]: `crate` in paths can only be used in start position
1098 --> $DIR/use-path-segment-kw.rs:112:26
1099 |
1100LL | type B4 = crate::crate;
1101 | ^^^^^ can only be used in path start position
1102
1103error[E0433]: `crate` in paths can only be used in start position
1104 --> $DIR/use-path-segment-kw.rs:118:26
1105 |
1106LL | type B5 = super::crate;
1107 | ^^^^^ can only be used in path start position
1108
1109error[E0433]: `crate` in paths can only be used in start position
1110 --> $DIR/use-path-segment-kw.rs:124:25
1111 |
1112LL | type B6 = self::crate;
1113 | ^^^^^ can only be used in path start position
1114
1115error[E0433]: global paths cannot start with `super`
1116 --> $DIR/use-path-segment-kw.rs:138:21
1117 |
1118LL | type C2 = ::super;
1119 | ^^^^^ cannot start with this
1120
1121error[E0433]: `super` in paths can only be used in start position
1122 --> $DIR/use-path-segment-kw.rs:144:27
1123 |
1124LL | type C3 = foobar::super;
1125 | ^^^^^ can only be used in path start position
1126
1127error[E0433]: `super` in paths can only be used in start position
1128 --> $DIR/use-path-segment-kw.rs:150:26
1129 |
1130LL | type C4 = crate::super;
1131 | ^^^^^ can only be used in path start position
1132
1133error[E0433]: global paths cannot start with `self`
1134 --> $DIR/use-path-segment-kw.rs:176:21
1135 |
1136LL | type D2 = ::self;
1137 | ^^^^ cannot start with this
1138
1139error[E0433]: `self` in paths can only be used in start position
1140 --> $DIR/use-path-segment-kw.rs:186:27
1141 |
1142LL | type D3 = foobar::self;
1143 | ^^^^ can only be used in path start position
1144
1145error[E0433]: `self` in paths can only be used in start position
1146 --> $DIR/use-path-segment-kw.rs:194:26
1147 |
1148LL | type D4 = crate::self;
1149 | ^^^^ can only be used in path start position
1150
1151error[E0433]: `self` in paths can only be used in start position
1152 --> $DIR/use-path-segment-kw.rs:201:26
1153 |
1154LL | type D5 = super::self;
1155 | ^^^^ can only be used in path start position
1156
1157error[E0433]: `self` in paths can only be used in start position
1158 --> $DIR/use-path-segment-kw.rs:208:25
1159 |
1160LL | type D6 = self::self;
1161 | ^^^^ can only be used in path start position
1162
1163error: aborting due to 126 previous errors
1164
1165Some errors have detailed explanations: E0429, E0433, E0573.
1166For 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..
24
35macro_rules! macro_dollar_crate {
46 () => {
......@@ -6,67 +8,62 @@ macro_rules! macro_dollar_crate {
68 use $crate::{};
79
810 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;
1113
1214 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
1719
1820 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
2325
2426 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
2931
3032 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
3537
3638 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
4143
4244 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
4749
4850 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
5555
5656 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`
6161
6262 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
6464 //~^ ERROR `self` imports are only allowed within a { } list
65 //~^^ ERROR the name `<!dummy!>` is defined multiple times
6665 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
7067 pub use $crate::{self as _m_nested_self8}; // Good
7168 }
7269}
......@@ -84,6 +81,8 @@ mod foo {
8481 pub use super::inner;
8582 }
8683
84 pub mod quxbaz {}
85
8786 pub fn inner() {}
8887 }
8988
......@@ -95,131 +94,129 @@ mod foo {
9594 use crate::{};
9695
9796 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
9998 pub use crate as _crate; // Good
10099
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
108105
109106 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
116111
117112 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
124117
125118 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
132123
133124 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
140129
141130 // --- super ---
142131 use super::*;
143 use super::{}; //~ ERROR unresolved import `super`
132 use super::{};
144133
145134 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;
148137
149138 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`
154143
155144 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`
160149
161150 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`
166155
167156 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};
172161
173162 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};
178167
179168 // --- self ---
180169 // use self::*; // Suppress other errors
181 use self::{}; //~ ERROR unresolved import `self`
170 use self::{};
182171
183172 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;
186175
187176 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
194185
195186 type D3 = foobar::self; //~ ERROR `self` in paths can only be used in start position
196187 pub use foobar::qux::self; //~ ERROR `self` imports are only allowed within a { } list
188 //[e2015]~^ ERROR unresolved import `foobar`
197189 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`
200193
201194 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
203196 //~^ ERROR `self` imports are only allowed within a { } list
204 //~^^ ERROR the name `crate` is defined multiple times
205197 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
208199 pub use crate::{self as _nested_self4}; // Good
209200
210201 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
212203 //~^ ERROR `self` imports are only allowed within a { } list
213204 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};
217207
218208 type D6 = self::self; //~ ERROR `self` in paths can only be used in start position
219209 use self::self; //~ ERROR `self` imports are only allowed within a { } list
210 //~^ ERROR imports need to be explicitly named
220211 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};
223220 }
224221}
225222
......@@ -235,10 +232,13 @@ fn main() {
235232 foo::bar::_super::bar::foobar::inner();
236233 foo::bar::_super5::outer();
237234 foo::bar::_nested_super5::outer();
235 foo::bar::_super6::bar::foobar::inner();
236 foo::bar::_nested_super6::bar::foobar::inner();
238237
239238 foo::bar::_self::foobar::inner();
240239 foo::bar::qux::inner(); // Works after recovery
241240 foo::bar::baz::inner();
241 foo::bar::_nested_self2::outer(); //[e2018]~ ERROR cannot find `_nested_self2` in `bar`
242242 foo::bar::_self3::inner(); // Works after recovery
243243 foo::bar::_nested_self3::inner();
244244 foo::bar::_self4::outer(); // Works after recovery
tests/ui/use/use-path-segment-kw.stderr deleted-1245
......@@ -1,1245 +0,0 @@
1error: crate root imports need to be explicitly named: `use crate as name;`
2 --> $DIR/use-path-segment-kw.rs:98:13
3 |
4LL | use crate;
5 | ^^^^^
6
7error: crate root imports need to be explicitly named: `use crate as name;`
8 --> $DIR/use-path-segment-kw.rs:102:15
9 |
10LL | use ::crate;
11 | ^^^^^
12
13error: crate root imports need to be explicitly named: `use crate as name;`
14 --> $DIR/use-path-segment-kw.rs:105:16
15 |
16LL | use ::{crate};
17 | ^^^^^
18
19error: crate root imports need to be explicitly named: `use crate as name;`
20 --> $DIR/use-path-segment-kw.rs:110:21
21 |
22LL | use foobar::crate;
23 | ^^^^^
24
25error: crate root imports need to be explicitly named: `use crate as name;`
26 --> $DIR/use-path-segment-kw.rs:113:22
27 |
28LL | use foobar::{crate};
29 | ^^^^^
30
31error: crate root imports need to be explicitly named: `use crate as name;`
32 --> $DIR/use-path-segment-kw.rs:118:20
33 |
34LL | use crate::crate;
35 | ^^^^^
36
37error: crate root imports need to be explicitly named: `use crate as name;`
38 --> $DIR/use-path-segment-kw.rs:121:21
39 |
40LL | use crate::{crate};
41 | ^^^^^
42
43error: crate root imports need to be explicitly named: `use crate as name;`
44 --> $DIR/use-path-segment-kw.rs:126:20
45 |
46LL | use super::crate;
47 | ^^^^^
48
49error: crate root imports need to be explicitly named: `use crate as name;`
50 --> $DIR/use-path-segment-kw.rs:129:21
51 |
52LL | use super::{crate};
53 | ^^^^^
54
55error: crate root imports need to be explicitly named: `use crate as name;`
56 --> $DIR/use-path-segment-kw.rs:134:19
57 |
58LL | use self::crate;
59 | ^^^^^
60
61error: crate root imports need to be explicitly named: `use crate as name;`
62 --> $DIR/use-path-segment-kw.rs:137:20
63 |
64LL | use self::{crate};
65 | ^^^^^
66
67error[E0429]: `self` imports are only allowed within a { } list
68 --> $DIR/use-path-segment-kw.rs:184:13
69 |
70LL | use self;
71 | ^^^^
72
73error[E0429]: `self` imports are only allowed within a { } list
74 --> $DIR/use-path-segment-kw.rs:185:17
75 |
76LL | pub use self as _self;
77 | ^^^^
78
79error[E0429]: `self` imports are only allowed within a { } list
80 --> $DIR/use-path-segment-kw.rs:188:13
81 |
82LL | use ::self;
83 | ^^^^^^
84 |
85help: consider importing the module directly
86 |
87LL - use ::self;
88LL + use ;
89 |
90help: alternatively, use the multi-path `use` syntax to import `self`
91 |
92LL | use ::{self};
93 | + +
94
95error[E0429]: `self` imports are only allowed within a { } list
96 --> $DIR/use-path-segment-kw.rs:190:13
97 |
98LL | use ::self as _self2;
99 | ^^^^^^
100 |
101help: consider importing the module directly
102 |
103LL - use ::self as _self2;
104LL + use as _self2;
105 |
106help: alternatively, use the multi-path `use` syntax to import `self`
107 |
108LL | use ::{self as _self2};
109 | + +
110
111error[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 |
114LL | use ::{self};
115 | ^^^^ can only appear in an import list with a non-empty prefix
116
117error[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 |
120LL | use ::{self as _nested_self2};
121 | ^^^^^^^^^^^^^^^^^^^^^ can only appear in an import list with a non-empty prefix
122
123error[E0429]: `self` imports are only allowed within a { } list
124 --> $DIR/use-path-segment-kw.rs:196:28
125 |
126LL | pub use foobar::qux::self;
127 | ^^^^^^
128 |
129help: consider importing the module directly
130 |
131LL - pub use foobar::qux::self;
132LL + pub use foobar::qux;
133 |
134help: alternatively, use the multi-path `use` syntax to import `self`
135 |
136LL | pub use foobar::qux::{self};
137 | + +
138
139error[E0429]: `self` imports are only allowed within a { } list
140 --> $DIR/use-path-segment-kw.rs:197:23
141 |
142LL | pub use foobar::self as _self3;
143 | ^^^^^^
144 |
145help: consider importing the module directly
146 |
147LL - pub use foobar::self as _self3;
148LL + pub use foobar as _self3;
149 |
150help: alternatively, use the multi-path `use` syntax to import `self`
151 |
152LL | pub use foobar::{self as _self3};
153 | + +
154
155error[E0429]: `self` imports are only allowed within a { } list
156 --> $DIR/use-path-segment-kw.rs:202:18
157 |
158LL | use crate::self;
159 | ^^^^^^
160 |
161help: consider importing the module directly
162 |
163LL - use crate::self;
164LL + use crate;
165 |
166help: alternatively, use the multi-path `use` syntax to import `self`
167 |
168LL | use crate::{self};
169 | + +
170
171error: crate root imports need to be explicitly named: `use crate as name;`
172 --> $DIR/use-path-segment-kw.rs:202:13
173 |
174LL | use crate::self;
175 | ^^^^^
176
177error[E0429]: `self` imports are only allowed within a { } list
178 --> $DIR/use-path-segment-kw.rs:205:22
179 |
180LL | pub use crate::self as _self4;
181 | ^^^^^^
182 |
183help: consider importing the module directly
184 |
185LL - pub use crate::self as _self4;
186LL + pub use crate as _self4;
187 |
188help: alternatively, use the multi-path `use` syntax to import `self`
189 |
190LL | pub use crate::{self as _self4};
191 | + +
192
193error: crate root imports need to be explicitly named: `use crate as name;`
194 --> $DIR/use-path-segment-kw.rs:206:21
195 |
196LL | use crate::{self};
197 | ^^^^
198
199error[E0429]: `self` imports are only allowed within a { } list
200 --> $DIR/use-path-segment-kw.rs:211:18
201 |
202LL | use super::self;
203 | ^^^^^^
204 |
205help: consider importing the module directly
206 |
207LL - use super::self;
208LL + use super;
209 |
210help: alternatively, use the multi-path `use` syntax to import `self`
211 |
212LL | use super::{self};
213 | + +
214
215error[E0429]: `self` imports are only allowed within a { } list
216 --> $DIR/use-path-segment-kw.rs:213:22
217 |
218LL | pub use super::self as _self5;
219 | ^^^^^^
220 |
221help: consider importing the module directly
222 |
223LL - pub use super::self as _self5;
224LL + pub use super as _self5;
225 |
226help: alternatively, use the multi-path `use` syntax to import `self`
227 |
228LL | pub use super::{self as _self5};
229 | + +
230
231error[E0429]: `self` imports are only allowed within a { } list
232 --> $DIR/use-path-segment-kw.rs:219:17
233 |
234LL | use self::self;
235 | ^^^^^^
236 |
237help: consider importing the module directly
238 |
239LL - use self::self;
240LL + use self;
241 |
242help: alternatively, use the multi-path `use` syntax to import `self`
243 |
244LL | use self::{self};
245 | + +
246
247error[E0429]: `self` imports are only allowed within a { } list
248 --> $DIR/use-path-segment-kw.rs:220:21
249 |
250LL | pub use self::self as _self6;
251 | ^^^^^^
252 |
253help: consider importing the module directly
254 |
255LL - pub use self::self as _self6;
256LL + pub use self as _self6;
257 |
258help: alternatively, use the multi-path `use` syntax to import `self`
259 |
260LL | pub use self::{self as _self6};
261 | + +
262
263error[E0252]: the name `crate` is defined multiple times
264 --> $DIR/use-path-segment-kw.rs:134:13
265 |
266LL | use crate;
267 | ----- previous import of the module `crate` here
268...
269LL | use self::crate;
270 | ^^^^^^^^^^^ `crate` reimported here
271 |
272 = note: `crate` must be defined only once in the type namespace of this module
273
274error[E0252]: the name `crate` is defined multiple times
275 --> $DIR/use-path-segment-kw.rs:137:20
276 |
277LL | use crate;
278 | ----- previous import of the module `crate` here
279...
280LL | 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
288error[E0252]: the name `crate` is defined multiple times
289 --> $DIR/use-path-segment-kw.rs:202:13
290 |
291LL | use crate;
292 | ----- previous import of the module `crate` here
293...
294LL | use crate::self;
295 | ^^^^^^^^^^^ `crate` reimported here
296 |
297 = note: `crate` must be defined only once in the type namespace of this module
298
299error[E0252]: the name `crate` is defined multiple times
300 --> $DIR/use-path-segment-kw.rs:206:21
301 |
302LL | use crate;
303 | ----- previous import of the module `crate` here
304...
305LL | 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
313error: `$crate` may not be imported
314 --> $DIR/use-path-segment-kw.rs:9:9
315 |
316LL | use $crate;
317 | ^^^^^^^^^^^
318...
319LL | 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
324error: `$crate` may not be imported
325 --> $DIR/use-path-segment-kw.rs:10:9
326 |
327LL | pub use $crate as _dollar_crate;
328 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
329...
330LL | 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
335error: crate root imports need to be explicitly named: `use crate as name;`
336 --> $DIR/use-path-segment-kw.rs:49:21
337 |
338LL | use $crate::crate;
339 | ^^^^^
340...
341LL | 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
346error: crate root imports need to be explicitly named: `use crate as name;`
347 --> $DIR/use-path-segment-kw.rs:52:22
348 |
349LL | use $crate::{crate};
350 | ^^^^^
351...
352LL | 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
357error[E0429]: `self` imports are only allowed within a { } list
358 --> $DIR/use-path-segment-kw.rs:63:19
359 |
360LL | use $crate::self;
361 | ^^^^^^
362...
363LL | 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)
367help: consider importing the module directly
368 |
369LL - use $crate::self;
370LL + use $crate;
371 |
372help: alternatively, use the multi-path `use` syntax to import `self`
373 |
374LL | use $crate::{self};
375 | + +
376
377error: `$crate` may not be imported
378 --> $DIR/use-path-segment-kw.rs:63:9
379 |
380LL | use $crate::self;
381 | ^^^^^^^^^^^^^^^^^
382...
383LL | 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
388error[E0429]: `self` imports are only allowed within a { } list
389 --> $DIR/use-path-segment-kw.rs:66:23
390 |
391LL | pub use $crate::self as _m_self8;
392 | ^^^^^^
393...
394LL | 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)
398help: consider importing the module directly
399 |
400LL - pub use $crate::self as _m_self8;
401LL + pub use $crate as _m_self8;
402 |
403help: alternatively, use the multi-path `use` syntax to import `self`
404 |
405LL | pub use $crate::{self as _m_self8};
406 | + +
407
408error: `$crate` may not be imported
409 --> $DIR/use-path-segment-kw.rs:66:9
410 |
411LL | pub use $crate::self as _m_self8;
412 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
413...
414LL | 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
419error[E0252]: the name `<!dummy!>` is defined multiple times
420 --> $DIR/use-path-segment-kw.rs:63:13
421 |
422LL | use $crate;
423 | ------ previous import of the module `<!dummy!>` here
424...
425LL | use $crate::self;
426 | ^^^^^^^^^^^^ `<!dummy!>` reimported here
427...
428LL | 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
434error[E0252]: the name `$crate` is defined multiple times
435 --> $DIR/use-path-segment-kw.rs:68:22
436 |
437LL | use self::$crate;
438 | ------------ previous import of the module `$crate` here
439...
440LL | use $crate::{self};
441 | -------------^^^^--
442 | | |
443 | | `$crate` reimported here
444 | help: remove unnecessary import
445...
446LL | 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
452error[E0432]: unresolved import `crate`
453 --> $DIR/use-path-segment-kw.rs:102:13
454 |
455LL | use ::crate;
456 | ^^^^^^^ no `crate` in the root
457
458error[E0432]: unresolved import `crate`
459 --> $DIR/use-path-segment-kw.rs:104:13
460 |
461LL | use ::crate as _crate2;
462 | ^^^^^^^^^^^^^^^^^^ no `crate` in the root
463
464error[E0432]: unresolved import `crate`
465 --> $DIR/use-path-segment-kw.rs:105:16
466 |
467LL | use ::{crate};
468 | ^^^^^ no `crate` in the root
469
470error[E0432]: unresolved import `crate`
471 --> $DIR/use-path-segment-kw.rs:107:16
472 |
473LL | use ::{crate as _nested_crate2};
474 | ^^^^^^^^^^^^^^^^^^^^^^^ no `crate` in the root
475
476error[E0432]: unresolved import `foobar::crate`
477 --> $DIR/use-path-segment-kw.rs:110:13
478 |
479LL | use foobar::crate;
480 | ^^^^^^^^^^^^^ no `crate` in `foo::bar::foobar`
481
482error[E0432]: unresolved import `foobar::crate`
483 --> $DIR/use-path-segment-kw.rs:112:13
484 |
485LL | use foobar::crate as _crate3;
486 | ^^^^^^^^^^^^^^^^^^^^^^^^ no `crate` in `foo::bar::foobar`
487
488error[E0432]: unresolved import `foobar::crate`
489 --> $DIR/use-path-segment-kw.rs:113:22
490 |
491LL | use foobar::{crate};
492 | ^^^^^ no `crate` in `foo::bar::foobar`
493
494error[E0432]: unresolved import `foobar::crate`
495 --> $DIR/use-path-segment-kw.rs:115:22
496 |
497LL | use foobar::{crate as _nested_crate3};
498 | ^^^^^^^^^^^^^^^^^^^^^^^ no `crate` in `foo::bar::foobar`
499
500error[E0432]: unresolved import `crate::crate`
501 --> $DIR/use-path-segment-kw.rs:118:13
502 |
503LL | use crate::crate;
504 | ^^^^^^^^^^^^ no `crate` in the root
505
506error[E0432]: unresolved import `crate::crate`
507 --> $DIR/use-path-segment-kw.rs:120:13
508 |
509LL | use crate::crate as _crate4;
510 | ^^^^^^^^^^^^^^^^^^^^^^^ no `crate` in the root
511
512error[E0432]: unresolved import `crate::crate`
513 --> $DIR/use-path-segment-kw.rs:121:21
514 |
515LL | use crate::{crate};
516 | ^^^^^ no `crate` in the root
517
518error[E0432]: unresolved import `crate::crate`
519 --> $DIR/use-path-segment-kw.rs:123:21
520 |
521LL | use crate::{crate as _nested_crate4};
522 | ^^^^^^^^^^^^^^^^^^^^^^^ no `crate` in the root
523
524error[E0432]: unresolved import `super::crate`
525 --> $DIR/use-path-segment-kw.rs:126:13
526 |
527LL | use super::crate;
528 | ^^^^^^^^^^^^ no `crate` in `foo`
529
530error[E0432]: unresolved import `super::crate`
531 --> $DIR/use-path-segment-kw.rs:128:13
532 |
533LL | use super::crate as _crate5;
534 | ^^^^^^^^^^^^^^^^^^^^^^^ no `crate` in `foo`
535
536error[E0432]: unresolved import `super::crate`
537 --> $DIR/use-path-segment-kw.rs:129:21
538 |
539LL | use super::{crate};
540 | ^^^^^ no `crate` in `foo`
541
542error[E0432]: unresolved import `super::crate`
543 --> $DIR/use-path-segment-kw.rs:131:21
544 |
545LL | use super::{crate as _nested_crate5};
546 | ^^^^^^^^^^^^^^^^^^^^^^^ no `crate` in `foo`
547
548error[E0432]: unresolved import `super`
549 --> $DIR/use-path-segment-kw.rs:143:13
550 |
551LL | use super::{};
552 | ^^^^^^^^^ no `super` in the root
553
554error[E0432]: unresolved import `super`
555 --> $DIR/use-path-segment-kw.rs:146:13
556 |
557LL | use super;
558 | ^^^^^ no `super` in the root
559
560error[E0432]: unresolved import `super`
561 --> $DIR/use-path-segment-kw.rs:147:17
562 |
563LL | pub use super as _super;
564 | ^^^^^^^^^^^^^^^ no `super` in the root
565
566error[E0432]: unresolved import `super`
567 --> $DIR/use-path-segment-kw.rs:150:13
568 |
569LL | use ::super;
570 | ^^^^^^^ no `super` in the root
571
572error[E0432]: unresolved import `super`
573 --> $DIR/use-path-segment-kw.rs:151:13
574 |
575LL | use ::super as _super2;
576 | ^^^^^^^^^^^^^^^^^^ no `super` in the root
577
578error[E0432]: unresolved import `super`
579 --> $DIR/use-path-segment-kw.rs:152:16
580 |
581LL | use ::{super};
582 | ^^^^^ no `super` in the root
583
584error[E0432]: unresolved import `super`
585 --> $DIR/use-path-segment-kw.rs:153:16
586 |
587LL | use ::{super as _nested_super2};
588 | ^^^^^^^^^^^^^^^^^^^^^^^ no `super` in the root
589
590error[E0432]: unresolved import `foobar::super`
591 --> $DIR/use-path-segment-kw.rs:156:13
592 |
593LL | use foobar::super;
594 | ^^^^^^^^^^^^^ no `super` in `foo::bar::foobar`
595
596error[E0432]: unresolved import `foobar::super`
597 --> $DIR/use-path-segment-kw.rs:157:13
598 |
599LL | use foobar::super as _super3;
600 | ^^^^^^^^^^^^^^^^^^^^^^^^ no `super` in `foo::bar::foobar`
601
602error[E0432]: unresolved import `foobar::super`
603 --> $DIR/use-path-segment-kw.rs:158:22
604 |
605LL | use foobar::{super};
606 | ^^^^^ no `super` in `foo::bar::foobar`
607
608error[E0432]: unresolved import `foobar::super`
609 --> $DIR/use-path-segment-kw.rs:159:22
610 |
611LL | use foobar::{super as _nested_super3};
612 | ^^^^^^^^^^^^^^^^^^^^^^^ no `super` in `foo::bar::foobar`
613
614error[E0432]: unresolved import `crate::super`
615 --> $DIR/use-path-segment-kw.rs:162:13
616 |
617LL | use crate::super;
618 | ^^^^^^^^^^^^ no `super` in the root
619
620error[E0432]: unresolved import `crate::super`
621 --> $DIR/use-path-segment-kw.rs:163:13
622 |
623LL | use crate::super as _super4;
624 | ^^^^^^^^^^^^^^^^^^^^^^^ no `super` in the root
625
626error[E0432]: unresolved import `crate::super`
627 --> $DIR/use-path-segment-kw.rs:164:21
628 |
629LL | use crate::{super};
630 | ^^^^^ no `super` in the root
631
632error[E0432]: unresolved import `crate::super`
633 --> $DIR/use-path-segment-kw.rs:165:21
634 |
635LL | use crate::{super as _nested_super4};
636 | ^^^^^^^^^^^^^^^^^^^^^^^ no `super` in the root
637
638error[E0432]: unresolved import `super::super`
639 --> $DIR/use-path-segment-kw.rs:168:13
640 |
641LL | use super::super;
642 | ^^^^^^^^^^^^ no `super` in `foo`
643
644error[E0432]: unresolved import `super::super`
645 --> $DIR/use-path-segment-kw.rs:169:17
646 |
647LL | pub use super::super as _super5;
648 | ^^^^^^^^^^^^^^^^^^^^^^^ no `super` in `foo`
649
650error[E0432]: unresolved import `super::super`
651 --> $DIR/use-path-segment-kw.rs:170:21
652 |
653LL | use super::{super};
654 | ^^^^^ no `super` in `foo`
655
656error[E0432]: unresolved import `super::super`
657 --> $DIR/use-path-segment-kw.rs:171:25
658 |
659LL | pub use super::{super as _nested_super5};
660 | ^^^^^^^^^^^^^^^^^^^^^^^ no `super` in `foo`
661
662error[E0432]: unresolved import `self`
663 --> $DIR/use-path-segment-kw.rs:181:13
664 |
665LL | use self::{};
666 | ^^^^^^^^ no `self` in the root
667
668error[E0432]: unresolved import `{{root}}`
669 --> $DIR/use-path-segment-kw.rs:188:13
670 |
671LL | use ::self;
672 | ^^^^^^ no `{{root}}` in the root
673
674error[E0432]: unresolved import `{{root}}`
675 --> $DIR/use-path-segment-kw.rs:190:13
676 |
677LL | use ::self as _self2;
678 | ^^^^^^^^^^^^^^^^ no `{{root}}` in the root
679
680error[E0432]: unresolved import `super`
681 --> $DIR/use-path-segment-kw.rs:211:13
682 |
683LL | use super::self;
684 | ^^^^^^^^^^^ no `super` in the root
685
686error[E0432]: unresolved import `super`
687 --> $DIR/use-path-segment-kw.rs:213:17
688 |
689LL | pub use super::self as _self5;
690 | ^^^^^^^^^^^^^^^^^^^^^ no `super` in the root
691
692error[E0432]: unresolved import `super`
693 --> $DIR/use-path-segment-kw.rs:215:21
694 |
695LL | use super::{self};
696 | ^^^^ no `super` in the root
697
698error[E0432]: unresolved import `super`
699 --> $DIR/use-path-segment-kw.rs:216:25
700 |
701LL | pub use super::{self as _nested_self5};
702 | ^^^^^^^^^^^^^^^^^^^^^ no `super` in the root
703
704error[E0432]: unresolved import `self`
705 --> $DIR/use-path-segment-kw.rs:221:20
706 |
707LL | use self::{self};
708 | ^^^^ no `self` in the root
709
710error[E0432]: unresolved import `self`
711 --> $DIR/use-path-segment-kw.rs:222:24
712 |
713LL | pub use self::{self as _nested_self6};
714 | ^^^^^^^^^^^^^^^^^^^^^ no `self` in the root
715
716error[E0432]: unresolved import `$crate`
717 --> $DIR/use-path-segment-kw.rs:13:13
718 |
719LL | use ::$crate;
720 | ^^^^^^^^ no `$crate` in the root
721...
722LL | 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
727error[E0432]: unresolved import `$crate`
728 --> $DIR/use-path-segment-kw.rs:14:13
729 |
730LL | use ::$crate as _dollar_crate2;
731 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ no `$crate` in the root
732...
733LL | 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
738error[E0432]: unresolved import `$crate`
739 --> $DIR/use-path-segment-kw.rs:15:16
740 |
741LL | use ::{$crate};
742 | ^^^^^^ no `$crate` in the root
743...
744LL | 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
749error[E0432]: unresolved import `$crate`
750 --> $DIR/use-path-segment-kw.rs:16:16
751 |
752LL | use ::{$crate as _nested_dollar_crate2};
753 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `$crate` in the root
754...
755LL | 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
760error[E0432]: unresolved import `foobar::$crate`
761 --> $DIR/use-path-segment-kw.rs:19:13
762 |
763LL | use foobar::$crate;
764 | ^^^^^^^^^^^^^^ no `$crate` in `foo::bar::foobar`
765...
766LL | 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
771error[E0432]: unresolved import `foobar::$crate`
772 --> $DIR/use-path-segment-kw.rs:20:13
773 |
774LL | use foobar::$crate as _dollar_crate3;
775 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `$crate` in `foo::bar::foobar`
776...
777LL | 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
782error[E0432]: unresolved import `foobar::$crate`
783 --> $DIR/use-path-segment-kw.rs:21:22
784 |
785LL | use foobar::{$crate};
786 | ^^^^^^ no `$crate` in `foo::bar::foobar`
787...
788LL | 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
793error[E0432]: unresolved import `foobar::$crate`
794 --> $DIR/use-path-segment-kw.rs:22:22
795 |
796LL | use foobar::{$crate as _nested_dollar_crate3};
797 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `$crate` in `foo::bar::foobar`
798...
799LL | 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
804error[E0432]: unresolved import `crate::$crate`
805 --> $DIR/use-path-segment-kw.rs:25:13
806 |
807LL | use crate::$crate;
808 | ^^^^^^^^^^^^^ no `$crate` in the root
809...
810LL | 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
815error[E0432]: unresolved import `crate::$crate`
816 --> $DIR/use-path-segment-kw.rs:26:13
817 |
818LL | use crate::$crate as _dollar_crate4;
819 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `$crate` in the root
820...
821LL | 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
826error[E0432]: unresolved import `crate::$crate`
827 --> $DIR/use-path-segment-kw.rs:27:21
828 |
829LL | use crate::{$crate};
830 | ^^^^^^ no `$crate` in the root
831...
832LL | 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
837error[E0432]: unresolved import `crate::$crate`
838 --> $DIR/use-path-segment-kw.rs:28:21
839 |
840LL | use crate::{$crate as _nested_dollar_crate4};
841 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `$crate` in the root
842...
843LL | 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
848error[E0432]: unresolved import `super::$crate`
849 --> $DIR/use-path-segment-kw.rs:31:13
850 |
851LL | use super::$crate;
852 | ^^^^^^^^^^^^^ no `$crate` in `foo`
853...
854LL | 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
859error[E0432]: unresolved import `super::$crate`
860 --> $DIR/use-path-segment-kw.rs:32:13
861 |
862LL | use super::$crate as _dollar_crate5;
863 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `$crate` in `foo`
864...
865LL | 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
870error[E0432]: unresolved import `super::$crate`
871 --> $DIR/use-path-segment-kw.rs:33:21
872 |
873LL | use super::{$crate};
874 | ^^^^^^ no `$crate` in `foo`
875...
876LL | 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
881error[E0432]: unresolved import `super::$crate`
882 --> $DIR/use-path-segment-kw.rs:34:21
883 |
884LL | use super::{$crate as _nested_dollar_crate5};
885 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `$crate` in `foo`
886...
887LL | 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
892error[E0432]: unresolved import `$crate::$crate`
893 --> $DIR/use-path-segment-kw.rs:43:13
894 |
895LL | use $crate::$crate;
896 | ^^^^^^^^^^^^^^ no `$crate` in the root
897...
898LL | 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
903error[E0432]: unresolved import `$crate::$crate`
904 --> $DIR/use-path-segment-kw.rs:44:13
905 |
906LL | use $crate::$crate as _dollar_crate7;
907 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `$crate` in the root
908...
909LL | 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
914error[E0432]: unresolved import `$crate::$crate`
915 --> $DIR/use-path-segment-kw.rs:45:22
916 |
917LL | use $crate::{$crate};
918 | ^^^^^^ no `$crate` in the root
919...
920LL | 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
925error[E0432]: unresolved import `$crate::$crate`
926 --> $DIR/use-path-segment-kw.rs:46:22
927 |
928LL | use $crate::{$crate as _nested_dollar_crate7};
929 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `$crate` in the root
930...
931LL | 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
936error[E0432]: unresolved import `$crate::crate`
937 --> $DIR/use-path-segment-kw.rs:49:13
938 |
939LL | use $crate::crate;
940 | ^^^^^^^^^^^^^ no `crate` in the root
941...
942LL | 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
947error[E0432]: unresolved import `$crate::crate`
948 --> $DIR/use-path-segment-kw.rs:51:13
949 |
950LL | use $crate::crate as _m_crate8;
951 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ no `crate` in the root
952...
953LL | 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
958error[E0432]: unresolved import `$crate::crate`
959 --> $DIR/use-path-segment-kw.rs:52:22
960 |
961LL | use $crate::{crate};
962 | ^^^^^ no `crate` in the root
963...
964LL | 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
969error[E0432]: unresolved import `$crate::crate`
970 --> $DIR/use-path-segment-kw.rs:54:22
971 |
972LL | use $crate::{crate as _m_nested_crate8};
973 | ^^^^^^^^^^^^^^^^^^^^^^^^^ no `crate` in the root
974...
975LL | 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
980error[E0432]: unresolved import `$crate::super`
981 --> $DIR/use-path-segment-kw.rs:57:13
982 |
983LL | use $crate::super;
984 | ^^^^^^^^^^^^^ no `super` in the root
985...
986LL | 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
991error[E0432]: unresolved import `$crate::super`
992 --> $DIR/use-path-segment-kw.rs:58:13
993 |
994LL | use $crate::super as _m_super8;
995 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ no `super` in the root
996...
997LL | 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
1002error[E0432]: unresolved import `$crate::super`
1003 --> $DIR/use-path-segment-kw.rs:59:22
1004 |
1005LL | use $crate::{super};
1006 | ^^^^^ no `super` in the root
1007...
1008LL | 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
1013error[E0432]: unresolved import `$crate::super`
1014 --> $DIR/use-path-segment-kw.rs:60:22
1015 |
1016LL | use $crate::{super as _m_nested_super8};
1017 | ^^^^^^^^^^^^^^^^^^^^^^^^^ no `super` in the root
1018...
1019LL | 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
1024error[E0573]: expected type, found module `$crate`
1025 --> $DIR/use-path-segment-kw.rs:8:19
1026 |
1027LL | type A1 = $crate;
1028 | ^^^^^^ not a type
1029...
1030LL | 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
1035error[E0573]: expected type, found module `crate`
1036 --> $DIR/use-path-segment-kw.rs:97:19
1037 |
1038LL | type B1 = crate;
1039 | ^^^^^ not a type
1040
1041error[E0573]: expected type, found module `super`
1042 --> $DIR/use-path-segment-kw.rs:145:19
1043 |
1044LL | type C1 = super;
1045 | ^^^^^ not a type
1046
1047error[E0573]: expected type, found module `super::super`
1048 --> $DIR/use-path-segment-kw.rs:167:19
1049 |
1050LL | type C5 = super::super;
1051 | ^^^^^^^^^^^^ not a type
1052
1053error[E0573]: expected type, found module `self::super`
1054 --> $DIR/use-path-segment-kw.rs:173:19
1055 |
1056LL | type C6 = self::super;
1057 | ^^^^^^^^^^^ not a type
1058
1059error[E0573]: expected type, found module `self`
1060 --> $DIR/use-path-segment-kw.rs:183:19
1061 |
1062LL | type D1 = self;
1063 | ^^^^ not a type
1064
1065error[E0433]: global paths cannot start with `$crate`
1066 --> $DIR/use-path-segment-kw.rs:12:21
1067 |
1068LL | type A2 = ::$crate;
1069 | ^^^^^^ cannot start with this
1070...
1071LL | 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
1076error[E0433]: `$crate` in paths can only be used in start position
1077 --> $DIR/use-path-segment-kw.rs:18:27
1078 |
1079LL | type A3 = foobar::$crate;
1080 | ^^^^^^ can only be used in path start position
1081...
1082LL | 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
1087error[E0433]: `$crate` in paths can only be used in start position
1088 --> $DIR/use-path-segment-kw.rs:24:26
1089 |
1090LL | type A4 = crate::$crate;
1091 | ^^^^^^ can only be used in path start position
1092...
1093LL | 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
1098error[E0433]: `$crate` in paths can only be used in start position
1099 --> $DIR/use-path-segment-kw.rs:30:26
1100 |
1101LL | type A5 = super::$crate;
1102 | ^^^^^^ can only be used in path start position
1103...
1104LL | 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
1109error[E0433]: `$crate` in paths can only be used in start position
1110 --> $DIR/use-path-segment-kw.rs:36:25
1111 |
1112LL | type A6 = self::$crate;
1113 | ^^^^^^ can only be used in path start position
1114...
1115LL | 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
1120error[E0433]: `$crate` in paths can only be used in start position
1121 --> $DIR/use-path-segment-kw.rs:42:27
1122 |
1123LL | type A7 = $crate::$crate;
1124 | ^^^^^^ can only be used in path start position
1125...
1126LL | 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
1131error[E0433]: `crate` in paths can only be used in start position
1132 --> $DIR/use-path-segment-kw.rs:48:27
1133 |
1134LL | type A8 = $crate::crate;
1135 | ^^^^^ can only be used in path start position
1136...
1137LL | 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
1142error[E0433]: `super` in paths can only be used in start position
1143 --> $DIR/use-path-segment-kw.rs:56:27
1144 |
1145LL | type A9 = $crate::super;
1146 | ^^^^^ can only be used in path start position
1147...
1148LL | 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
1153error[E0433]: `self` in paths can only be used in start position
1154 --> $DIR/use-path-segment-kw.rs:62:28
1155 |
1156LL | type A10 = $crate::self;
1157 | ^^^^ can only be used in path start position
1158...
1159LL | 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
1164error[E0433]: global paths cannot start with `crate`
1165 --> $DIR/use-path-segment-kw.rs:101:21
1166 |
1167LL | type B2 = ::crate;
1168 | ^^^^^ cannot start with this
1169
1170error[E0433]: `crate` in paths can only be used in start position
1171 --> $DIR/use-path-segment-kw.rs:109:27
1172 |
1173LL | type B3 = foobar::crate;
1174 | ^^^^^ can only be used in path start position
1175
1176error[E0433]: `crate` in paths can only be used in start position
1177 --> $DIR/use-path-segment-kw.rs:117:26
1178 |
1179LL | type B4 = crate::crate;
1180 | ^^^^^ can only be used in path start position
1181
1182error[E0433]: `crate` in paths can only be used in start position
1183 --> $DIR/use-path-segment-kw.rs:125:26
1184 |
1185LL | type B5 = super::crate;
1186 | ^^^^^ can only be used in path start position
1187
1188error[E0433]: `crate` in paths can only be used in start position
1189 --> $DIR/use-path-segment-kw.rs:133:25
1190 |
1191LL | type B6 = self::crate;
1192 | ^^^^^ can only be used in path start position
1193
1194error[E0433]: global paths cannot start with `super`
1195 --> $DIR/use-path-segment-kw.rs:149:21
1196 |
1197LL | type C2 = ::super;
1198 | ^^^^^ cannot start with this
1199
1200error[E0433]: `super` in paths can only be used in start position
1201 --> $DIR/use-path-segment-kw.rs:155:27
1202 |
1203LL | type C3 = foobar::super;
1204 | ^^^^^ can only be used in path start position
1205
1206error[E0433]: `super` in paths can only be used in start position
1207 --> $DIR/use-path-segment-kw.rs:161:26
1208 |
1209LL | type C4 = crate::super;
1210 | ^^^^^ can only be used in path start position
1211
1212error[E0433]: global paths cannot start with `self`
1213 --> $DIR/use-path-segment-kw.rs:187:21
1214 |
1215LL | type D2 = ::self;
1216 | ^^^^ cannot start with this
1217
1218error[E0433]: `self` in paths can only be used in start position
1219 --> $DIR/use-path-segment-kw.rs:195:27
1220 |
1221LL | type D3 = foobar::self;
1222 | ^^^^ can only be used in path start position
1223
1224error[E0433]: `self` in paths can only be used in start position
1225 --> $DIR/use-path-segment-kw.rs:201:26
1226 |
1227LL | type D4 = crate::self;
1228 | ^^^^ can only be used in path start position
1229
1230error[E0433]: `self` in paths can only be used in start position
1231 --> $DIR/use-path-segment-kw.rs:210:26
1232 |
1233LL | type D5 = super::self;
1234 | ^^^^ can only be used in path start position
1235
1236error[E0433]: `self` in paths can only be used in start position
1237 --> $DIR/use-path-segment-kw.rs:218:25
1238 |
1239LL | type D6 = self::self;
1240 | ^^^^ can only be used in path start position
1241
1242error: aborting due to 141 previous errors
1243
1244Some errors have detailed explanations: E0252, E0429, E0431, E0432, E0433, E0573.
1245For more information about an error, try `rustc --explain E0252`.