diff --git a/Cargo.lock b/Cargo.lock index 146070cf16713..0b1b01557ba94 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3882,7 +3882,6 @@ dependencies = [ "termcolor", "termize", "tracing", - "unicode-width", "windows", ] diff --git a/compiler/rustc_ast_passes/messages.ftl b/compiler/rustc_ast_passes/messages.ftl index ca0b7f2ac3a67..df5c639382f04 100644 --- a/compiler/rustc_ast_passes/messages.ftl +++ b/compiler/rustc_ast_passes/messages.ftl @@ -155,8 +155,6 @@ ast_passes_impl_trait_path = `impl Trait` is not allowed in path parameters ast_passes_incompatible_features = `{$f1}` and `{$f2}` are incompatible, using them at the same time is not allowed .help = remove one of these features -ast_passes_incompatible_trait_bound_modifiers = `{$left}` and `{$right}` are mutually exclusive - ast_passes_inherent_cannot_be = inherent impls cannot be {$annotation} .because = {$annotation} because of this .type = inherent impl for this type diff --git a/compiler/rustc_ast_passes/src/ast_validation.rs b/compiler/rustc_ast_passes/src/ast_validation.rs index 34aac6e447304..1088db74cc966 100644 --- a/compiler/rustc_ast_passes/src/ast_validation.rs +++ b/compiler/rustc_ast_passes/src/ast_validation.rs @@ -1366,17 +1366,6 @@ impl<'a> Visitor<'a> for AstValidator<'a> { { self.dcx().emit_err(errors::TildeConstDisallowed { span, reason }); } - ( - _, - BoundConstness::Always(_) | BoundConstness::Maybe(_), - BoundPolarity::Negative(_) | BoundPolarity::Maybe(_), - ) => { - self.dcx().emit_err(errors::IncompatibleTraitBoundModifiers { - span: bound.span(), - left: modifiers.constness.as_str(), - right: modifiers.polarity.as_str(), - }); - } _ => {} } diff --git a/compiler/rustc_ast_passes/src/errors.rs b/compiler/rustc_ast_passes/src/errors.rs index 215ccd2ab4d9e..9151c4a7c7c59 100644 --- a/compiler/rustc_ast_passes/src/errors.rs +++ b/compiler/rustc_ast_passes/src/errors.rs @@ -656,15 +656,6 @@ pub enum TildeConstReason { Item, } -#[derive(Diagnostic)] -#[diag(ast_passes_incompatible_trait_bound_modifiers)] -pub struct IncompatibleTraitBoundModifiers { - #[primary_span] - pub span: Span, - pub left: &'static str, - pub right: &'static str, -} - #[derive(Diagnostic)] #[diag(ast_passes_const_and_async)] pub struct ConstAndAsync { diff --git a/compiler/rustc_errors/Cargo.toml b/compiler/rustc_errors/Cargo.toml index cc114fdcd8c35..2fff9f2de50fb 100644 --- a/compiler/rustc_errors/Cargo.toml +++ b/compiler/rustc_errors/Cargo.toml @@ -26,7 +26,6 @@ serde_json = "1.0.59" termcolor = "1.2.0" termize = "0.1.1" tracing = "0.1" -unicode-width = "0.1.4" # tidy-alphabetical-end [target.'cfg(windows)'.dependencies.windows] diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs index aa47ca166764b..58220c6549005 100644 --- a/compiler/rustc_errors/src/emitter.rs +++ b/compiler/rustc_errors/src/emitter.rs @@ -8,7 +8,7 @@ //! The output types are defined in `rustc_session::config::ErrorOutputType`. use rustc_span::source_map::SourceMap; -use rustc_span::{FileLines, FileName, SourceFile, Span}; +use rustc_span::{char_width, FileLines, FileName, SourceFile, Span}; use crate::snippet::{ Annotation, AnnotationColumn, AnnotationType, Line, MultilineAnnotation, Style, StyledString, @@ -677,10 +677,7 @@ impl HumanEmitter { .skip(left) .take_while(|ch| { // Make sure that the trimming on the right will fall within the terminal width. - // FIXME: `unicode_width` sometimes disagrees with terminals on how wide a `char` - // is. For now, just accept that sometimes the code line will be longer than - // desired. - let next = unicode_width::UnicodeWidthChar::width(*ch).unwrap_or(1); + let next = char_width(*ch); if taken + next > right - left { return false; } @@ -742,11 +739,7 @@ impl HumanEmitter { let left = margin.left(source_string.len()); // Account for unicode characters of width !=0 that were removed. - let left = source_string - .chars() - .take(left) - .map(|ch| unicode_width::UnicodeWidthChar::width(ch).unwrap_or(1)) - .sum(); + let left = source_string.chars().take(left).map(|ch| char_width(ch)).sum(); self.draw_line( buffer, @@ -2039,7 +2032,7 @@ impl HumanEmitter { let sub_len: usize = if is_whitespace_addition { &part.snippet } else { part.snippet.trim() } .chars() - .map(|ch| unicode_width::UnicodeWidthChar::width(ch).unwrap_or(1)) + .map(|ch| char_width(ch)) .sum(); let offset: isize = offsets @@ -2076,11 +2069,8 @@ impl HumanEmitter { } // length of the code after substitution - let full_sub_len = part - .snippet - .chars() - .map(|ch| unicode_width::UnicodeWidthChar::width(ch).unwrap_or(1)) - .sum::() as isize; + let full_sub_len = + part.snippet.chars().map(|ch| char_width(ch)).sum::() as isize; // length of the code to be substituted let snippet_len = span_end_pos as isize - span_start_pos as isize; @@ -2568,18 +2558,53 @@ fn num_decimal_digits(num: usize) -> usize { } // We replace some characters so the CLI output is always consistent and underlines aligned. +// Keep the following list in sync with `rustc_span::char_width`. const OUTPUT_REPLACEMENTS: &[(char, &str)] = &[ - ('\t', " "), // We do our own tab replacement + ('\t', " "), // We do our own tab replacement ('\u{200D}', ""), // Replace ZWJ with nothing for consistent terminal output of grapheme clusters. - ('\u{202A}', ""), // The following unicode text flow control characters are inconsistently - ('\u{202B}', ""), // supported across CLIs and can cause confusion due to the bytes on disk - ('\u{202D}', ""), // not corresponding to the visible source code, so we replace them always. - ('\u{202E}', ""), - ('\u{2066}', ""), - ('\u{2067}', ""), - ('\u{2068}', ""), - ('\u{202C}', ""), - ('\u{2069}', ""), + ('\u{202A}', "�"), // The following unicode text flow control characters are inconsistently + ('\u{202B}', "�"), // supported across CLIs and can cause confusion due to the bytes on disk + ('\u{202D}', "�"), // not corresponding to the visible source code, so we replace them always. + ('\u{202E}', "�"), + ('\u{2066}', "�"), + ('\u{2067}', "�"), + ('\u{2068}', "�"), + ('\u{202C}', "�"), + ('\u{2069}', "�"), + // In terminals without Unicode support the following will be garbled, but in *all* terminals + // the underlying codepoint will be as well. We could gate this replacement behind a "unicode + // support" gate. + ('\u{0000}', "␀"), + ('\u{0001}', "␁"), + ('\u{0002}', "␂"), + ('\u{0003}', "␃"), + ('\u{0004}', "␄"), + ('\u{0005}', "␅"), + ('\u{0006}', "␆"), + ('\u{0007}', "␇"), + ('\u{0008}', "␈"), + ('\u{000B}', "␋"), + ('\u{000C}', "␌"), + ('\u{000D}', "␍"), + ('\u{000E}', "␎"), + ('\u{000F}', "␏"), + ('\u{0010}', "␐"), + ('\u{0011}', "␑"), + ('\u{0012}', "␒"), + ('\u{0013}', "␓"), + ('\u{0014}', "␔"), + ('\u{0015}', "␕"), + ('\u{0016}', "␖"), + ('\u{0017}', "␗"), + ('\u{0018}', "␘"), + ('\u{0019}', "␙"), + ('\u{001A}', "␚"), + ('\u{001B}', "␛"), + ('\u{001C}', "␜"), + ('\u{001D}', "␝"), + ('\u{001E}', "␞"), + ('\u{001F}', "␟"), + ('\u{007F}', "␡"), ]; fn normalize_whitespace(str: &str) -> String { diff --git a/compiler/rustc_metadata/src/rmeta/decoder.rs b/compiler/rustc_metadata/src/rmeta/decoder.rs index e5e430bc90dcd..9874624ae2592 100644 --- a/compiler/rustc_metadata/src/rmeta/decoder.rs +++ b/compiler/rustc_metadata/src/rmeta/decoder.rs @@ -1728,7 +1728,6 @@ impl<'a, 'tcx> CrateMetadataRef<'a> { source_len, lines, multibyte_chars, - non_narrow_chars, normalized_pos, stable_id, .. @@ -1780,7 +1779,6 @@ impl<'a, 'tcx> CrateMetadataRef<'a> { self.cnum, lines, multibyte_chars, - non_narrow_chars, normalized_pos, source_file_index, ); diff --git a/compiler/rustc_parse/messages.ftl b/compiler/rustc_parse/messages.ftl index c79dad3953ba0..391a57917768d 100644 --- a/compiler/rustc_parse/messages.ftl +++ b/compiler/rustc_parse/messages.ftl @@ -53,6 +53,12 @@ parse_bare_cr = {$double_quotes -> parse_bare_cr_in_raw_string = bare CR not allowed in raw string +parse_binder_and_polarity = `for<...>` binder not allowed with `{$polarity}` trait polarity modifier + .label = there is not a well-defined meaning for a higher-ranked `{$polarity}` trait + +parse_binder_before_modifiers = `for<...>` binder should be placed before trait bound modifiers + .label = place the `for<...>` binder before any modifiers + parse_bounds_not_allowed_on_trait_aliases = bounds are not allowed on trait aliases parse_box_not_pat = expected pattern, found {$descr} @@ -577,6 +583,9 @@ parse_missing_trait_in_trait_impl = missing trait in a trait impl parse_modifier_lifetime = `{$modifier}` may only modify trait bounds, not lifetime bounds .suggestion = remove the `{$modifier}` +parse_modifiers_and_polarity = `{$modifiers_concatenated}` trait not allowed with `{$polarity}` trait polarity modifier + .label = there is not a well-defined meaning for a `{$modifiers_concatenated} {$polarity}` trait + parse_more_than_one_char = character literal may only contain one codepoint .followed_by = this `{$chr}` is followed by the combining {$len -> [one] mark diff --git a/compiler/rustc_parse/src/errors.rs b/compiler/rustc_parse/src/errors.rs index 109d36fe68998..2e81d2a876bac 100644 --- a/compiler/rustc_parse/src/errors.rs +++ b/compiler/rustc_parse/src/errors.rs @@ -3212,3 +3212,33 @@ pub struct UnsafeAttrOutsideUnsafeSuggestion { #[suggestion_part(code = ")")] pub right: Span, } + +#[derive(Diagnostic)] +#[diag(parse_binder_before_modifiers)] +pub struct BinderBeforeModifiers { + #[primary_span] + pub binder_span: Span, + #[label] + pub modifiers_span: Span, +} + +#[derive(Diagnostic)] +#[diag(parse_binder_and_polarity)] +pub struct BinderAndPolarity { + #[primary_span] + pub polarity_span: Span, + #[label] + pub binder_span: Span, + pub polarity: &'static str, +} + +#[derive(Diagnostic)] +#[diag(parse_modifiers_and_polarity)] +pub struct PolarityAndModifiers { + #[primary_span] + pub polarity_span: Span, + #[label] + pub modifiers_span: Span, + pub polarity: &'static str, + pub modifiers_concatenated: String, +} diff --git a/compiler/rustc_parse/src/parser/ty.rs b/compiler/rustc_parse/src/parser/ty.rs index a8134110010d3..f95ecd254ceb9 100644 --- a/compiler/rustc_parse/src/parser/ty.rs +++ b/compiler/rustc_parse/src/parser/ty.rs @@ -935,9 +935,14 @@ impl<'a> Parser<'a> { /// If no modifiers are present, this does not consume any tokens. /// /// ```ebnf - /// TRAIT_BOUND_MODIFIERS = [["~"] "const"] ["async"] ["?" | "!"] + /// CONSTNESS = [["~"] "const"] + /// ASYNCNESS = ["async"] + /// POLARITY = ["?" | "!"] /// ``` + /// + /// See `parse_generic_ty_bound` for the complete grammar of trait bound modifiers. fn parse_trait_bound_modifiers(&mut self) -> PResult<'a, TraitBoundModifiers> { + let modifier_lo = self.token.span; let constness = if self.eat(&token::Tilde) { let tilde = self.prev_token.span; self.expect_keyword(kw::Const)?; @@ -970,6 +975,7 @@ impl<'a> Parser<'a> { } else { BoundAsyncness::Normal }; + let modifier_hi = self.prev_token.span; let polarity = if self.eat(&token::Question) { BoundPolarity::Maybe(self.prev_token.span) @@ -980,13 +986,40 @@ impl<'a> Parser<'a> { BoundPolarity::Positive }; + // Enforce the mutual-exclusivity of `const`/`async` and `?`/`!`. + match polarity { + BoundPolarity::Positive => { + // All trait bound modifiers allowed to combine with positive polarity + } + BoundPolarity::Maybe(polarity_span) | BoundPolarity::Negative(polarity_span) => { + match (asyncness, constness) { + (BoundAsyncness::Normal, BoundConstness::Never) => { + // Ok, no modifiers. + } + (_, _) => { + let constness = constness.as_str(); + let asyncness = asyncness.as_str(); + let glue = + if !constness.is_empty() && !asyncness.is_empty() { " " } else { "" }; + let modifiers_concatenated = format!("{constness}{glue}{asyncness}"); + self.dcx().emit_err(errors::PolarityAndModifiers { + polarity_span, + polarity: polarity.as_str(), + modifiers_span: modifier_lo.to(modifier_hi), + modifiers_concatenated, + }); + } + } + } + } + Ok(TraitBoundModifiers { constness, asyncness, polarity }) } /// Parses a type bound according to: /// ```ebnf /// TY_BOUND = TY_BOUND_NOPAREN | (TY_BOUND_NOPAREN) - /// TY_BOUND_NOPAREN = [TRAIT_BOUND_MODIFIERS] [for] SIMPLE_PATH + /// TY_BOUND_NOPAREN = [for CONSTNESS ASYNCNESS | POLARITY] SIMPLE_PATH /// ``` /// /// For example, this grammar accepts `for<'a: 'b> ~const ?m::Trait<'a>`. @@ -996,9 +1029,25 @@ impl<'a> Parser<'a> { has_parens: bool, leading_token: &Token, ) -> PResult<'a, GenericBound> { - let modifiers = self.parse_trait_bound_modifiers()?; let (mut lifetime_defs, binder_span) = self.parse_late_bound_lifetime_defs()?; + let modifiers_lo = self.token.span; + let modifiers = self.parse_trait_bound_modifiers()?; + let modifiers_span = modifiers_lo.to(self.prev_token.span); + + if let Some(binder_span) = binder_span { + match modifiers.polarity { + BoundPolarity::Negative(polarity_span) | BoundPolarity::Maybe(polarity_span) => { + self.dcx().emit_err(errors::BinderAndPolarity { + binder_span, + polarity_span, + polarity: modifiers.polarity.as_str(), + }); + } + BoundPolarity::Positive => {} + } + } + // Recover erroneous lifetime bound with modifiers or binder. // e.g. `T: for<'a> 'a` or `T: ~const 'a`. if self.token.is_lifetime() { @@ -1006,6 +1055,11 @@ impl<'a> Parser<'a> { return self.parse_generic_lt_bound(lo, has_parens); } + if let (more_lifetime_defs, Some(binder_span)) = self.parse_late_bound_lifetime_defs()? { + lifetime_defs.extend(more_lifetime_defs); + self.dcx().emit_err(errors::BinderBeforeModifiers { binder_span, modifiers_span }); + } + let mut path = if self.token.is_keyword(kw::Fn) && self.look_ahead(1, |tok| tok.kind == TokenKind::OpenDelim(Delimiter::Parenthesis)) && let Some(path) = self.recover_path_from_fn() diff --git a/compiler/rustc_query_system/src/ich/impls_syntax.rs b/compiler/rustc_query_system/src/ich/impls_syntax.rs index 5bd4fe04848fb..39da5e395c42d 100644 --- a/compiler/rustc_query_system/src/ich/impls_syntax.rs +++ b/compiler/rustc_query_system/src/ich/impls_syntax.rs @@ -73,7 +73,6 @@ impl<'a> HashStable> for SourceFile { source_len: _, lines: _, ref multibyte_chars, - ref non_narrow_chars, ref normalized_pos, } = *self; @@ -98,11 +97,6 @@ impl<'a> HashStable> for SourceFile { char_pos.hash_stable(hcx, hasher); } - non_narrow_chars.len().hash_stable(hcx, hasher); - for &char_pos in non_narrow_chars.iter() { - char_pos.hash_stable(hcx, hasher); - } - normalized_pos.len().hash_stable(hcx, hasher); for &char_pos in normalized_pos.iter() { char_pos.hash_stable(hcx, hasher); diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs index bf7972e392c9a..046ae5fc5933d 100644 --- a/compiler/rustc_resolve/src/diagnostics.rs +++ b/compiler/rustc_resolve/src/diagnostics.rs @@ -2012,7 +2012,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { ) } else if ident.name == sym::core { ( - format!("maybe a missing crate `{ident}`?"), + format!("you might be missing crate `{ident}`"), Some(( vec![(ident.span, "std".to_string())], "try using `std` instead of `core`".to_string(), @@ -2021,7 +2021,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { ) } else if self.tcx.sess.is_rust_2015() { ( - format!("maybe a missing crate `{ident}`?"), + format!("you might be missing crate `{ident}`"), Some(( vec![], format!( diff --git a/compiler/rustc_span/src/analyze_source_file.rs b/compiler/rustc_span/src/analyze_source_file.rs index d9e1ebaf0bce0..ba7e0cec5bd80 100644 --- a/compiler/rustc_span/src/analyze_source_file.rs +++ b/compiler/rustc_span/src/analyze_source_file.rs @@ -1,5 +1,4 @@ use super::*; -use unicode_width::UnicodeWidthChar; #[cfg(test)] mod tests; @@ -9,15 +8,12 @@ mod tests; /// /// This function will use an SSE2 enhanced implementation if hardware support /// is detected at runtime. -pub fn analyze_source_file( - src: &str, -) -> (Vec, Vec, Vec) { +pub fn analyze_source_file(src: &str) -> (Vec, Vec) { let mut lines = vec![RelativeBytePos::from_u32(0)]; let mut multi_byte_chars = vec![]; - let mut non_narrow_chars = vec![]; // Calls the right implementation, depending on hardware support available. - analyze_source_file_dispatch(src, &mut lines, &mut multi_byte_chars, &mut non_narrow_chars); + analyze_source_file_dispatch(src, &mut lines, &mut multi_byte_chars); // The code above optimistically registers a new line *after* each \n // it encounters. If that point is already outside the source_file, remove @@ -30,7 +26,7 @@ pub fn analyze_source_file( } } - (lines, multi_byte_chars, non_narrow_chars) + (lines, multi_byte_chars) } cfg_match! { @@ -39,11 +35,10 @@ cfg_match! { src: &str, lines: &mut Vec, multi_byte_chars: &mut Vec, - non_narrow_chars: &mut Vec, ) { if is_x86_feature_detected!("sse2") { unsafe { - analyze_source_file_sse2(src, lines, multi_byte_chars, non_narrow_chars); + analyze_source_file_sse2(src, lines, multi_byte_chars); } } else { analyze_source_file_generic( @@ -52,7 +47,6 @@ cfg_match! { RelativeBytePos::from_u32(0), lines, multi_byte_chars, - non_narrow_chars, ); } } @@ -66,7 +60,6 @@ cfg_match! { src: &str, lines: &mut Vec, multi_byte_chars: &mut Vec, - non_narrow_chars: &mut Vec, ) { #[cfg(target_arch = "x86")] use std::arch::x86::*; @@ -159,7 +152,6 @@ cfg_match! { RelativeBytePos::from_usize(scan_start), lines, multi_byte_chars, - non_narrow_chars, ); } @@ -172,7 +164,6 @@ cfg_match! { RelativeBytePos::from_usize(tail_start), lines, multi_byte_chars, - non_narrow_chars, ); } } @@ -183,7 +174,6 @@ cfg_match! { src: &str, lines: &mut Vec, multi_byte_chars: &mut Vec, - non_narrow_chars: &mut Vec, ) { analyze_source_file_generic( src, @@ -191,7 +181,6 @@ cfg_match! { RelativeBytePos::from_u32(0), lines, multi_byte_chars, - non_narrow_chars, ); } } @@ -205,7 +194,6 @@ fn analyze_source_file_generic( output_offset: RelativeBytePos, lines: &mut Vec, multi_byte_chars: &mut Vec, - non_narrow_chars: &mut Vec, ) -> usize { assert!(src.len() >= scan_len); let mut i = 0; @@ -227,16 +215,8 @@ fn analyze_source_file_generic( let pos = RelativeBytePos::from_usize(i) + output_offset; - match byte { - b'\n' => { - lines.push(pos + RelativeBytePos(1)); - } - b'\t' => { - non_narrow_chars.push(NonNarrowChar::Tab(pos)); - } - _ => { - non_narrow_chars.push(NonNarrowChar::ZeroWidth(pos)); - } + if let b'\n' = byte { + lines.push(pos + RelativeBytePos(1)); } } else if byte >= 127 { // The slow path: @@ -252,14 +232,6 @@ fn analyze_source_file_generic( let mbc = MultiByteChar { pos, bytes: char_len as u8 }; multi_byte_chars.push(mbc); } - - // Assume control characters are zero width. - // FIXME: How can we decide between `width` and `width_cjk`? - let char_width = UnicodeWidthChar::width(c).unwrap_or(0); - - if char_width != 1 { - non_narrow_chars.push(NonNarrowChar::new(pos, char_width)); - } } i += char_len; diff --git a/compiler/rustc_span/src/analyze_source_file/tests.rs b/compiler/rustc_span/src/analyze_source_file/tests.rs index 0c77d080c17a0..e4a24239d8ea1 100644 --- a/compiler/rustc_span/src/analyze_source_file/tests.rs +++ b/compiler/rustc_span/src/analyze_source_file/tests.rs @@ -4,11 +4,10 @@ macro_rules! test { (case: $test_name:ident, text: $text:expr, lines: $lines:expr, - multi_byte_chars: $multi_byte_chars:expr, - non_narrow_chars: $non_narrow_chars:expr,) => { + multi_byte_chars: $multi_byte_chars:expr,) => { #[test] fn $test_name() { - let (lines, multi_byte_chars, non_narrow_chars) = analyze_source_file($text); + let (lines, multi_byte_chars) = analyze_source_file($text); let expected_lines: Vec = $lines.into_iter().map(RelativeBytePos).collect(); @@ -21,13 +20,6 @@ macro_rules! test { .collect(); assert_eq!(multi_byte_chars, expected_mbcs); - - let expected_nncs: Vec = $non_narrow_chars - .into_iter() - .map(|(pos, width)| NonNarrowChar::new(RelativeBytePos(pos), width)) - .collect(); - - assert_eq!(non_narrow_chars, expected_nncs); } }; } @@ -37,7 +29,6 @@ test!( text: "", lines: vec![], multi_byte_chars: vec![], - non_narrow_chars: vec![], ); test!( @@ -45,7 +36,6 @@ test!( text: "a\nc", lines: vec![0, 2], multi_byte_chars: vec![], - non_narrow_chars: vec![], ); test!( @@ -53,7 +43,6 @@ test!( text: "012345678\nabcdef012345678\na", lines: vec![0, 10, 26], multi_byte_chars: vec![], - non_narrow_chars: vec![], ); test!( @@ -61,7 +50,6 @@ test!( text: "01234β789\nbcdef0123456789abcdef", lines: vec![0, 11], multi_byte_chars: vec![(5, 2)], - non_narrow_chars: vec![], ); test!( @@ -69,7 +57,6 @@ test!( text: "01234\u{07}6789\nbcdef0123456789abcdef", lines: vec![0, 11], multi_byte_chars: vec![], - non_narrow_chars: vec![(5, 0)], ); test!( @@ -77,7 +64,6 @@ test!( text: "aβc", lines: vec![0], multi_byte_chars: vec![(1, 2)], - non_narrow_chars: vec![], ); test!( @@ -85,7 +71,6 @@ test!( text: "0123456789abcΔf012345β", lines: vec![0], multi_byte_chars: vec![(13, 2), (22, 2)], - non_narrow_chars: vec![], ); test!( @@ -93,7 +78,6 @@ test!( text: "0123456789abcdeΔ123456789abcdef01234", lines: vec![0], multi_byte_chars: vec![(15, 2)], - non_narrow_chars: vec![], ); test!( @@ -101,7 +85,6 @@ test!( text: "0123456789abcdeΔ....", lines: vec![0], multi_byte_chars: vec![(15, 2)], - non_narrow_chars: vec![], ); test!( @@ -109,7 +92,6 @@ test!( text: "0\t2", lines: vec![0], multi_byte_chars: vec![], - non_narrow_chars: vec![(1, 4)], ); test!( @@ -117,7 +99,6 @@ test!( text: "01\t3456789abcdef01234567\u{07}9", lines: vec![0], multi_byte_chars: vec![], - non_narrow_chars: vec![(2, 4), (24, 0)], ); test!( @@ -125,5 +106,4 @@ test!( text: "01\t345\n789abcΔf01234567\u{07}9\nbcΔf", lines: vec![0, 7, 27], multi_byte_chars: vec![(13, 2), (29, 2)], - non_narrow_chars: vec![(2, 4), (24, 0)], ); diff --git a/compiler/rustc_span/src/lib.rs b/compiler/rustc_span/src/lib.rs index 266956d63d710..7c8ac3be4beca 100644 --- a/compiler/rustc_span/src/lib.rs +++ b/compiler/rustc_span/src/lib.rs @@ -1345,68 +1345,6 @@ pub struct MultiByteChar { pub bytes: u8, } -/// Identifies an offset of a non-narrow character in a `SourceFile`. -#[derive(Copy, Clone, Encodable, Decodable, Eq, PartialEq, Debug, HashStable_Generic)] -pub enum NonNarrowChar { - /// Represents a zero-width character. - ZeroWidth(RelativeBytePos), - /// Represents a wide (full-width) character. - Wide(RelativeBytePos), - /// Represents a tab character, represented visually with a width of 4 characters. - Tab(RelativeBytePos), -} - -impl NonNarrowChar { - fn new(pos: RelativeBytePos, width: usize) -> Self { - match width { - 0 => NonNarrowChar::ZeroWidth(pos), - 2 => NonNarrowChar::Wide(pos), - 4 => NonNarrowChar::Tab(pos), - _ => panic!("width {width} given for non-narrow character"), - } - } - - /// Returns the relative offset of the character in the `SourceFile`. - pub fn pos(&self) -> RelativeBytePos { - match *self { - NonNarrowChar::ZeroWidth(p) | NonNarrowChar::Wide(p) | NonNarrowChar::Tab(p) => p, - } - } - - /// Returns the width of the character, 0 (zero-width) or 2 (wide). - pub fn width(&self) -> usize { - match *self { - NonNarrowChar::ZeroWidth(_) => 0, - NonNarrowChar::Wide(_) => 2, - NonNarrowChar::Tab(_) => 4, - } - } -} - -impl Add for NonNarrowChar { - type Output = Self; - - fn add(self, rhs: RelativeBytePos) -> Self { - match self { - NonNarrowChar::ZeroWidth(pos) => NonNarrowChar::ZeroWidth(pos + rhs), - NonNarrowChar::Wide(pos) => NonNarrowChar::Wide(pos + rhs), - NonNarrowChar::Tab(pos) => NonNarrowChar::Tab(pos + rhs), - } - } -} - -impl Sub for NonNarrowChar { - type Output = Self; - - fn sub(self, rhs: RelativeBytePos) -> Self { - match self { - NonNarrowChar::ZeroWidth(pos) => NonNarrowChar::ZeroWidth(pos - rhs), - NonNarrowChar::Wide(pos) => NonNarrowChar::Wide(pos - rhs), - NonNarrowChar::Tab(pos) => NonNarrowChar::Tab(pos - rhs), - } - } -} - /// Identifies an offset of a character that was normalized away from `SourceFile`. #[derive(Copy, Clone, Encodable, Decodable, Eq, PartialEq, Debug, HashStable_Generic)] pub struct NormalizedPos { @@ -1581,8 +1519,6 @@ pub struct SourceFile { pub lines: FreezeLock, /// Locations of multi-byte characters in the source code. pub multibyte_chars: Vec, - /// Width of characters that are not narrow in the source code. - pub non_narrow_chars: Vec, /// Locations of characters removed during normalization. pub normalized_pos: Vec, /// A hash of the filename & crate-id, used for uniquely identifying source @@ -1604,7 +1540,6 @@ impl Clone for SourceFile { source_len: self.source_len, lines: self.lines.clone(), multibyte_chars: self.multibyte_chars.clone(), - non_narrow_chars: self.non_narrow_chars.clone(), normalized_pos: self.normalized_pos.clone(), stable_id: self.stable_id, cnum: self.cnum, @@ -1679,7 +1614,6 @@ impl Encodable for SourceFile { } self.multibyte_chars.encode(s); - self.non_narrow_chars.encode(s); self.stable_id.encode(s); self.normalized_pos.encode(s); self.cnum.encode(s); @@ -1706,7 +1640,6 @@ impl Decodable for SourceFile { } }; let multibyte_chars: Vec = Decodable::decode(d); - let non_narrow_chars: Vec = Decodable::decode(d); let stable_id = Decodable::decode(d); let normalized_pos: Vec = Decodable::decode(d); let cnum: CrateNum = Decodable::decode(d); @@ -1721,7 +1654,6 @@ impl Decodable for SourceFile { external_src: FreezeLock::frozen(ExternalSource::Unneeded), lines: FreezeLock::new(lines), multibyte_chars, - non_narrow_chars, normalized_pos, stable_id, cnum, @@ -1809,8 +1741,7 @@ impl SourceFile { let source_len = src.len(); let source_len = u32::try_from(source_len).map_err(|_| OffsetOverflowError)?; - let (lines, multibyte_chars, non_narrow_chars) = - analyze_source_file::analyze_source_file(&src); + let (lines, multibyte_chars) = analyze_source_file::analyze_source_file(&src); Ok(SourceFile { name, @@ -1821,7 +1752,6 @@ impl SourceFile { source_len: RelativeBytePos::from_u32(source_len), lines: FreezeLock::frozen(SourceFileLines::Lines(lines)), multibyte_chars, - non_narrow_chars, normalized_pos, stable_id, cnum: LOCAL_CRATE, @@ -2130,41 +2060,45 @@ impl SourceFile { let pos = self.relative_position(pos); let (line, col_or_chpos) = self.lookup_file_pos(pos); if line > 0 { - let col = col_or_chpos; - let linebpos = self.lines()[line - 1]; - let col_display = { - let start_width_idx = self - .non_narrow_chars - .binary_search_by_key(&linebpos, |x| x.pos()) - .unwrap_or_else(|x| x); - let end_width_idx = self - .non_narrow_chars - .binary_search_by_key(&pos, |x| x.pos()) - .unwrap_or_else(|x| x); - let special_chars = end_width_idx - start_width_idx; - let non_narrow: usize = self.non_narrow_chars[start_width_idx..end_width_idx] - .iter() - .map(|x| x.width()) - .sum(); - col.0 - special_chars + non_narrow + let Some(code) = self.get_line(line - 1) else { + // If we don't have the code available, it is ok as a fallback to return the bytepos + // instead of the "display" column, which is only used to properly show underlines + // in the terminal. + // FIXME: we'll want better handling of this in the future for the sake of tools + // that want to use the display col instead of byte offsets to modify Rust code, but + // that is a problem for another day, the previous code was already incorrect for + // both displaying *and* third party tools using the json output naïvely. + tracing::info!("couldn't find line {line} {:?}", self.name); + return (line, col_or_chpos, col_or_chpos.0); }; - (line, col, col_display) + let display_col = code.chars().take(col_or_chpos.0).map(|ch| char_width(ch)).sum(); + (line, col_or_chpos, display_col) } else { - let chpos = col_or_chpos; - let col_display = { - let end_width_idx = self - .non_narrow_chars - .binary_search_by_key(&pos, |x| x.pos()) - .unwrap_or_else(|x| x); - let non_narrow: usize = - self.non_narrow_chars[0..end_width_idx].iter().map(|x| x.width()).sum(); - chpos.0 - end_width_idx + non_narrow - }; - (0, chpos, col_display) + // This is never meant to happen? + (0, col_or_chpos, col_or_chpos.0) } } } +pub fn char_width(ch: char) -> usize { + // FIXME: `unicode_width` sometimes disagrees with terminals on how wide a `char` is. For now, + // just accept that sometimes the code line will be longer than desired. + match ch { + '\t' => 4, + // Keep the following list in sync with `rustc_errors::emitter::OUTPUT_REPLACEMENTS`. These + // are control points that we replace before printing with a visible codepoint for the sake + // of being able to point at them with underlines. + '\u{0000}' | '\u{0001}' | '\u{0002}' | '\u{0003}' | '\u{0004}' | '\u{0005}' + | '\u{0006}' | '\u{0007}' | '\u{0008}' | '\u{000B}' | '\u{000C}' | '\u{000D}' + | '\u{000E}' | '\u{000F}' | '\u{0010}' | '\u{0011}' | '\u{0012}' | '\u{0013}' + | '\u{0014}' | '\u{0015}' | '\u{0016}' | '\u{0017}' | '\u{0018}' | '\u{0019}' + | '\u{001A}' | '\u{001B}' | '\u{001C}' | '\u{001D}' | '\u{001E}' | '\u{001F}' + | '\u{007F}' | '\u{202A}' | '\u{202B}' | '\u{202D}' | '\u{202E}' | '\u{2066}' + | '\u{2067}' | '\u{2068}' | '\u{202C}' | '\u{2069}' => 1, + _ => unicode_width::UnicodeWidthChar::width(ch).unwrap_or(1), + } +} + /// Normalizes the source code and records the normalizations. fn normalize_src(src: &mut String) -> Vec { let mut normalized_pos = vec![]; diff --git a/compiler/rustc_span/src/source_map.rs b/compiler/rustc_span/src/source_map.rs index fb212d67997a7..14c157a0111ce 100644 --- a/compiler/rustc_span/src/source_map.rs +++ b/compiler/rustc_span/src/source_map.rs @@ -330,7 +330,6 @@ impl SourceMap { cnum: CrateNum, file_local_lines: FreezeLock, multibyte_chars: Vec, - non_narrow_chars: Vec, normalized_pos: Vec, metadata_index: u32, ) -> Lrc { @@ -348,7 +347,6 @@ impl SourceMap { source_len, lines: file_local_lines, multibyte_chars, - non_narrow_chars, normalized_pos, stable_id, cnum, diff --git a/compiler/rustc_span/src/source_map/tests.rs b/compiler/rustc_span/src/source_map/tests.rs index dcb02da371921..0c818b94b85a3 100644 --- a/compiler/rustc_span/src/source_map/tests.rs +++ b/compiler/rustc_span/src/source_map/tests.rs @@ -232,7 +232,6 @@ fn t10() { source_len, lines, multibyte_chars, - non_narrow_chars, normalized_pos, stable_id, .. @@ -246,7 +245,6 @@ fn t10() { CrateNum::ZERO, FreezeLock::new(lines.read().clone()), multibyte_chars, - non_narrow_chars, normalized_pos, 0, ); diff --git a/compiler/rustc_trait_selection/src/traits/project.rs b/compiler/rustc_trait_selection/src/traits/project.rs index 1d7a05150444f..b96e0c8a97757 100644 --- a/compiler/rustc_trait_selection/src/traits/project.rs +++ b/compiler/rustc_trait_selection/src/traits/project.rs @@ -1202,6 +1202,12 @@ fn assemble_candidates_from_impls<'cx, 'tcx>( false } } + } else if tcx.trait_is_auto(trait_ref.def_id) { + tcx.dcx().span_delayed_bug( + tcx.def_span(obligation.predicate.def_id), + "associated types not allowed on auto traits", + ); + false } else { bug!("unexpected builtin trait with associated type: {trait_ref:?}") } diff --git a/src/tools/run-make-support/src/external_deps/c_build.rs b/src/tools/run-make-support/src/external_deps/c_build.rs index 35b2bf75c95f5..86c9c08183197 100644 --- a/src/tools/run-make-support/src/external_deps/c_build.rs +++ b/src/tools/run-make-support/src/external_deps/c_build.rs @@ -1,10 +1,13 @@ use std::path::PathBuf; -use crate::artifact_names::static_lib_name; +use super::cygpath::get_windows_path; +use crate::artifact_names::{dynamic_lib_name, static_lib_name}; use crate::external_deps::cc::cc; use crate::external_deps::llvm::llvm_ar; use crate::path_helpers::path; -use crate::targets::is_msvc; +use crate::targets::{is_darwin, is_msvc, is_windows}; + +// FIXME(Oneirical): These native build functions should take a Path-based generic. /// Builds a static lib (`.lib` on Windows MSVC and `.a` for the rest) with the given name. #[track_caller] @@ -25,3 +28,33 @@ pub fn build_native_static_lib(lib_name: &str) -> PathBuf { llvm_ar().obj_to_ar().output_input(&lib_path, &obj_file).run(); path(lib_path) } + +/// Builds a dynamic lib. The filename is computed in a target-dependent manner, relying on +/// [`std::env::consts::DLL_PREFIX`] and [`std::env::consts::DLL_EXTENSION`]. +#[track_caller] +pub fn build_native_dynamic_lib(lib_name: &str) -> PathBuf { + let obj_file = if is_msvc() { format!("{lib_name}") } else { format!("{lib_name}.o") }; + let src = format!("{lib_name}.c"); + let lib_path = dynamic_lib_name(lib_name); + if is_msvc() { + cc().arg("-c").out_exe(&obj_file).input(src).run(); + } else { + cc().arg("-v").arg("-c").out_exe(&obj_file).input(src).run(); + }; + let obj_file = if is_msvc() { format!("{lib_name}.obj") } else { format!("{lib_name}.o") }; + if is_msvc() { + let mut out_arg = "-out:".to_owned(); + out_arg.push_str(&get_windows_path(&lib_path)); + cc().input(&obj_file).args(&["-link", "-dll", &out_arg]).run(); + } else if is_darwin() { + cc().out_exe(&lib_path).input(&obj_file).args(&["-dynamiclib", "-Wl,-dylib"]).run(); + } else if is_windows() { + cc().out_exe(&lib_path) + .input(&obj_file) + .args(&["-shared", &format!("-Wl,--out-implib={lib_path}.a")]) + .run(); + } else { + cc().out_exe(&lib_path).input(&obj_file).arg("-shared").run(); + } + path(lib_path) +} diff --git a/src/tools/run-make-support/src/fs.rs b/src/tools/run-make-support/src/fs.rs index f346e983aea8b..0a79616163308 100644 --- a/src/tools/run-make-support/src/fs.rs +++ b/src/tools/run-make-support/src/fs.rs @@ -1,5 +1,5 @@ use std::io; -use std::path::Path; +use std::path::{Path, PathBuf}; // FIXME(jieyouxu): modify create_symlink to panic on windows. @@ -176,3 +176,16 @@ pub fn set_permissions>(path: P, perm: std::fs::Permissions) { path.as_ref().display() )); } + +/// A function which prints all file names in the directory `dir` similarly to Unix's `ls`. +/// Useful for debugging. +/// Usage: `eprintln!("{:#?}", shallow_find_dir_entries(some_dir));` +#[track_caller] +pub fn shallow_find_dir_entries>(dir: P) -> Vec { + let paths = read_dir(dir); + let mut output = Vec::new(); + for path in paths { + output.push(path.unwrap().path()); + } + output +} diff --git a/src/tools/run-make-support/src/lib.rs b/src/tools/run-make-support/src/lib.rs index b85191970de62..a4bb9056346d9 100644 --- a/src/tools/run-make-support/src/lib.rs +++ b/src/tools/run-make-support/src/lib.rs @@ -43,7 +43,7 @@ pub use wasmparser; pub use external_deps::{c_build, cc, clang, htmldocck, llvm, python, rustc, rustdoc}; // These rely on external dependencies. -pub use c_build::build_native_static_lib; +pub use c_build::{build_native_dynamic_lib, build_native_static_lib}; pub use cc::{cc, extra_c_flags, extra_cxx_flags, Cc}; pub use clang::{clang, Clang}; pub use htmldocck::htmldocck; diff --git a/src/tools/rustfmt/tests/source/type.rs b/src/tools/rustfmt/tests/source/type.rs index 61ef73a3cab1c..7a232f85198a8 100644 --- a/src/tools/rustfmt/tests/source/type.rs +++ b/src/tools/rustfmt/tests/source/type.rs @@ -146,8 +146,6 @@ trait T: ~ const Super {} const fn not_quite_const() -> i32 { ::CONST } -struct S(std::marker::PhantomData); - impl ~ const T {} fn apit(_: impl ~ const T) {} diff --git a/src/tools/rustfmt/tests/target/negative-bounds.rs b/src/tools/rustfmt/tests/target/negative-bounds.rs index 4fb35cccf6684..9fcb86ef4a429 100644 --- a/src/tools/rustfmt/tests/target/negative-bounds.rs +++ b/src/tools/rustfmt/tests/target/negative-bounds.rs @@ -3,9 +3,3 @@ where i32: !Copy, { } - -fn maybe_const_negative() -where - i32: ~const !Copy, -{ -} diff --git a/src/tools/rustfmt/tests/target/type.rs b/src/tools/rustfmt/tests/target/type.rs index c789ecb055a7d..325adb52f3f99 100644 --- a/src/tools/rustfmt/tests/target/type.rs +++ b/src/tools/rustfmt/tests/target/type.rs @@ -153,8 +153,6 @@ const fn not_quite_const() -> i32 { ::CONST } -struct S(std::marker::PhantomData); - impl ~const T {} fn apit(_: impl ~const T) {} diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt index 4042bac8dacd6..f5d7b1adf5151 100644 --- a/src/tools/tidy/src/allowed_run_make_makefiles.txt +++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt @@ -1,6 +1,4 @@ run-make/branch-protection-check-IBT/Makefile -run-make/c-dynamic-dylib/Makefile -run-make/c-dynamic-rlib/Makefile run-make/c-unwind-abi-catch-lib-panic/Makefile run-make/cat-and-grep-sanity-check/Makefile run-make/cdylib-dylib-linkage/Makefile @@ -51,7 +49,6 @@ run-make/panic-abort-eh_frame/Makefile run-make/pdb-buildinfo-cl-cmd/Makefile run-make/pgo-gen-lto/Makefile run-make/pgo-indirect-call-promotion/Makefile -run-make/pointer-auth-link-with-c/Makefile run-make/print-calling-conventions/Makefile run-make/print-target-list/Makefile run-make/raw-dylib-alt-calling-convention/Makefile diff --git a/src/tools/tidy/src/ui_tests.rs b/src/tools/tidy/src/ui_tests.rs index 5e6992038e395..0ae0356b2c452 100644 --- a/src/tools/tidy/src/ui_tests.rs +++ b/src/tools/tidy/src/ui_tests.rs @@ -16,7 +16,7 @@ use std::path::{Path, PathBuf}; const ENTRY_LIMIT: u32 = 901; // FIXME: The following limits should be reduced eventually. -const ISSUES_ENTRY_LIMIT: u32 = 1672; +const ISSUES_ENTRY_LIMIT: u32 = 1673; const EXPECTED_TEST_FILE_EXTENSIONS: &[&str] = &[ "rs", // test source files diff --git a/tests/crashes/117829-2.rs b/tests/crashes/117829-2.rs deleted file mode 100644 index ecfd3148569df..0000000000000 --- a/tests/crashes/117829-2.rs +++ /dev/null @@ -1,14 +0,0 @@ -//@ known-bug: #117829 -#![feature(auto_traits)] - -trait B {} - -auto trait Z -where - T: Z, - >::W: B, -{ - type W; -} - -fn main() {} diff --git a/tests/crashes/117829.rs b/tests/crashes/117829.rs deleted file mode 100644 index 7544b5ec0fceb..0000000000000 --- a/tests/crashes/117829.rs +++ /dev/null @@ -1,9 +0,0 @@ -//@ known-bug: #117829 -auto trait Z<'a, T: ?Sized> -where - T: Z<'a, u16>, - - for<'b> >::W: Clone, -{ - type W: ?Sized; -} diff --git a/tests/run-make/c-dynamic-dylib/Makefile b/tests/run-make/c-dynamic-dylib/Makefile deleted file mode 100644 index 39561b28222ca..0000000000000 --- a/tests/run-make/c-dynamic-dylib/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -# This test checks that dynamic Rust linking with C does not encounter any errors, with dynamic dependencies given preference over static. -# See https://github.com/rust-lang/rust/issues/10434 - -# ignore-cross-compile -include ../tools.mk - -# ignore-apple -# -# This hits an assertion in the linker on older versions of osx apparently - -all: $(call DYLIB,cfoo) - $(RUSTC) foo.rs -C prefer-dynamic - $(RUSTC) bar.rs - $(call RUN,bar) - $(call REMOVE_DYLIBS,cfoo) - $(call FAIL,bar) diff --git a/tests/run-make/c-dynamic-dylib/rmake.rs b/tests/run-make/c-dynamic-dylib/rmake.rs new file mode 100644 index 0000000000000..65b5e02abf087 --- /dev/null +++ b/tests/run-make/c-dynamic-dylib/rmake.rs @@ -0,0 +1,17 @@ +// This test checks that dynamic Rust linking with C does not encounter any errors in both +// compilation and execution, with dynamic dependencies given preference over static. +// See https://github.com/rust-lang/rust/issues/10434 + +//@ ignore-cross-compile +// Reason: the compiled binary is executed + +use run_make_support::{build_native_dynamic_lib, dynamic_lib_name, rfs, run, run_fail, rustc}; + +fn main() { + build_native_dynamic_lib("cfoo"); + rustc().input("foo.rs").arg("-Cprefer-dynamic").run(); + rustc().input("bar.rs").run(); + run("bar"); + rfs::remove_file(dynamic_lib_name("cfoo")); + run_fail("bar"); +} diff --git a/tests/run-make/c-dynamic-rlib/Makefile b/tests/run-make/c-dynamic-rlib/Makefile deleted file mode 100644 index 7b05e3d91a098..0000000000000 --- a/tests/run-make/c-dynamic-rlib/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -# This test checks that dynamic Rust linking with C does not encounter any errors, with static dependencies given preference over dynamic. (This is the default behaviour.) -# See https://github.com/rust-lang/rust/issues/10434 - -# ignore-cross-compile -include ../tools.mk - -# ignore-apple -# -# This hits an assertion in the linker on older versions of osx apparently - -# This overrides the LD_LIBRARY_PATH for RUN -TARGET_RPATH_DIR:=$(TARGET_RPATH_DIR):$(TMPDIR) - -all: $(call DYLIB,cfoo) - $(RUSTC) foo.rs - $(RUSTC) bar.rs - $(call RUN,bar) - $(call REMOVE_DYLIBS,cfoo) - $(call FAIL,bar) diff --git a/tests/run-make/c-dynamic-rlib/rmake.rs b/tests/run-make/c-dynamic-rlib/rmake.rs new file mode 100644 index 0000000000000..b59887bbdd631 --- /dev/null +++ b/tests/run-make/c-dynamic-rlib/rmake.rs @@ -0,0 +1,18 @@ +// This test checks that dynamic Rust linking with C does not encounter any errors in both +// compilation and execution, with static dependencies given preference over dynamic. +// (This is the default behaviour.) +// See https://github.com/rust-lang/rust/issues/10434 + +//@ ignore-cross-compile +// Reason: the compiled binary is executed + +use run_make_support::{build_native_dynamic_lib, dynamic_lib_name, rfs, run, run_fail, rustc}; + +fn main() { + build_native_dynamic_lib("cfoo"); + rustc().input("foo.rs").run(); + rustc().input("bar.rs").run(); + run("bar"); + rfs::remove_file(dynamic_lib_name("cfoo")); + run_fail("bar"); +} diff --git a/tests/run-make/pointer-auth-link-with-c/Makefile b/tests/run-make/pointer-auth-link-with-c/Makefile deleted file mode 100644 index 8fcf10e2096cd..0000000000000 --- a/tests/run-make/pointer-auth-link-with-c/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -include ../tools.mk - -# only-aarch64 -# ignore-cross-compile - -all: - $(COMPILE_OBJ) $(TMPDIR)/test.o test.c - $(AR) rcs $(TMPDIR)/libtest.a $(TMPDIR)/test.o - $(RUSTC) --target $(TARGET) -Z branch-protection=bti,pac-ret,leaf test.rs - $(call RUN,test) - - $(COMPILE_OBJ) $(TMPDIR)/test.o test.c -mbranch-protection=bti+pac-ret+leaf - $(AR) rcs $(TMPDIR)/libtest.a $(TMPDIR)/test.o - $(RUSTC) --target $(TARGET) -Z branch-protection=bti,pac-ret,leaf test.rs - $(call RUN,test) diff --git a/tests/run-make/pointer-auth-link-with-c/rmake.rs b/tests/run-make/pointer-auth-link-with-c/rmake.rs new file mode 100644 index 0000000000000..960eafa546b85 --- /dev/null +++ b/tests/run-make/pointer-auth-link-with-c/rmake.rs @@ -0,0 +1,28 @@ +// `-Z branch protection` is an unstable compiler feature which adds pointer-authentication +// code (PAC), a useful hashing measure for verifying that pointers have not been modified. +// This test checks that compilation and execution is successful when this feature is activated, +// with some of its possible extra arguments (bti, pac-ret, leaf). +// See https://github.com/rust-lang/rust/pull/88354 + +//@ only-aarch64 +// Reason: branch protection is not supported on other architectures +//@ ignore-cross-compile +// Reason: the compiled binary is executed + +use run_make_support::{build_native_static_lib, cc, is_msvc, llvm_ar, run, rustc}; + +fn main() { + build_native_static_lib("test"); + rustc().arg("-Zbranch-protection=bti,pac-ret,leaf").input("test.rs").run(); + run("test"); + cc().arg("-v") + .arg("-c") + .out_exe("test") + .input("test.c") + .arg("-mbranch-protection=bti+pac-ret+leaf") + .run(); + let obj_file = if is_msvc() { "test.obj" } else { "test" }; + llvm_ar().obj_to_ar().output_input("libtest.a", &obj_file).run(); + rustc().arg("-Zbranch-protection=bti,pac-ret,leaf").input("test.rs").run(); + run("test"); +} diff --git a/tests/rustdoc-ui/doctest/test-compile-fail3.stderr b/tests/rustdoc-ui/doctest/test-compile-fail3.stderr index 1ed4554225116..09d78b2f34673 100644 --- a/tests/rustdoc-ui/doctest/test-compile-fail3.stderr +++ b/tests/rustdoc-ui/doctest/test-compile-fail3.stderr @@ -2,7 +2,7 @@ error[E0765]: unterminated double quote string --> $DIR/test-compile-fail3.rs:3:1 | 3 | "fail - | ^^^^^^ + | ^^^^^ error: aborting due to 1 previous error diff --git a/tests/rustdoc-ui/ice-unresolved-import-100241.stderr b/tests/rustdoc-ui/ice-unresolved-import-100241.stderr index 57fbbb59c8d41..e23e0f01fabe3 100644 --- a/tests/rustdoc-ui/ice-unresolved-import-100241.stderr +++ b/tests/rustdoc-ui/ice-unresolved-import-100241.stderr @@ -2,7 +2,7 @@ error[E0432]: unresolved import `inner` --> $DIR/ice-unresolved-import-100241.rs:9:13 | LL | pub use inner::S; - | ^^^^^ maybe a missing crate `inner`? + | ^^^^^ you might be missing crate `inner` | = help: consider adding `extern crate inner` to use the `inner` crate diff --git a/tests/rustdoc-ui/intra-doc/unresolved-import-recovery.stderr b/tests/rustdoc-ui/intra-doc/unresolved-import-recovery.stderr index 8315c73a639f8..a74e6b7393891 100644 --- a/tests/rustdoc-ui/intra-doc/unresolved-import-recovery.stderr +++ b/tests/rustdoc-ui/intra-doc/unresolved-import-recovery.stderr @@ -1,8 +1,8 @@ -error[E0433]: failed to resolve: maybe a missing crate `unresolved_crate`? +error[E0433]: failed to resolve: you might be missing crate `unresolved_crate` --> $DIR/unresolved-import-recovery.rs:3:5 | LL | use unresolved_crate::module::Name; - | ^^^^^^^^^^^^^^^^ maybe a missing crate `unresolved_crate`? + | ^^^^^^^^^^^^^^^^ you might be missing crate `unresolved_crate` | = help: consider adding `extern crate unresolved_crate` to use the `unresolved_crate` crate diff --git a/tests/rustdoc-ui/issues/issue-61732.rs b/tests/rustdoc-ui/issues/issue-61732.rs index 4bd8efeaa3b97..3969ab92c32ee 100644 --- a/tests/rustdoc-ui/issues/issue-61732.rs +++ b/tests/rustdoc-ui/issues/issue-61732.rs @@ -1,4 +1,4 @@ // This previously triggered an ICE. pub(in crate::r#mod) fn main() {} -//~^ ERROR failed to resolve: maybe a missing crate `r#mod` +//~^ ERROR failed to resolve: you might be missing crate `r#mod` diff --git a/tests/rustdoc-ui/issues/issue-61732.stderr b/tests/rustdoc-ui/issues/issue-61732.stderr index f351f52d1e15c..f49d53b0d9ad0 100644 --- a/tests/rustdoc-ui/issues/issue-61732.stderr +++ b/tests/rustdoc-ui/issues/issue-61732.stderr @@ -1,8 +1,8 @@ -error[E0433]: failed to resolve: maybe a missing crate `r#mod`? +error[E0433]: failed to resolve: you might be missing crate `r#mod` --> $DIR/issue-61732.rs:3:15 | LL | pub(in crate::r#mod) fn main() {} - | ^^^^^ maybe a missing crate `r#mod`? + | ^^^^^ you might be missing crate `r#mod` | = help: consider adding `extern crate r#mod` to use the `r#mod` crate diff --git a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs index dc268dfc5caf7..e8cec6321772d 100644 --- a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs +++ b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs @@ -56,7 +56,7 @@ enum DiagnosticOnEnum { #[derive(Diagnostic)] #[diag(no_crate_example, code = E0123)] #[diag = "E0123"] -//~^ ERROR failed to resolve: maybe a missing crate `core` +//~^ ERROR failed to resolve: you might be missing crate `core` struct WrongStructAttrStyle {} #[derive(Diagnostic)] @@ -801,7 +801,7 @@ struct SuggestionsNoItem { struct SuggestionsInvalidItem { #[suggestion(code(foo))] //~^ ERROR `code(...)` must contain only string literals - //~| ERROR failed to resolve: maybe a missing crate `core` + //~| ERROR failed to resolve: you might be missing crate `core` sub: Span, } @@ -809,7 +809,7 @@ struct SuggestionsInvalidItem { #[diag(no_crate_example)] struct SuggestionsInvalidLiteral { #[suggestion(code = 3)] - //~^ ERROR failed to resolve: maybe a missing crate `core` + //~^ ERROR failed to resolve: you might be missing crate `core` sub: Span, } diff --git a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr index e36c6852d3b20..97f9896f3a72a 100644 --- a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr +++ b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr @@ -524,23 +524,23 @@ LL | #[suggestion(no_crate_suggestion, code = "")] = help: to show a suggestion consisting of multiple parts, use a `Subdiagnostic` annotated with `#[multipart_suggestion(...)]` = help: to show a variable set of suggestions, use a `Vec` of `Subdiagnostic`s annotated with `#[suggestion(...)]` -error[E0433]: failed to resolve: maybe a missing crate `core`? +error[E0433]: failed to resolve: you might be missing crate `core` --> $DIR/diagnostic-derive.rs:58:8 | LL | #[diag = "E0123"] - | ^ maybe a missing crate `core`? + | ^ you might be missing crate `core` -error[E0433]: failed to resolve: maybe a missing crate `core`? +error[E0433]: failed to resolve: you might be missing crate `core` --> $DIR/diagnostic-derive.rs:802:23 | LL | #[suggestion(code(foo))] - | ^^^ maybe a missing crate `core`? + | ^^^ you might be missing crate `core` -error[E0433]: failed to resolve: maybe a missing crate `core`? +error[E0433]: failed to resolve: you might be missing crate `core` --> $DIR/diagnostic-derive.rs:811:25 | LL | #[suggestion(code = 3)] - | ^ maybe a missing crate `core`? + | ^ you might be missing crate `core` error: cannot find attribute `nonsense` in this scope --> $DIR/diagnostic-derive.rs:63:3 diff --git a/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs b/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs index 659ae54f7a3be..c837372a7a7a7 100644 --- a/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs +++ b/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs @@ -94,8 +94,8 @@ struct G { #[derive(Subdiagnostic)] #[label("...")] -//~^ ERROR failed to resolve: maybe a missing crate `core`? -//~| NOTE maybe a missing crate `core`? +//~^ ERROR failed to resolve: you might be missing crate `core` +//~| NOTE you might be missing crate `core` struct H { #[primary_span] span: Span, @@ -310,8 +310,8 @@ struct AB { #[derive(Subdiagnostic)] union AC { - //~^ ERROR failed to resolve: maybe a missing crate `core`? - //~| NOTE maybe a missing crate `core`? + //~^ ERROR failed to resolve: you might be missing crate `core` + //~| NOTE you might be missing crate `core` span: u32, b: u64, } @@ -581,8 +581,8 @@ struct BD { span2: Span, #[suggestion_part(foo = "bar")] //~^ ERROR `code` is the only valid nested attribute - //~| ERROR failed to resolve: maybe a missing crate `core`? - //~| NOTE maybe a missing crate `core`? + //~| ERROR failed to resolve: you might be missing crate `core` + //~| NOTE you might be missing crate `core` span4: Span, #[suggestion_part(code = "...")] //~^ ERROR the `#[suggestion_part(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan` @@ -674,8 +674,8 @@ enum BL { struct BM { #[suggestion_part(code("foo"))] //~^ ERROR expected exactly one string literal for `code = ...` - //~| ERROR failed to resolve: maybe a missing crate `core`? - //~| NOTE maybe a missing crate `core`? + //~| ERROR failed to resolve: you might be missing crate `core` + //~| NOTE you might be missing crate `core` span: Span, r#type: String, } @@ -685,8 +685,8 @@ struct BM { struct BN { #[suggestion_part(code("foo", "bar"))] //~^ ERROR expected exactly one string literal for `code = ...` - //~| ERROR failed to resolve: maybe a missing crate `core`? - //~| NOTE maybe a missing crate `core`? + //~| ERROR failed to resolve: you might be missing crate `core` + //~| NOTE you might be missing crate `core` span: Span, r#type: String, } @@ -696,8 +696,8 @@ struct BN { struct BO { #[suggestion_part(code(3))] //~^ ERROR expected exactly one string literal for `code = ...` - //~| ERROR failed to resolve: maybe a missing crate `core`? - //~| NOTE maybe a missing crate `core`? + //~| ERROR failed to resolve: you might be missing crate `core` + //~| NOTE you might be missing crate `core` span: Span, r#type: String, } @@ -718,8 +718,8 @@ struct BP { #[multipart_suggestion(no_crate_example)] struct BQ { #[suggestion_part(code = 3)] - //~^ ERROR failed to resolve: maybe a missing crate `core`? - //~| NOTE maybe a missing crate `core`? + //~^ ERROR failed to resolve: you might be missing crate `core` + //~| NOTE you might be missing crate `core` span: Span, r#type: String, } @@ -811,8 +811,8 @@ struct SuggestionStyleInvalid3 { #[derive(Subdiagnostic)] #[suggestion(no_crate_example, code = "", style("foo"))] //~^ ERROR expected `= "xxx"` -//~| ERROR failed to resolve: maybe a missing crate `core`? -//~| NOTE maybe a missing crate `core`? +//~| ERROR failed to resolve: you might be missing crate `core` +//~| NOTE you might be missing crate `core` struct SuggestionStyleInvalid4 { #[primary_span] sub: Span, diff --git a/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.stderr b/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.stderr index fccf3757dbec6..96f6ef06d1dca 100644 --- a/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.stderr +++ b/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.stderr @@ -451,53 +451,53 @@ error: suggestion without `#[primary_span]` field LL | #[suggestion(no_crate_example, code = "")] | ^ -error[E0433]: failed to resolve: maybe a missing crate `core`? +error[E0433]: failed to resolve: you might be missing crate `core` --> $DIR/subdiagnostic-derive.rs:96:9 | LL | #[label("...")] - | ^^^^^ maybe a missing crate `core`? + | ^^^^^ you might be missing crate `core` -error[E0433]: failed to resolve: maybe a missing crate `core`? +error[E0433]: failed to resolve: you might be missing crate `core` --> $DIR/subdiagnostic-derive.rs:312:1 | LL | union AC { - | ^^^^^ maybe a missing crate `core`? + | ^^^^^ you might be missing crate `core` -error[E0433]: failed to resolve: maybe a missing crate `core`? +error[E0433]: failed to resolve: you might be missing crate `core` --> $DIR/subdiagnostic-derive.rs:582:27 | LL | #[suggestion_part(foo = "bar")] - | ^ maybe a missing crate `core`? + | ^ you might be missing crate `core` -error[E0433]: failed to resolve: maybe a missing crate `core`? +error[E0433]: failed to resolve: you might be missing crate `core` --> $DIR/subdiagnostic-derive.rs:675:28 | LL | #[suggestion_part(code("foo"))] - | ^^^^^ maybe a missing crate `core`? + | ^^^^^ you might be missing crate `core` -error[E0433]: failed to resolve: maybe a missing crate `core`? +error[E0433]: failed to resolve: you might be missing crate `core` --> $DIR/subdiagnostic-derive.rs:686:28 | LL | #[suggestion_part(code("foo", "bar"))] - | ^^^^^ maybe a missing crate `core`? + | ^^^^^ you might be missing crate `core` -error[E0433]: failed to resolve: maybe a missing crate `core`? +error[E0433]: failed to resolve: you might be missing crate `core` --> $DIR/subdiagnostic-derive.rs:697:28 | LL | #[suggestion_part(code(3))] - | ^ maybe a missing crate `core`? + | ^ you might be missing crate `core` -error[E0433]: failed to resolve: maybe a missing crate `core`? +error[E0433]: failed to resolve: you might be missing crate `core` --> $DIR/subdiagnostic-derive.rs:720:30 | LL | #[suggestion_part(code = 3)] - | ^ maybe a missing crate `core`? + | ^ you might be missing crate `core` -error[E0433]: failed to resolve: maybe a missing crate `core`? +error[E0433]: failed to resolve: you might be missing crate `core` --> $DIR/subdiagnostic-derive.rs:812:48 | LL | #[suggestion(no_crate_example, code = "", style("foo"))] - | ^ maybe a missing crate `core`? + | ^ you might be missing crate `core` error: cannot find attribute `foo` in this scope --> $DIR/subdiagnostic-derive.rs:67:3 diff --git a/tests/ui/async-await/async-fn/higher-ranked-async-fn.rs b/tests/ui/async-await/async-fn/higher-ranked-async-fn.rs index be338ddeb7dbf..f8da517213aee 100644 --- a/tests/ui/async-await/async-fn/higher-ranked-async-fn.rs +++ b/tests/ui/async-await/async-fn/higher-ranked-async-fn.rs @@ -15,7 +15,7 @@ async fn f(arg: &i32) {} async fn func(f: F) where - F: async for<'a> Fn(&'a i32), + F: for<'a> async Fn(&'a i32), { let x: i32 = 0; f(&x).await; diff --git a/tests/ui/attributes/field-attributes-vis-unresolved.stderr b/tests/ui/attributes/field-attributes-vis-unresolved.stderr index 439762546381e..819cd859ae909 100644 --- a/tests/ui/attributes/field-attributes-vis-unresolved.stderr +++ b/tests/ui/attributes/field-attributes-vis-unresolved.stderr @@ -1,16 +1,16 @@ -error[E0433]: failed to resolve: maybe a missing crate `nonexistent`? +error[E0433]: failed to resolve: you might be missing crate `nonexistent` --> $DIR/field-attributes-vis-unresolved.rs:17:12 | LL | pub(in nonexistent) field: u8 - | ^^^^^^^^^^^ maybe a missing crate `nonexistent`? + | ^^^^^^^^^^^ you might be missing crate `nonexistent` | = help: consider adding `extern crate nonexistent` to use the `nonexistent` crate -error[E0433]: failed to resolve: maybe a missing crate `nonexistent`? +error[E0433]: failed to resolve: you might be missing crate `nonexistent` --> $DIR/field-attributes-vis-unresolved.rs:22:12 | LL | pub(in nonexistent) u8 - | ^^^^^^^^^^^ maybe a missing crate `nonexistent`? + | ^^^^^^^^^^^ you might be missing crate `nonexistent` | = help: consider adding `extern crate nonexistent` to use the `nonexistent` crate diff --git a/tests/ui/auto-traits/assoc-ty.current.stderr b/tests/ui/auto-traits/assoc-ty.current.stderr new file mode 100644 index 0000000000000..77a1c8fb654f1 --- /dev/null +++ b/tests/ui/auto-traits/assoc-ty.current.stderr @@ -0,0 +1,40 @@ +error[E0380]: auto traits cannot have associated items + --> $DIR/assoc-ty.rs:10:10 + | +LL | auto trait Trait { + | ----- auto traits cannot have associated items +LL | +LL | type Output; + | -----^^^^^^- help: remove these associated items + +error[E0658]: auto traits are experimental and possibly buggy + --> $DIR/assoc-ty.rs:8:1 + | +LL | / auto trait Trait { +LL | | +LL | | type Output; +LL | | +LL | | } + | |_^ + | + = note: see issue #13231 for more information + = help: add `#![feature(auto_traits)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0308]: mismatched types + --> $DIR/assoc-ty.rs:15:36 + | +LL | let _: <() as Trait>::Output = (); + | --------------------- ^^ expected associated type, found `()` + | | + | expected due to this + | + = note: expected associated type `<() as Trait>::Output` + found unit type `()` + = help: consider constraining the associated type `<() as Trait>::Output` to `()` or calling a method that returns `<() as Trait>::Output` + = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0308, E0380, E0658. +For more information about an error, try `rustc --explain E0308`. diff --git a/tests/ui/auto-traits/assoc-ty.next.stderr b/tests/ui/auto-traits/assoc-ty.next.stderr new file mode 100644 index 0000000000000..b9f56d6c99c4c --- /dev/null +++ b/tests/ui/auto-traits/assoc-ty.next.stderr @@ -0,0 +1,40 @@ +error[E0380]: auto traits cannot have associated items + --> $DIR/assoc-ty.rs:10:10 + | +LL | auto trait Trait { + | ----- auto traits cannot have associated items +LL | +LL | type Output; + | -----^^^^^^- help: remove these associated items + +error[E0658]: auto traits are experimental and possibly buggy + --> $DIR/assoc-ty.rs:8:1 + | +LL | / auto trait Trait { +LL | | +LL | | type Output; +LL | | +LL | | } + | |_^ + | + = note: see issue #13231 for more information + = help: add `#![feature(auto_traits)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0308]: mismatched types + --> $DIR/assoc-ty.rs:15:36 + | +LL | let _: <() as Trait>::Output = (); + | --------------------- ^^ types differ + | | + | expected due to this + | + = note: expected associated type `<() as Trait>::Output` + found unit type `()` + = help: consider constraining the associated type `<() as Trait>::Output` to `()` or calling a method that returns `<() as Trait>::Output` + = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0308, E0380, E0658. +For more information about an error, try `rustc --explain E0308`. diff --git a/tests/ui/auto-traits/assoc-ty.rs b/tests/ui/auto-traits/assoc-ty.rs new file mode 100644 index 0000000000000..ada75147f6ea6 --- /dev/null +++ b/tests/ui/auto-traits/assoc-ty.rs @@ -0,0 +1,17 @@ +//@ revisions: current next +//@[next] compile-flags: -Znext-solver +//@ ignore-compare-mode-next-solver (explicit revisions) + +// Tests that projection doesn't explode if we accidentally +// put an associated type on an auto trait. + +auto trait Trait { + //~^ ERROR auto traits are experimental and possibly buggy + type Output; + //~^ ERROR auto traits cannot have associated items +} + +fn main() { + let _: <() as Trait>::Output = (); + //~^ ERROR mismatched types +} diff --git a/tests/ui/codemap_tests/tab_2.stderr b/tests/ui/codemap_tests/tab_2.stderr index 4f9a937155dde..b22c7b4266517 100644 --- a/tests/ui/codemap_tests/tab_2.stderr +++ b/tests/ui/codemap_tests/tab_2.stderr @@ -4,7 +4,7 @@ error[E0765]: unterminated double quote string LL | """; | ___________________^ LL | | } - | |__^ + | |_^ error: aborting due to 1 previous error diff --git a/tests/ui/error-codes/E0432.stderr b/tests/ui/error-codes/E0432.stderr index 473e82f863437..a0b17e35c94a8 100644 --- a/tests/ui/error-codes/E0432.stderr +++ b/tests/ui/error-codes/E0432.stderr @@ -2,7 +2,7 @@ error[E0432]: unresolved import `something` --> $DIR/E0432.rs:1:5 | LL | use something::Foo; - | ^^^^^^^^^ maybe a missing crate `something`? + | ^^^^^^^^^ you might be missing crate `something` | = help: consider adding `extern crate something` to use the `something` crate diff --git a/tests/ui/error-codes/E0601.stderr b/tests/ui/error-codes/E0601.stderr index 41a4a8f7dbbaa..c051bc0b31a0f 100644 --- a/tests/ui/error-codes/E0601.stderr +++ b/tests/ui/error-codes/E0601.stderr @@ -2,7 +2,7 @@ error[E0601]: `main` function not found in crate `E0601` --> $DIR/E0601.rs:1:37 | LL | - | ^ consider adding a `main` function to `$DIR/E0601.rs` + | ^ consider adding a `main` function to `$DIR/E0601.rs` error: aborting due to 1 previous error diff --git a/tests/ui/feature-gates/feature-gate-extern_absolute_paths.stderr b/tests/ui/feature-gates/feature-gate-extern_absolute_paths.stderr index 2fcad98be9f73..0234480ac5acb 100644 --- a/tests/ui/feature-gates/feature-gate-extern_absolute_paths.stderr +++ b/tests/ui/feature-gates/feature-gate-extern_absolute_paths.stderr @@ -4,14 +4,14 @@ error[E0432]: unresolved import `core` LL | use core::default; | ^^^^ | | - | maybe a missing crate `core`? + | you might be missing crate `core` | help: try using `std` instead of `core`: `std` -error[E0433]: failed to resolve: maybe a missing crate `core`? +error[E0433]: failed to resolve: you might be missing crate `core` --> $DIR/feature-gate-extern_absolute_paths.rs:4:19 | LL | let _: u8 = ::core::default::Default(); - | ^^^^ maybe a missing crate `core`? + | ^^^^ you might be missing crate `core` | help: try using `std` instead of `core` | diff --git a/tests/ui/impl-trait/normalize-tait-in-const.rs b/tests/ui/impl-trait/normalize-tait-in-const.rs index fc90139d64095..e3f53e5f8a82a 100644 --- a/tests/ui/impl-trait/normalize-tait-in-const.rs +++ b/tests/ui/impl-trait/normalize-tait-in-const.rs @@ -24,7 +24,7 @@ mod foo { } use foo::*; -const fn with_positive Fn(&'a Alias<'a>) + ~const Destruct>(fun: F) { +const fn with_positive ~const Fn(&'a Alias<'a>) + ~const Destruct>(fun: F) { fun(filter_positive()); } diff --git a/tests/ui/impl-trait/normalize-tait-in-const.stderr b/tests/ui/impl-trait/normalize-tait-in-const.stderr index 73f4d4c388563..b20dabe7b25ac 100644 --- a/tests/ui/impl-trait/normalize-tait-in-const.stderr +++ b/tests/ui/impl-trait/normalize-tait-in-const.stderr @@ -1,13 +1,13 @@ error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/normalize-tait-in-const.rs:27:42 | -LL | const fn with_positive Fn(&'a Alias<'a>) + ~const Destruct>(fun: F) { +LL | const fn with_positive ~const Fn(&'a Alias<'a>) + ~const Destruct>(fun: F) { | ^^^^^^^^^^^^^^^^^ error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/normalize-tait-in-const.rs:27:69 | -LL | const fn with_positive Fn(&'a Alias<'a>) + ~const Destruct>(fun: F) { +LL | const fn with_positive ~const Fn(&'a Alias<'a>) + ~const Destruct>(fun: F) { | ^^^^^^^^ error[E0015]: cannot call non-const closure in constant functions @@ -19,7 +19,7 @@ LL | fun(filter_positive()); = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants help: consider further restricting this bound | -LL | const fn with_positive Fn(&'a Alias<'a>) + ~const Destruct + ~const Fn(&foo::Alias<'_>)>(fun: F) { +LL | const fn with_positive ~const Fn(&'a Alias<'a>) + ~const Destruct + ~const Fn(&foo::Alias<'_>)>(fun: F) { | ++++++++++++++++++++++++++++ help: add `#![feature(effects)]` to the crate attributes to enable | @@ -29,7 +29,7 @@ LL + #![feature(effects)] error[E0493]: destructor of `F` cannot be evaluated at compile-time --> $DIR/normalize-tait-in-const.rs:27:79 | -LL | const fn with_positive Fn(&'a Alias<'a>) + ~const Destruct>(fun: F) { +LL | const fn with_positive ~const Fn(&'a Alias<'a>) + ~const Destruct>(fun: F) { | ^^^ the destructor for this type cannot be evaluated in constant functions LL | fun(filter_positive()); LL | } diff --git a/tests/ui/imports/import-from-missing-star-2.stderr b/tests/ui/imports/import-from-missing-star-2.stderr index ea3876248c93f..59b000a43822b 100644 --- a/tests/ui/imports/import-from-missing-star-2.stderr +++ b/tests/ui/imports/import-from-missing-star-2.stderr @@ -2,7 +2,7 @@ error[E0432]: unresolved import `spam` --> $DIR/import-from-missing-star-2.rs:2:9 | LL | use spam::*; - | ^^^^ maybe a missing crate `spam`? + | ^^^^ you might be missing crate `spam` | = help: consider adding `extern crate spam` to use the `spam` crate diff --git a/tests/ui/imports/import-from-missing-star-3.stderr b/tests/ui/imports/import-from-missing-star-3.stderr index 1fe5d4f19a97d..23df6b354450b 100644 --- a/tests/ui/imports/import-from-missing-star-3.stderr +++ b/tests/ui/imports/import-from-missing-star-3.stderr @@ -2,7 +2,7 @@ error[E0432]: unresolved import `spam` --> $DIR/import-from-missing-star-3.rs:2:9 | LL | use spam::*; - | ^^^^ maybe a missing crate `spam`? + | ^^^^ you might be missing crate `spam` | = help: consider adding `extern crate spam` to use the `spam` crate @@ -10,7 +10,7 @@ error[E0432]: unresolved import `spam` --> $DIR/import-from-missing-star-3.rs:27:13 | LL | use spam::*; - | ^^^^ maybe a missing crate `spam`? + | ^^^^ you might be missing crate `spam` | = help: consider adding `extern crate spam` to use the `spam` crate diff --git a/tests/ui/imports/import-from-missing-star.stderr b/tests/ui/imports/import-from-missing-star.stderr index f8e295078047f..b311527bc28e4 100644 --- a/tests/ui/imports/import-from-missing-star.stderr +++ b/tests/ui/imports/import-from-missing-star.stderr @@ -2,7 +2,7 @@ error[E0432]: unresolved import `spam` --> $DIR/import-from-missing-star.rs:1:5 | LL | use spam::*; - | ^^^^ maybe a missing crate `spam`? + | ^^^^ you might be missing crate `spam` | = help: consider adding `extern crate spam` to use the `spam` crate diff --git a/tests/ui/imports/import3.stderr b/tests/ui/imports/import3.stderr index 80b0a7f061994..06260ef9ebc75 100644 --- a/tests/ui/imports/import3.stderr +++ b/tests/ui/imports/import3.stderr @@ -2,7 +2,7 @@ error[E0432]: unresolved import `main` --> $DIR/import3.rs:2:5 | LL | use main::bar; - | ^^^^ maybe a missing crate `main`? + | ^^^^ you might be missing crate `main` | = help: consider adding `extern crate main` to use the `main` crate diff --git a/tests/ui/imports/issue-109343.stderr b/tests/ui/imports/issue-109343.stderr index 1b95fcf55679f..fe06eddeada69 100644 --- a/tests/ui/imports/issue-109343.stderr +++ b/tests/ui/imports/issue-109343.stderr @@ -2,7 +2,7 @@ error[E0432]: unresolved import `unresolved` --> $DIR/issue-109343.rs:4:9 | LL | pub use unresolved::f; - | ^^^^^^^^^^ maybe a missing crate `unresolved`? + | ^^^^^^^^^^ you might be missing crate `unresolved` | = help: consider adding `extern crate unresolved` to use the `unresolved` crate diff --git a/tests/ui/imports/issue-1697.rs b/tests/ui/imports/issue-1697.rs index 5cd76d21f91cf..8ec48d4d28628 100644 --- a/tests/ui/imports/issue-1697.rs +++ b/tests/ui/imports/issue-1697.rs @@ -1,6 +1,8 @@ // Testing that we don't fail abnormally after hitting the errors -use unresolved::*; //~ ERROR unresolved import `unresolved` [E0432] - //~^ maybe a missing crate `unresolved`? +use unresolved::*; +//~^ ERROR unresolved import `unresolved` [E0432] +//~| NOTE you might be missing crate `unresolved` +//~| HELP consider adding `extern crate unresolved` to use the `unresolved` crate fn main() {} diff --git a/tests/ui/imports/issue-1697.stderr b/tests/ui/imports/issue-1697.stderr index 840608ca2a14d..df2957b8f2b13 100644 --- a/tests/ui/imports/issue-1697.stderr +++ b/tests/ui/imports/issue-1697.stderr @@ -2,7 +2,7 @@ error[E0432]: unresolved import `unresolved` --> $DIR/issue-1697.rs:3:5 | LL | use unresolved::*; - | ^^^^^^^^^^ maybe a missing crate `unresolved`? + | ^^^^^^^^^^ you might be missing crate `unresolved` | = help: consider adding `extern crate unresolved` to use the `unresolved` crate diff --git a/tests/ui/imports/issue-33464.stderr b/tests/ui/imports/issue-33464.stderr index c4e5c55589914..17cc0e4469e43 100644 --- a/tests/ui/imports/issue-33464.stderr +++ b/tests/ui/imports/issue-33464.stderr @@ -2,7 +2,7 @@ error[E0432]: unresolved import `abc` --> $DIR/issue-33464.rs:3:5 | LL | use abc::one_el; - | ^^^ maybe a missing crate `abc`? + | ^^^ you might be missing crate `abc` | = help: consider adding `extern crate abc` to use the `abc` crate @@ -10,7 +10,7 @@ error[E0432]: unresolved import `abc` --> $DIR/issue-33464.rs:5:5 | LL | use abc::{a, bbb, cccccc}; - | ^^^ maybe a missing crate `abc`? + | ^^^ you might be missing crate `abc` | = help: consider adding `extern crate abc` to use the `abc` crate @@ -18,7 +18,7 @@ error[E0432]: unresolved import `a_very_long_name` --> $DIR/issue-33464.rs:7:5 | LL | use a_very_long_name::{el, el2}; - | ^^^^^^^^^^^^^^^^ maybe a missing crate `a_very_long_name`? + | ^^^^^^^^^^^^^^^^ you might be missing crate `a_very_long_name` | = help: consider adding `extern crate a_very_long_name` to use the `a_very_long_name` crate diff --git a/tests/ui/imports/issue-36881.stderr b/tests/ui/imports/issue-36881.stderr index e9b632d2718ce..3c136df83fe4c 100644 --- a/tests/ui/imports/issue-36881.stderr +++ b/tests/ui/imports/issue-36881.stderr @@ -2,7 +2,7 @@ error[E0432]: unresolved import `issue_36881_aux` --> $DIR/issue-36881.rs:5:9 | LL | use issue_36881_aux::Foo; - | ^^^^^^^^^^^^^^^ maybe a missing crate `issue_36881_aux`? + | ^^^^^^^^^^^^^^^ you might be missing crate `issue_36881_aux` | = help: consider adding `extern crate issue_36881_aux` to use the `issue_36881_aux` crate diff --git a/tests/ui/imports/issue-37887.stderr b/tests/ui/imports/issue-37887.stderr index e7792ac0d159b..36020707405f1 100644 --- a/tests/ui/imports/issue-37887.stderr +++ b/tests/ui/imports/issue-37887.stderr @@ -2,7 +2,7 @@ error[E0432]: unresolved import `test` --> $DIR/issue-37887.rs:3:9 | LL | use test::*; - | ^^^^ maybe a missing crate `test`? + | ^^^^ you might be missing crate `test` | = help: consider adding `extern crate test` to use the `test` crate diff --git a/tests/ui/imports/issue-53269.stderr b/tests/ui/imports/issue-53269.stderr index 29c7556dac432..317b3c633a65f 100644 --- a/tests/ui/imports/issue-53269.stderr +++ b/tests/ui/imports/issue-53269.stderr @@ -2,7 +2,7 @@ error[E0432]: unresolved import `nonexistent_module` --> $DIR/issue-53269.rs:6:9 | LL | use nonexistent_module::mac; - | ^^^^^^^^^^^^^^^^^^ maybe a missing crate `nonexistent_module`? + | ^^^^^^^^^^^^^^^^^^ you might be missing crate `nonexistent_module` | = help: consider adding `extern crate nonexistent_module` to use the `nonexistent_module` crate diff --git a/tests/ui/imports/issue-55457.stderr b/tests/ui/imports/issue-55457.stderr index 09bb13a060478..e9126e6575c0d 100644 --- a/tests/ui/imports/issue-55457.stderr +++ b/tests/ui/imports/issue-55457.stderr @@ -11,7 +11,7 @@ error[E0432]: unresolved import `non_existent` --> $DIR/issue-55457.rs:2:5 | LL | use non_existent::non_existent; - | ^^^^^^^^^^^^ maybe a missing crate `non_existent`? + | ^^^^^^^^^^^^ you might be missing crate `non_existent` | = help: consider adding `extern crate non_existent` to use the `non_existent` crate diff --git a/tests/ui/imports/issue-81413.stderr b/tests/ui/imports/issue-81413.stderr index c2a3212501181..321b3695d2cc0 100644 --- a/tests/ui/imports/issue-81413.stderr +++ b/tests/ui/imports/issue-81413.stderr @@ -2,7 +2,7 @@ error[E0432]: unresolved import `doesnt_exist` --> $DIR/issue-81413.rs:7:9 | LL | pub use doesnt_exist::*; - | ^^^^^^^^^^^^ maybe a missing crate `doesnt_exist`? + | ^^^^^^^^^^^^ you might be missing crate `doesnt_exist` | = help: consider adding `extern crate doesnt_exist` to use the `doesnt_exist` crate diff --git a/tests/ui/imports/tool-mod-child.rs b/tests/ui/imports/tool-mod-child.rs index 4581dc2e2ad88..a8249ab01dfc1 100644 --- a/tests/ui/imports/tool-mod-child.rs +++ b/tests/ui/imports/tool-mod-child.rs @@ -1,7 +1,7 @@ use clippy::a; //~ ERROR unresolved import `clippy` -use clippy::a::b; //~ ERROR failed to resolve: maybe a missing crate `clippy`? +use clippy::a::b; //~ ERROR failed to resolve: you might be missing crate `clippy` use rustdoc::a; //~ ERROR unresolved import `rustdoc` -use rustdoc::a::b; //~ ERROR failed to resolve: maybe a missing crate `rustdoc`? +use rustdoc::a::b; //~ ERROR failed to resolve: you might be missing crate `rustdoc` fn main() {} diff --git a/tests/ui/imports/tool-mod-child.stderr b/tests/ui/imports/tool-mod-child.stderr index 6caf15bc72401..764256e76f045 100644 --- a/tests/ui/imports/tool-mod-child.stderr +++ b/tests/ui/imports/tool-mod-child.stderr @@ -1,8 +1,8 @@ -error[E0433]: failed to resolve: maybe a missing crate `clippy`? +error[E0433]: failed to resolve: you might be missing crate `clippy` --> $DIR/tool-mod-child.rs:2:5 | LL | use clippy::a::b; - | ^^^^^^ maybe a missing crate `clippy`? + | ^^^^^^ you might be missing crate `clippy` | = help: consider adding `extern crate clippy` to use the `clippy` crate @@ -10,15 +10,15 @@ error[E0432]: unresolved import `clippy` --> $DIR/tool-mod-child.rs:1:5 | LL | use clippy::a; - | ^^^^^^ maybe a missing crate `clippy`? + | ^^^^^^ you might be missing crate `clippy` | = help: consider adding `extern crate clippy` to use the `clippy` crate -error[E0433]: failed to resolve: maybe a missing crate `rustdoc`? +error[E0433]: failed to resolve: you might be missing crate `rustdoc` --> $DIR/tool-mod-child.rs:5:5 | LL | use rustdoc::a::b; - | ^^^^^^^ maybe a missing crate `rustdoc`? + | ^^^^^^^ you might be missing crate `rustdoc` | = help: consider adding `extern crate rustdoc` to use the `rustdoc` crate @@ -26,7 +26,7 @@ error[E0432]: unresolved import `rustdoc` --> $DIR/tool-mod-child.rs:4:5 | LL | use rustdoc::a; - | ^^^^^^^ maybe a missing crate `rustdoc`? + | ^^^^^^^ you might be missing crate `rustdoc` | = help: consider adding `extern crate rustdoc` to use the `rustdoc` crate diff --git a/tests/ui/imports/unresolved-imports-used.stderr b/tests/ui/imports/unresolved-imports-used.stderr index 73f9d1bfb6c61..1cbc2356320f7 100644 --- a/tests/ui/imports/unresolved-imports-used.stderr +++ b/tests/ui/imports/unresolved-imports-used.stderr @@ -14,7 +14,7 @@ error[E0432]: unresolved import `foo` --> $DIR/unresolved-imports-used.rs:11:5 | LL | use foo::bar; - | ^^^ maybe a missing crate `foo`? + | ^^^ you might be missing crate `foo` | = help: consider adding `extern crate foo` to use the `foo` crate @@ -22,7 +22,7 @@ error[E0432]: unresolved import `baz` --> $DIR/unresolved-imports-used.rs:12:5 | LL | use baz::*; - | ^^^ maybe a missing crate `baz`? + | ^^^ you might be missing crate `baz` | = help: consider adding `extern crate baz` to use the `baz` crate @@ -30,7 +30,7 @@ error[E0432]: unresolved import `foo2` --> $DIR/unresolved-imports-used.rs:14:5 | LL | use foo2::bar2; - | ^^^^ maybe a missing crate `foo2`? + | ^^^^ you might be missing crate `foo2` | = help: consider adding `extern crate foo2` to use the `foo2` crate @@ -38,7 +38,7 @@ error[E0432]: unresolved import `baz2` --> $DIR/unresolved-imports-used.rs:15:5 | LL | use baz2::*; - | ^^^^ maybe a missing crate `baz2`? + | ^^^^ you might be missing crate `baz2` | = help: consider adding `extern crate baz2` to use the `baz2` crate diff --git a/tests/ui/issues/issue-39089.rs b/tests/ui/issues/issue-39089.rs index b00b842380235..822c47503afe9 100644 --- a/tests/ui/issues/issue-39089.rs +++ b/tests/ui/issues/issue-39089.rs @@ -1,5 +1,4 @@ -//@ check-pass -#![allow(dead_code)] fn f Sized>() {} +//~^ ERROR `for<...>` binder should be placed before trait bound modifiers fn main() {} diff --git a/tests/ui/issues/issue-39089.stderr b/tests/ui/issues/issue-39089.stderr new file mode 100644 index 0000000000000..a81010aedff5a --- /dev/null +++ b/tests/ui/issues/issue-39089.stderr @@ -0,0 +1,10 @@ +error: `for<...>` binder should be placed before trait bound modifiers + --> $DIR/issue-39089.rs:1:13 + | +LL | fn f Sized>() {} + | - ^^^^ + | | + | place the `for<...>` binder before any modifiers + +error: aborting due to 1 previous error + diff --git a/tests/ui/issues/issue-44078.stderr b/tests/ui/issues/issue-44078.stderr index 3e12de34e11ee..41106b29aad78 100644 --- a/tests/ui/issues/issue-44078.stderr +++ b/tests/ui/issues/issue-44078.stderr @@ -4,7 +4,7 @@ error[E0765]: unterminated double quote string LL | "😊""; | _________^ LL | | } - | |__^ + | |_^ error: aborting due to 1 previous error diff --git a/tests/ui/keyword/extern/keyword-extern-as-identifier-use.stderr b/tests/ui/keyword/extern/keyword-extern-as-identifier-use.stderr index 54ee45c28679a..a647ca27f1c26 100644 --- a/tests/ui/keyword/extern/keyword-extern-as-identifier-use.stderr +++ b/tests/ui/keyword/extern/keyword-extern-as-identifier-use.stderr @@ -13,7 +13,7 @@ error[E0432]: unresolved import `r#extern` --> $DIR/keyword-extern-as-identifier-use.rs:1:5 | LL | use extern::foo; - | ^^^^^^ maybe a missing crate `r#extern`? + | ^^^^^^ you might be missing crate `r#extern` | = help: consider adding `extern crate r#extern` to use the `r#extern` crate diff --git a/tests/ui/lexer/lex-bare-cr-string-literal-doc-comment.stderr b/tests/ui/lexer/lex-bare-cr-string-literal-doc-comment.stderr index da80991c727f7..841d5236edefa 100644 --- a/tests/ui/lexer/lex-bare-cr-string-literal-doc-comment.stderr +++ b/tests/ui/lexer/lex-bare-cr-string-literal-doc-comment.stderr @@ -1,31 +1,31 @@ error: bare CR not allowed in doc-comment --> $DIR/lex-bare-cr-string-literal-doc-comment.rs:3:32 | -LL | /// doc comment with bare CR: ' ' +LL | /// doc comment with bare CR: '␍' | ^ error: bare CR not allowed in block doc-comment --> $DIR/lex-bare-cr-string-literal-doc-comment.rs:7:38 | -LL | /** block doc comment with bare CR: ' ' */ +LL | /** block doc comment with bare CR: '␍' */ | ^ error: bare CR not allowed in doc-comment --> $DIR/lex-bare-cr-string-literal-doc-comment.rs:12:36 | -LL | //! doc comment with bare CR: ' ' +LL | //! doc comment with bare CR: '␍' | ^ error: bare CR not allowed in block doc-comment --> $DIR/lex-bare-cr-string-literal-doc-comment.rs:15:42 | -LL | /*! block doc comment with bare CR: ' ' */ +LL | /*! block doc comment with bare CR: '␍' */ | ^ error: bare CR not allowed in string, use `\r` instead --> $DIR/lex-bare-cr-string-literal-doc-comment.rs:19:18 | -LL | let _s = "foo bar"; +LL | let _s = "foo␍bar"; | ^ | help: escape the character @@ -36,13 +36,13 @@ LL | let _s = "foo\rbar"; error: bare CR not allowed in raw string --> $DIR/lex-bare-cr-string-literal-doc-comment.rs:22:19 | -LL | let _s = r"bar foo"; +LL | let _s = r"bar␍foo"; | ^ error: unknown character escape: `\r` --> $DIR/lex-bare-cr-string-literal-doc-comment.rs:25:19 | -LL | let _s = "foo\ bar"; +LL | let _s = "foo\␍bar"; | ^ unknown character escape | = help: this is an isolated carriage return; consider checking your editor and version control settings diff --git a/tests/ui/lexer/unterminated-comment.stderr b/tests/ui/lexer/unterminated-comment.stderr index ea65bffd10368..6ab5441ee05ce 100644 --- a/tests/ui/lexer/unterminated-comment.stderr +++ b/tests/ui/lexer/unterminated-comment.stderr @@ -2,7 +2,7 @@ error[E0758]: unterminated block comment --> $DIR/unterminated-comment.rs:1:1 | LL | /* - | ^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/lexer/unterminated-nested-comment.stderr b/tests/ui/lexer/unterminated-nested-comment.stderr index 9117b689c94e3..78b72ce1fe4a0 100644 --- a/tests/ui/lexer/unterminated-nested-comment.stderr +++ b/tests/ui/lexer/unterminated-nested-comment.stderr @@ -12,7 +12,7 @@ LL | | /* | | | | | ...as last nested comment starts here, maybe you want to close this instead? LL | | */ - | |_--^ + | |_-^ | | | ...and last nested comment terminates here. diff --git a/tests/ui/lint/issue-104897.stderr b/tests/ui/lint/issue-104897.stderr index 1f3d40605f673..584902ee4c03c 100644 --- a/tests/ui/lint/issue-104897.stderr +++ b/tests/ui/lint/issue-104897.stderr @@ -2,7 +2,7 @@ error: this file contains an unclosed delimiter --> $DIR/issue-104897.rs:5:18 | LL | fn f(){(print!(á - | -- - ^ + | -- - ^ | || | | || unclosed delimiter | |unclosed delimiter diff --git a/tests/ui/macros/meta-item-absolute-path.stderr b/tests/ui/macros/meta-item-absolute-path.stderr index f0d763d7abbaa..af56d935284cc 100644 --- a/tests/ui/macros/meta-item-absolute-path.stderr +++ b/tests/ui/macros/meta-item-absolute-path.stderr @@ -1,14 +1,14 @@ -error[E0433]: failed to resolve: maybe a missing crate `Absolute`? +error[E0433]: failed to resolve: you might be missing crate `Absolute` --> $DIR/meta-item-absolute-path.rs:1:12 | LL | #[derive(::Absolute)] - | ^^^^^^^^ maybe a missing crate `Absolute`? + | ^^^^^^^^ you might be missing crate `Absolute` -error[E0433]: failed to resolve: maybe a missing crate `Absolute`? +error[E0433]: failed to resolve: you might be missing crate `Absolute` --> $DIR/meta-item-absolute-path.rs:1:12 | LL | #[derive(::Absolute)] - | ^^^^^^^^ maybe a missing crate `Absolute`? + | ^^^^^^^^ you might be missing crate `Absolute` | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` diff --git a/tests/ui/malformed/issue-107423-unused-delim-only-one-no-pair.stderr b/tests/ui/malformed/issue-107423-unused-delim-only-one-no-pair.stderr index ad90aeda1d13b..d9748843fd7a8 100644 --- a/tests/ui/malformed/issue-107423-unused-delim-only-one-no-pair.stderr +++ b/tests/ui/malformed/issue-107423-unused-delim-only-one-no-pair.stderr @@ -2,7 +2,7 @@ error: this file contains an unclosed delimiter --> $DIR/issue-107423-unused-delim-only-one-no-pair.rs:7:11 | LL | fn a(){{{ - | --- ^ + | ---^ | ||| | ||unclosed delimiter | |unclosed delimiter diff --git a/tests/ui/parser/bad-char-literals.rs b/tests/ui/parser/bad-char-literals.rs index 748b4a22253f5..c3d55d3f7e3bf 100644 Binary files a/tests/ui/parser/bad-char-literals.rs and b/tests/ui/parser/bad-char-literals.rs differ diff --git a/tests/ui/parser/bad-char-literals.stderr b/tests/ui/parser/bad-char-literals.stderr index 89253d7d4aacd..1fb324a1b7e84 100644 --- a/tests/ui/parser/bad-char-literals.stderr +++ b/tests/ui/parser/bad-char-literals.stderr @@ -25,7 +25,7 @@ LL | '\n'; error: character constant must be escaped: `\r` --> $DIR/bad-char-literals.rs:15:6 | -LL | ' '; +LL | '␍'; | ^ | help: escape the character @@ -33,8 +33,19 @@ help: escape the character LL | '\r'; | ++ +error: character literal may only contain one codepoint + --> $DIR/bad-char-literals.rs:18:5 + | +LL | '-␀-'; + | ^^^^^ + | +help: if you meant to write a string literal, use double quotes + | +LL | "-␀-"; + | ~ ~ + error: character constant must be escaped: `\t` - --> $DIR/bad-char-literals.rs:18:6 + --> $DIR/bad-char-literals.rs:21:6 | LL | ' '; | ^^^^ @@ -44,5 +55,5 @@ help: escape the character LL | '\t'; | ++ -error: aborting due to 4 previous errors +error: aborting due to 5 previous errors diff --git a/tests/ui/parser/bounds-type.rs b/tests/ui/parser/bounds-type.rs index a1971fa3146d1..7cee6def32f83 100644 --- a/tests/ui/parser/bounds-type.rs +++ b/tests/ui/parser/bounds-type.rs @@ -1,19 +1,30 @@ //@ compile-flags: -Z parse-only +//@ edition: 2021 struct S< T: 'a + Tr, // OK T: Tr + 'a, // OK T: 'a, // OK T:, // OK - T: ?for<'a> Trait, // OK + T: for<'a> ?Trait, //~ ERROR `for<...>` binder not allowed with `?` trait polarity modifier T: Tr +, // OK T: ?'a, //~ ERROR `?` may only modify trait bounds, not lifetime bounds T: ~const Tr, // OK - T: ~const ?Tr, // OK + T: ~const ?Tr, //~ ERROR `~const` trait not allowed with `?` trait polarity modifier T: ~const Tr + 'a, // OK T: ~const 'a, //~ ERROR `~const` may only modify trait bounds, not lifetime bounds T: const 'a, //~ ERROR `const` may only modify trait bounds, not lifetime bounds + + T: async Tr, // OK + T: async ?Tr, //~ ERROR `async` trait not allowed with `?` trait polarity modifier + T: async Tr + 'a, // OK + T: async 'a, //~ ERROR `async` may only modify trait bounds, not lifetime bounds + + T: const async Tr, // OK + T: const async ?Tr, //~ ERROR `const async` trait not allowed with `?` trait polarity modifier + T: const async Tr + 'a, // OK + T: const async 'a, //~ ERROR `const` may only modify trait bounds, not lifetime bounds >; fn main() {} diff --git a/tests/ui/parser/bounds-type.stderr b/tests/ui/parser/bounds-type.stderr index d1210e88d6678..09c35c12b000a 100644 --- a/tests/ui/parser/bounds-type.stderr +++ b/tests/ui/parser/bounds-type.stderr @@ -1,20 +1,64 @@ +error: `for<...>` binder not allowed with `?` trait polarity modifier + --> $DIR/bounds-type.rs:9:16 + | +LL | T: for<'a> ?Trait, + | ---- ^ + | | + | there is not a well-defined meaning for a higher-ranked `?` trait + error: `?` may only modify trait bounds, not lifetime bounds - --> $DIR/bounds-type.rs:10:8 + --> $DIR/bounds-type.rs:11:8 | LL | T: ?'a, | ^ +error: `~const` trait not allowed with `?` trait polarity modifier + --> $DIR/bounds-type.rs:14:15 + | +LL | T: ~const ?Tr, + | ------ ^ + | | + | there is not a well-defined meaning for a `~const ?` trait + error: `~const` may only modify trait bounds, not lifetime bounds - --> $DIR/bounds-type.rs:15:8 + --> $DIR/bounds-type.rs:16:8 | LL | T: ~const 'a, | ^^^^^^ error: `const` may only modify trait bounds, not lifetime bounds - --> $DIR/bounds-type.rs:16:8 + --> $DIR/bounds-type.rs:17:8 | LL | T: const 'a, | ^^^^^ -error: aborting due to 3 previous errors +error: `async` trait not allowed with `?` trait polarity modifier + --> $DIR/bounds-type.rs:20:14 + | +LL | T: async ?Tr, + | ----- ^ + | | + | there is not a well-defined meaning for a `async ?` trait + +error: `async` may only modify trait bounds, not lifetime bounds + --> $DIR/bounds-type.rs:22:8 + | +LL | T: async 'a, + | ^^^^^ + +error: `const async` trait not allowed with `?` trait polarity modifier + --> $DIR/bounds-type.rs:25:20 + | +LL | T: const async ?Tr, + | ----------- ^ + | | + | there is not a well-defined meaning for a `const async ?` trait + +error: `const` may only modify trait bounds, not lifetime bounds + --> $DIR/bounds-type.rs:27:8 + | +LL | T: const async 'a, + | ^^^^^ + +error: aborting due to 9 previous errors diff --git a/tests/ui/parser/brace-in-let-chain.stderr b/tests/ui/parser/brace-in-let-chain.stderr index 7182d86d001d0..d76cb25ad8b84 100644 --- a/tests/ui/parser/brace-in-let-chain.stderr +++ b/tests/ui/parser/brace-in-let-chain.stderr @@ -31,7 +31,7 @@ LL | && let () = () LL | } | - ...as it matches this but it has different indentation LL | } - | ^ + | ^ error: found a `{` in the middle of a let-chain --> $DIR/brace-in-let-chain.rs:14:24 diff --git a/tests/ui/parser/byte-string-literals.stderr b/tests/ui/parser/byte-string-literals.stderr index 655b6998e85ff..24e0eaac8fa91 100644 --- a/tests/ui/parser/byte-string-literals.stderr +++ b/tests/ui/parser/byte-string-literals.stderr @@ -43,7 +43,7 @@ error[E0766]: unterminated double quote byte string LL | b"a | ______^ LL | | } - | |__^ + | |_^ error: aborting due to 6 previous errors diff --git a/tests/ui/parser/deli-ident-issue-1.stderr b/tests/ui/parser/deli-ident-issue-1.stderr index 78f5d7b63b954..d17913eb7ea40 100644 --- a/tests/ui/parser/deli-ident-issue-1.stderr +++ b/tests/ui/parser/deli-ident-issue-1.stderr @@ -11,7 +11,7 @@ LL | } | - ...as it matches this but it has different indentation ... LL | fn main() { } - | ^ + | ^ error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-103451.stderr b/tests/ui/parser/issues/issue-103451.stderr index 7ad816e451eab..f078e556e2b16 100644 --- a/tests/ui/parser/issues/issue-103451.stderr +++ b/tests/ui/parser/issues/issue-103451.stderr @@ -4,7 +4,7 @@ error: this file contains an unclosed delimiter LL | struct S { | - unclosed delimiter LL | x: [u8; R - | - ^ + | - ^ | | | unclosed delimiter diff --git a/tests/ui/parser/issues/issue-104367.stderr b/tests/ui/parser/issues/issue-104367.stderr index e6e76535761fb..c067d12e2d96c 100644 --- a/tests/ui/parser/issues/issue-104367.stderr +++ b/tests/ui/parser/issues/issue-104367.stderr @@ -20,7 +20,7 @@ LL | #![cfg] { LL | #![w,) | - missing open `(` for this delimiter LL | - | ^ + | ^ error: aborting due to 2 previous errors diff --git a/tests/ui/parser/issues/issue-105209.stderr b/tests/ui/parser/issues/issue-105209.stderr index c75eafa18335e..72017e4327de4 100644 --- a/tests/ui/parser/issues/issue-105209.stderr +++ b/tests/ui/parser/issues/issue-105209.stderr @@ -16,7 +16,7 @@ LL | #![c={#![c[)x | | unclosed delimiter | unclosed delimiter LL | - | ^ + | ^ error: aborting due to 2 previous errors diff --git a/tests/ui/parser/issues/issue-107705.stderr b/tests/ui/parser/issues/issue-107705.stderr index 2d0c3e0e675c7..10a47b799318c 100644 --- a/tests/ui/parser/issues/issue-107705.stderr +++ b/tests/ui/parser/issues/issue-107705.stderr @@ -2,7 +2,7 @@ error: this file contains an unclosed delimiter --> $DIR/issue-107705.rs:3:67 | LL | fn f() {a(b:&, - | - - unclosed delimiter ^ + | - - unclosed delimiter ^ | | | unclosed delimiter diff --git a/tests/ui/parser/issues/issue-2354.stderr b/tests/ui/parser/issues/issue-2354.stderr index fd649a575c6c6..3e63473b6f45c 100644 --- a/tests/ui/parser/issues/issue-2354.stderr +++ b/tests/ui/parser/issues/issue-2354.stderr @@ -10,7 +10,7 @@ LL | } | - ...as it matches this but it has different indentation ... LL | - | ^ + | ^ error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-62546.stderr b/tests/ui/parser/issues/issue-62546.stderr index 6889cb3b8e9d2..6435cb2b719f4 100644 --- a/tests/ui/parser/issues/issue-62546.stderr +++ b/tests/ui/parser/issues/issue-62546.stderr @@ -2,7 +2,7 @@ error: this file contains an unclosed delimiter --> $DIR/issue-62546.rs:1:60 | LL | pub t(# - | - unclosed delimiter ^ + | - unclosed delimiter ^ error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-62554.stderr b/tests/ui/parser/issues/issue-62554.stderr index 37314dd39c7fd..d4aaef1618139 100644 --- a/tests/ui/parser/issues/issue-62554.stderr +++ b/tests/ui/parser/issues/issue-62554.stderr @@ -2,7 +2,7 @@ error: this file contains an unclosed delimiter --> $DIR/issue-62554.rs:5:89 | LL | fn foo(u: u8) { if u8 macro_rules! u8 { (u6) => { fn uuuuuuuuuuu() { use s loo mod u8 { - | - - - - - ^ + | - - - - -^ | | | | | | | | | | | unclosed delimiter | | | | unclosed delimiter diff --git a/tests/ui/parser/issues/issue-62881.stderr b/tests/ui/parser/issues/issue-62881.stderr index 2165a81a0482d..d8ae2cf090530 100644 --- a/tests/ui/parser/issues/issue-62881.stderr +++ b/tests/ui/parser/issues/issue-62881.stderr @@ -2,7 +2,7 @@ error: this file contains an unclosed delimiter --> $DIR/issue-62881.rs:3:96 | LL | fn f() -> isize { fn f() -> isize {} pub f< - | - unclosed delimiter ^ + | - unclosed delimiter ^ error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-62894.stderr b/tests/ui/parser/issues/issue-62894.stderr index 870633fc96f85..230319fc31e7e 100644 --- a/tests/ui/parser/issues/issue-62894.stderr +++ b/tests/ui/parser/issues/issue-62894.stderr @@ -8,7 +8,7 @@ LL | fn f() { assert_eq!(f(), (), assert_eq!(assert_eq! | unclosed delimiter LL | LL | fn main() {} - | ^ + | ^ error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-62973.stderr b/tests/ui/parser/issues/issue-62973.stderr index 14411a8cb7849..493183988e18b 100644 --- a/tests/ui/parser/issues/issue-62973.stderr +++ b/tests/ui/parser/issues/issue-62973.stderr @@ -25,7 +25,7 @@ LL | fn p() { match s { v, E { [) {) } | unclosed delimiter LL | LL | - | ^ + | ^ error: aborting due to 3 previous errors diff --git a/tests/ui/parser/issues/issue-63116.stderr b/tests/ui/parser/issues/issue-63116.stderr index 27c94f337bdb8..e0f7dd176ceb3 100644 --- a/tests/ui/parser/issues/issue-63116.stderr +++ b/tests/ui/parser/issues/issue-63116.stderr @@ -10,7 +10,7 @@ error: this file contains an unclosed delimiter --> $DIR/issue-63116.rs:3:18 | LL | impl W $DIR/issue-63135.rs:3:16 | LL | fn i(n{...,f # - | - - ^ + | - - ^ | | | | | unclosed delimiter | unclosed delimiter diff --git a/tests/ui/parser/issues/issue-66473.stderr b/tests/ui/parser/issues/issue-66473.stderr index 0e8b0a5da2205..ba38c4fa1b7ad 100644 Binary files a/tests/ui/parser/issues/issue-66473.stderr and b/tests/ui/parser/issues/issue-66473.stderr differ diff --git a/tests/ui/parser/issues/issue-67377-invalid-syntax-in-enum-discriminant.stderr b/tests/ui/parser/issues/issue-67377-invalid-syntax-in-enum-discriminant.stderr index 9f631edf680c8..b82b0f3255b55 100644 --- a/tests/ui/parser/issues/issue-67377-invalid-syntax-in-enum-discriminant.stderr +++ b/tests/ui/parser/issues/issue-67377-invalid-syntax-in-enum-discriminant.stderr @@ -41,7 +41,7 @@ LL | V = [Vec::new; { [0].len() ].len() as isize, | - missing open `[` for this delimiter ... LL | fn main() {} - | ^ + | ^ error: aborting due to 4 previous errors diff --git a/tests/ui/parser/issues/issue-68629.stderr b/tests/ui/parser/issues/issue-68629.stderr index 2562baa1c49c3..f003f37817951 100644 Binary files a/tests/ui/parser/issues/issue-68629.stderr and b/tests/ui/parser/issues/issue-68629.stderr differ diff --git a/tests/ui/parser/issues/issue-68730.stderr b/tests/ui/parser/issues/issue-68730.stderr index 5bca5bbebeacb..9bd98287db34a 100644 Binary files a/tests/ui/parser/issues/issue-68730.stderr and b/tests/ui/parser/issues/issue-68730.stderr differ diff --git a/tests/ui/parser/issues/issue-81804.stderr b/tests/ui/parser/issues/issue-81804.stderr index de3b33ecd95c6..6caaaa792b196 100644 --- a/tests/ui/parser/issues/issue-81804.stderr +++ b/tests/ui/parser/issues/issue-81804.stderr @@ -10,7 +10,7 @@ error: this file contains an unclosed delimiter --> $DIR/issue-81804.rs:6:11 | LL | fn p([=(} - | -- ^ + | -- ^ | || | |unclosed delimiter | unclosed delimiter diff --git a/tests/ui/parser/issues/issue-81827.stderr b/tests/ui/parser/issues/issue-81827.stderr index 63d135f73e69f..d12c74b4a3420 100644 --- a/tests/ui/parser/issues/issue-81827.stderr +++ b/tests/ui/parser/issues/issue-81827.stderr @@ -11,7 +11,7 @@ error: this file contains an unclosed delimiter --> $DIR/issue-81827.rs:10:27 | LL | fn r()->i{0|{#[cfg(r(0{]0 - | - - - ^ + | - - - ^ | | | | | | | missing open `[` for this delimiter | | unclosed delimiter diff --git a/tests/ui/parser/issues/issue-84104.stderr b/tests/ui/parser/issues/issue-84104.stderr index e866d39226751..b9b14c081a985 100644 --- a/tests/ui/parser/issues/issue-84104.stderr +++ b/tests/ui/parser/issues/issue-84104.stderr @@ -2,7 +2,7 @@ error: this file contains an unclosed delimiter --> $DIR/issue-84104.rs:2:13 | LL | #[i=i::<ښܖ< - | - ^ + | - ^ | | | unclosed delimiter diff --git a/tests/ui/parser/issues/issue-84148-2.stderr b/tests/ui/parser/issues/issue-84148-2.stderr index d9b6b336a2ce8..b30f3d9114c1d 100644 --- a/tests/ui/parser/issues/issue-84148-2.stderr +++ b/tests/ui/parser/issues/issue-84148-2.stderr @@ -2,7 +2,7 @@ error: this file contains an unclosed delimiter --> $DIR/issue-84148-2.rs:2:16 | LL | fn f(t:for<>t? - | - ^ + | - ^ | | | unclosed delimiter diff --git a/tests/ui/parser/issues/issue-88770.stderr b/tests/ui/parser/issues/issue-88770.stderr index 60ef025fa8bfd..5b54072d009fb 100644 --- a/tests/ui/parser/issues/issue-88770.stderr +++ b/tests/ui/parser/issues/issue-88770.stderr @@ -8,7 +8,7 @@ LL | fn m(){print!("",(c for&g | unclosed delimiter ... LL | e - | ^ + | ^ error: aborting due to 1 previous error diff --git a/tests/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.stderr b/tests/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.stderr index 97aac661d4658..39144246be24a 100644 --- a/tests/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.stderr +++ b/tests/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.stderr @@ -5,7 +5,7 @@ LL | impl T for () { | - unclosed delimiter ... LL | - | ^ + | ^ error: aborting due to 1 previous error diff --git a/tests/ui/parser/mismatched-braces/missing-close-brace-in-struct.stderr b/tests/ui/parser/mismatched-braces/missing-close-brace-in-struct.stderr index f70dac443e55f..603aee02ad6b0 100644 --- a/tests/ui/parser/mismatched-braces/missing-close-brace-in-struct.stderr +++ b/tests/ui/parser/mismatched-braces/missing-close-brace-in-struct.stderr @@ -5,7 +5,7 @@ LL | pub(crate) struct Bar { | - unclosed delimiter ... LL | fn main() {} - | ^ + | ^ error: aborting due to 1 previous error diff --git a/tests/ui/parser/mismatched-braces/missing-close-brace-in-trait.stderr b/tests/ui/parser/mismatched-braces/missing-close-brace-in-trait.stderr index a565ad49b221c..a2fb698c80f65 100644 --- a/tests/ui/parser/mismatched-braces/missing-close-brace-in-trait.stderr +++ b/tests/ui/parser/mismatched-braces/missing-close-brace-in-trait.stderr @@ -5,7 +5,7 @@ LL | trait T { | - unclosed delimiter ... LL | fn main() {} - | ^ + | ^ error: aborting due to 1 previous error diff --git a/tests/ui/parser/parser-ice-ed2021-await-105210.stderr b/tests/ui/parser/parser-ice-ed2021-await-105210.stderr index fc54476c22048..29abab2608e94 100644 --- a/tests/ui/parser/parser-ice-ed2021-await-105210.stderr +++ b/tests/ui/parser/parser-ice-ed2021-await-105210.stderr @@ -28,7 +28,7 @@ LL | (( h (const {( default ( await ( await ( (move {await((((}} | unclosed delimiter ... LL | - | ^ + | ^ error: aborting due to 3 previous errors diff --git a/tests/ui/parser/parser-recovery-1.stderr b/tests/ui/parser/parser-recovery-1.stderr index 8162db3d8e5d6..4ed40d7532612 100644 --- a/tests/ui/parser/parser-recovery-1.stderr +++ b/tests/ui/parser/parser-recovery-1.stderr @@ -10,7 +10,7 @@ LL | } | - ...as it matches this but it has different indentation ... LL | } - | ^ + | ^ error: aborting due to 1 previous error diff --git a/tests/ui/parser/raw/raw-byte-string-literals.stderr b/tests/ui/parser/raw/raw-byte-string-literals.stderr index a2f27d1ed70ae..a20ce845c3268 100644 --- a/tests/ui/parser/raw/raw-byte-string-literals.stderr +++ b/tests/ui/parser/raw/raw-byte-string-literals.stderr @@ -1,7 +1,7 @@ error: bare CR not allowed in raw string --> $DIR/raw-byte-string-literals.rs:4:9 | -LL | br"a "; +LL | br"a␍"; | ^ error: non-ASCII character in raw byte string literal diff --git a/tests/ui/parser/several-carriage-returns-in-doc-comment.stderr b/tests/ui/parser/several-carriage-returns-in-doc-comment.stderr index 07066fc22e6cd..e235a15838493 100644 --- a/tests/ui/parser/several-carriage-returns-in-doc-comment.stderr +++ b/tests/ui/parser/several-carriage-returns-in-doc-comment.stderr @@ -1,20 +1,20 @@ error: bare CR not allowed in doc-comment --> $DIR/several-carriage-returns-in-doc-comment.rs:6:12 | -LL | /// This do c comment contains three isolated `\r` symbols +LL | /// This do␍c comment contains ␍three isolated `\r`␍ symbols | ^ error: bare CR not allowed in doc-comment --> $DIR/several-carriage-returns-in-doc-comment.rs:6:32 | -LL | /// This do c comment contains three isolated `\r` symbols - | ^ +LL | /// This do␍c comment contains ␍three isolated `\r`␍ symbols + | ^ error: bare CR not allowed in doc-comment --> $DIR/several-carriage-returns-in-doc-comment.rs:6:52 | -LL | /// This do c comment contains three isolated `\r` symbols - | ^ +LL | /// This do␍c comment contains ␍three isolated `\r`␍ symbols + | ^ error: aborting due to 3 previous errors diff --git a/tests/ui/parser/trailing-carriage-return-in-string.stderr b/tests/ui/parser/trailing-carriage-return-in-string.stderr index fa2677921b32d..c5949432af893 100644 --- a/tests/ui/parser/trailing-carriage-return-in-string.stderr +++ b/tests/ui/parser/trailing-carriage-return-in-string.stderr @@ -1,7 +1,7 @@ error: unknown character escape: `\r` --> $DIR/trailing-carriage-return-in-string.rs:10:25 | -LL | let bad = "This is \ a test"; +LL | let bad = "This is \␍ a test"; | ^ unknown character escape | = help: this is an isolated carriage return; consider checking your editor and version control settings diff --git a/tests/ui/parser/unbalanced-doublequote.stderr b/tests/ui/parser/unbalanced-doublequote.stderr index d40b982da7c39..9fdad87a86cf1 100644 --- a/tests/ui/parser/unbalanced-doublequote.stderr +++ b/tests/ui/parser/unbalanced-doublequote.stderr @@ -3,7 +3,7 @@ error[E0765]: unterminated double quote string | LL | / " LL | | } - | |__^ + | |_^ error: aborting due to 1 previous error diff --git a/tests/ui/parser/unclosed-braces.stderr b/tests/ui/parser/unclosed-braces.stderr index acd92ac792597..74ac66af528db 100644 --- a/tests/ui/parser/unclosed-braces.stderr +++ b/tests/ui/parser/unclosed-braces.stderr @@ -11,7 +11,7 @@ LL | } | - ...as it matches this but it has different indentation ... LL | - | ^ + | ^ error: aborting due to 1 previous error diff --git a/tests/ui/parser/unicode-control-codepoints.stderr b/tests/ui/parser/unicode-control-codepoints.stderr index fc071a9419142..28de4ae72abbd 100644 --- a/tests/ui/parser/unicode-control-codepoints.stderr +++ b/tests/ui/parser/unicode-control-codepoints.stderr @@ -17,78 +17,78 @@ LL | println!("{:?}", b"us\u{202B}e\u{202A}r"); error: non-ASCII character in byte string literal --> $DIR/unicode-control-codepoints.rs:16:26 | -LL | println!("{:?}", b"/* } if isAdmin begin admins only "); +LL | println!("{:?}", b"/*� } �if isAdmin� � begin admins only "); | ^ must be ASCII but is '\u{202e}' | help: if you meant to use the UTF-8 encoding of '\u{202e}', use \xHH escapes | -LL | println!("{:?}", b"/*\xE2\x80\xAE } if isAdmin begin admins only "); +LL | println!("{:?}", b"/*\xE2\x80\xAE } �if isAdmin� � begin admins only "); | ~~~~~~~~~~~~ error: non-ASCII character in byte string literal --> $DIR/unicode-control-codepoints.rs:16:30 | -LL | println!("{:?}", b"/* } if isAdmin begin admins only "); - | ^ must be ASCII but is '\u{2066}' +LL | println!("{:?}", b"/*� } �if isAdmin� � begin admins only "); + | ^ must be ASCII but is '\u{2066}' | help: if you meant to use the UTF-8 encoding of '\u{2066}', use \xHH escapes | -LL | println!("{:?}", b"/* } \xE2\x81\xA6if isAdmin begin admins only "); - | ~~~~~~~~~~~~ +LL | println!("{:?}", b"/*� } \xE2\x81\xA6if isAdmin� � begin admins only "); + | ~~~~~~~~~~~~ error: non-ASCII character in byte string literal --> $DIR/unicode-control-codepoints.rs:16:41 | -LL | println!("{:?}", b"/* } if isAdmin begin admins only "); - | ^ must be ASCII but is '\u{2069}' +LL | println!("{:?}", b"/*� } �if isAdmin� � begin admins only "); + | ^ must be ASCII but is '\u{2069}' | help: if you meant to use the UTF-8 encoding of '\u{2069}', use \xHH escapes | -LL | println!("{:?}", b"/* } if isAdmin\xE2\x81\xA9 begin admins only "); - | ~~~~~~~~~~~~ +LL | println!("{:?}", b"/*� } �if isAdmin\xE2\x81\xA9 � begin admins only "); + | ~~~~~~~~~~~~ error: non-ASCII character in byte string literal --> $DIR/unicode-control-codepoints.rs:16:43 | -LL | println!("{:?}", b"/* } if isAdmin begin admins only "); - | ^ must be ASCII but is '\u{2066}' +LL | println!("{:?}", b"/*� } �if isAdmin� � begin admins only "); + | ^ must be ASCII but is '\u{2066}' | help: if you meant to use the UTF-8 encoding of '\u{2066}', use \xHH escapes | -LL | println!("{:?}", b"/* } if isAdmin \xE2\x81\xA6 begin admins only "); - | ~~~~~~~~~~~~ +LL | println!("{:?}", b"/*� } �if isAdmin� \xE2\x81\xA6 begin admins only "); + | ~~~~~~~~~~~~ error: non-ASCII character in raw byte string literal --> $DIR/unicode-control-codepoints.rs:21:29 | -LL | println!("{:?}", br##"/* } if isAdmin begin admins only "##); +LL | println!("{:?}", br##"/*� } �if isAdmin� � begin admins only "##); | ^ must be ASCII but is '\u{202e}' error: non-ASCII character in raw byte string literal --> $DIR/unicode-control-codepoints.rs:21:33 | -LL | println!("{:?}", br##"/* } if isAdmin begin admins only "##); - | ^ must be ASCII but is '\u{2066}' +LL | println!("{:?}", br##"/*� } �if isAdmin� � begin admins only "##); + | ^ must be ASCII but is '\u{2066}' error: non-ASCII character in raw byte string literal --> $DIR/unicode-control-codepoints.rs:21:44 | -LL | println!("{:?}", br##"/* } if isAdmin begin admins only "##); - | ^ must be ASCII but is '\u{2069}' +LL | println!("{:?}", br##"/*� } �if isAdmin� � begin admins only "##); + | ^ must be ASCII but is '\u{2069}' error: non-ASCII character in raw byte string literal --> $DIR/unicode-control-codepoints.rs:21:46 | -LL | println!("{:?}", br##"/* } if isAdmin begin admins only "##); - | ^ must be ASCII but is '\u{2066}' +LL | println!("{:?}", br##"/*� } �if isAdmin� � begin admins only "##); + | ^ must be ASCII but is '\u{2066}' error: unicode codepoint changing visible direction of text present in comment --> $DIR/unicode-control-codepoints.rs:2:5 | -LL | // if access_level != "user" { // Check if admin - | ^^^^^^^^^^^^^^^^^^^^^^^^^--^^^^^^^^^^^^^^^^^^^^^ - | | || - | | |'\u{202a}' +LL | // if access_level != "us�e�r" { // Check if admin + | ^^^^^^^^^^^^^^^^^^^^^^^^^-^-^^^^^^^^^^^^^^^^^^^^^^ + | | | | + | | | '\u{202a}' | | '\u{202b}' | this comment contains invisible unicode text flow control codepoints | @@ -99,12 +99,12 @@ LL | // if access_level != "user" { // Check if admin error: unicode codepoint changing visible direction of text present in comment --> $DIR/unicode-control-codepoints.rs:30:1 | -LL | //"/* } if isAdmin begin admins only */" - | ^^^^^-^^-^^^^^^^^^--^^^^^^^^^^^^^^^^^^^^^ - | | | | || - | | | | |'\u{2066}' - | | | | '\u{2069}' - | | | '\u{2066}' +LL | //"/*� } �if isAdmin� � begin admins only */" + | ^^^^^-^^^-^^^^^^^^^^-^-^^^^^^^^^^^^^^^^^^^^^^ + | | | | | | + | | | | | '\u{2066}' + | | | | '\u{2069}' + | | | '\u{2066}' | | '\u{202e}' | this comment contains invisible unicode text flow control codepoints | @@ -114,12 +114,12 @@ LL | //"/* } if isAdmin begin admins only */" error: unicode codepoint changing visible direction of text present in literal --> $DIR/unicode-control-codepoints.rs:11:22 | -LL | println!("{:?}", "/* } if isAdmin begin admins only "); - | ^^^-^^-^^^^^^^^^--^^^^^^^^^^^^^^^^^^^ - | | | | || - | | | | |'\u{2066}' - | | | | '\u{2069}' - | | | '\u{2066}' +LL | println!("{:?}", "/*� } �if isAdmin� � begin admins only "); + | ^^^-^^^-^^^^^^^^^^-^-^^^^^^^^^^^^^^^^^^^^ + | | | | | | + | | | | | '\u{2066}' + | | | | '\u{2069}' + | | | '\u{2066}' | | '\u{202e}' | this literal contains invisible unicode text flow control codepoints | @@ -134,12 +134,12 @@ LL | println!("{:?}", "/*\u{202e} } \u{2066}if isAdmin\u{2069} \u{2066} begi error: unicode codepoint changing visible direction of text present in literal --> $DIR/unicode-control-codepoints.rs:14:22 | -LL | println!("{:?}", r##"/* } if isAdmin begin admins only "##); - | ^^^^^^-^^-^^^^^^^^^--^^^^^^^^^^^^^^^^^^^^^ - | | | | || - | | | | |'\u{2066}' - | | | | '\u{2069}' - | | | '\u{2066}' +LL | println!("{:?}", r##"/*� } �if isAdmin� � begin admins only "##); + | ^^^^^^-^^^-^^^^^^^^^^-^-^^^^^^^^^^^^^^^^^^^^^^ + | | | | | | + | | | | | '\u{2066}' + | | | | '\u{2069}' + | | | '\u{2066}' | | '\u{202e}' | this literal contains invisible unicode text flow control codepoints | @@ -153,8 +153,8 @@ LL | println!("{:?}", r##"/*\u{202e} } \u{2066}if isAdmin\u{2069} \u{2066} b error: unicode codepoint changing visible direction of text present in literal --> $DIR/unicode-control-codepoints.rs:26:22 | -LL | println!("{:?}", ''); - | ^- +LL | println!("{:?}", '�'); + | ^-^ | || | |'\u{202e}' | this literal contains an invisible unicode text flow control codepoint @@ -169,8 +169,8 @@ LL | println!("{:?}", '\u{202e}'); error: unicode codepoint changing visible direction of text present in doc comment --> $DIR/unicode-control-codepoints.rs:33:1 | -LL | /** ''); */fn foo() {} - | ^^^^^^^^^^^^ this doc comment contains an invisible unicode text flow control codepoint +LL | /** '�'); */fn foo() {} + | ^^^^^^^^^^^^^ this doc comment contains an invisible unicode text flow control codepoint | = note: these kind of unicode codepoints change the way text flows on applications that support them, but can cause confusion because they change the order of characters on the screen = note: if their presence wasn't intentional, you can remove them @@ -181,8 +181,8 @@ error: unicode codepoint changing visible direction of text present in doc comme | LL | / /** LL | | * -LL | | * ''); */fn bar() {} - | |___________^ this doc comment contains an invisible unicode text flow control codepoint +LL | | * '�'); */fn bar() {} + | |____________^ this doc comment contains an invisible unicode text flow control codepoint | = note: these kind of unicode codepoints change the way text flows on applications that support them, but can cause confusion because they change the order of characters on the screen = note: if their presence wasn't intentional, you can remove them diff --git a/tests/ui/parser/unmatched-delimiter-at-end-of-file.stderr b/tests/ui/parser/unmatched-delimiter-at-end-of-file.stderr index c6960892b2bc8..192f5324935f6 100644 --- a/tests/ui/parser/unmatched-delimiter-at-end-of-file.stderr +++ b/tests/ui/parser/unmatched-delimiter-at-end-of-file.stderr @@ -2,7 +2,7 @@ error: this file contains an unclosed delimiter --> $DIR/unmatched-delimiter-at-end-of-file.rs:11:63 | LL | fn foo() { - | - unclosed delimiter ^ + | - unclosed delimiter ^ error: aborting due to 1 previous error diff --git a/tests/ui/parser/use-unclosed-brace.stderr b/tests/ui/parser/use-unclosed-brace.stderr index 6e624cb913163..1e62a0a06a36b 100644 --- a/tests/ui/parser/use-unclosed-brace.stderr +++ b/tests/ui/parser/use-unclosed-brace.stderr @@ -5,7 +5,7 @@ LL | use foo::{bar, baz; | - unclosed delimiter ... LL | fn main() {} - | ^ + | ^ error: aborting due to 1 previous error diff --git a/tests/ui/parser/utf16-be-without-bom.stderr b/tests/ui/parser/utf16-be-without-bom.stderr index c041f3ecf53b2..55ebf7aacd237 100644 Binary files a/tests/ui/parser/utf16-be-without-bom.stderr and b/tests/ui/parser/utf16-be-without-bom.stderr differ diff --git a/tests/ui/parser/utf16-le-without-bom.stderr b/tests/ui/parser/utf16-le-without-bom.stderr index cc2220441ac10..ad272a70f0627 100644 Binary files a/tests/ui/parser/utf16-le-without-bom.stderr and b/tests/ui/parser/utf16-le-without-bom.stderr differ diff --git a/tests/ui/privacy/restricted/test.rs b/tests/ui/privacy/restricted/test.rs index e1d87cfcd88c8..3fdfd191b365b 100644 --- a/tests/ui/privacy/restricted/test.rs +++ b/tests/ui/privacy/restricted/test.rs @@ -47,6 +47,6 @@ fn main() { } mod pathological { - pub(in bad::path) mod m1 {} //~ ERROR failed to resolve: maybe a missing crate `bad`? + pub(in bad::path) mod m1 {} //~ ERROR failed to resolve: you might be missing crate `bad` pub(in foo) mod m2 {} //~ ERROR visibilities can only be restricted to ancestor modules } diff --git a/tests/ui/privacy/restricted/test.stderr b/tests/ui/privacy/restricted/test.stderr index 76f19525df532..a48bb671d9f88 100644 --- a/tests/ui/privacy/restricted/test.stderr +++ b/tests/ui/privacy/restricted/test.stderr @@ -1,8 +1,8 @@ -error[E0433]: failed to resolve: maybe a missing crate `bad`? +error[E0433]: failed to resolve: you might be missing crate `bad` --> $DIR/test.rs:50:12 | LL | pub(in bad::path) mod m1 {} - | ^^^ maybe a missing crate `bad`? + | ^^^ you might be missing crate `bad` | = help: consider adding `extern crate bad` to use the `bad` crate diff --git a/tests/ui/resolve/editions-crate-root-2015.rs b/tests/ui/resolve/editions-crate-root-2015.rs index 5f764d3ceef81..869f4c82c8b71 100644 --- a/tests/ui/resolve/editions-crate-root-2015.rs +++ b/tests/ui/resolve/editions-crate-root-2015.rs @@ -2,10 +2,10 @@ mod inner { fn global_inner(_: ::nonexistant::Foo) { - //~^ ERROR failed to resolve: maybe a missing crate `nonexistant`? + //~^ ERROR failed to resolve: you might be missing crate `nonexistant` } fn crate_inner(_: crate::nonexistant::Foo) { - //~^ ERROR failed to resolve: maybe a missing crate `nonexistant`? + //~^ ERROR failed to resolve: you might be missing crate `nonexistant` } fn bare_global(_: ::nonexistant) { diff --git a/tests/ui/resolve/editions-crate-root-2015.stderr b/tests/ui/resolve/editions-crate-root-2015.stderr index 00cdd0c58f4ec..74fb7e6019ff5 100644 --- a/tests/ui/resolve/editions-crate-root-2015.stderr +++ b/tests/ui/resolve/editions-crate-root-2015.stderr @@ -1,16 +1,16 @@ -error[E0433]: failed to resolve: maybe a missing crate `nonexistant`? +error[E0433]: failed to resolve: you might be missing crate `nonexistant` --> $DIR/editions-crate-root-2015.rs:4:26 | LL | fn global_inner(_: ::nonexistant::Foo) { - | ^^^^^^^^^^^ maybe a missing crate `nonexistant`? + | ^^^^^^^^^^^ you might be missing crate `nonexistant` | = help: consider adding `extern crate nonexistant` to use the `nonexistant` crate -error[E0433]: failed to resolve: maybe a missing crate `nonexistant`? +error[E0433]: failed to resolve: you might be missing crate `nonexistant` --> $DIR/editions-crate-root-2015.rs:7:30 | LL | fn crate_inner(_: crate::nonexistant::Foo) { - | ^^^^^^^^^^^ maybe a missing crate `nonexistant`? + | ^^^^^^^^^^^ you might be missing crate `nonexistant` | = help: consider adding `extern crate nonexistant` to use the `nonexistant` crate diff --git a/tests/ui/resolve/extern-prelude-fail.stderr b/tests/ui/resolve/extern-prelude-fail.stderr index a1591914b4d29..4c2d5abb78247 100644 --- a/tests/ui/resolve/extern-prelude-fail.stderr +++ b/tests/ui/resolve/extern-prelude-fail.stderr @@ -2,15 +2,15 @@ error[E0432]: unresolved import `extern_prelude` --> $DIR/extern-prelude-fail.rs:7:9 | LL | use extern_prelude::S; - | ^^^^^^^^^^^^^^ maybe a missing crate `extern_prelude`? + | ^^^^^^^^^^^^^^ you might be missing crate `extern_prelude` | = help: consider adding `extern crate extern_prelude` to use the `extern_prelude` crate -error[E0433]: failed to resolve: maybe a missing crate `extern_prelude`? +error[E0433]: failed to resolve: you might be missing crate `extern_prelude` --> $DIR/extern-prelude-fail.rs:8:15 | LL | let s = ::extern_prelude::S; - | ^^^^^^^^^^^^^^ maybe a missing crate `extern_prelude`? + | ^^^^^^^^^^^^^^ you might be missing crate `extern_prelude` | = help: consider adding `extern crate extern_prelude` to use the `extern_prelude` crate diff --git a/tests/ui/resolve/issue-82865.rs b/tests/ui/resolve/issue-82865.rs index 07d88c413bfa8..29a898906e96b 100644 --- a/tests/ui/resolve/issue-82865.rs +++ b/tests/ui/resolve/issue-82865.rs @@ -2,7 +2,7 @@ #![feature(decl_macro)] -use x::y::z; //~ ERROR: failed to resolve: maybe a missing crate `x`? +use x::y::z; //~ ERROR: failed to resolve: you might be missing crate `x` macro mac () { Box::z //~ ERROR: no function or associated item diff --git a/tests/ui/resolve/issue-82865.stderr b/tests/ui/resolve/issue-82865.stderr index 730fd6d602645..ce0061a2b665e 100644 --- a/tests/ui/resolve/issue-82865.stderr +++ b/tests/ui/resolve/issue-82865.stderr @@ -1,8 +1,8 @@ -error[E0433]: failed to resolve: maybe a missing crate `x`? +error[E0433]: failed to resolve: you might be missing crate `x` --> $DIR/issue-82865.rs:5:5 | LL | use x::y::z; - | ^ maybe a missing crate `x`? + | ^ you might be missing crate `x` | = help: consider adding `extern crate x` to use the `x` crate diff --git a/tests/ui/resolve/resolve-bad-visibility.stderr b/tests/ui/resolve/resolve-bad-visibility.stderr index 2ac41b87562e1..8e4757354030e 100644 --- a/tests/ui/resolve/resolve-bad-visibility.stderr +++ b/tests/ui/resolve/resolve-bad-visibility.stderr @@ -16,19 +16,19 @@ error[E0742]: visibilities can only be restricted to ancestor modules LL | pub(in std::vec) struct F; | ^^^^^^^^ -error[E0433]: failed to resolve: maybe a missing crate `nonexistent`? +error[E0433]: failed to resolve: you might be missing crate `nonexistent` --> $DIR/resolve-bad-visibility.rs:7:8 | LL | pub(in nonexistent) struct G; - | ^^^^^^^^^^^ maybe a missing crate `nonexistent`? + | ^^^^^^^^^^^ you might be missing crate `nonexistent` | = help: consider adding `extern crate nonexistent` to use the `nonexistent` crate -error[E0433]: failed to resolve: maybe a missing crate `too_soon`? +error[E0433]: failed to resolve: you might be missing crate `too_soon` --> $DIR/resolve-bad-visibility.rs:8:8 | LL | pub(in too_soon) struct H; - | ^^^^^^^^ maybe a missing crate `too_soon`? + | ^^^^^^^^ you might be missing crate `too_soon` | = help: consider adding `extern crate too_soon` to use the `too_soon` crate diff --git a/tests/ui/rfcs/rfc-2627-raw-dylib/dlltool-failed.stderr b/tests/ui/rfcs/rfc-2627-raw-dylib/dlltool-failed.stderr index 0c5a06e68b89f..90cca83d1c1f5 100644 --- a/tests/ui/rfcs/rfc-2627-raw-dylib/dlltool-failed.stderr +++ b/tests/ui/rfcs/rfc-2627-raw-dylib/dlltool-failed.stderr @@ -1,6 +1,6 @@ error: Dlltool could not create import library with $DLLTOOL -d $DEF_FILE -D foo.dll -l $LIB_FILE $TARGET_MACHINE $ASM_FLAGS --no-leading-underscore $TEMP_PREFIX: - $DLLTOOL: Syntax error in def file $DEF_FILE:1 + $DLLTOOL: Syntax error in def file $DEF_FILE:1␍ error: aborting due to 1 previous error diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/issue-102156.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/issue-102156.stderr index c331236a4601c..0c836a614f8ba 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/issue-102156.stderr +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/issue-102156.stderr @@ -1,19 +1,19 @@ -error[E0433]: failed to resolve: maybe a missing crate `core`? +error[E0433]: failed to resolve: you might be missing crate `core` --> $DIR/issue-102156.rs:4:5 | LL | use core::convert::{From, TryFrom}; | ^^^^ | | - | maybe a missing crate `core`? + | you might be missing crate `core` | help: try using `std` instead of `core`: `std` -error[E0433]: failed to resolve: maybe a missing crate `core`? +error[E0433]: failed to resolve: you might be missing crate `core` --> $DIR/issue-102156.rs:4:5 | LL | use core::convert::{From, TryFrom}; | ^^^^ | | - | maybe a missing crate `core`? + | you might be missing crate `core` | help: try using `std` instead of `core`: `std` | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/mutually-exclusive-trait-bound-modifiers.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/mutually-exclusive-trait-bound-modifiers.rs index 37e285f2c6590..aaab8e819a39c 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/mutually-exclusive-trait-bound-modifiers.rs +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/mutually-exclusive-trait-bound-modifiers.rs @@ -1,17 +1,17 @@ #![feature(const_trait_impl)] const fn maybe_const_maybe() {} -//~^ ERROR `~const` and `?` are mutually exclusive +//~^ ERROR `~const` trait not allowed with `?` trait polarity modifier fn const_maybe() {} -//~^ ERROR `const` and `?` are mutually exclusive +//~^ ERROR `const` trait not allowed with `?` trait polarity modifier const fn maybe_const_negative() {} -//~^ ERROR `~const` and `!` are mutually exclusive +//~^ ERROR `~const` trait not allowed with `!` trait polarity modifier //~| ERROR negative bounds are not supported fn const_negative() {} -//~^ ERROR `const` and `!` are mutually exclusive +//~^ ERROR `const` trait not allowed with `!` trait polarity modifier //~| ERROR negative bounds are not supported #[const_trait] diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/mutually-exclusive-trait-bound-modifiers.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/mutually-exclusive-trait-bound-modifiers.stderr index 1938f740170b5..18e4d160f5f46 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/mutually-exclusive-trait-bound-modifiers.stderr +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/mutually-exclusive-trait-bound-modifiers.stderr @@ -1,26 +1,34 @@ -error: `~const` and `?` are mutually exclusive - --> $DIR/mutually-exclusive-trait-bound-modifiers.rs:3:31 +error: `~const` trait not allowed with `?` trait polarity modifier + --> $DIR/mutually-exclusive-trait-bound-modifiers.rs:3:38 | LL | const fn maybe_const_maybe() {} - | ^^^^^^^^^^^^^ + | ------ ^ + | | + | there is not a well-defined meaning for a `~const ?` trait -error: `const` and `?` are mutually exclusive - --> $DIR/mutually-exclusive-trait-bound-modifiers.rs:6:19 +error: `const` trait not allowed with `?` trait polarity modifier + --> $DIR/mutually-exclusive-trait-bound-modifiers.rs:6:25 | LL | fn const_maybe() {} - | ^^^^^^^^^^^^ + | ----- ^ + | | + | there is not a well-defined meaning for a `const ?` trait -error: `~const` and `!` are mutually exclusive - --> $DIR/mutually-exclusive-trait-bound-modifiers.rs:9:34 +error: `~const` trait not allowed with `!` trait polarity modifier + --> $DIR/mutually-exclusive-trait-bound-modifiers.rs:9:41 | LL | const fn maybe_const_negative() {} - | ^^^^^^^^^^^^^ + | ------ ^ + | | + | there is not a well-defined meaning for a `~const !` trait -error: `const` and `!` are mutually exclusive - --> $DIR/mutually-exclusive-trait-bound-modifiers.rs:13:22 +error: `const` trait not allowed with `!` trait polarity modifier + --> $DIR/mutually-exclusive-trait-bound-modifiers.rs:13:28 | LL | fn const_negative() {} - | ^^^^^^^^^^^^ + | ----- ^ + | | + | there is not a well-defined meaning for a `const !` trait error: negative bounds are not supported --> $DIR/mutually-exclusive-trait-bound-modifiers.rs:9:41 diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-syntax.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-syntax.rs index 496f97b5e24aa..d65ecae3d067c 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-syntax.rs +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-syntax.rs @@ -4,6 +4,6 @@ #![feature(const_trait_impl)] struct S< - T: ~const ?for<'a> Tr<'a> + 'static + ~const std::ops::Add, - T: ~const ?for<'a: 'b> m::Trait<'a>, + T: for<'a> ~const Tr<'a> + 'static + ~const std::ops::Add, + T: for<'a: 'b> ~const m::Trait<'a>, >; diff --git a/tests/ui/rfcs/rfc-3348-c-string-literals/no-nuls.stderr b/tests/ui/rfcs/rfc-3348-c-string-literals/no-nuls.stderr index a05dea3ff07e6..13cbd8370db64 100644 Binary files a/tests/ui/rfcs/rfc-3348-c-string-literals/no-nuls.stderr and b/tests/ui/rfcs/rfc-3348-c-string-literals/no-nuls.stderr differ diff --git a/tests/ui/rustdoc/unterminated-doc-comment.stderr b/tests/ui/rustdoc/unterminated-doc-comment.stderr index 2d96c606b1636..f0b691333dc93 100644 --- a/tests/ui/rustdoc/unterminated-doc-comment.stderr +++ b/tests/ui/rustdoc/unterminated-doc-comment.stderr @@ -2,7 +2,7 @@ error[E0758]: unterminated block doc-comment --> $DIR/unterminated-doc-comment.rs:1:1 | LL | /*! - | ^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/simd/portable-intrinsics-arent-exposed.stderr b/tests/ui/simd/portable-intrinsics-arent-exposed.stderr index a6f27af428b51..d38667f750d92 100644 --- a/tests/ui/simd/portable-intrinsics-arent-exposed.stderr +++ b/tests/ui/simd/portable-intrinsics-arent-exposed.stderr @@ -1,10 +1,10 @@ -error[E0433]: failed to resolve: maybe a missing crate `core`? +error[E0433]: failed to resolve: you might be missing crate `core` --> $DIR/portable-intrinsics-arent-exposed.rs:4:5 | LL | use core::simd::intrinsics; | ^^^^ | | - | maybe a missing crate `core`? + | you might be missing crate `core` | help: try using `std` instead of `core`: `std` error[E0432]: unresolved import `std::simd::intrinsics` diff --git a/tests/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.stderr b/tests/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.stderr index 004a057bbcdaf..c8cce16241617 100644 --- a/tests/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.stderr +++ b/tests/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.stderr @@ -2,7 +2,7 @@ error: this file contains an unclosed delimiter --> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs:12:85 | LL | trait C{async fn new(val: T) {} - | - unclosed delimiter ^ + | - unclosed delimiter ^ error: aborting due to 1 previous error diff --git a/tests/ui/str/str-escape.stderr b/tests/ui/str/str-escape.stderr index c4aee2a110a5b..4c8ee6bc013ef 100644 --- a/tests/ui/str/str-escape.stderr +++ b/tests/ui/str/str-escape.stderr @@ -22,9 +22,9 @@ warning: whitespace symbol '\u{c}' is not skipped | LL | let s = b"a\ | ________________^ -LL | | b"; - | | ^- whitespace symbol '\u{c}' is not skipped - | |____| +LL | | ␌b"; + | | ^ whitespace symbol '\u{c}' is not skipped + | |_____| | warning: 3 warnings emitted diff --git a/tests/ui/suggestions/issue-94171.stderr b/tests/ui/suggestions/issue-94171.stderr index b3440e46e8acd..3d73ee1d27a06 100644 --- a/tests/ui/suggestions/issue-94171.stderr +++ b/tests/ui/suggestions/issue-94171.stderr @@ -30,7 +30,7 @@ LL | (; {` | unclosed delimiter ... LL | - | ^ + | ^ error: aborting due to 3 previous errors diff --git a/tests/ui/typeck/issue-91334.stderr b/tests/ui/typeck/issue-91334.stderr index 7cb30eea530c6..01e34919ce67d 100644 --- a/tests/ui/typeck/issue-91334.stderr +++ b/tests/ui/typeck/issue-91334.stderr @@ -11,7 +11,7 @@ error: this file contains an unclosed delimiter --> $DIR/issue-91334.rs:7:23 | LL | fn f(){||yield(((){), - | - - - ^ + | - - - ^ | | | | | | | missing open `(` for this delimiter | | unclosed delimiter diff --git a/tests/ui/underscore-imports/issue-110164.stderr b/tests/ui/underscore-imports/issue-110164.stderr index 5016c41e8a579..240742996e12a 100644 --- a/tests/ui/underscore-imports/issue-110164.stderr +++ b/tests/ui/underscore-imports/issue-110164.stderr @@ -38,7 +38,7 @@ error[E0432]: unresolved import `_` --> $DIR/issue-110164.rs:8:5 | LL | use _::*; - | ^ maybe a missing crate `_`? + | ^ you might be missing crate `_` | = help: consider adding `extern crate _` to use the `_` crate @@ -46,7 +46,7 @@ error[E0432]: unresolved import `_` --> $DIR/issue-110164.rs:5:5 | LL | use _::a; - | ^ maybe a missing crate `_`? + | ^ you might be missing crate `_` | = help: consider adding `extern crate _` to use the `_` crate @@ -54,7 +54,7 @@ error[E0432]: unresolved import `_` --> $DIR/issue-110164.rs:13:9 | LL | use _::a; - | ^ maybe a missing crate `_`? + | ^ you might be missing crate `_` | = help: consider adding `extern crate _` to use the `_` crate @@ -62,7 +62,7 @@ error[E0432]: unresolved import `_` --> $DIR/issue-110164.rs:16:9 | LL | use _::*; - | ^ maybe a missing crate `_`? + | ^ you might be missing crate `_` | = help: consider adding `extern crate _` to use the `_` crate diff --git a/tests/ui/unresolved/unresolved-asterisk-imports.stderr b/tests/ui/unresolved/unresolved-asterisk-imports.stderr index 24ac2f8e6213a..299ec699775e9 100644 --- a/tests/ui/unresolved/unresolved-asterisk-imports.stderr +++ b/tests/ui/unresolved/unresolved-asterisk-imports.stderr @@ -2,7 +2,7 @@ error[E0432]: unresolved import `not_existing_crate` --> $DIR/unresolved-asterisk-imports.rs:1:5 | LL | use not_existing_crate::*; - | ^^^^^^^^^^^^^^^^^^ maybe a missing crate `not_existing_crate`? + | ^^^^^^^^^^^^^^^^^^ you might be missing crate `not_existing_crate` | = help: consider adding `extern crate not_existing_crate` to use the `not_existing_crate` crate diff --git a/tests/ui/unresolved/unresolved-import.rs b/tests/ui/unresolved/unresolved-import.rs index 4125c593c747f..e8f3b323e3375 100644 --- a/tests/ui/unresolved/unresolved-import.rs +++ b/tests/ui/unresolved/unresolved-import.rs @@ -1,21 +1,25 @@ -use foo::bar; //~ ERROR unresolved import `foo` [E0432] - //~^ maybe a missing crate `foo`? - //~| HELP consider adding `extern crate foo` to use the `foo` crate - -use bar::Baz as x; //~ ERROR unresolved import `bar::Baz` [E0432] - //~| no `Baz` in `bar` - //~| HELP a similar name exists in the module - //~| SUGGESTION Bar - -use food::baz; //~ ERROR unresolved import `food::baz` - //~| no `baz` in `food` - //~| HELP a similar name exists in the module - //~| SUGGESTION bag - -use food::{beens as Foo}; //~ ERROR unresolved import `food::beens` [E0432] - //~| no `beens` in `food` - //~| HELP a similar name exists in the module - //~| SUGGESTION beans +use foo::bar; +//~^ ERROR unresolved import `foo` [E0432] +//~| NOTE you might be missing crate `foo` +//~| HELP consider adding `extern crate foo` to use the `foo` crate + +use bar::Baz as x; +//~^ ERROR unresolved import `bar::Baz` [E0432] +//~| NOTE no `Baz` in `bar` +//~| HELP a similar name exists in the module +//~| SUGGESTION Bar + +use food::baz; +//~^ ERROR unresolved import `food::baz` +//~| NOTE no `baz` in `food` +//~| HELP a similar name exists in the module +//~| SUGGESTION bag + +use food::{beens as Foo}; +//~^ ERROR unresolved import `food::beens` [E0432] +//~| NOTE no `beens` in `food` +//~| HELP a similar name exists in the module +//~| SUGGESTION beans mod bar { pub struct Bar; @@ -36,9 +40,10 @@ mod m { MyVariant } - use MyEnum::*; //~ ERROR unresolved import `MyEnum` [E0432] - //~| HELP a similar path exists - //~| SUGGESTION self::MyEnum + use MyEnum::*; + //~^ ERROR unresolved import `MyEnum` [E0432] + //~| HELP a similar path exists + //~| SUGGESTION self::MyEnum } mod items { @@ -46,9 +51,10 @@ mod items { Variant } - use Enum::*; //~ ERROR unresolved import `Enum` [E0432] - //~| HELP a similar path exists - //~| SUGGESTION self::Enum + use Enum::*; + //~^ ERROR unresolved import `Enum` [E0432] + //~| HELP a similar path exists + //~| SUGGESTION self::Enum fn item() {} } diff --git a/tests/ui/unresolved/unresolved-import.stderr b/tests/ui/unresolved/unresolved-import.stderr index 0dd928c8b6ffd..7b03717c827ce 100644 --- a/tests/ui/unresolved/unresolved-import.stderr +++ b/tests/ui/unresolved/unresolved-import.stderr @@ -2,12 +2,12 @@ error[E0432]: unresolved import `foo` --> $DIR/unresolved-import.rs:1:5 | LL | use foo::bar; - | ^^^ maybe a missing crate `foo`? + | ^^^ you might be missing crate `foo` | = help: consider adding `extern crate foo` to use the `foo` crate error[E0432]: unresolved import `bar::Baz` - --> $DIR/unresolved-import.rs:5:5 + --> $DIR/unresolved-import.rs:6:5 | LL | use bar::Baz as x; | ^^^^^---^^^^^ @@ -16,7 +16,7 @@ LL | use bar::Baz as x; | no `Baz` in `bar` error[E0432]: unresolved import `food::baz` - --> $DIR/unresolved-import.rs:10:5 + --> $DIR/unresolved-import.rs:12:5 | LL | use food::baz; | ^^^^^^--- @@ -25,7 +25,7 @@ LL | use food::baz; | no `baz` in `food` error[E0432]: unresolved import `food::beens` - --> $DIR/unresolved-import.rs:15:12 + --> $DIR/unresolved-import.rs:18:12 | LL | use food::{beens as Foo}; | -----^^^^^^^ @@ -34,13 +34,13 @@ LL | use food::{beens as Foo}; | help: a similar name exists in the module: `beans` error[E0432]: unresolved import `MyEnum` - --> $DIR/unresolved-import.rs:39:9 + --> $DIR/unresolved-import.rs:43:9 | LL | use MyEnum::*; | ^^^^^^ help: a similar path exists: `self::MyEnum` error[E0432]: unresolved import `Enum` - --> $DIR/unresolved-import.rs:49:9 + --> $DIR/unresolved-import.rs:54:9 | LL | use Enum::*; | ^^^^ help: a similar path exists: `self::Enum`