Auto merge of #147428 - matthiaskrgr:rollup-k3nlxlu, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - rust-lang/rust#145495 (Use declarative macro for `#[derive(TryFromU32)]`) - rust-lang/rust#147165 (test: Subtract code_offset from width for ui_testing) - rust-lang/rust#147354 (Fix wrong span for hightlight for duplicated diff lines) - rust-lang/rust#147395 (Improve diagnostics: update note and add help message) - rust-lang/rust#147396 (Fluent tidy improvements) - rust-lang/rust#147407 (Update books) - rust-lang/rust#147413 (don't panic on extern with just multiple quotes in the name) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
4a54b26d30
59 changed files with 319 additions and 345 deletions
|
|
@ -6,7 +6,6 @@ use rustc_abi::Align;
|
|||
use rustc_codegen_ssa::traits::{BaseTypeCodegenMethods, ConstCodegenMethods};
|
||||
use rustc_data_structures::fx::FxIndexMap;
|
||||
use rustc_index::IndexVec;
|
||||
use rustc_macros::TryFromU32;
|
||||
use rustc_middle::ty::TyCtxt;
|
||||
use rustc_session::RemapFileNameExt;
|
||||
use rustc_session::config::RemapPathScopeComponents;
|
||||
|
|
@ -16,7 +15,7 @@ use tracing::debug;
|
|||
use crate::common::CodegenCx;
|
||||
use crate::coverageinfo::llvm_cov;
|
||||
use crate::coverageinfo::mapgen::covfun::prepare_covfun_record;
|
||||
use crate::llvm;
|
||||
use crate::{TryFromU32, llvm};
|
||||
|
||||
mod covfun;
|
||||
mod spans;
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
#![feature(if_let_guard)]
|
||||
#![feature(impl_trait_in_assoc_type)]
|
||||
#![feature(iter_intersperse)]
|
||||
#![feature(macro_derive)]
|
||||
#![feature(rustdoc_internals)]
|
||||
#![feature(slice_as_array)]
|
||||
#![feature(try_blocks)]
|
||||
|
|
@ -65,6 +66,7 @@ mod errors;
|
|||
mod intrinsic;
|
||||
mod llvm;
|
||||
mod llvm_util;
|
||||
mod macros;
|
||||
mod mono_item;
|
||||
mod type_;
|
||||
mod type_of;
|
||||
|
|
@ -74,6 +76,8 @@ mod value;
|
|||
|
||||
rustc_fluent_macro::fluent_messages! { "../messages.ftl" }
|
||||
|
||||
pub(crate) use macros::TryFromU32;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct LlvmCodegenBackend(());
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ use std::ptr;
|
|||
|
||||
use bitflags::bitflags;
|
||||
use libc::{c_char, c_int, c_uchar, c_uint, c_ulonglong, c_void, size_t};
|
||||
use rustc_macros::TryFromU32;
|
||||
|
||||
use super::RustString;
|
||||
use super::debuginfo::{
|
||||
|
|
@ -27,8 +26,8 @@ use super::debuginfo::{
|
|||
DIGlobalVariableExpression, DILocation, DISPFlags, DIScope, DISubprogram,
|
||||
DITemplateTypeParameter, DIType, DebugEmissionKind, DebugNameTableKind,
|
||||
};
|
||||
use crate::llvm;
|
||||
use crate::llvm::MetadataKindId;
|
||||
use crate::{TryFromU32, llvm};
|
||||
|
||||
/// In the LLVM-C API, boolean values are passed as `typedef int LLVMBool`,
|
||||
/// which has a different ABI from Rust or C++ `bool`.
|
||||
|
|
|
|||
22
compiler/rustc_codegen_llvm/src/macros.rs
Normal file
22
compiler/rustc_codegen_llvm/src/macros.rs
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
macro_rules! TryFromU32 {
|
||||
derive() (
|
||||
$(#[$meta:meta])*
|
||||
$vis:vis enum $Type:ident {
|
||||
$(
|
||||
$(#[$varmeta:meta])*
|
||||
$Variant:ident $(= $discr:expr)?
|
||||
),* $(,)?
|
||||
}
|
||||
) => {
|
||||
impl ::core::convert::TryFrom<u32> for $Type {
|
||||
type Error = u32;
|
||||
#[allow(deprecated)] // Don't warn about deprecated variants.
|
||||
fn try_from(value: u32) -> ::core::result::Result<$Type, Self::Error> {
|
||||
$( if value == const { $Type::$Variant as u32 } { return Ok($Type::$Variant) } )*
|
||||
Err(value)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) use TryFromU32;
|
||||
|
|
@ -2021,7 +2021,7 @@ impl HumanEmitter {
|
|||
if let Some(width) = self.diagnostic_width {
|
||||
width.saturating_sub(code_offset)
|
||||
} else if self.ui_testing || cfg!(miri) {
|
||||
DEFAULT_COLUMN_WIDTH
|
||||
DEFAULT_COLUMN_WIDTH.saturating_sub(code_offset)
|
||||
} else {
|
||||
termize::dimensions()
|
||||
.map(|(w, _)| w.saturating_sub(code_offset))
|
||||
|
|
@ -2412,7 +2412,7 @@ impl HumanEmitter {
|
|||
// too bad to begin with, so we side-step that issue here.
|
||||
for (i, line) in snippet.lines().enumerate() {
|
||||
let line = normalize_whitespace(line);
|
||||
let row = row_num - 2 - (newlines - i - 1);
|
||||
let row = (row_num - 2 - (newlines - i - 1)).max(2);
|
||||
// On the first line, we highlight between the start of the part
|
||||
// span, and the end of that line.
|
||||
// On the last line, we highlight between the start of the line, and
|
||||
|
|
|
|||
|
|
@ -118,8 +118,9 @@ expand_module_file_not_found =
|
|||
.note = if there is a `mod {$name}` elsewhere in the crate already, import it with `use crate::...` instead
|
||||
|
||||
expand_module_in_block =
|
||||
cannot declare a non-inline module inside a block unless it has a path attribute
|
||||
.note = maybe `use` the module `{$name}` instead of redeclaring it
|
||||
cannot declare a file module inside a block unless it has a path attribute
|
||||
.help = maybe `use` the module `{$name}` instead of redeclaring it
|
||||
.note = file modules are usually placed outside of blocks, at the top level of the file
|
||||
|
||||
expand_module_multiple_candidates =
|
||||
file for module `{$name}` found at both "{$default_path}" and "{$secondary_path}"
|
||||
|
|
|
|||
|
|
@ -265,6 +265,7 @@ pub(crate) struct ModuleCircular {
|
|||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(expand_module_in_block)]
|
||||
#[note]
|
||||
pub(crate) struct ModuleInBlock {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
|
|
@ -273,7 +274,7 @@ pub(crate) struct ModuleInBlock {
|
|||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[note(expand_note)]
|
||||
#[help(expand_help)]
|
||||
pub(crate) struct ModuleInBlockName {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ mod print_attribute;
|
|||
mod query;
|
||||
mod serialize;
|
||||
mod symbols;
|
||||
mod try_from;
|
||||
mod type_foldable;
|
||||
mod type_visitable;
|
||||
mod visitable;
|
||||
|
|
@ -176,14 +175,6 @@ decl_derive!(
|
|||
applicability)] => diagnostics::subdiagnostic_derive
|
||||
);
|
||||
|
||||
decl_derive! {
|
||||
[TryFromU32] =>
|
||||
/// Derives `TryFrom<u32>` for the annotated `enum`, which must have no fields.
|
||||
/// Each variant maps to the value it would produce under an `as u32` cast.
|
||||
///
|
||||
/// The error type is `u32`.
|
||||
try_from::try_from_u32
|
||||
}
|
||||
decl_derive! {
|
||||
[PrintAttribute] =>
|
||||
/// Derives `PrintAttribute` for `AttributeKind`.
|
||||
|
|
|
|||
|
|
@ -1,55 +0,0 @@
|
|||
use proc_macro2::TokenStream;
|
||||
use quote::{quote, quote_spanned};
|
||||
use syn::Data;
|
||||
use syn::spanned::Spanned;
|
||||
use synstructure::Structure;
|
||||
|
||||
pub(crate) fn try_from_u32(s: Structure<'_>) -> TokenStream {
|
||||
let span_error = |span, message: &str| {
|
||||
quote_spanned! { span => const _: () = ::core::compile_error!(#message); }
|
||||
};
|
||||
|
||||
// Must be applied to an enum type.
|
||||
if let Some(span) = match &s.ast().data {
|
||||
Data::Enum(_) => None,
|
||||
Data::Struct(s) => Some(s.struct_token.span()),
|
||||
Data::Union(u) => Some(u.union_token.span()),
|
||||
} {
|
||||
return span_error(span, "type is not an enum (TryFromU32)");
|
||||
}
|
||||
|
||||
// The enum's variants must not have fields.
|
||||
let variant_field_errors = s
|
||||
.variants()
|
||||
.iter()
|
||||
.filter_map(|v| v.ast().fields.iter().map(|f| f.span()).next())
|
||||
.map(|span| span_error(span, "enum variant cannot have fields (TryFromU32)"))
|
||||
.collect::<TokenStream>();
|
||||
if !variant_field_errors.is_empty() {
|
||||
return variant_field_errors;
|
||||
}
|
||||
|
||||
let ctor = s
|
||||
.variants()
|
||||
.iter()
|
||||
.map(|v| v.construct(|_, _| -> TokenStream { unreachable!() }))
|
||||
.collect::<Vec<_>>();
|
||||
// FIXME(edition_2024): Fix the `keyword_idents_2024` lint to not trigger here?
|
||||
#[allow(keyword_idents_2024)]
|
||||
s.gen_impl(quote! {
|
||||
// The surrounding code might have shadowed these identifiers.
|
||||
use ::core::convert::TryFrom;
|
||||
use ::core::primitive::u32;
|
||||
use ::core::result::Result::{self, Ok, Err};
|
||||
|
||||
gen impl TryFrom<u32> for @Self {
|
||||
type Error = u32;
|
||||
|
||||
#[allow(deprecated)] // Don't warn about deprecated variants.
|
||||
fn try_from(value: u32) -> Result<Self, Self::Error> {
|
||||
#( if value == const { #ctor as u32 } { return Ok(#ctor) } )*
|
||||
Err(value)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
@ -2511,9 +2511,11 @@ impl Ident {
|
|||
}
|
||||
|
||||
/// Creates a new ident with the same span and name with leading quote removed, if any.
|
||||
/// If called on an empty ident, or with name just a single quote, returns an empty ident which is invalid.
|
||||
/// Calling it on a `'` ident will return an empty ident, which triggers debug assertions.
|
||||
pub fn without_first_quote(self) -> Ident {
|
||||
Ident::new(Symbol::intern(self.as_str().trim_start_matches('\'')), self.span)
|
||||
self.as_str()
|
||||
.strip_prefix('\'')
|
||||
.map_or(self, |name| Ident::new(Symbol::intern(name), self.span))
|
||||
}
|
||||
|
||||
/// "Normalize" ident for use in comparisons using "item hygiene".
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit e11adf6016a362766eea5a3f9832e193994dd0c8
|
||||
Subproject commit 8efb9805686722dba511b7b27281bb6b77d32130
|
||||
|
|
@ -19,7 +19,7 @@ LL | let _ = option_env!("PATH").expect("environment variable PATH isn't set
|
|||
error: this will panic at run-time if the environment variable doesn't exist at compile-time
|
||||
--> tests/ui/option_env_unwrap.rs:14:13
|
||||
|
|
||||
LL | let _ = option_env!("__Y__do_not_use").unwrap(); // This test only works if you don't have a __Y__do_not_use env variable in your env...
|
||||
LL | let _ = option_env!("__Y__do_not_use").unwrap(); // This test only works if you don't have a __Y__do_not_use env variable in you...
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using the `env!` macro instead
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ LL | | /// gravida non lacinia at, rhoncus eu lacus.
|
|||
error: first doc comment paragraph is too long
|
||||
--> tests/ui/too_long_first_doc_paragraph.rs:65:1
|
||||
|
|
||||
LL | / /// Some function. This doc-string paragraph is too long. Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lore...
|
||||
LL | / /// Some function. This doc-string paragraph is too long. Lorem Ipsum is simply dummy text of the printing and typesetting industr...
|
||||
LL | |
|
||||
LL | | ///
|
||||
LL | | /// Here's a second paragraph. It would be preferable to put the details here.
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
error: Undefined Behavior: trying to join an already joined thread
|
||||
--> tests/fail-dep/concurrency/libc_pthread_join_joined.rs:LL:CC
|
||||
|
|
||||
LL | assert_eq!(libc::pthread_join(native, ptr::null_mut()), 0);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Undefined Behavior occurred here
|
||||
LL | ... assert_eq!(libc::pthread_join(native, ptr::null_mut()), 0);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Undefined Behavior occurred here
|
||||
|
|
||||
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
|
||||
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
error: Undefined Behavior: trying to join a detached thread
|
||||
--> tests/fail-dep/concurrency/libc_pthread_join_main.rs:LL:CC
|
||||
|
|
||||
LL | assert_eq!(libc::pthread_join(thread_id, ptr::null_mut()), 0);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Undefined Behavior occurred here
|
||||
LL | ... assert_eq!(libc::pthread_join(thread_id, ptr::null_mut()), 0);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Undefined Behavior occurred here
|
||||
|
|
||||
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
|
||||
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
error: Undefined Behavior: Data race detected between (1) non-atomic read on thread `unnamed-ID` and (2) deallocation on thread `unnamed-ID` at ALLOC
|
||||
--> tests/fail/data_race/dealloc_read_race1.rs:LL:CC
|
||||
|
|
||||
LL | / __rust_dealloc(
|
||||
LL | |
|
||||
LL | | ptr.0 as *mut _,
|
||||
LL | | std::mem::size_of::<usize>(),
|
||||
LL | | std::mem::align_of::<usize>(),
|
||||
LL | | );
|
||||
| |_____________^ (2) just happened here
|
||||
LL | / ... __rust_dealloc(
|
||||
LL | | ...
|
||||
LL | | ... ptr.0 as *mut _,
|
||||
LL | | ... std::mem::size_of::<usize>(),
|
||||
LL | | ... std::mem::align_of::<usize>(),
|
||||
LL | | ... );
|
||||
| |_______^ (2) just happened here
|
||||
|
|
||||
help: and (1) occurred earlier here
|
||||
--> tests/fail/data_race/dealloc_read_race1.rs:LL:CC
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
error: Undefined Behavior: Data race detected between (1) non-atomic read on thread `unnamed-ID` and (2) deallocation on thread `unnamed-ID` at ALLOC
|
||||
--> tests/fail/data_race/dealloc_read_race_stack.rs:LL:CC
|
||||
|
|
||||
LL | }
|
||||
| ^ (2) just happened here
|
||||
LL | ... }
|
||||
| ^ (2) just happened here
|
||||
|
|
||||
help: and (1) occurred earlier here
|
||||
--> tests/fail/data_race/dealloc_read_race_stack.rs:LL:CC
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) deallocation on thread `unnamed-ID` at ALLOC
|
||||
--> tests/fail/data_race/dealloc_write_race1.rs:LL:CC
|
||||
|
|
||||
LL | / __rust_dealloc(
|
||||
LL | |
|
||||
LL | | ptr.0 as *mut _,
|
||||
LL | | std::mem::size_of::<usize>(),
|
||||
LL | | std::mem::align_of::<usize>(),
|
||||
LL | | );
|
||||
| |_____________^ (2) just happened here
|
||||
LL | / ... __rust_dealloc(
|
||||
LL | | ...
|
||||
LL | | ... ptr.0 as *mut _,
|
||||
LL | | ... std::mem::size_of::<usize>(),
|
||||
LL | | ... std::mem::align_of::<usize>(),
|
||||
LL | | ... );
|
||||
| |_______^ (2) just happened here
|
||||
|
|
||||
help: and (1) occurred earlier here
|
||||
--> tests/fail/data_race/dealloc_write_race1.rs:LL:CC
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) deallocation on thread `unnamed-ID` at ALLOC
|
||||
--> tests/fail/data_race/dealloc_write_race_stack.rs:LL:CC
|
||||
|
|
||||
LL | }
|
||||
| ^ (2) just happened here
|
||||
LL | ... }
|
||||
| ^ (2) just happened here
|
||||
|
|
||||
help: and (1) occurred earlier here
|
||||
--> tests/fail/data_race/dealloc_write_race_stack.rs:LL:CC
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
error: Undefined Behavior: accessing memory with alignment ALIGN, but alignment ALIGN is required
|
||||
--> tests/fail/intrinsics/copy_unaligned.rs:LL:CC
|
||||
|
|
||||
LL | std::intrinsics::copy_nonoverlapping(&data[5], ptr, 0);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Undefined Behavior occurred here
|
||||
LL | ... std::intrinsics::copy_nonoverlapping(&data[5], ptr, 0);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Undefined Behavior occurred here
|
||||
|
|
||||
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
|
||||
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
error: Undefined Behavior: `simd_cast` intrinsic called on 3.40282347E+38f32 which cannot be represented in target type `i32`
|
||||
--> tests/fail/intrinsics/simd-float-to-int.rs:LL:CC
|
||||
|
|
||||
LL | let _x: i32x2 = f32x2::from_array([f32::MAX, f32::MIN]).to_int_unchecked();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Undefined Behavior occurred here
|
||||
LL | ... let _x: i32x2 = f32x2::from_array([f32::MAX, f32::MIN]).to_int_unchecked();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Undefined Behavior occurred here
|
||||
|
|
||||
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
|
||||
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
error: Undefined Behavior: Data race detected between (1) retag read on thread `unnamed-ID` and (2) non-atomic write on thread `unnamed-ID` at ALLOC
|
||||
--> tests/fail/stacked_borrows/retag_data_race_read.rs:LL:CC
|
||||
|
|
||||
LL | *p = 5;
|
||||
| ^^^^^^ (2) just happened here
|
||||
LL | ... *p = 5;
|
||||
| ^^^^^^ (2) just happened here
|
||||
|
|
||||
help: and (1) occurred earlier here
|
||||
--> tests/fail/stacked_borrows/retag_data_race_read.rs:LL:CC
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ use std::fs::OpenOptions;
|
|||
use std::io::Write;
|
||||
use std::path::Path;
|
||||
|
||||
use fluent_syntax::ast::Entry;
|
||||
use fluent_syntax::parser;
|
||||
use regex::Regex;
|
||||
|
||||
use crate::diagnostics::{CheckId, DiagCtx, RunningCheck};
|
||||
|
|
@ -24,30 +26,31 @@ fn check_alphabetic(
|
|||
check: &mut RunningCheck,
|
||||
all_defined_msgs: &mut HashMap<String, String>,
|
||||
) {
|
||||
let mut matches = message().captures_iter(fluent).peekable();
|
||||
while let Some(m) = matches.next() {
|
||||
let name = m.get(1).unwrap();
|
||||
if let Some(defined_filename) = all_defined_msgs.get(name.as_str()) {
|
||||
check.error(format!(
|
||||
"{filename}: message `{}` is already defined in {defined_filename}",
|
||||
name.as_str(),
|
||||
));
|
||||
}
|
||||
let Ok(resource) = parser::parse(fluent) else {
|
||||
panic!("Errors encountered while parsing fluent file `{filename}`");
|
||||
};
|
||||
|
||||
all_defined_msgs.insert(name.as_str().to_owned(), filename.to_owned());
|
||||
let mut prev: Option<&str> = None;
|
||||
|
||||
if let Some(next) = matches.peek() {
|
||||
let next = next.get(1).unwrap();
|
||||
if name.as_str() > next.as_str() {
|
||||
for entry in &resource.body {
|
||||
if let Entry::Message(msg) = entry {
|
||||
let name: &str = msg.id.name;
|
||||
if let Some(defined_filename) = all_defined_msgs.get(name) {
|
||||
check.error(format!(
|
||||
"{filename}: message `{}` appears before `{}`, but is alphabetically later than it
|
||||
run `./x.py test tidy --bless` to sort the file correctly",
|
||||
name.as_str(),
|
||||
next.as_str()
|
||||
"{filename}: message `{name}` is already defined in {defined_filename}",
|
||||
));
|
||||
} else {
|
||||
all_defined_msgs.insert(name.to_string(), filename.to_owned());
|
||||
}
|
||||
if let Some(prev) = prev
|
||||
&& prev > name
|
||||
{
|
||||
check.error(format!(
|
||||
"{filename}: message `{prev}` appears before `{name}`, but is alphabetically \
|
||||
later than it. Run `./x.py test tidy --bless` to sort the file correctly",
|
||||
));
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
prev = Some(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -115,5 +118,7 @@ pub fn check(path: &Path, bless: bool, diag_ctx: DiagCtx) {
|
|||
},
|
||||
);
|
||||
|
||||
assert!(!all_defined_msgs.is_empty());
|
||||
|
||||
crate::fluent_used::check(path, all_defined_msgs, diag_ctx);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,24 +0,0 @@
|
|||
#![feature(rustc_private)]
|
||||
//@ edition: 2021
|
||||
|
||||
// Checks the error messages produced by `#[derive(TryFromU32)]`.
|
||||
|
||||
extern crate rustc_macros;
|
||||
|
||||
use rustc_macros::TryFromU32;
|
||||
|
||||
#[derive(TryFromU32)]
|
||||
struct MyStruct {} //~ ERROR type is not an enum
|
||||
|
||||
#[derive(TryFromU32)]
|
||||
enum NonTrivial {
|
||||
A,
|
||||
B(),
|
||||
C {},
|
||||
D(bool), //~ ERROR enum variant cannot have fields
|
||||
E(bool, bool), //~ ERROR enum variant cannot have fields
|
||||
F { x: bool }, //~ ERROR enum variant cannot have fields
|
||||
G { x: bool, y: bool }, //~ ERROR enum variant cannot have fields
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
error: type is not an enum (TryFromU32)
|
||||
--> $DIR/errors.rs:11:1
|
||||
|
|
||||
LL | struct MyStruct {}
|
||||
| ^^^^^^
|
||||
|
||||
error: enum variant cannot have fields (TryFromU32)
|
||||
--> $DIR/errors.rs:18:7
|
||||
|
|
||||
LL | D(bool),
|
||||
| ^^^^
|
||||
|
||||
error: enum variant cannot have fields (TryFromU32)
|
||||
--> $DIR/errors.rs:19:7
|
||||
|
|
||||
LL | E(bool, bool),
|
||||
| ^^^^
|
||||
|
||||
error: enum variant cannot have fields (TryFromU32)
|
||||
--> $DIR/errors.rs:20:9
|
||||
|
|
||||
LL | F { x: bool },
|
||||
| ^
|
||||
|
||||
error: enum variant cannot have fields (TryFromU32)
|
||||
--> $DIR/errors.rs:21:9
|
||||
|
|
||||
LL | G { x: bool, y: bool },
|
||||
| ^
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
#![feature(rustc_private)]
|
||||
//@ edition: 2021
|
||||
//@ check-pass
|
||||
|
||||
// Checks that the derive macro still works even if the surrounding code has
|
||||
// shadowed the relevant library types.
|
||||
|
||||
extern crate rustc_macros;
|
||||
|
||||
mod submod {
|
||||
use rustc_macros::TryFromU32;
|
||||
|
||||
struct Result;
|
||||
trait TryFrom {}
|
||||
#[allow(non_camel_case_types)]
|
||||
struct u32;
|
||||
struct Ok;
|
||||
struct Err;
|
||||
mod core {}
|
||||
mod std {}
|
||||
|
||||
#[derive(TryFromU32)]
|
||||
pub(crate) enum MyEnum {
|
||||
Zero,
|
||||
One,
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
use submod::MyEnum;
|
||||
let _: Result<MyEnum, u32> = MyEnum::try_from(1u32);
|
||||
}
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
#![feature(assert_matches)]
|
||||
#![feature(rustc_private)]
|
||||
//@ edition: 2021
|
||||
//@ run-pass
|
||||
|
||||
// Checks the values accepted by the `TryFrom<u32>` impl produced by `#[derive(TryFromU32)]`.
|
||||
|
||||
extern crate rustc_macros;
|
||||
|
||||
use core::assert_matches::assert_matches;
|
||||
use rustc_macros::TryFromU32;
|
||||
|
||||
#[derive(TryFromU32, Debug, PartialEq)]
|
||||
#[repr(u32)]
|
||||
enum Repr {
|
||||
Zero,
|
||||
One(),
|
||||
Seven = 7,
|
||||
}
|
||||
|
||||
#[derive(TryFromU32, Debug)]
|
||||
enum NoRepr {
|
||||
Zero,
|
||||
One,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
assert_eq!(Repr::try_from(0u32), Ok(Repr::Zero));
|
||||
assert_eq!(Repr::try_from(1u32), Ok(Repr::One()));
|
||||
assert_eq!(Repr::try_from(2u32), Err(2));
|
||||
assert_eq!(Repr::try_from(7u32), Ok(Repr::Seven));
|
||||
|
||||
assert_matches!(NoRepr::try_from(0u32), Ok(NoRepr::Zero));
|
||||
assert_matches!(NoRepr::try_from(1u32), Ok(NoRepr::One));
|
||||
assert_matches!(NoRepr::try_from(2u32), Err(2));
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
//@ only-linux
|
||||
//@ compile-flags: --error-format=human --color=always
|
||||
|
||||
// The hightlight span should be correct. See #147070
|
||||
struct Thingie;
|
||||
|
||||
impl Thingie {
|
||||
pub(crate) fn new(
|
||||
_a: String,
|
||||
_b: String,
|
||||
_c: String,
|
||||
_d: String,
|
||||
_e: String,
|
||||
_f: String,
|
||||
) -> Self {
|
||||
unimplemented!()
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let foo = Thingie::new(
|
||||
String::from(""),
|
||||
String::from(""),
|
||||
String::from(""),
|
||||
String::from(""),
|
||||
String::from(""),
|
||||
String::from(""),
|
||||
String::from(""),
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
<svg width="970px" height="434px" xmlns="http://www.w3.org/2000/svg">
|
||||
<style>
|
||||
.fg { fill: #AAAAAA }
|
||||
.bg { fill: #000000 }
|
||||
.fg-ansi256-009 { fill: #FF5555 }
|
||||
.fg-ansi256-010 { fill: #55FF55 }
|
||||
.fg-ansi256-012 { fill: #5555FF }
|
||||
.fg-ansi256-014 { fill: #55FFFF }
|
||||
.container {
|
||||
padding: 0 10px;
|
||||
line-height: 18px;
|
||||
}
|
||||
.bold { font-weight: bold; }
|
||||
tspan {
|
||||
font: 14px SFMono-Regular, Consolas, Liberation Mono, Menlo, monospace;
|
||||
white-space: pre;
|
||||
line-height: 18px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<rect width="100%" height="100%" y="0" rx="4.5" class="bg" />
|
||||
|
||||
<text xml:space="preserve" class="container fg">
|
||||
<tspan x="10px" y="28px"><tspan class="fg-ansi256-009 bold">error[E0061]</tspan><tspan class="bold">: this function takes 6 arguments but 7 arguments were supplied</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="46px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/wrong-highlight-span-extra-arguments-147070.rs:21:15</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="64px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="82px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> let foo = Thingie::new(</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="100px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^^^^^^^^^^^</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="118px"><tspan class="fg-ansi256-012 bold">...</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="136px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> String::from(""),</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="154px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">----------------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">unexpected argument #7 of type `String`</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="172px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="190px"><tspan class="fg-ansi256-010 bold">note</tspan><tspan>: associated function defined here</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="208px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/wrong-highlight-span-extra-arguments-147070.rs:8:19</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="226px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="244px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> pub(crate) fn new(</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="262px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010 bold">^^^</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="280px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: remove the extra argument</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="298px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="316px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-009">- String::from(""),</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="334px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="352px">
|
||||
</tspan>
|
||||
<tspan x="10px" y="370px"><tspan class="fg-ansi256-009 bold">error</tspan><tspan class="bold">: aborting due to 1 previous error</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="388px">
|
||||
</tspan>
|
||||
<tspan x="10px" y="406px"><tspan class="bold">For more information about this error, try `rustc --explain E0061`.</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="424px">
|
||||
</tspan>
|
||||
</text>
|
||||
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 3.8 KiB |
|
|
@ -1,14 +1,14 @@
|
|||
error[E0423]: expected function, found module `core::future::async_drop`
|
||||
--> $DIR/ex-ice1.rs:9:35
|
||||
|
|
||||
LL | let async_drop_fut = pin!(core::future::async_drop(async {}));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ not a function
|
||||
LL | ... let async_drop_fut = pin!(core::future::async_drop(async {}));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ not a function
|
||||
|
||||
error[E0603]: module `async_drop` is private
|
||||
--> $DIR/ex-ice1.rs:9:49
|
||||
|
|
||||
LL | let async_drop_fut = pin!(core::future::async_drop(async {}));
|
||||
| ^^^^^^^^^^ private module
|
||||
LL | ... let async_drop_fut = pin!(core::future::async_drop(async {}));
|
||||
| ^^^^^^^^^^ private module
|
||||
|
|
||||
note: the module `async_drop` is defined here
|
||||
--> $SRC_DIR/core/src/future/mod.rs:LL:COL
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
error[E0605]: non-primitive cast: `&for<'a, 'b> fn(&'a Event<'b>) {my_fn}` as `&for<'a, 'b> fn(&'a Event<'b>)`
|
||||
--> $DIR/func-pointer-issue-140491.rs:6:34
|
||||
|
|
||||
LL | ..._>) = &my_fn as _;
|
||||
| ^^^^^^^^^^^ an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object
|
||||
LL | ... = &my_fn as _;
|
||||
| ^^^^^^^^^^^ an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object
|
||||
|
|
||||
= note: casting reference expression `&my_fn` because `&` binds tighter than `as`
|
||||
|
||||
|
|
|
|||
|
|
@ -43,8 +43,8 @@ LL | pub const UNDERFLOW_ADDRESS_SPACE: *const u8 = unsafe { (1 as *const u8).of
|
|||
error[E0080]: in-bounds pointer arithmetic failed: attempting to offset pointer by -$BYTES bytes, but got ALLOC3-0x2 which points to before the beginning of the allocation
|
||||
--> $DIR/offset_ub.rs:16:49
|
||||
|
|
||||
LL | ...*const u8 = unsafe { [0u8; 1].as_ptr().wrapping_offset(-2).offset(-2) };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `NEGATIVE_OFFSET` failed here
|
||||
LL | ...nst u8 = unsafe { [0u8; 1].as_ptr().wrapping_offset(-2).offset(-2) };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `NEGATIVE_OFFSET` failed here
|
||||
|
||||
error[E0080]: in-bounds pointer arithmetic failed: attempting to offset pointer by 1 byte, but got ALLOC4 which is at or beyond the end of the allocation of size $BYTES bytes
|
||||
--> $DIR/offset_ub.rs:18:50
|
||||
|
|
|
|||
|
|
@ -73,8 +73,8 @@ LL | let _ = nested::DeprecatedStruct {
|
|||
error: use of deprecated unit struct `deprecation_lint::nested::DeprecatedUnitStruct`: text
|
||||
--> $DIR/deprecation-lint.rs:48:25
|
||||
|
|
||||
LL | let _ = nested::DeprecatedUnitStruct;
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
LL | ... let _ = nested::DeprecatedUnitStruct;
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: use of deprecated unit variant `deprecation_lint::nested::Enum::DeprecatedVariant`: text
|
||||
--> $DIR/deprecation-lint.rs:50:31
|
||||
|
|
@ -97,8 +97,8 @@ LL | macro_test_arg!(deprecated_text());
|
|||
error: use of deprecated function `deprecation_lint::deprecated_text`: text
|
||||
--> $DIR/deprecation-lint.rs:60:41
|
||||
|
|
||||
LL | macro_test_arg!(macro_test_arg!(deprecated_text()));
|
||||
| ^^^^^^^^^^^^^^^
|
||||
LL | ... macro_test_arg!(macro_test_arg!(deprecated_text()));
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
error: use of deprecated method `deprecation_lint::Trait::trait_deprecated`: text
|
||||
--> $DIR/deprecation-lint.rs:65:16
|
||||
|
|
@ -211,8 +211,8 @@ LL | Trait::trait_deprecated_text(&foo);
|
|||
error: use of deprecated method `this_crate::Trait::trait_deprecated_text`: text
|
||||
--> $DIR/deprecation-lint.rs:261:25
|
||||
|
|
||||
LL | <Foo as Trait>::trait_deprecated_text(&foo);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | ... <Foo as Trait>::trait_deprecated_text(&foo);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: use of deprecated function `this_crate::deprecated_future`: text
|
||||
--> $DIR/deprecation-lint.rs:264:9
|
||||
|
|
@ -295,8 +295,8 @@ LL | Trait::trait_deprecated_text(&foo);
|
|||
error: use of deprecated method `this_crate::Trait::trait_deprecated_text`: text
|
||||
--> $DIR/deprecation-lint.rs:299:25
|
||||
|
|
||||
LL | <Foo as Trait>::trait_deprecated_text(&foo);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | ... <Foo as Trait>::trait_deprecated_text(&foo);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: use of deprecated function `this_crate::test_fn_closure_body::{closure#0}::bar`
|
||||
--> $DIR/deprecation-lint.rs:317:13
|
||||
|
|
@ -391,8 +391,8 @@ LL | foo.method_deprecated_text();
|
|||
error: use of deprecated method `deprecation_lint::MethodTester::method_deprecated_text`: text
|
||||
--> $DIR/deprecation-lint.rs:27:14
|
||||
|
|
||||
LL | Foo::method_deprecated_text(&foo);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | ... Foo::method_deprecated_text(&foo);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: use of deprecated method `deprecation_lint::MethodTester::method_deprecated_text`: text
|
||||
--> $DIR/deprecation-lint.rs:28:16
|
||||
|
|
@ -589,8 +589,8 @@ LL | Foo::method_deprecated_text(&foo);
|
|||
error: use of deprecated method `this_crate::MethodTester::method_deprecated_text`: text
|
||||
--> $DIR/deprecation-lint.rs:257:16
|
||||
|
|
||||
LL | <Foo>::method_deprecated_text(&foo);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | ... <Foo>::method_deprecated_text(&foo);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: use of deprecated method `this_crate::Trait::trait_deprecated_text`: text
|
||||
--> $DIR/deprecation-lint.rs:258:13
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0369]: cannot add `&str` to `&str`
|
||||
--> $DIR/non-1-width-unicode-multiline-label.rs:7:237
|
||||
--> $DIR/non-1-width-unicode-multiline-label.rs:8:237
|
||||
|
|
||||
LL | ...👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦"; let _a = unicode_is_fun + " really fun!";
|
||||
| -------------- ^ -------------- &str
|
||||
|
|
@ -14,7 +14,7 @@ LL | let _ = "👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧
|
|||
| +++++++++++
|
||||
|
||||
error[E0369]: cannot add `&str` to `&str`
|
||||
--> $DIR/non-1-width-unicode-multiline-label.rs:9:384
|
||||
--> $DIR/non-1-width-unicode-multiline-label.rs:10:384
|
||||
|
|
||||
LL | ...👧👦👨👩👧👦👨👩👧👦"; let _a = unicode_is_fun + " really fun!";
|
||||
| -------------- ^ -------------- &str
|
||||
|
|
@ -29,7 +29,7 @@ LL | let _ = "👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧
|
|||
| +++++++++++
|
||||
|
||||
error[E0369]: cannot add `&str` to `&str`
|
||||
--> $DIR/non-1-width-unicode-multiline-label.rs:11:260
|
||||
--> $DIR/non-1-width-unicode-multiline-label.rs:12:260
|
||||
|
|
||||
LL | ...࿇࿈࿉࿊࿋࿌࿎࿏࿐࿑࿒࿓࿔࿕࿖࿗࿘࿙࿚"; let _a = unicode_is_fun + " really fun!";
|
||||
| -------------- ^ -------------- &str
|
||||
|
|
@ -44,7 +44,7 @@ LL | let _ = "ༀ༁༂༃༄༅༆༇༈༉༊་༌།༎༏༐༑༒༓
|
|||
| +++++++++++
|
||||
|
||||
error[E0369]: cannot add `&str` to `&str`
|
||||
--> $DIR/non-1-width-unicode-multiline-label.rs:13:219
|
||||
--> $DIR/non-1-width-unicode-multiline-label.rs:14:219
|
||||
|
|
||||
LL | ...xxxxxxxxxxxxxxxxxxxx"; let _a = unicode_is_fun + " really fun!";
|
||||
| -------------- ^ -------------- &str
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
//@ revisions: ascii unicode
|
||||
//@ compile-flags: --diagnostic-width=145
|
||||
//@[unicode] compile-flags: -Zunstable-options --error-format=human-unicode
|
||||
// ignore-tidy-linelength
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0369]: cannot add `&str` to `&str`
|
||||
╭▸ $DIR/non-1-width-unicode-multiline-label.rs:7:237
|
||||
╭▸ $DIR/non-1-width-unicode-multiline-label.rs:8:237
|
||||
│
|
||||
LL │ …👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦"; let _a = unicode_is_fun + " really fun!";
|
||||
│ ┬───────────── ┯ ────────────── &str
|
||||
|
|
@ -14,7 +14,7 @@ LL │ let _ = "👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧
|
|||
╰╴ +++++++++++
|
||||
|
||||
error[E0369]: cannot add `&str` to `&str`
|
||||
╭▸ $DIR/non-1-width-unicode-multiline-label.rs:9:384
|
||||
╭▸ $DIR/non-1-width-unicode-multiline-label.rs:10:384
|
||||
│
|
||||
LL │ …👨👩👧👦👨👩👧👦👨👩👧👦"; let _a = unicode_is_fun + " really fun!";
|
||||
│ ┬───────────── ┯ ────────────── &str
|
||||
|
|
@ -29,7 +29,7 @@ LL │ let _ = "👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧
|
|||
╰╴ +++++++++++
|
||||
|
||||
error[E0369]: cannot add `&str` to `&str`
|
||||
╭▸ $DIR/non-1-width-unicode-multiline-label.rs:11:260
|
||||
╭▸ $DIR/non-1-width-unicode-multiline-label.rs:12:260
|
||||
│
|
||||
LL │ …࿅࿆࿇࿈࿉࿊࿋࿌࿎࿏࿐࿑࿒࿓࿔࿕࿖࿗࿘࿙࿚"; let _a = unicode_is_fun + " really fun!";
|
||||
│ ┬───────────── ┯ ────────────── &str
|
||||
|
|
@ -44,7 +44,7 @@ LL │ let _ = "ༀ༁༂༃༄༅༆༇༈༉༊་༌།༎༏༐༑༒༓
|
|||
╰╴ +++++++++++
|
||||
|
||||
error[E0369]: cannot add `&str` to `&str`
|
||||
╭▸ $DIR/non-1-width-unicode-multiline-label.rs:13:219
|
||||
╭▸ $DIR/non-1-width-unicode-multiline-label.rs:14:219
|
||||
│
|
||||
LL │ …xxxxxxxxxxxxxxxxxxxxxx"; let _a = unicode_is_fun + " really fun!";
|
||||
│ ┬───────────── ┯ ────────────── &str
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/non-whitespace-trimming-2.rs:6:311
|
||||
--> $DIR/non-whitespace-trimming-2.rs:7:311
|
||||
|
|
||||
LL | ...13; let _: usize = 14; let _: usize = 15; let _: () = 42; let _: usize = 0; let _: usize = 1; let _: usize = 2; let _: usize = 3; let ...
|
||||
| -- ^^ expected `()`, found integer
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
//@ revisions: ascii unicode
|
||||
//@ compile-flags: --diagnostic-width=145
|
||||
//@[unicode] compile-flags: -Zunstable-options --error-format=human-unicode
|
||||
// ignore-tidy-linelength
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0308]: mismatched types
|
||||
╭▸ $DIR/non-whitespace-trimming-2.rs:6:311
|
||||
╭▸ $DIR/non-whitespace-trimming-2.rs:7:311
|
||||
│
|
||||
LL │ …= 13; let _: usize = 14; let _: usize = 15; let _: () = 42; let _: usize = 0; let _: usize = 1; let _: usize = 2; let _: usize = 3; let _:…
|
||||
│ ┬─ ━━ expected `()`, found integer
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
//@ compile-flags: --diagnostic-width=145
|
||||
// ignore-tidy-linelength
|
||||
|
||||
fn main() {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/non-whitespace-trimming-unicode.rs:4:415
|
||||
--> $DIR/non-whitespace-trimming-unicode.rs:5:415
|
||||
|
|
||||
LL | ...♣♤♥♦♧♨♩♪♫♬♭♮♯♰♱♲♳♴♵♶♷♸♹♺♻♼♽♾♿⚀⚁⚂⚃⚄⚅⚆⚈⚉4"; let _: () = 42; let _: &str = "🦀☀☁☂☃☄★☆☇☈☉☊☋☌☍☎☏☐☑☒☓ ☖☗☘☙☚☛☜☝☞☟☠☡☢☣☤☥☦☧☨☩☪☫☬☭☮☯☰☱☲☳☴☵☶☷☸☹☺☻☼☽ ...
|
||||
| -- ^^ expected `()`, found integer
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
//@ compile-flags: --diagnostic-width=145
|
||||
// ignore-tidy-linelength
|
||||
|
||||
fn main() {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/non-whitespace-trimming.rs:4:241
|
||||
--> $DIR/non-whitespace-trimming.rs:5:241
|
||||
|
|
||||
LL | ... () = (); let _: () = (); let _: () = (); let _: () = 42; let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = ...
|
||||
| -- ^^ expected `()`, found integer
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// Test for #78438: ensure underline alignment with many tabs on the left, long line on the right
|
||||
|
||||
//@ compile-flags: --diagnostic-width=145
|
||||
// ignore-tidy-linelength
|
||||
// ignore-tidy-tab
|
||||
|
||||
|
|
|
|||
5
tests/ui/directory_ownership/file-mod-restriction.rs
Normal file
5
tests/ui/directory_ownership/file-mod-restriction.rs
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
// Test that file modules are not allowed inside blocks.
|
||||
|
||||
fn main() {
|
||||
mod foo; //~ ERROR cannot declare a file module inside a block unless it has a path attribute
|
||||
}
|
||||
10
tests/ui/directory_ownership/file-mod-restriction.stderr
Normal file
10
tests/ui/directory_ownership/file-mod-restriction.stderr
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
error: cannot declare a file module inside a block unless it has a path attribute
|
||||
--> $DIR/file-mod-restriction.rs:4:5
|
||||
|
|
||||
LL | mod foo;
|
||||
| ^^^^^^^^
|
||||
|
|
||||
= note: file modules are usually placed outside of blocks, at the top level of the file
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
// Test that macro-expanded non-inline modules behave correctly
|
||||
// Test that macro-expanded file modules behave correctly
|
||||
|
||||
macro_rules! mod_decl {
|
||||
($i:ident) => {
|
||||
mod $i; //~ ERROR cannot declare a non-inline module inside a block
|
||||
mod $i; //~ ERROR cannot declare a file module inside a block unless it has a path attribute
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
error: cannot declare a non-inline module inside a block unless it has a path attribute
|
||||
error: cannot declare a file module inside a block unless it has a path attribute
|
||||
--> $DIR/macro-expanded-mod.rs:5:9
|
||||
|
|
||||
LL | mod $i;
|
||||
|
|
@ -7,6 +7,7 @@ LL | mod $i;
|
|||
LL | mod_decl!(foo);
|
||||
| -------------- in this macro invocation
|
||||
|
|
||||
= note: file modules are usually placed outside of blocks, at the top level of the file
|
||||
= note: this error originates in the macro `mod_decl` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
|
|
|||
|
|
@ -1,5 +0,0 @@
|
|||
// Test that non-inline modules are not allowed inside blocks.
|
||||
|
||||
fn main() {
|
||||
mod foo; //~ ERROR cannot declare a non-inline module inside a block
|
||||
}
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
error: cannot declare a non-inline module inside a block unless it has a path attribute
|
||||
--> $DIR/non-inline-mod-restriction.rs:4:5
|
||||
|
|
||||
LL | mod foo;
|
||||
| ^^^^^^^^
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
|
|
@ -2,8 +2,12 @@
|
|||
|
||||
// https://github.com/rust-lang/rust/issues/147365
|
||||
// Ensures we don't trigger debug assert by creating an empty Ident when determining whether
|
||||
// the single quote is a raw lifetime.
|
||||
// the quotes are a raw lifetime.
|
||||
|
||||
extern "'" {} //~ ERROR invalid ABI: found `'`
|
||||
|
||||
extern "''" {} //~ ERROR invalid ABI: found `''`
|
||||
|
||||
extern "'''" {} //~ ERROR invalid ABI: found `'''`
|
||||
|
||||
fn main() {}
|
||||
32
tests/ui/extern/extern-only-quotes-issue-147365.stderr
vendored
Normal file
32
tests/ui/extern/extern-only-quotes-issue-147365.stderr
vendored
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
error[E0703]: invalid ABI: found `'`
|
||||
--> $DIR/extern-only-quotes-issue-147365.rs:7:8
|
||||
|
|
||||
LL | extern "'" {}
|
||||
| ^^^ invalid ABI
|
||||
|
|
||||
= note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions
|
||||
help: there's a similarly named valid ABI `C`
|
||||
|
|
||||
LL - extern "'" {}
|
||||
LL + extern "C" {}
|
||||
|
|
||||
|
||||
error[E0703]: invalid ABI: found `''`
|
||||
--> $DIR/extern-only-quotes-issue-147365.rs:9:8
|
||||
|
|
||||
LL | extern "''" {}
|
||||
| ^^^^ invalid ABI
|
||||
|
|
||||
= note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions
|
||||
|
||||
error[E0703]: invalid ABI: found `'''`
|
||||
--> $DIR/extern-only-quotes-issue-147365.rs:11:8
|
||||
|
|
||||
LL | extern "'''" {}
|
||||
| ^^^^^ invalid ABI
|
||||
|
|
||||
= note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0703`.
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
error[E0703]: invalid ABI: found `'`
|
||||
--> $DIR/extern-single-quote-issue-147365.rs:7:8
|
||||
|
|
||||
LL | extern "'" {}
|
||||
| ^^^ invalid ABI
|
||||
|
|
||||
= note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions
|
||||
help: there's a similarly named valid ABI `C`
|
||||
|
|
||||
LL - extern "'" {}
|
||||
LL + extern "C" {}
|
||||
|
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0703`.
|
||||
|
|
@ -43,8 +43,8 @@ LL | Trait::trait_deprecated_text(&foo);
|
|||
warning: use of deprecated method `lint_stability::Trait::trait_deprecated_text`: text
|
||||
--> $DIR/lint-stability-deprecated.rs:40:25
|
||||
|
|
||||
LL | <Foo as Trait>::trait_deprecated_text(&foo);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | ... <Foo as Trait>::trait_deprecated_text(&foo);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
warning: use of deprecated function `lint_stability::deprecated_unstable`: text
|
||||
--> $DIR/lint-stability-deprecated.rs:42:9
|
||||
|
|
@ -115,8 +115,8 @@ LL | let _ = Enum::DeprecatedVariant;
|
|||
warning: use of deprecated unit variant `lint_stability::Enum::DeprecatedUnstableVariant`: text
|
||||
--> $DIR/lint-stability-deprecated.rs:121:23
|
||||
|
|
||||
LL | let _ = Enum::DeprecatedUnstableVariant;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | ... let _ = Enum::DeprecatedUnstableVariant;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
warning: use of deprecated tuple struct `lint_stability::DeprecatedTupleStruct`: text
|
||||
--> $DIR/lint-stability-deprecated.rs:125:17
|
||||
|
|
@ -127,8 +127,8 @@ LL | let _ = DeprecatedTupleStruct (1);
|
|||
warning: use of deprecated tuple struct `lint_stability::DeprecatedUnstableTupleStruct`: text
|
||||
--> $DIR/lint-stability-deprecated.rs:126:17
|
||||
|
|
||||
LL | let _ = DeprecatedUnstableTupleStruct (1);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | ... let _ = DeprecatedUnstableTupleStruct (1);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
warning: use of deprecated function `lint_stability::deprecated_text`: text
|
||||
--> $DIR/lint-stability-deprecated.rs:135:25
|
||||
|
|
@ -139,14 +139,14 @@ LL | macro_test_arg!(deprecated_text());
|
|||
warning: use of deprecated function `lint_stability::deprecated_unstable_text`: text
|
||||
--> $DIR/lint-stability-deprecated.rs:136:25
|
||||
|
|
||||
LL | macro_test_arg!(deprecated_unstable_text());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | ... macro_test_arg!(deprecated_unstable_text());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
warning: use of deprecated function `lint_stability::deprecated_text`: text
|
||||
--> $DIR/lint-stability-deprecated.rs:137:41
|
||||
|
|
||||
LL | macro_test_arg!(macro_test_arg!(deprecated_text()));
|
||||
| ^^^^^^^^^^^^^^^
|
||||
LL | ... macro_test_arg!(macro_test_arg!(deprecated_text()));
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
warning: use of deprecated method `lint_stability::Trait::trait_deprecated`: text
|
||||
--> $DIR/lint-stability-deprecated.rs:142:16
|
||||
|
|
@ -169,8 +169,8 @@ LL | Trait::trait_deprecated_text(&foo);
|
|||
warning: use of deprecated method `lint_stability::Trait::trait_deprecated_text`: text
|
||||
--> $DIR/lint-stability-deprecated.rs:148:25
|
||||
|
|
||||
LL | <Foo as Trait>::trait_deprecated_text(&foo);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | ... <Foo as Trait>::trait_deprecated_text(&foo);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
warning: use of deprecated method `lint_stability::Trait::trait_deprecated_unstable`: text
|
||||
--> $DIR/lint-stability-deprecated.rs:150:16
|
||||
|
|
@ -211,8 +211,8 @@ LL | trait LocalTrait2 : DeprecatedTrait { }
|
|||
warning: use of deprecated function `inheritance::inherited_stability::unstable_mod::deprecated`: text
|
||||
--> $DIR/lint-stability-deprecated.rs:205:23
|
||||
|
|
||||
LL | unstable_mod::deprecated();
|
||||
| ^^^^^^^^^^
|
||||
LL | ... unstable_mod::deprecated();
|
||||
| ^^^^^^^^^^
|
||||
|
||||
warning: use of deprecated function `this_crate::deprecated`: text
|
||||
--> $DIR/lint-stability-deprecated.rs:327:9
|
||||
|
|
@ -367,14 +367,14 @@ LL | foo.method_deprecated_text();
|
|||
warning: use of deprecated method `lint_stability::MethodTester::method_deprecated_text`: text
|
||||
--> $DIR/lint-stability-deprecated.rs:35:14
|
||||
|
|
||||
LL | Foo::method_deprecated_text(&foo);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | ... Foo::method_deprecated_text(&foo);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
warning: use of deprecated method `lint_stability::MethodTester::method_deprecated_text`: text
|
||||
--> $DIR/lint-stability-deprecated.rs:36:16
|
||||
|
|
||||
LL | <Foo>::method_deprecated_text(&foo);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | ... <Foo>::method_deprecated_text(&foo);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
warning: use of deprecated method `lint_stability::Trait::trait_deprecated_text`: text
|
||||
--> $DIR/lint-stability-deprecated.rs:37:13
|
||||
|
|
@ -397,8 +397,8 @@ LL | foo.method_deprecated_unstable();
|
|||
warning: use of deprecated method `lint_stability::MethodTester::method_deprecated_unstable`: text
|
||||
--> $DIR/lint-stability-deprecated.rs:44:14
|
||||
|
|
||||
LL | Foo::method_deprecated_unstable(&foo);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | ... Foo::method_deprecated_unstable(&foo);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
warning: use of deprecated method `lint_stability::MethodTester::method_deprecated_unstable`: text
|
||||
--> $DIR/lint-stability-deprecated.rs:45:16
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
error: too many `#` symbols: raw strings may be delimited by up to 255 `#` symbols, but found 256
|
||||
--> $DIR/too-many-hash.rs:4:19
|
||||
|
|
||||
LL | ... = r####################################################...#######################################;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | ... = r###################################################...######################################;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -346,8 +346,8 @@ LL + NonEmptyEnum2::Foo(_) | NonEmptyEnum2::Bar => todo!()
|
|||
error[E0004]: non-exhaustive patterns: `NonEmptyEnum5::V1`, `NonEmptyEnum5::V2`, `NonEmptyEnum5::V3` and 2 more not covered
|
||||
--> $DIR/empty-match.rs:71:24
|
||||
|
|
||||
LL | match_guarded_arm!(NonEmptyEnum5::V1);
|
||||
| ^^^^^^^^^^^^^^^^^ patterns `NonEmptyEnum5::V1`, `NonEmptyEnum5::V2`, `NonEmptyEnum5::V3` and 2 more not covered
|
||||
LL | ...ded_arm!(NonEmptyEnum5::V1);
|
||||
| ^^^^^^^^^^^^^^^^^ patterns `NonEmptyEnum5::V1`, `NonEmptyEnum5::V2`, `NonEmptyEnum5::V3` and 2 more not covered
|
||||
|
|
||||
note: `NonEmptyEnum5` defined here
|
||||
--> $DIR/empty-match.rs:38:10
|
||||
|
|
|
|||
|
|
@ -346,8 +346,8 @@ LL + NonEmptyEnum2::Foo(_) | NonEmptyEnum2::Bar => todo!()
|
|||
error[E0004]: non-exhaustive patterns: `NonEmptyEnum5::V1`, `NonEmptyEnum5::V2`, `NonEmptyEnum5::V3` and 2 more not covered
|
||||
--> $DIR/empty-match.rs:71:24
|
||||
|
|
||||
LL | match_guarded_arm!(NonEmptyEnum5::V1);
|
||||
| ^^^^^^^^^^^^^^^^^ patterns `NonEmptyEnum5::V1`, `NonEmptyEnum5::V2`, `NonEmptyEnum5::V3` and 2 more not covered
|
||||
LL | ...ded_arm!(NonEmptyEnum5::V1);
|
||||
| ^^^^^^^^^^^^^^^^^ patterns `NonEmptyEnum5::V1`, `NonEmptyEnum5::V2`, `NonEmptyEnum5::V3` and 2 more not covered
|
||||
|
|
||||
note: `NonEmptyEnum5` defined here
|
||||
--> $DIR/empty-match.rs:38:10
|
||||
|
|
|
|||
|
|
@ -79,8 +79,8 @@ LL | simd_insert(v, 2, 0u8);
|
|||
error[E0511]: invalid monomorphization of `simd_extract` intrinsic: SIMD index #1 is out of bounds (limit 2)
|
||||
--> $DIR/not-out-of-bounds.rs:85:24
|
||||
|
|
||||
LL | let _val: u8 = simd_extract(v, 2);
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
LL | ... let _val: u8 = simd_extract(v, 2);
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 9 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
error[E0277]: `&[u8; 0]` cannot be safely transmuted into `&[u16; 0]`
|
||||
--> $DIR/align-fail.rs:21:55
|
||||
|
|
||||
LL | ...tatic [u8; 0], &'static [u16; 0]>();
|
||||
| ^^^^^^^^^^^^^^^^^ the minimum alignment of `&[u8; 0]` (1) should be greater than that of `&[u16; 0]` (2)
|
||||
LL | ...ic [u8; 0], &'static [u16; 0]>();
|
||||
| ^^^^^^^^^^^^^^^^^ the minimum alignment of `&[u8; 0]` (1) should be greater than that of `&[u16; 0]` (2)
|
||||
|
|
||||
note: required by a bound in `is_maybe_transmutable`
|
||||
--> $DIR/align-fail.rs:9:14
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue