mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-19 11:12:43 +00:00
Auto merge of #128169 - matthiaskrgr:rollup-ylsoq30, r=matthiaskrgr
Rollup of 5 pull requests Successful merges: - #127054 (Reorder trait bound modifiers *after* `for<...>` binder in trait bounds) - #127528 (Replace ASCII control chars with Unicode Control Pictures) - #127872 (Migrate `pointer-auth-link-with-c`, `c-dynamic-rlib` and `c-dynamic-dylib` `run-make` tests to rmake) - #128111 (Do not use question as label) - #128160 (Don't ICE when auto trait has assoc ty in old solver) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
004e155c46
@ -3882,7 +3882,6 @@ dependencies = [
|
||||
"termcolor",
|
||||
"termize",
|
||||
"tracing",
|
||||
"unicode-width",
|
||||
"windows",
|
||||
]
|
||||
|
||||
|
@ -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
|
||||
|
@ -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(),
|
||||
});
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
|
@ -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 {
|
||||
|
@ -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]
|
||||
|
@ -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::<usize>() as isize;
|
||||
let full_sub_len =
|
||||
part.snippet.chars().map(|ch| char_width(ch)).sum::<usize>() 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}', "<EFBFBD>"), // The following unicode text flow control characters are inconsistently
|
||||
('\u{202B}', "<EFBFBD>"), // supported across CLIs and can cause confusion due to the bytes on disk
|
||||
('\u{202D}', "<EFBFBD>"), // not corresponding to the visible source code, so we replace them always.
|
||||
('\u{202E}', "<EFBFBD>"),
|
||||
('\u{2066}', "<EFBFBD>"),
|
||||
('\u{2067}', "<EFBFBD>"),
|
||||
('\u{2068}', "<EFBFBD>"),
|
||||
('\u{202C}', "<EFBFBD>"),
|
||||
('\u{2069}', "<EFBFBD>"),
|
||||
// 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 {
|
||||
|
@ -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,
|
||||
);
|
||||
|
@ -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
|
||||
|
@ -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,
|
||||
}
|
||||
|
@ -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<LT_PARAM_DEFS>] SIMPLE_PATH
|
||||
/// TY_BOUND_NOPAREN = [for<GENERIC_PARAMS> 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()
|
||||
|
@ -73,7 +73,6 @@ impl<'a> HashStable<StableHashingContext<'a>> for SourceFile {
|
||||
source_len: _,
|
||||
lines: _,
|
||||
ref multibyte_chars,
|
||||
ref non_narrow_chars,
|
||||
ref normalized_pos,
|
||||
} = *self;
|
||||
|
||||
@ -98,11 +97,6 @@ impl<'a> HashStable<StableHashingContext<'a>> 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);
|
||||
|
@ -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!(
|
||||
|
@ -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<RelativeBytePos>, Vec<MultiByteChar>, Vec<NonNarrowChar>) {
|
||||
pub fn analyze_source_file(src: &str) -> (Vec<RelativeBytePos>, Vec<MultiByteChar>) {
|
||||
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<RelativeBytePos>,
|
||||
multi_byte_chars: &mut Vec<MultiByteChar>,
|
||||
non_narrow_chars: &mut Vec<NonNarrowChar>,
|
||||
) {
|
||||
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<RelativeBytePos>,
|
||||
multi_byte_chars: &mut Vec<MultiByteChar>,
|
||||
non_narrow_chars: &mut Vec<NonNarrowChar>,
|
||||
) {
|
||||
#[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<RelativeBytePos>,
|
||||
multi_byte_chars: &mut Vec<MultiByteChar>,
|
||||
non_narrow_chars: &mut Vec<NonNarrowChar>,
|
||||
) {
|
||||
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<RelativeBytePos>,
|
||||
multi_byte_chars: &mut Vec<MultiByteChar>,
|
||||
non_narrow_chars: &mut Vec<NonNarrowChar>,
|
||||
) -> 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;
|
||||
|
@ -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<RelativeBytePos> =
|
||||
$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<NonNarrowChar> = $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)],
|
||||
);
|
||||
|
@ -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<RelativeBytePos> 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<RelativeBytePos> 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<SourceFileLines>,
|
||||
/// Locations of multi-byte characters in the source code.
|
||||
pub multibyte_chars: Vec<MultiByteChar>,
|
||||
/// Width of characters that are not narrow in the source code.
|
||||
pub non_narrow_chars: Vec<NonNarrowChar>,
|
||||
/// Locations of characters removed during normalization.
|
||||
pub normalized_pos: Vec<NormalizedPos>,
|
||||
/// 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<S: SpanEncoder> Encodable<S> 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<D: SpanDecoder> Decodable<D> for SourceFile {
|
||||
}
|
||||
};
|
||||
let multibyte_chars: Vec<MultiByteChar> = Decodable::decode(d);
|
||||
let non_narrow_chars: Vec<NonNarrowChar> = Decodable::decode(d);
|
||||
let stable_id = Decodable::decode(d);
|
||||
let normalized_pos: Vec<NormalizedPos> = Decodable::decode(d);
|
||||
let cnum: CrateNum = Decodable::decode(d);
|
||||
@ -1721,7 +1654,6 @@ impl<D: SpanDecoder> Decodable<D> 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<NormalizedPos> {
|
||||
let mut normalized_pos = vec![];
|
||||
|
@ -330,7 +330,6 @@ impl SourceMap {
|
||||
cnum: CrateNum,
|
||||
file_local_lines: FreezeLock<SourceFileLines>,
|
||||
multibyte_chars: Vec<MultiByteChar>,
|
||||
non_narrow_chars: Vec<NonNarrowChar>,
|
||||
normalized_pos: Vec<NormalizedPos>,
|
||||
metadata_index: u32,
|
||||
) -> Lrc<SourceFile> {
|
||||
@ -348,7 +347,6 @@ impl SourceMap {
|
||||
source_len,
|
||||
lines: file_local_lines,
|
||||
multibyte_chars,
|
||||
non_narrow_chars,
|
||||
normalized_pos,
|
||||
stable_id,
|
||||
cnum,
|
||||
|
@ -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,
|
||||
);
|
||||
|
@ -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:?}")
|
||||
}
|
||||
|
@ -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)
|
||||
}
|
||||
|
@ -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<P: AsRef<Path>>(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<P: AsRef<Path>>(dir: P) -> Vec<PathBuf> {
|
||||
let paths = read_dir(dir);
|
||||
let mut output = Vec::new();
|
||||
for path in paths {
|
||||
output.push(path.unwrap().path());
|
||||
}
|
||||
output
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -146,8 +146,6 @@ trait T: ~ const Super {}
|
||||
|
||||
const fn not_quite_const<S: ~ const T>() -> i32 { <S as T>::CONST }
|
||||
|
||||
struct S<T:~ const ? Sized>(std::marker::PhantomData<T>);
|
||||
|
||||
impl ~ const T {}
|
||||
|
||||
fn apit(_: impl ~ const T) {}
|
||||
|
@ -3,9 +3,3 @@ where
|
||||
i32: !Copy,
|
||||
{
|
||||
}
|
||||
|
||||
fn maybe_const_negative()
|
||||
where
|
||||
i32: ~const !Copy,
|
||||
{
|
||||
}
|
||||
|
@ -153,8 +153,6 @@ const fn not_quite_const<S: ~const T>() -> i32 {
|
||||
<S as T>::CONST
|
||||
}
|
||||
|
||||
struct S<T: ~const ?Sized>(std::marker::PhantomData<T>);
|
||||
|
||||
impl ~const T {}
|
||||
|
||||
fn apit(_: impl ~const T) {}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -1,14 +0,0 @@
|
||||
//@ known-bug: #117829
|
||||
#![feature(auto_traits)]
|
||||
|
||||
trait B {}
|
||||
|
||||
auto trait Z<T>
|
||||
where
|
||||
T: Z<u16>,
|
||||
<T as Z<u16>>::W: B,
|
||||
{
|
||||
type W;
|
||||
}
|
||||
|
||||
fn main() {}
|
@ -1,9 +0,0 @@
|
||||
//@ known-bug: #117829
|
||||
auto trait Z<'a, T: ?Sized>
|
||||
where
|
||||
T: Z<'a, u16>,
|
||||
|
||||
for<'b> <T as Z<'b, u16>>::W: Clone,
|
||||
{
|
||||
type W: ?Sized;
|
||||
}
|
@ -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)
|
17
tests/run-make/c-dynamic-dylib/rmake.rs
Normal file
17
tests/run-make/c-dynamic-dylib/rmake.rs
Normal file
@ -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");
|
||||
}
|
@ -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)
|
18
tests/run-make/c-dynamic-rlib/rmake.rs
Normal file
18
tests/run-make/c-dynamic-rlib/rmake.rs
Normal file
@ -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");
|
||||
}
|
@ -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)
|
28
tests/run-make/pointer-auth-link-with-c/rmake.rs
Normal file
28
tests/run-make/pointer-auth-link-with-c/rmake.rs
Normal file
@ -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");
|
||||
}
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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`
|
||||
|
@ -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
|
||||
|
||||
|
@ -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,
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
@ -15,7 +15,7 @@ async fn f(arg: &i32) {}
|
||||
|
||||
async fn func<F>(f: F)
|
||||
where
|
||||
F: async for<'a> Fn(&'a i32),
|
||||
F: for<'a> async Fn(&'a i32),
|
||||
{
|
||||
let x: i32 = 0;
|
||||
f(&x).await;
|
||||
|
@ -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
|
||||
|
||||
|
40
tests/ui/auto-traits/assoc-ty.current.stderr
Normal file
40
tests/ui/auto-traits/assoc-ty.current.stderr
Normal file
@ -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 <https://github.com/rust-lang/rust/issues/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`.
|
40
tests/ui/auto-traits/assoc-ty.next.stderr
Normal file
40
tests/ui/auto-traits/assoc-ty.next.stderr
Normal file
@ -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 <https://github.com/rust-lang/rust/issues/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`.
|
17
tests/ui/auto-traits/assoc-ty.rs
Normal file
17
tests/ui/auto-traits/assoc-ty.rs
Normal file
@ -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
|
||||
}
|
@ -4,7 +4,7 @@ error[E0765]: unterminated double quote string
|
||||
LL | """;
|
||||
| ___________________^
|
||||
LL | | }
|
||||
| |__^
|
||||
| |_^
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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`
|
||||
|
|
||||
|
@ -24,7 +24,7 @@ mod foo {
|
||||
}
|
||||
use foo::*;
|
||||
|
||||
const fn with_positive<F: ~const for<'a> Fn(&'a Alias<'a>) + ~const Destruct>(fun: F) {
|
||||
const fn with_positive<F: for<'a> ~const Fn(&'a Alias<'a>) + ~const Destruct>(fun: F) {
|
||||
fun(filter_positive());
|
||||
}
|
||||
|
||||
|
@ -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<F: ~const for<'a> Fn(&'a Alias<'a>) + ~const Destruct>(fun: F) {
|
||||
LL | const fn with_positive<F: for<'a> ~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<F: ~const for<'a> Fn(&'a Alias<'a>) + ~const Destruct>(fun: F) {
|
||||
LL | const fn with_positive<F: for<'a> ~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<F: ~const for<'a> Fn(&'a Alias<'a>) + ~const Destruct + ~const Fn(&foo::Alias<'_>)>(fun: F) {
|
||||
LL | const fn with_positive<F: for<'a> ~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<F: ~const for<'a> Fn(&'a Alias<'a>) + ~const Destruct>(fun: F) {
|
||||
LL | const fn with_positive<F: for<'a> ~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 | }
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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() {}
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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() {}
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
//@ check-pass
|
||||
#![allow(dead_code)]
|
||||
fn f<T: ?for<'a> Sized>() {}
|
||||
//~^ ERROR `for<...>` binder should be placed before trait bound modifiers
|
||||
|
||||
fn main() {}
|
||||
|
10
tests/ui/issues/issue-39089.stderr
Normal file
10
tests/ui/issues/issue-39089.stderr
Normal file
@ -0,0 +1,10 @@
|
||||
error: `for<...>` binder should be placed before trait bound modifiers
|
||||
--> $DIR/issue-39089.rs:1:13
|
||||
|
|
||||
LL | fn f<T: ?for<'a> Sized>() {}
|
||||
| - ^^^^
|
||||
| |
|
||||
| place the `for<...>` binder before any modifiers
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
@ -4,7 +4,7 @@ error[E0765]: unterminated double quote string
|
||||
LL | "😊"";
|
||||
| _________^
|
||||
LL | | }
|
||||
| |__^
|
||||
| |_^
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -2,7 +2,7 @@ error[E0758]: unterminated block comment
|
||||
--> $DIR/unterminated-comment.rs:1:1
|
||||
|
|
||||
LL | /*
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
|
@ -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.
|
||||
|
||||
|
@ -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
|
||||
|
@ -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`
|
||||
|
||||
|
@ -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
|
||||
|
Binary file not shown.
@ -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
|
||||
|
||||
|
@ -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() {}
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -43,7 +43,7 @@ error[E0766]: unterminated double quote byte string
|
||||
LL | b"a
|
||||
| ______^
|
||||
LL | | }
|
||||
| |__^
|
||||
| |_^
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
|
@ -11,7 +11,7 @@ LL | }
|
||||
| - ...as it matches this but it has different indentation
|
||||
...
|
||||
LL | fn main() { }
|
||||
| ^
|
||||
| ^
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
|
@ -4,7 +4,7 @@ error: this file contains an unclosed delimiter
|
||||
LL | struct S {
|
||||
| - unclosed delimiter
|
||||
LL | x: [u8; R
|
||||
| - ^
|
||||
| - ^
|
||||
| |
|
||||
| unclosed delimiter
|
||||
|
||||
|
@ -20,7 +20,7 @@ LL | #![cfg] {
|
||||
LL | #![w,)
|
||||
| - missing open `(` for this delimiter
|
||||
LL |
|
||||
| ^
|
||||
| ^
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -16,7 +16,7 @@ LL | #![c={#![c[)x
|
||||
| | unclosed delimiter
|
||||
| unclosed delimiter
|
||||
LL |
|
||||
| ^
|
||||
| ^
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -10,7 +10,7 @@ LL | }
|
||||
| - ...as it matches this but it has different indentation
|
||||
...
|
||||
LL |
|
||||
| ^
|
||||
| ^
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -25,7 +25,7 @@ LL | fn p() { match s { v, E { [) {) }
|
||||
| unclosed delimiter
|
||||
LL |
|
||||
LL |
|
||||
| ^
|
||||
| ^
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
|
@ -10,7 +10,7 @@ error: this file contains an unclosed delimiter
|
||||
--> $DIR/issue-63116.rs:3:18
|
||||
|
|
||||
LL | impl W <s(f;Y(;]
|
||||
| - - ^
|
||||
| - -^
|
||||
| | |
|
||||
| | missing open `[` for this delimiter
|
||||
| unclosed delimiter
|
||||
|
@ -2,7 +2,7 @@ error: this file contains an unclosed delimiter
|
||||
--> $DIR/issue-63135.rs:3:16
|
||||
|
|
||||
LL | fn i(n{...,f #
|
||||
| - - ^
|
||||
| - - ^
|
||||
| | |
|
||||
| | unclosed delimiter
|
||||
| unclosed delimiter
|
||||
|
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user