mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-31 14:31:55 +00:00
Auto merge of #122041 - matthiaskrgr:rollup-imsmdke, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - #121202 (Limit the number of names and values in check-cfg diagnostics) - #121301 (errors: share `SilentEmitter` between rustc and rustfmt) - #121658 (Hint user to update nightly on ICEs produced from outdated nightly) - #121846 (only compare ambiguity item that have hard error) - #121961 (add test for #78894 #71450) - #121975 (hir_analysis: enums return `None` in `find_field`) - #121978 (Fix duplicated path in the "not found dylib" error) - #121991 (Merge impl_trait_in_assoc_types_defined_by query back into `opaque_types_defined_by`) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
62415e2a95
@ -50,7 +50,7 @@ rustc_trait_selection = { path = "../rustc_trait_selection" }
|
||||
rustc_ty_utils = { path = "../rustc_ty_utils" }
|
||||
serde_json = "1.0.59"
|
||||
shlex = "1.0"
|
||||
time = { version = "0.3", default-features = false, features = ["alloc", "formatting"] }
|
||||
time = { version = "0.3", default-features = false, features = ["alloc", "formatting", "parsing", "macros"] }
|
||||
tracing = { version = "0.1.35" }
|
||||
# tidy-alphabetical-end
|
||||
|
||||
|
@ -1,6 +1,10 @@
|
||||
driver_impl_ice = the compiler unexpectedly panicked. this is a bug.
|
||||
driver_impl_ice_bug_report = we would appreciate a bug report: {$bug_report_url}
|
||||
driver_impl_ice_bug_report_internal_feature = using internal features is not supported and expected to cause internal compiler errors when used incorrectly
|
||||
driver_impl_ice_bug_report_outdated =
|
||||
it seems that this compiler `{$version}` is outdated, a newer nightly should have been released in the mean time
|
||||
.update = please consider running `rustup update nightly` to update the nightly channel and check if this problem still persists
|
||||
.url = if the problem still persists, we would appreciate a bug report: {$bug_report_url}
|
||||
driver_impl_ice_exclude_cargo_defaults = some of the compiler flags provided by cargo are hidden
|
||||
|
||||
driver_impl_ice_flags = compiler flags: {$flags}
|
||||
|
@ -58,7 +58,7 @@ use std::str;
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use std::sync::{Arc, OnceLock};
|
||||
use std::time::{Instant, SystemTime};
|
||||
use time::OffsetDateTime;
|
||||
use time::{Date, OffsetDateTime, Time};
|
||||
|
||||
#[allow(unused_macros)]
|
||||
macro do_not_use_print($($t:tt)*) {
|
||||
@ -1369,6 +1369,9 @@ pub fn install_ice_hook(
|
||||
using_internal_features
|
||||
}
|
||||
|
||||
const DATE_FORMAT: &[time::format_description::FormatItem<'static>] =
|
||||
&time::macros::format_description!("[year]-[month]-[day]");
|
||||
|
||||
/// Prints the ICE message, including query stack, but without backtrace.
|
||||
///
|
||||
/// The message will point the user at `bug_report_url` to report the ICE.
|
||||
@ -1397,10 +1400,34 @@ fn report_ice(
|
||||
dcx.emit_err(session_diagnostics::Ice);
|
||||
}
|
||||
|
||||
if using_internal_features.load(std::sync::atomic::Ordering::Relaxed) {
|
||||
dcx.emit_note(session_diagnostics::IceBugReportInternalFeature);
|
||||
use time::ext::NumericalDuration;
|
||||
|
||||
// Try to hint user to update nightly if applicable when reporting an ICE.
|
||||
// Attempt to calculate when current version was released, and add 12 hours
|
||||
// as buffer. If the current version's release timestamp is older than
|
||||
// the system's current time + 24 hours + 12 hours buffer if we're on
|
||||
// nightly.
|
||||
if let Some("nightly") = option_env!("CFG_RELEASE_CHANNEL")
|
||||
&& let Some(version) = option_env!("CFG_VERSION")
|
||||
&& let Some(ver_date_str) = option_env!("CFG_VER_DATE")
|
||||
&& let Ok(ver_date) = Date::parse(&ver_date_str, DATE_FORMAT)
|
||||
&& let ver_datetime = OffsetDateTime::new_utc(ver_date, Time::MIDNIGHT)
|
||||
&& let system_datetime = OffsetDateTime::from(SystemTime::now())
|
||||
&& system_datetime.checked_sub(36.hours()).is_some_and(|d| d > ver_datetime)
|
||||
&& !using_internal_features.load(std::sync::atomic::Ordering::Relaxed)
|
||||
{
|
||||
dcx.emit_note(session_diagnostics::IceBugReportOutdated {
|
||||
version,
|
||||
bug_report_url,
|
||||
note_update: (),
|
||||
note_url: (),
|
||||
});
|
||||
} else {
|
||||
dcx.emit_note(session_diagnostics::IceBugReport { bug_report_url });
|
||||
if using_internal_features.load(std::sync::atomic::Ordering::Relaxed) {
|
||||
dcx.emit_note(session_diagnostics::IceBugReportInternalFeature);
|
||||
} else {
|
||||
dcx.emit_note(session_diagnostics::IceBugReport { bug_report_url });
|
||||
}
|
||||
}
|
||||
|
||||
let version = util::version_str!().unwrap_or("unknown_version");
|
||||
|
@ -46,6 +46,17 @@ pub(crate) struct IceBugReport<'a> {
|
||||
#[diag(driver_impl_ice_bug_report_internal_feature)]
|
||||
pub(crate) struct IceBugReportInternalFeature;
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(driver_impl_ice_bug_report_outdated)]
|
||||
pub(crate) struct IceBugReportOutdated<'a> {
|
||||
pub version: &'a str,
|
||||
pub bug_report_url: &'a str,
|
||||
#[note(driver_impl_update)]
|
||||
pub note_update: (),
|
||||
#[note(driver_impl_url)]
|
||||
pub note_url: (),
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(driver_impl_ice_version)]
|
||||
pub(crate) struct IceVersion<'a> {
|
||||
|
@ -10,7 +10,6 @@
|
||||
use rustc_span::source_map::SourceMap;
|
||||
use rustc_span::{FileLines, FileName, SourceFile, Span};
|
||||
|
||||
use crate::error::TranslateError;
|
||||
use crate::snippet::{
|
||||
Annotation, AnnotationColumn, AnnotationType, Line, MultilineAnnotation, Style, StyledString,
|
||||
};
|
||||
@ -539,18 +538,9 @@ impl Emitter for HumanEmitter {
|
||||
/// Fatal diagnostics are forwarded to `fatal_dcx` to avoid silent
|
||||
/// failures of rustc, as witnessed e.g. in issue #89358.
|
||||
pub struct SilentEmitter {
|
||||
pub fallback_bundle: LazyFallbackBundle,
|
||||
pub fatal_dcx: DiagCtxt,
|
||||
pub fatal_note: String,
|
||||
}
|
||||
|
||||
pub fn silent_translate<'a>(message: &'a DiagMessage) -> Result<Cow<'_, str>, TranslateError<'_>> {
|
||||
match message {
|
||||
DiagMessage::Str(msg) | DiagMessage::Translated(msg) => Ok(Cow::Borrowed(msg)),
|
||||
DiagMessage::FluentIdentifier(identifier, _) => {
|
||||
// Any value works here.
|
||||
Ok(identifier.clone())
|
||||
}
|
||||
}
|
||||
pub fatal_note: Option<String>,
|
||||
}
|
||||
|
||||
impl Translate for SilentEmitter {
|
||||
@ -559,17 +549,9 @@ impl Translate for SilentEmitter {
|
||||
}
|
||||
|
||||
fn fallback_fluent_bundle(&self) -> &FluentBundle {
|
||||
panic!("silent emitter attempted to translate message")
|
||||
}
|
||||
|
||||
// Override `translate_message` for the silent emitter because eager translation of
|
||||
// subdiagnostics result in a call to this.
|
||||
fn translate_message<'a>(
|
||||
&'a self,
|
||||
message: &'a DiagMessage,
|
||||
_: &'a FluentArgs<'_>,
|
||||
) -> Result<Cow<'_, str>, TranslateError<'_>> {
|
||||
silent_translate(message)
|
||||
// Ideally this field wouldn't be necessary and the fallback bundle in `fatal_dcx` would be
|
||||
// used but the lock prevents this.
|
||||
&self.fallback_bundle
|
||||
}
|
||||
}
|
||||
|
||||
@ -580,7 +562,9 @@ impl Emitter for SilentEmitter {
|
||||
|
||||
fn emit_diagnostic(&mut self, mut diag: DiagInner) {
|
||||
if diag.level == Level::Fatal {
|
||||
diag.sub(Level::Note, self.fatal_note.clone(), MultiSpan::new());
|
||||
if let Some(fatal_note) = &self.fatal_note {
|
||||
diag.sub(Level::Note, fatal_note.clone(), MultiSpan::new());
|
||||
}
|
||||
self.fatal_dcx.emit_diagnostic(diag);
|
||||
}
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ use emitter::{is_case_difference, DynEmitter, Emitter};
|
||||
use registry::Registry;
|
||||
use rustc_data_structures::fx::{FxHashSet, FxIndexMap, FxIndexSet};
|
||||
use rustc_data_structures::stable_hasher::{Hash128, StableHasher};
|
||||
use rustc_data_structures::sync::Lock;
|
||||
use rustc_data_structures::sync::{Lock, Lrc};
|
||||
use rustc_data_structures::AtomicRef;
|
||||
use rustc_lint_defs::LintExpectationId;
|
||||
use rustc_span::source_map::SourceMap;
|
||||
@ -606,29 +606,54 @@ impl DiagCtxt {
|
||||
}
|
||||
|
||||
pub fn new(emitter: Box<DynEmitter>) -> Self {
|
||||
Self {
|
||||
inner: Lock::new(DiagCtxtInner {
|
||||
flags: DiagCtxtFlags { can_emit_warnings: true, ..Default::default() },
|
||||
err_guars: Vec::new(),
|
||||
lint_err_guars: Vec::new(),
|
||||
delayed_bugs: Vec::new(),
|
||||
deduplicated_err_count: 0,
|
||||
deduplicated_warn_count: 0,
|
||||
emitter,
|
||||
must_produce_diag: false,
|
||||
has_printed: false,
|
||||
suppressed_expected_diag: false,
|
||||
taught_diagnostics: Default::default(),
|
||||
emitted_diagnostic_codes: Default::default(),
|
||||
emitted_diagnostics: Default::default(),
|
||||
stashed_diagnostics: Default::default(),
|
||||
future_breakage_diagnostics: Vec::new(),
|
||||
check_unstable_expect_diagnostics: false,
|
||||
unstable_expect_diagnostics: Vec::new(),
|
||||
fulfilled_expectations: Default::default(),
|
||||
ice_file: None,
|
||||
}),
|
||||
Self { inner: Lock::new(DiagCtxtInner::new(emitter)) }
|
||||
}
|
||||
|
||||
pub fn make_silent(&mut self, fallback_bundle: LazyFallbackBundle, fatal_note: Option<String>) {
|
||||
self.wrap_emitter(|old_dcx| {
|
||||
Box::new(emitter::SilentEmitter {
|
||||
fallback_bundle,
|
||||
fatal_dcx: DiagCtxt { inner: Lock::new(old_dcx) },
|
||||
fatal_note,
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
fn wrap_emitter<F>(&mut self, f: F)
|
||||
where
|
||||
F: FnOnce(DiagCtxtInner) -> Box<DynEmitter>,
|
||||
{
|
||||
// A empty type that implements `Emitter` so that a `DiagCtxtInner` can be constructed
|
||||
// to temporarily swap in place of the real one, which will be used in constructing
|
||||
// its replacement.
|
||||
struct FalseEmitter;
|
||||
|
||||
impl Emitter for FalseEmitter {
|
||||
fn emit_diagnostic(&mut self, _: DiagInner) {
|
||||
unimplemented!("false emitter must only used during `wrap_emitter`")
|
||||
}
|
||||
|
||||
fn source_map(&self) -> Option<&Lrc<SourceMap>> {
|
||||
unimplemented!("false emitter must only used during `wrap_emitter`")
|
||||
}
|
||||
}
|
||||
|
||||
impl translation::Translate for FalseEmitter {
|
||||
fn fluent_bundle(&self) -> Option<&Lrc<FluentBundle>> {
|
||||
unimplemented!("false emitter must only used during `wrap_emitter`")
|
||||
}
|
||||
|
||||
fn fallback_fluent_bundle(&self) -> &FluentBundle {
|
||||
unimplemented!("false emitter must only used during `wrap_emitter`")
|
||||
}
|
||||
}
|
||||
|
||||
let mut inner = self.inner.borrow_mut();
|
||||
let mut prev_dcx = DiagCtxtInner::new(Box::new(FalseEmitter));
|
||||
std::mem::swap(&mut *inner, &mut prev_dcx);
|
||||
let new_emitter = f(prev_dcx);
|
||||
let mut new_dcx = DiagCtxtInner::new(new_emitter);
|
||||
std::mem::swap(&mut *inner, &mut new_dcx);
|
||||
}
|
||||
|
||||
/// Translate `message` eagerly with `args` to `SubdiagMessage::Eager`.
|
||||
@ -1345,6 +1370,30 @@ impl DiagCtxt {
|
||||
// `DiagCtxt::foo()` just borrows `inner` and forwards a call to
|
||||
// `DiagCtxtInner::foo`.
|
||||
impl DiagCtxtInner {
|
||||
fn new(emitter: Box<DynEmitter>) -> Self {
|
||||
Self {
|
||||
flags: DiagCtxtFlags { can_emit_warnings: true, ..Default::default() },
|
||||
err_guars: Vec::new(),
|
||||
lint_err_guars: Vec::new(),
|
||||
delayed_bugs: Vec::new(),
|
||||
deduplicated_err_count: 0,
|
||||
deduplicated_warn_count: 0,
|
||||
emitter,
|
||||
must_produce_diag: false,
|
||||
has_printed: false,
|
||||
suppressed_expected_diag: false,
|
||||
taught_diagnostics: Default::default(),
|
||||
emitted_diagnostic_codes: Default::default(),
|
||||
emitted_diagnostics: Default::default(),
|
||||
stashed_diagnostics: Default::default(),
|
||||
future_breakage_diagnostics: Vec::new(),
|
||||
check_unstable_expect_diagnostics: false,
|
||||
unstable_expect_diagnostics: Vec::new(),
|
||||
fulfilled_expectations: Default::default(),
|
||||
ice_file: None,
|
||||
}
|
||||
}
|
||||
|
||||
/// Emit all stashed diagnostics.
|
||||
fn emit_stashed_diagnostics(&mut self) -> Option<ErrorGuaranteed> {
|
||||
let mut guar = None;
|
||||
|
@ -791,7 +791,12 @@ fn convert_enum_variant_types(tcx: TyCtxt<'_>, def_id: DefId) {
|
||||
}
|
||||
|
||||
fn find_field(tcx: TyCtxt<'_>, (def_id, ident): (DefId, Ident)) -> Option<FieldIdx> {
|
||||
tcx.adt_def(def_id).non_enum_variant().fields.iter_enumerated().find_map(|(idx, field)| {
|
||||
let adt = tcx.adt_def(def_id);
|
||||
if adt.is_enum() {
|
||||
return None;
|
||||
}
|
||||
|
||||
adt.non_enum_variant().fields.iter_enumerated().find_map(|(idx, field)| {
|
||||
if field.is_unnamed() {
|
||||
let field_ty = tcx.type_of(field.did).instantiate_identity();
|
||||
let adt_def = field_ty.ty_adt_def().expect("expect Adt for unnamed field");
|
||||
|
@ -46,9 +46,7 @@ pub(super) fn find_opaque_ty_constraints_for_impl_trait_in_assoc_type(
|
||||
for &assoc_id in tcx.associated_item_def_ids(impl_def_id) {
|
||||
let assoc = tcx.associated_item(assoc_id);
|
||||
match assoc.kind {
|
||||
ty::AssocKind::Const | ty::AssocKind::Fn => {
|
||||
locator.check(assoc_id.expect_local(), ImplTraitSource::AssocTy)
|
||||
}
|
||||
ty::AssocKind::Const | ty::AssocKind::Fn => locator.check(assoc_id.expect_local()),
|
||||
// Associated types don't have bodies, so they can't constrain hidden types
|
||||
ty::AssocKind::Type => {}
|
||||
}
|
||||
@ -182,15 +180,9 @@ struct TaitConstraintLocator<'tcx> {
|
||||
typeck_types: Vec<ty::OpaqueHiddenType<'tcx>>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
enum ImplTraitSource {
|
||||
AssocTy,
|
||||
TyAlias,
|
||||
}
|
||||
|
||||
impl TaitConstraintLocator<'_> {
|
||||
#[instrument(skip(self), level = "debug")]
|
||||
fn check(&mut self, item_def_id: LocalDefId, source: ImplTraitSource) {
|
||||
fn check(&mut self, item_def_id: LocalDefId) {
|
||||
// Don't try to check items that cannot possibly constrain the type.
|
||||
if !self.tcx.has_typeck_results(item_def_id) {
|
||||
debug!("no constraint: no typeck results");
|
||||
@ -242,12 +234,8 @@ impl TaitConstraintLocator<'_> {
|
||||
continue;
|
||||
}
|
||||
constrained = true;
|
||||
let opaque_types_defined_by = match source {
|
||||
ImplTraitSource::AssocTy => {
|
||||
self.tcx.impl_trait_in_assoc_types_defined_by(item_def_id)
|
||||
}
|
||||
ImplTraitSource::TyAlias => self.tcx.opaque_types_defined_by(item_def_id),
|
||||
};
|
||||
let opaque_types_defined_by = self.tcx.opaque_types_defined_by(item_def_id);
|
||||
|
||||
if !opaque_types_defined_by.contains(&self.def_id) {
|
||||
self.tcx.dcx().emit_err(TaitForwardCompat {
|
||||
span: hidden_type.span,
|
||||
@ -308,7 +296,7 @@ impl<'tcx> intravisit::Visitor<'tcx> for TaitConstraintLocator<'tcx> {
|
||||
}
|
||||
fn visit_expr(&mut self, ex: &'tcx Expr<'tcx>) {
|
||||
if let hir::ExprKind::Closure(closure) = ex.kind {
|
||||
self.check(closure.def_id, ImplTraitSource::TyAlias);
|
||||
self.check(closure.def_id);
|
||||
}
|
||||
intravisit::walk_expr(self, ex);
|
||||
}
|
||||
@ -316,7 +304,7 @@ impl<'tcx> intravisit::Visitor<'tcx> for TaitConstraintLocator<'tcx> {
|
||||
trace!(?it.owner_id);
|
||||
// The opaque type itself or its children are not within its reveal scope.
|
||||
if it.owner_id.def_id != self.def_id {
|
||||
self.check(it.owner_id.def_id, ImplTraitSource::TyAlias);
|
||||
self.check(it.owner_id.def_id);
|
||||
intravisit::walk_item(self, it);
|
||||
}
|
||||
}
|
||||
@ -324,13 +312,13 @@ impl<'tcx> intravisit::Visitor<'tcx> for TaitConstraintLocator<'tcx> {
|
||||
trace!(?it.owner_id);
|
||||
// The opaque type itself or its children are not within its reveal scope.
|
||||
if it.owner_id.def_id != self.def_id {
|
||||
self.check(it.owner_id.def_id, ImplTraitSource::TyAlias);
|
||||
self.check(it.owner_id.def_id);
|
||||
intravisit::walk_impl_item(self, it);
|
||||
}
|
||||
}
|
||||
fn visit_trait_item(&mut self, it: &'tcx TraitItem<'tcx>) {
|
||||
trace!(?it.owner_id);
|
||||
self.check(it.owner_id.def_id, ImplTraitSource::TyAlias);
|
||||
self.check(it.owner_id.def_id);
|
||||
intravisit::walk_trait_item(self, it);
|
||||
}
|
||||
fn visit_foreign_item(&mut self, it: &'tcx hir::ForeignItem<'tcx>) {
|
||||
|
@ -45,9 +45,10 @@ pub struct Compiler {
|
||||
pub(crate) fn parse_cfg(dcx: &DiagCtxt, cfgs: Vec<String>) -> Cfg {
|
||||
cfgs.into_iter()
|
||||
.map(|s| {
|
||||
let psess = ParseSess::with_silent_emitter(format!(
|
||||
"this error occurred on the command line: `--cfg={s}`"
|
||||
));
|
||||
let psess = ParseSess::with_silent_emitter(
|
||||
vec![crate::DEFAULT_LOCALE_RESOURCE, rustc_parse::DEFAULT_LOCALE_RESOURCE],
|
||||
format!("this error occurred on the command line: `--cfg={s}`"),
|
||||
);
|
||||
let filename = FileName::cfg_spec_source_code(&s);
|
||||
|
||||
macro_rules! error {
|
||||
@ -107,9 +108,10 @@ pub(crate) fn parse_check_cfg(dcx: &DiagCtxt, specs: Vec<String>) -> CheckCfg {
|
||||
let mut check_cfg = CheckCfg { exhaustive_names, exhaustive_values, ..CheckCfg::default() };
|
||||
|
||||
for s in specs {
|
||||
let psess = ParseSess::with_silent_emitter(format!(
|
||||
"this error occurred on the command line: `--check-cfg={s}`"
|
||||
));
|
||||
let psess = ParseSess::with_silent_emitter(
|
||||
vec![crate::DEFAULT_LOCALE_RESOURCE, rustc_parse::DEFAULT_LOCALE_RESOURCE],
|
||||
format!("this error occurred on the command line: `--check-cfg={s}`"),
|
||||
);
|
||||
let filename = FileName::cfg_spec_source_code(&s);
|
||||
|
||||
macro_rules! error {
|
||||
|
@ -12,6 +12,43 @@ use rustc_span::edit_distance::find_best_match_for_name;
|
||||
use rustc_span::symbol::{sym, Symbol};
|
||||
use rustc_span::BytePos;
|
||||
|
||||
const MAX_CHECK_CFG_NAMES_OR_VALUES: usize = 35;
|
||||
|
||||
fn check_cfg_expected_note(
|
||||
sess: &Session,
|
||||
possibilities: &[Symbol],
|
||||
type_: &str,
|
||||
name: Option<Symbol>,
|
||||
suffix: &str,
|
||||
) -> String {
|
||||
use std::fmt::Write;
|
||||
|
||||
let n_possibilities = if sess.opts.unstable_opts.check_cfg_all_expected {
|
||||
possibilities.len()
|
||||
} else {
|
||||
std::cmp::min(possibilities.len(), MAX_CHECK_CFG_NAMES_OR_VALUES)
|
||||
};
|
||||
|
||||
let mut possibilities = possibilities.iter().map(Symbol::as_str).collect::<Vec<_>>();
|
||||
possibilities.sort();
|
||||
|
||||
let and_more = possibilities.len().saturating_sub(n_possibilities);
|
||||
let possibilities = possibilities[..n_possibilities].join("`, `");
|
||||
|
||||
let mut note = String::with_capacity(50 + possibilities.len());
|
||||
|
||||
write!(&mut note, "expected {type_}").unwrap();
|
||||
if let Some(name) = name {
|
||||
write!(&mut note, " for `{name}`").unwrap();
|
||||
}
|
||||
write!(&mut note, " are: {suffix}`{possibilities}`").unwrap();
|
||||
if and_more > 0 {
|
||||
write!(&mut note, " and {and_more} more").unwrap();
|
||||
}
|
||||
|
||||
note
|
||||
}
|
||||
|
||||
pub(super) fn builtin(sess: &Session, diagnostic: BuiltinLintDiag, diag: &mut Diag<'_, ()>) {
|
||||
match diagnostic {
|
||||
BuiltinLintDiag::UnicodeTextFlow(span, content) => {
|
||||
@ -286,16 +323,13 @@ pub(super) fn builtin(sess: &Session, diagnostic: BuiltinLintDiag, diag: &mut Di
|
||||
}
|
||||
}
|
||||
if !possibilities.is_empty() {
|
||||
let mut possibilities =
|
||||
possibilities.iter().map(Symbol::as_str).collect::<Vec<_>>();
|
||||
possibilities.sort();
|
||||
let possibilities = possibilities.join("`, `");
|
||||
|
||||
// The list of expected names can be long (even by default) and
|
||||
// so the diagnostic produced can take a lot of space. To avoid
|
||||
// cloging the user output we only want to print that diagnostic
|
||||
// once.
|
||||
diag.help_once(format!("expected names are: `{possibilities}`"));
|
||||
diag.help_once(check_cfg_expected_note(
|
||||
sess,
|
||||
&possibilities,
|
||||
"names",
|
||||
None,
|
||||
"",
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
@ -338,16 +372,13 @@ pub(super) fn builtin(sess: &Session, diagnostic: BuiltinLintDiag, diag: &mut Di
|
||||
// Show the full list if all possible values for a given name, but don't do it
|
||||
// for names as the possibilities could be very long
|
||||
if !possibilities.is_empty() {
|
||||
{
|
||||
let mut possibilities =
|
||||
possibilities.iter().map(Symbol::as_str).collect::<Vec<_>>();
|
||||
possibilities.sort();
|
||||
|
||||
let possibilities = possibilities.join("`, `");
|
||||
let none = if have_none_possibility { "(none), " } else { "" };
|
||||
|
||||
diag.note(format!("expected values for `{name}` are: {none}`{possibilities}`"));
|
||||
}
|
||||
diag.note(check_cfg_expected_note(
|
||||
sess,
|
||||
&possibilities,
|
||||
"values",
|
||||
Some(name),
|
||||
if have_none_possibility { "(none), " } else { "" },
|
||||
));
|
||||
|
||||
if let Some((value, value_span)) = value {
|
||||
// Suggest the most probable if we found one
|
||||
|
@ -1132,7 +1132,13 @@ fn load_dylib(path: &Path, max_attempts: usize) -> Result<libloading::Library, S
|
||||
Err(err) => {
|
||||
// Only try to recover from this specific error.
|
||||
if !matches!(err, libloading::Error::LoadLibraryExW { .. }) {
|
||||
return Err(err.to_string());
|
||||
let err = format_dlopen_err(&err);
|
||||
// We include the path of the dylib in the error ourselves, so
|
||||
// if it's in the error, we strip it.
|
||||
if let Some(err) = err.strip_prefix(&format!(": {}", path.display())) {
|
||||
return Err(err.to_string());
|
||||
}
|
||||
return Err(err);
|
||||
}
|
||||
|
||||
last_error = Some(err);
|
||||
|
@ -344,15 +344,6 @@ rustc_queries! {
|
||||
}
|
||||
}
|
||||
|
||||
query impl_trait_in_assoc_types_defined_by(
|
||||
key: LocalDefId
|
||||
) -> &'tcx ty::List<LocalDefId> {
|
||||
desc {
|
||||
|tcx| "computing the opaque types defined by `{}`",
|
||||
tcx.def_path_str(key.to_def_id())
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the list of bounds that can be used for
|
||||
/// `SelectionCandidate::ProjectionCandidate(_)` and
|
||||
/// `ProjectionTyCandidate::TraitDef`.
|
||||
|
@ -8,8 +8,8 @@ use crate::errors::{
|
||||
ItemsInTraitsAreNotImportable,
|
||||
};
|
||||
use crate::Determinacy::{self, *};
|
||||
use crate::Namespace::*;
|
||||
use crate::{module_to_string, names_to_string, ImportSuggestion};
|
||||
use crate::{AmbiguityError, Namespace::*};
|
||||
use crate::{AmbiguityKind, BindingKey, ResolutionError, Resolver, Segment};
|
||||
use crate::{Finalize, Module, ModuleOrUniformRoot, ParentScope, PerNS, ScopeSet};
|
||||
use crate::{NameBinding, NameBindingData, NameBindingKind, PathResult, Used};
|
||||
@ -538,7 +538,6 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
||||
.chain(indeterminate_imports.iter().map(|i| (true, i)))
|
||||
{
|
||||
let unresolved_import_error = self.finalize_import(*import);
|
||||
|
||||
// If this import is unresolved then create a dummy import
|
||||
// resolution for it so that later resolve stages won't complain.
|
||||
self.import_dummy_binding(*import, is_indeterminate);
|
||||
@ -856,7 +855,9 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
||||
ImportKind::Single { target_bindings, .. } => target_bindings[TypeNS].get(),
|
||||
_ => None,
|
||||
};
|
||||
let prev_ambiguity_errors_len = self.ambiguity_errors.len();
|
||||
let ambiguity_errors_len =
|
||||
|errors: &Vec<AmbiguityError<'_>>| errors.iter().filter(|error| !error.warning).count();
|
||||
let prev_ambiguity_errors_len = ambiguity_errors_len(&self.ambiguity_errors);
|
||||
let finalize = Finalize::with_root_span(import.root_id, import.span, import.root_span);
|
||||
|
||||
// We'll provide more context to the privacy errors later, up to `len`.
|
||||
@ -870,7 +871,8 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
||||
ignore_binding,
|
||||
);
|
||||
|
||||
let no_ambiguity = self.ambiguity_errors.len() == prev_ambiguity_errors_len;
|
||||
let no_ambiguity =
|
||||
ambiguity_errors_len(&self.ambiguity_errors) == prev_ambiguity_errors_len;
|
||||
import.vis.set(orig_vis);
|
||||
let module = match path_res {
|
||||
PathResult::Module(module) => {
|
||||
|
@ -1565,6 +1565,8 @@ options! {
|
||||
"set options for branch target identification and pointer authentication on AArch64"),
|
||||
cf_protection: CFProtection = (CFProtection::None, parse_cfprotection, [TRACKED],
|
||||
"instrument control-flow architecture protection"),
|
||||
check_cfg_all_expected: bool = (false, parse_bool, [UNTRACKED],
|
||||
"show all expected values in check-cfg diagnostics (default: no)"),
|
||||
codegen_backend: Option<String> = (None, parse_opt_string, [TRACKED],
|
||||
"the backend to use"),
|
||||
collapse_macro_debuginfo: CollapseMacroDebuginfo = (CollapseMacroDebuginfo::Unspecified,
|
||||
|
@ -265,14 +265,20 @@ impl ParseSess {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn with_silent_emitter(fatal_note: String) -> Self {
|
||||
let fallback_bundle = fallback_fluent_bundle(Vec::new(), false);
|
||||
pub fn with_silent_emitter(locale_resources: Vec<&'static str>, fatal_note: String) -> Self {
|
||||
let fallback_bundle = fallback_fluent_bundle(locale_resources, false);
|
||||
let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
|
||||
let emitter =
|
||||
Box::new(HumanEmitter::new(stderr_destination(ColorConfig::Auto), fallback_bundle));
|
||||
let emitter = Box::new(HumanEmitter::new(
|
||||
stderr_destination(ColorConfig::Auto),
|
||||
fallback_bundle.clone(),
|
||||
));
|
||||
let fatal_dcx = DiagCtxt::new(emitter);
|
||||
let dcx =
|
||||
DiagCtxt::new(Box::new(SilentEmitter { fatal_dcx, fatal_note })).disable_warnings();
|
||||
let dcx = DiagCtxt::new(Box::new(SilentEmitter {
|
||||
fallback_bundle,
|
||||
fatal_dcx,
|
||||
fatal_note: Some(fatal_note),
|
||||
}))
|
||||
.disable_warnings();
|
||||
ParseSess::with_dcx(dcx, sm)
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,11 @@ enum CollectionMode {
|
||||
}
|
||||
|
||||
impl<'tcx> OpaqueTypeCollector<'tcx> {
|
||||
fn new(tcx: TyCtxt<'tcx>, item: LocalDefId, mode: CollectionMode) -> Self {
|
||||
fn new(tcx: TyCtxt<'tcx>, item: LocalDefId) -> Self {
|
||||
let mode = match tcx.def_kind(tcx.local_parent(item)) {
|
||||
DefKind::Impl { of_trait: true } => CollectionMode::ImplTraitInAssocTypes,
|
||||
_ => CollectionMode::TypeAliasImplTraitTransition,
|
||||
};
|
||||
Self { tcx, opaques: Vec::new(), item, seen: Default::default(), span: None, mode }
|
||||
}
|
||||
|
||||
@ -284,23 +288,13 @@ impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for OpaqueTypeCollector<'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
fn impl_trait_in_assoc_types_defined_by<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
item: LocalDefId,
|
||||
) -> &'tcx ty::List<LocalDefId> {
|
||||
let mut collector = OpaqueTypeCollector::new(tcx, item, CollectionMode::ImplTraitInAssocTypes);
|
||||
super::sig_types::walk_types(tcx, item, &mut collector);
|
||||
tcx.mk_local_def_ids(&collector.opaques)
|
||||
}
|
||||
|
||||
fn opaque_types_defined_by<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
item: LocalDefId,
|
||||
) -> &'tcx ty::List<LocalDefId> {
|
||||
let kind = tcx.def_kind(item);
|
||||
trace!(?kind);
|
||||
let mut collector =
|
||||
OpaqueTypeCollector::new(tcx, item, CollectionMode::TypeAliasImplTraitTransition);
|
||||
let mut collector = OpaqueTypeCollector::new(tcx, item);
|
||||
super::sig_types::walk_types(tcx, item, &mut collector);
|
||||
match kind {
|
||||
DefKind::AssocFn
|
||||
@ -343,6 +337,5 @@ fn opaque_types_defined_by<'tcx>(
|
||||
}
|
||||
|
||||
pub(super) fn provide(providers: &mut Providers) {
|
||||
*providers =
|
||||
Providers { opaque_types_defined_by, impl_trait_in_assoc_types_defined_by, ..*providers };
|
||||
*providers = Providers { opaque_types_defined_by, ..*providers };
|
||||
}
|
||||
|
@ -1,9 +1,8 @@
|
||||
use std::borrow::Cow;
|
||||
use std::path::Path;
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
|
||||
use rustc_data_structures::sync::{IntoDynSyncSend, Lrc};
|
||||
use rustc_errors::emitter::{stderr_destination, DynEmitter, Emitter, HumanEmitter};
|
||||
use rustc_errors::emitter::{stderr_destination, DynEmitter, Emitter, HumanEmitter, SilentEmitter};
|
||||
use rustc_errors::translation::Translate;
|
||||
use rustc_errors::{ColorConfig, Diag, DiagCtxt, DiagInner, Level as DiagnosticLevel};
|
||||
use rustc_session::parse::ParseSess as RawParseSess;
|
||||
@ -28,41 +27,6 @@ pub(crate) struct ParseSess {
|
||||
can_reset_errors: Lrc<AtomicBool>,
|
||||
}
|
||||
|
||||
/// Emitter which discards every error.
|
||||
struct SilentEmitter;
|
||||
|
||||
impl Translate for SilentEmitter {
|
||||
fn fluent_bundle(&self) -> Option<&Lrc<rustc_errors::FluentBundle>> {
|
||||
None
|
||||
}
|
||||
|
||||
fn fallback_fluent_bundle(&self) -> &rustc_errors::FluentBundle {
|
||||
panic!("silent emitter attempted to translate a diagnostic");
|
||||
}
|
||||
|
||||
// Override `translate_message` for the silent emitter because eager translation of
|
||||
// subdiagnostics result in a call to this.
|
||||
fn translate_message<'a>(
|
||||
&'a self,
|
||||
message: &'a rustc_errors::DiagMessage,
|
||||
_: &'a rustc_errors::translation::FluentArgs<'_>,
|
||||
) -> Result<Cow<'_, str>, rustc_errors::error::TranslateError<'_>> {
|
||||
rustc_errors::emitter::silent_translate(message)
|
||||
}
|
||||
}
|
||||
|
||||
impl Emitter for SilentEmitter {
|
||||
fn source_map(&self) -> Option<&Lrc<SourceMap>> {
|
||||
None
|
||||
}
|
||||
|
||||
fn emit_diagnostic(&mut self, _diag: DiagInner) {}
|
||||
}
|
||||
|
||||
fn silent_emitter() -> Box<DynEmitter> {
|
||||
Box::new(SilentEmitter {})
|
||||
}
|
||||
|
||||
/// Emit errors against every files expect ones specified in the `ignore_path_set`.
|
||||
struct SilentOnIgnoredFilesEmitter {
|
||||
ignore_path_set: IntoDynSyncSend<Lrc<IgnorePathSet>>,
|
||||
@ -143,17 +107,23 @@ fn default_dcx(
|
||||
ColorConfig::Never
|
||||
};
|
||||
|
||||
let emitter = if hide_parse_errors {
|
||||
silent_emitter()
|
||||
let fallback_bundle = rustc_errors::fallback_fluent_bundle(
|
||||
rustc_driver::DEFAULT_LOCALE_RESOURCES.to_vec(),
|
||||
false,
|
||||
);
|
||||
let emitter = Box::new(
|
||||
HumanEmitter::new(stderr_destination(emit_color), fallback_bundle.clone())
|
||||
.sm(Some(source_map.clone())),
|
||||
);
|
||||
|
||||
let emitter: Box<DynEmitter> = if hide_parse_errors {
|
||||
Box::new(SilentEmitter {
|
||||
fallback_bundle,
|
||||
fatal_dcx: DiagCtxt::new(emitter),
|
||||
fatal_note: None,
|
||||
})
|
||||
} else {
|
||||
let fallback_bundle = rustc_errors::fallback_fluent_bundle(
|
||||
rustc_driver::DEFAULT_LOCALE_RESOURCES.to_vec(),
|
||||
false,
|
||||
);
|
||||
Box::new(
|
||||
HumanEmitter::new(stderr_destination(emit_color), fallback_bundle)
|
||||
.sm(Some(source_map.clone())),
|
||||
)
|
||||
emitter
|
||||
};
|
||||
DiagCtxt::new(Box::new(SilentOnIgnoredFilesEmitter {
|
||||
has_non_ignorable_parser_errors: false,
|
||||
@ -232,7 +202,14 @@ impl ParseSess {
|
||||
}
|
||||
|
||||
pub(crate) fn set_silent_emitter(&mut self) {
|
||||
self.raw_psess.dcx = DiagCtxt::new(silent_emitter());
|
||||
// Ideally this invocation wouldn't be necessary and the fallback bundle in
|
||||
// `self.parse_sess.dcx` could be used, but the lock in `DiagCtxt` prevents this.
|
||||
// See `<rustc_errors::SilentEmitter as Translate>::fallback_fluent_bundle`.
|
||||
let fallback_bundle = rustc_errors::fallback_fluent_bundle(
|
||||
rustc_driver::DEFAULT_LOCALE_RESOURCES.to_vec(),
|
||||
false,
|
||||
);
|
||||
self.raw_psess.dcx.make_silent(fallback_bundle, None);
|
||||
}
|
||||
|
||||
pub(crate) fn span_to_filename(&self, span: Span) -> FileName {
|
||||
|
@ -176,7 +176,7 @@ fn rustfmt_emits_error_on_line_overflow_true() {
|
||||
#[test]
|
||||
#[allow(non_snake_case)]
|
||||
fn dont_emit_ICE() {
|
||||
let files = ["tests/target/issue_5728.rs", "tests/target/issue_5729.rs"];
|
||||
let files = ["tests/target/issue_5728.rs", "tests/target/issue_5729.rs", "tests/target/issue_6082.rs"];
|
||||
|
||||
for file in files {
|
||||
let args = [file];
|
||||
|
5
src/tools/rustfmt/tests/target/issue_6082.rs
Normal file
5
src/tools/rustfmt/tests/target/issue_6082.rs
Normal file
@ -0,0 +1,5 @@
|
||||
macro_rules! test {
|
||||
($T:ident, $b:lifetime) => {
|
||||
Box<$T<$b>>
|
||||
};
|
||||
}
|
@ -74,6 +74,8 @@ fn test_cfg_macro() {
|
||||
//~^ WARNING unexpected `cfg` condition value
|
||||
//~| WARNING unexpected `cfg` condition value
|
||||
//~| WARNING unexpected `cfg` condition value
|
||||
cfg!(target_feature = "zebra");
|
||||
//~^ WARNING unexpected `cfg` condition value
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -245,5 +245,14 @@ LL | cfg!(all(feature = "zebra", feature = "zebra", feature = "zebra"));
|
||||
= help: to expect this configuration use `--check-cfg=cfg(feature, values("zebra"))`
|
||||
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
|
||||
|
||||
warning: 26 warnings emitted
|
||||
warning: unexpected `cfg` condition value: `zebra`
|
||||
--> $DIR/mix.rs:77:10
|
||||
|
|
||||
LL | cfg!(target_feature = "zebra");
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: expected values for `target_feature` are: `10e60`, `2e3`, `3e3r1`, `3e3r2`, `3e3r3`, `3e7`, `7e10`, `a`, `aclass`, `adx`, `aes`, `altivec`, `alu32`, `atomics`, `avx`, `avx2`, `avx512bf16`, `avx512bitalg`, `avx512bw`, `avx512cd`, `avx512dq`, `avx512er`, `avx512f`, `avx512fp16`, `avx512ifma`, `avx512pf`, `avx512vbmi`, `avx512vbmi2`, `avx512vl`, `avx512vnni`, `avx512vp2intersect`, `avx512vpopcntdq`, `bf16`, `bmi1`, `bmi2` and 186 more
|
||||
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
|
||||
|
||||
warning: 27 warnings emitted
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
//
|
||||
//@ check-pass
|
||||
//@ compile-flags: --check-cfg=cfg() -Z unstable-options
|
||||
//@ compile-flags: -Zcheck-cfg-all-expected
|
||||
|
||||
#![feature(cfg_overflow_checks)]
|
||||
#![feature(cfg_relocation_model)]
|
||||
|
@ -1,5 +1,5 @@
|
||||
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
|
||||
--> $DIR/well-known-values.rs:25:5
|
||||
--> $DIR/well-known-values.rs:26:5
|
||||
|
|
||||
LL | clippy = "_UNEXPECTED_VALUE",
|
||||
| ^^^^^^----------------------
|
||||
@ -11,7 +11,7 @@ LL | clippy = "_UNEXPECTED_VALUE",
|
||||
= note: `#[warn(unexpected_cfgs)]` on by default
|
||||
|
||||
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
|
||||
--> $DIR/well-known-values.rs:27:5
|
||||
--> $DIR/well-known-values.rs:28:5
|
||||
|
|
||||
LL | debug_assertions = "_UNEXPECTED_VALUE",
|
||||
| ^^^^^^^^^^^^^^^^----------------------
|
||||
@ -22,7 +22,7 @@ LL | debug_assertions = "_UNEXPECTED_VALUE",
|
||||
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
|
||||
|
||||
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
|
||||
--> $DIR/well-known-values.rs:29:5
|
||||
--> $DIR/well-known-values.rs:30:5
|
||||
|
|
||||
LL | doc = "_UNEXPECTED_VALUE",
|
||||
| ^^^----------------------
|
||||
@ -33,7 +33,7 @@ LL | doc = "_UNEXPECTED_VALUE",
|
||||
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
|
||||
|
||||
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
|
||||
--> $DIR/well-known-values.rs:31:5
|
||||
--> $DIR/well-known-values.rs:32:5
|
||||
|
|
||||
LL | doctest = "_UNEXPECTED_VALUE",
|
||||
| ^^^^^^^----------------------
|
||||
@ -44,7 +44,7 @@ LL | doctest = "_UNEXPECTED_VALUE",
|
||||
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
|
||||
|
||||
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
|
||||
--> $DIR/well-known-values.rs:33:5
|
||||
--> $DIR/well-known-values.rs:34:5
|
||||
|
|
||||
LL | miri = "_UNEXPECTED_VALUE",
|
||||
| ^^^^----------------------
|
||||
@ -55,7 +55,7 @@ LL | miri = "_UNEXPECTED_VALUE",
|
||||
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
|
||||
|
||||
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
|
||||
--> $DIR/well-known-values.rs:35:5
|
||||
--> $DIR/well-known-values.rs:36:5
|
||||
|
|
||||
LL | overflow_checks = "_UNEXPECTED_VALUE",
|
||||
| ^^^^^^^^^^^^^^^----------------------
|
||||
@ -66,7 +66,7 @@ LL | overflow_checks = "_UNEXPECTED_VALUE",
|
||||
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
|
||||
|
||||
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
|
||||
--> $DIR/well-known-values.rs:37:5
|
||||
--> $DIR/well-known-values.rs:38:5
|
||||
|
|
||||
LL | panic = "_UNEXPECTED_VALUE",
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -75,7 +75,7 @@ LL | panic = "_UNEXPECTED_VALUE",
|
||||
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
|
||||
|
||||
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
|
||||
--> $DIR/well-known-values.rs:39:5
|
||||
--> $DIR/well-known-values.rs:40:5
|
||||
|
|
||||
LL | proc_macro = "_UNEXPECTED_VALUE",
|
||||
| ^^^^^^^^^^----------------------
|
||||
@ -86,7 +86,7 @@ LL | proc_macro = "_UNEXPECTED_VALUE",
|
||||
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
|
||||
|
||||
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
|
||||
--> $DIR/well-known-values.rs:41:5
|
||||
--> $DIR/well-known-values.rs:42:5
|
||||
|
|
||||
LL | relocation_model = "_UNEXPECTED_VALUE",
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -95,7 +95,7 @@ LL | relocation_model = "_UNEXPECTED_VALUE",
|
||||
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
|
||||
|
||||
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
|
||||
--> $DIR/well-known-values.rs:43:5
|
||||
--> $DIR/well-known-values.rs:44:5
|
||||
|
|
||||
LL | sanitize = "_UNEXPECTED_VALUE",
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -104,7 +104,7 @@ LL | sanitize = "_UNEXPECTED_VALUE",
|
||||
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
|
||||
|
||||
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
|
||||
--> $DIR/well-known-values.rs:45:5
|
||||
--> $DIR/well-known-values.rs:46:5
|
||||
|
|
||||
LL | target_abi = "_UNEXPECTED_VALUE",
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -113,7 +113,7 @@ LL | target_abi = "_UNEXPECTED_VALUE",
|
||||
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
|
||||
|
||||
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
|
||||
--> $DIR/well-known-values.rs:47:5
|
||||
--> $DIR/well-known-values.rs:48:5
|
||||
|
|
||||
LL | target_arch = "_UNEXPECTED_VALUE",
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -122,7 +122,7 @@ LL | target_arch = "_UNEXPECTED_VALUE",
|
||||
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
|
||||
|
||||
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
|
||||
--> $DIR/well-known-values.rs:49:5
|
||||
--> $DIR/well-known-values.rs:50:5
|
||||
|
|
||||
LL | target_endian = "_UNEXPECTED_VALUE",
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -131,7 +131,7 @@ LL | target_endian = "_UNEXPECTED_VALUE",
|
||||
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
|
||||
|
||||
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
|
||||
--> $DIR/well-known-values.rs:51:5
|
||||
--> $DIR/well-known-values.rs:52:5
|
||||
|
|
||||
LL | target_env = "_UNEXPECTED_VALUE",
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -140,7 +140,7 @@ LL | target_env = "_UNEXPECTED_VALUE",
|
||||
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
|
||||
|
||||
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
|
||||
--> $DIR/well-known-values.rs:53:5
|
||||
--> $DIR/well-known-values.rs:54:5
|
||||
|
|
||||
LL | target_family = "_UNEXPECTED_VALUE",
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -149,7 +149,7 @@ LL | target_family = "_UNEXPECTED_VALUE",
|
||||
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
|
||||
|
||||
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
|
||||
--> $DIR/well-known-values.rs:55:5
|
||||
--> $DIR/well-known-values.rs:56:5
|
||||
|
|
||||
LL | target_feature = "_UNEXPECTED_VALUE",
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -158,7 +158,7 @@ LL | target_feature = "_UNEXPECTED_VALUE",
|
||||
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
|
||||
|
||||
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
|
||||
--> $DIR/well-known-values.rs:57:5
|
||||
--> $DIR/well-known-values.rs:58:5
|
||||
|
|
||||
LL | target_has_atomic = "_UNEXPECTED_VALUE",
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -167,7 +167,7 @@ LL | target_has_atomic = "_UNEXPECTED_VALUE",
|
||||
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
|
||||
|
||||
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
|
||||
--> $DIR/well-known-values.rs:59:5
|
||||
--> $DIR/well-known-values.rs:60:5
|
||||
|
|
||||
LL | target_has_atomic_equal_alignment = "_UNEXPECTED_VALUE",
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -176,7 +176,7 @@ LL | target_has_atomic_equal_alignment = "_UNEXPECTED_VALUE",
|
||||
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
|
||||
|
||||
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
|
||||
--> $DIR/well-known-values.rs:61:5
|
||||
--> $DIR/well-known-values.rs:62:5
|
||||
|
|
||||
LL | target_has_atomic_load_store = "_UNEXPECTED_VALUE",
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -185,7 +185,7 @@ LL | target_has_atomic_load_store = "_UNEXPECTED_VALUE",
|
||||
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
|
||||
|
||||
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
|
||||
--> $DIR/well-known-values.rs:63:5
|
||||
--> $DIR/well-known-values.rs:64:5
|
||||
|
|
||||
LL | target_os = "_UNEXPECTED_VALUE",
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -194,7 +194,7 @@ LL | target_os = "_UNEXPECTED_VALUE",
|
||||
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
|
||||
|
||||
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
|
||||
--> $DIR/well-known-values.rs:65:5
|
||||
--> $DIR/well-known-values.rs:66:5
|
||||
|
|
||||
LL | target_pointer_width = "_UNEXPECTED_VALUE",
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -203,7 +203,7 @@ LL | target_pointer_width = "_UNEXPECTED_VALUE",
|
||||
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
|
||||
|
||||
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
|
||||
--> $DIR/well-known-values.rs:67:5
|
||||
--> $DIR/well-known-values.rs:68:5
|
||||
|
|
||||
LL | target_thread_local = "_UNEXPECTED_VALUE",
|
||||
| ^^^^^^^^^^^^^^^^^^^----------------------
|
||||
@ -214,7 +214,7 @@ LL | target_thread_local = "_UNEXPECTED_VALUE",
|
||||
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
|
||||
|
||||
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
|
||||
--> $DIR/well-known-values.rs:69:5
|
||||
--> $DIR/well-known-values.rs:70:5
|
||||
|
|
||||
LL | target_vendor = "_UNEXPECTED_VALUE",
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -223,7 +223,7 @@ LL | target_vendor = "_UNEXPECTED_VALUE",
|
||||
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
|
||||
|
||||
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
|
||||
--> $DIR/well-known-values.rs:71:5
|
||||
--> $DIR/well-known-values.rs:72:5
|
||||
|
|
||||
LL | test = "_UNEXPECTED_VALUE",
|
||||
| ^^^^----------------------
|
||||
@ -234,7 +234,7 @@ LL | test = "_UNEXPECTED_VALUE",
|
||||
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
|
||||
|
||||
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
|
||||
--> $DIR/well-known-values.rs:73:5
|
||||
--> $DIR/well-known-values.rs:74:5
|
||||
|
|
||||
LL | unix = "_UNEXPECTED_VALUE",
|
||||
| ^^^^----------------------
|
||||
@ -245,7 +245,7 @@ LL | unix = "_UNEXPECTED_VALUE",
|
||||
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
|
||||
|
||||
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
|
||||
--> $DIR/well-known-values.rs:75:5
|
||||
--> $DIR/well-known-values.rs:76:5
|
||||
|
|
||||
LL | windows = "_UNEXPECTED_VALUE",
|
||||
| ^^^^^^^----------------------
|
||||
@ -256,7 +256,7 @@ LL | windows = "_UNEXPECTED_VALUE",
|
||||
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
|
||||
|
||||
warning: unexpected `cfg` condition value: `linuz`
|
||||
--> $DIR/well-known-values.rs:81:7
|
||||
--> $DIR/well-known-values.rs:82:7
|
||||
|
|
||||
LL | #[cfg(target_os = "linuz")] // testing that we suggest `linux`
|
||||
| ^^^^^^^^^^^^-------
|
||||
|
7
tests/ui/codegen/duplicated-path-in-error.rs
Normal file
7
tests/ui/codegen/duplicated-path-in-error.rs
Normal file
@ -0,0 +1,7 @@
|
||||
//@ only-linux
|
||||
//@ compile-flags: -Zcodegen-backend=/non-existing-one.so
|
||||
|
||||
// This test ensures that the error of the "not found dylib" doesn't duplicate
|
||||
// the path of the dylib.
|
||||
|
||||
fn main() {}
|
2
tests/ui/codegen/duplicated-path-in-error.stderr
Normal file
2
tests/ui/codegen/duplicated-path-in-error.stderr
Normal file
@ -0,0 +1,2 @@
|
||||
error: couldn't load codegen backend /non-existing-one.so: cannot open shared object file: No such file or directory
|
||||
|
24
tests/ui/imports/unresolved-seg-after-ambiguous.rs
Normal file
24
tests/ui/imports/unresolved-seg-after-ambiguous.rs
Normal file
@ -0,0 +1,24 @@
|
||||
mod a {
|
||||
mod b {
|
||||
mod c {
|
||||
pub struct E;
|
||||
}
|
||||
|
||||
mod d {
|
||||
#[derive(Debug)]
|
||||
pub struct E;
|
||||
}
|
||||
|
||||
pub use self::d::*;
|
||||
pub use self::c::*;
|
||||
}
|
||||
|
||||
pub use self::b::*;
|
||||
}
|
||||
|
||||
use self::a::E::in_exist;
|
||||
//~^ ERROR: unresolved import `self::a::E`
|
||||
//~| WARNING: `E` is ambiguous
|
||||
//~| WARNING: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
|
||||
fn main() {}
|
32
tests/ui/imports/unresolved-seg-after-ambiguous.stderr
Normal file
32
tests/ui/imports/unresolved-seg-after-ambiguous.stderr
Normal file
@ -0,0 +1,32 @@
|
||||
error[E0432]: unresolved import `self::a::E`
|
||||
--> $DIR/unresolved-seg-after-ambiguous.rs:19:14
|
||||
|
|
||||
LL | use self::a::E::in_exist;
|
||||
| ^ `E` is a struct, not a module
|
||||
|
||||
warning: `E` is ambiguous
|
||||
--> $DIR/unresolved-seg-after-ambiguous.rs:19:14
|
||||
|
|
||||
LL | use self::a::E::in_exist;
|
||||
| ^ ambiguous name
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #114095 <https://github.com/rust-lang/rust/issues/114095>
|
||||
= note: ambiguous because of multiple glob imports of a name in the same module
|
||||
note: `E` could refer to the struct imported here
|
||||
--> $DIR/unresolved-seg-after-ambiguous.rs:13:17
|
||||
|
|
||||
LL | pub use self::c::*;
|
||||
| ^^^^^^^^^^
|
||||
= help: consider adding an explicit import of `E` to disambiguate
|
||||
note: `E` could also refer to the struct imported here
|
||||
--> $DIR/unresolved-seg-after-ambiguous.rs:12:17
|
||||
|
|
||||
LL | pub use self::d::*;
|
||||
| ^^^^^^^^^^
|
||||
= help: consider adding an explicit import of `E` to disambiguate
|
||||
= note: `#[warn(ambiguous_glob_imports)]` on by default
|
||||
|
||||
error: aborting due to 1 previous error; 1 warning emitted
|
||||
|
||||
For more information about this error, try `rustc --explain E0432`.
|
45
tests/ui/lint/use-redundant/use-redundant-issue-71450.rs
Normal file
45
tests/ui/lint/use-redundant/use-redundant-issue-71450.rs
Normal file
@ -0,0 +1,45 @@
|
||||
//@ check-pass
|
||||
|
||||
#![warn(unused_imports)]
|
||||
|
||||
mod foo {
|
||||
use std::fmt;
|
||||
|
||||
pub struct String;
|
||||
|
||||
impl String {
|
||||
pub fn new() -> String {
|
||||
String{}
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for String {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "String")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
||||
{
|
||||
use std::string::String; //~ WARNING the item `String` is imported redundantly
|
||||
// 'String' from 'std::string::String'.
|
||||
let s = String::new();
|
||||
println!("{}", s);
|
||||
}
|
||||
|
||||
{
|
||||
// 'String' from 'std::string::String'.
|
||||
let s = String::new();
|
||||
println!("{}", s);
|
||||
}
|
||||
|
||||
{
|
||||
use foo::*;
|
||||
// 'String' from 'foo::String'.
|
||||
let s = String::new();
|
||||
println!("{}", s);
|
||||
}
|
||||
|
||||
}
|
17
tests/ui/lint/use-redundant/use-redundant-issue-71450.stderr
Normal file
17
tests/ui/lint/use-redundant/use-redundant-issue-71450.stderr
Normal file
@ -0,0 +1,17 @@
|
||||
warning: the item `String` is imported redundantly
|
||||
--> $DIR/use-redundant-issue-71450.rs:26:13
|
||||
|
|
||||
LL | use std::string::String;
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
--> $SRC_DIR/std/src/prelude/mod.rs:LL:COL
|
||||
|
|
||||
= note: the item `String` is already defined here
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/use-redundant-issue-71450.rs:3:9
|
||||
|
|
||||
LL | #![warn(unused_imports)]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
warning: 1 warning emitted
|
||||
|
48
tests/ui/lint/use-redundant/use-redundant-issue-78894.rs
Normal file
48
tests/ui/lint/use-redundant/use-redundant-issue-78894.rs
Normal file
@ -0,0 +1,48 @@
|
||||
//@ check-pass
|
||||
//@ edition:2018
|
||||
|
||||
#![warn(unused_imports)]
|
||||
|
||||
mod foo {
|
||||
macro_rules! foo1 {
|
||||
() => ();
|
||||
}
|
||||
|
||||
pub(crate) use foo1;
|
||||
}
|
||||
|
||||
fn main ()
|
||||
{
|
||||
bar!();
|
||||
|
||||
macro_rules! bar {
|
||||
() => ();
|
||||
}
|
||||
|
||||
use bar;
|
||||
|
||||
mod m {
|
||||
bar1!();
|
||||
|
||||
macro_rules! bar1 {
|
||||
() => ();
|
||||
}
|
||||
|
||||
use bar1;
|
||||
}
|
||||
|
||||
{
|
||||
foo::foo1!();
|
||||
}
|
||||
|
||||
{
|
||||
use foo::foo1;
|
||||
foo1!();
|
||||
}
|
||||
|
||||
{
|
||||
use foo::foo1; //~ WARNING unused import: `foo::foo1`
|
||||
foo::foo1!();
|
||||
}
|
||||
|
||||
}
|
14
tests/ui/lint/use-redundant/use-redundant-issue-78894.stderr
Normal file
14
tests/ui/lint/use-redundant/use-redundant-issue-78894.stderr
Normal file
@ -0,0 +1,14 @@
|
||||
warning: unused import: `foo::foo1`
|
||||
--> $DIR/use-redundant-issue-78894.rs:44:13
|
||||
|
|
||||
LL | use foo::foo1;
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/use-redundant-issue-78894.rs:4:9
|
||||
|
|
||||
LL | #![warn(unused_imports)]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
warning: 1 warning emitted
|
||||
|
@ -15,7 +15,7 @@ impl Trait for Bar {
|
||||
type Assoc = impl std::fmt::Debug;
|
||||
fn foo() -> Foo {
|
||||
Foo { field: () }
|
||||
//~^ ERROR: item constrains opaque type that is not in its signature
|
||||
//~^ ERROR: mismatched types
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,11 +1,15 @@
|
||||
error: item constrains opaque type that is not in its signature
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/hidden_behind_struct_field2.rs:17:22
|
||||
|
|
||||
LL | type Assoc = impl std::fmt::Debug;
|
||||
| -------------------- the expected opaque type
|
||||
LL | fn foo() -> Foo {
|
||||
LL | Foo { field: () }
|
||||
| ^^
|
||||
| ^^ expected opaque type, found `()`
|
||||
|
|
||||
= note: this item must mention the opaque type in its signature in order to be able to register hidden types
|
||||
note: this item must mention the opaque type in its signature in order to be able to register hidden types
|
||||
= note: expected opaque type `<Bar as Trait>::Assoc`
|
||||
found unit type `()`
|
||||
note: this item must have the opaque type in its signature in order to be able to register hidden types
|
||||
--> $DIR/hidden_behind_struct_field2.rs:16:8
|
||||
|
|
||||
LL | fn foo() -> Foo {
|
||||
@ -13,3 +17,4 @@ LL | fn foo() -> Foo {
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
||||
|
@ -17,7 +17,7 @@ impl Trait for Bar {
|
||||
type Assoc = impl Iterator<Item = Foo>;
|
||||
fn foo() -> Self::Assoc {
|
||||
vec![Foo { field: () }].into_iter()
|
||||
//~^ ERROR item constrains opaque type that is not in its signature
|
||||
//~^ ERROR mismatched types
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,11 +1,15 @@
|
||||
error: item constrains opaque type that is not in its signature
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/hidden_behind_struct_field3.rs:19:27
|
||||
|
|
||||
LL | type Assoc2 = impl std::fmt::Debug;
|
||||
| -------------------- the expected opaque type
|
||||
...
|
||||
LL | vec![Foo { field: () }].into_iter()
|
||||
| ^^
|
||||
| ^^ expected opaque type, found `()`
|
||||
|
|
||||
= note: this item must mention the opaque type in its signature in order to be able to register hidden types
|
||||
note: this item must mention the opaque type in its signature in order to be able to register hidden types
|
||||
= note: expected opaque type `<Bar as Trait>::Assoc2`
|
||||
found unit type `()`
|
||||
note: this item must have the opaque type in its signature in order to be able to register hidden types
|
||||
--> $DIR/hidden_behind_struct_field3.rs:18:8
|
||||
|
|
||||
LL | fn foo() -> Self::Assoc {
|
||||
@ -13,3 +17,4 @@ LL | fn foo() -> Self::Assoc {
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
||||
|
@ -0,0 +1,25 @@
|
||||
type NodeId = u32;
|
||||
struct Type<'a>(std::marker::PhantomData::<&'a ()>);
|
||||
|
||||
type Ast<'ast> = &'ast AstStructure<'ast>;
|
||||
|
||||
struct AstStructure<'ast> {
|
||||
//~^ ERROR struct with unnamed fields must have `#[repr(C)]` representation
|
||||
id: NodeId,
|
||||
_: AstKind<'ast>
|
||||
//~^ ERROR unnamed fields are not yet fully implemented [E0658]
|
||||
//~^^ ERROR unnamed fields can only have struct or union types
|
||||
}
|
||||
|
||||
enum AstKind<'ast> {
|
||||
ExprInt,
|
||||
ExprLambda(Ast<'ast>),
|
||||
}
|
||||
|
||||
fn compute_types<'tcx,'ast>(ast: Ast<'ast>) -> Type<'tcx>
|
||||
{
|
||||
match ast.kind {}
|
||||
//~^ ERROR no field `kind` on type `&'ast AstStructure<'ast>` [E0609]
|
||||
}
|
||||
|
||||
fn main() {}
|
@ -0,0 +1,45 @@
|
||||
error[E0658]: unnamed fields are not yet fully implemented
|
||||
--> $DIR/unnamed-enum-field-issue-121757.rs:9:5
|
||||
|
|
||||
LL | _: AstKind<'ast>
|
||||
| ^
|
||||
|
|
||||
= note: see issue #49804 <https://github.com/rust-lang/rust/issues/49804> for more information
|
||||
= help: add `#![feature(unnamed_fields)]` 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: struct with unnamed fields must have `#[repr(C)]` representation
|
||||
--> $DIR/unnamed-enum-field-issue-121757.rs:6:1
|
||||
|
|
||||
LL | struct AstStructure<'ast> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ struct `AstStructure` defined here
|
||||
|
|
||||
note: unnamed field defined here
|
||||
--> $DIR/unnamed-enum-field-issue-121757.rs:9:5
|
||||
|
|
||||
LL | _: AstKind<'ast>
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
help: add `#[repr(C)]` to this struct
|
||||
|
|
||||
LL + #[repr(C)]
|
||||
LL | struct AstStructure<'ast> {
|
||||
|
|
||||
|
||||
error: unnamed fields can only have struct or union types
|
||||
--> $DIR/unnamed-enum-field-issue-121757.rs:9:5
|
||||
|
|
||||
LL | _: AstKind<'ast>
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0609]: no field `kind` on type `&'ast AstStructure<'ast>`
|
||||
--> $DIR/unnamed-enum-field-issue-121757.rs:21:15
|
||||
|
|
||||
LL | match ast.kind {}
|
||||
| ^^^^ unknown field
|
||||
|
|
||||
= note: available fields are: `id`, `_`
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0609, E0658.
|
||||
For more information about an error, try `rustc --explain E0609`.
|
Loading…
Reference in New Issue
Block a user