Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions compiler/rustc_metadata/src/dependency_format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ use crate::creader::CStore;
use crate::errors::{
BadPanicStrategy, CrateDepMultiple, IncompatiblePanicInDropStrategy,
IncompatibleWithImmediateAbort, IncompatibleWithImmediateAbortCore, LibRequired,
NonStaticCrateDep, RequiredPanicStrategy, RlibRequired, RustcDriverHelp, RustcLibRequired,
TwoPanicRuntimes,
NonStaticCrateDep, RequiredPanicStrategy, RlibRequired, RustcLibRequired, TwoPanicRuntimes,
};

pub(crate) fn calculate(tcx: TyCtxt<'_>) -> Dependencies {
Expand Down Expand Up @@ -318,7 +317,7 @@ fn add_library(
.drain(..)
.map(|cnum| NonStaticCrateDep { crate_name_: tcx.crate_name(cnum) })
.collect(),
rustc_driver_help: linking_to_rustc_driver.then_some(RustcDriverHelp),
rustc_driver_help: linking_to_rustc_driver,
});
}
}
Expand Down
8 changes: 2 additions & 6 deletions compiler/rustc_metadata/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ pub struct CrateDepMultiple {
pub crate_name: Symbol,
#[subdiagnostic]
pub non_static_deps: Vec<NonStaticCrateDep>,
#[subdiagnostic]
pub rustc_driver_help: Option<RustcDriverHelp>,
#[help("`feature(rustc_private)` is needed to link to the compiler's `rustc_driver` library")]
pub rustc_driver_help: bool,
}

#[derive(Subdiagnostic)]
Expand All @@ -54,10 +54,6 @@ pub struct NonStaticCrateDep {
pub crate_name_: Symbol,
}

#[derive(Subdiagnostic)]
#[help("`feature(rustc_private)` is needed to link to the compiler's `rustc_driver` library")]
pub struct RustcDriverHelp;

#[derive(Diagnostic)]
#[diag("cannot link together two panic runtimes: {$prev_name} and {$cur_name}")]
pub struct TwoPanicRuntimes {
Expand Down
20 changes: 6 additions & 14 deletions compiler/rustc_parse/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2786,12 +2786,14 @@ pub(crate) struct UnknownTokenStart {
pub escaped: String,
#[subdiagnostic]
pub sugg: Option<TokenSubstitution>,
#[subdiagnostic]
pub null: Option<UnknownTokenNull>,
#[help(
"source files must contain UTF-8 encoded text, unexpected null bytes might occur when a different encoding is used"
)]
pub null: bool,
#[subdiagnostic]
pub repeat: Option<UnknownTokenRepeat>,
#[subdiagnostic]
pub invisible: Option<InvisibleCharacter>,
#[help("invisible characters like '{$escaped}' are not usually visible in text editors")]
pub invisible: bool,
}

#[derive(Subdiagnostic)]
Expand Down Expand Up @@ -2837,16 +2839,6 @@ pub(crate) struct UnknownTokenRepeat {
pub repeats: usize,
}

#[derive(Subdiagnostic)]
#[help("invisible characters like '{$escaped}' are not usually visible in text editors")]
pub(crate) struct InvisibleCharacter;

#[derive(Subdiagnostic)]
#[help(
"source files must contain UTF-8 encoded text, unexpected null bytes might occur when a different encoding is used"
)]
pub(crate) struct UnknownTokenNull;

#[derive(Diagnostic)]
pub(crate) enum UnescapeError {
#[diag("invalid unicode character escape")]
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_parse/src/lexer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -459,8 +459,8 @@ impl<'psess, 'src> Lexer<'psess, 'src> {
span: self.mk_sp(start, self.pos + Pos::from_usize(repeats * c.len_utf8())),
escaped: escaped_char(c),
sugg,
null: if c == '\x00' { Some(errors::UnknownTokenNull) } else { None },
invisible: if INVISIBLE_CHARACTERS.contains(&c) { Some(errors::InvisibleCharacter) } else { None },
null: c == '\x00',
invisible: INVISIBLE_CHARACTERS.contains(&c),
repeat: if repeats > 0 {
swallow_next_invalid = repeats;
Some(errors::UnknownTokenRepeat { repeats })
Expand Down
6 changes: 1 addition & 5 deletions compiler/rustc_resolve/src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1015,11 +1015,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
span,
name,
param_kind: is_type,
help: self
.tcx
.sess
.is_nightly_build()
.then_some(errs::ParamInNonTrivialAnonConstHelp),
help: self.tcx.sess.is_nightly_build(),
})
}
ResolutionError::ParamInEnumDiscriminant { name, param_kind: is_type } => self
Expand Down
8 changes: 2 additions & 6 deletions compiler/rustc_resolve/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -429,14 +429,10 @@ pub(crate) struct ParamInNonTrivialAnonConst {
pub(crate) name: Symbol,
#[subdiagnostic]
pub(crate) param_kind: ParamKindInNonTrivialAnonConst,
#[subdiagnostic]
pub(crate) help: Option<ParamInNonTrivialAnonConstHelp>,
#[help("add `#![feature(generic_const_exprs)]` to allow generic const expressions")]
pub(crate) help: bool,
}

#[derive(Subdiagnostic)]
#[help("add `#![feature(generic_const_exprs)]` to allow generic const expressions")]
pub(crate) struct ParamInNonTrivialAnonConstHelp;

#[derive(Debug)]
#[derive(Subdiagnostic)]
pub(crate) enum ParamKindInNonTrivialAnonConst {
Expand Down
7 changes: 1 addition & 6 deletions compiler/rustc_resolve/src/late/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3510,12 +3510,7 @@ impl<'ast, 'ra, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> {
span: lifetime_ref.ident.span,
name: lifetime_ref.ident.name,
param_kind: errors::ParamKindInNonTrivialAnonConst::Lifetime,
help: self
.r
.tcx
.sess
.is_nightly_build()
.then_some(errors::ParamInNonTrivialAnonConstHelp),
help: self.r.tcx.sess.is_nightly_build(),
})
.emit();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use tracing::debug;

use crate::error_reporting::infer::nice_region_error::NiceRegionError;
use crate::error_reporting::infer::nice_region_error::placeholder_error::Highlighted;
use crate::errors::{ConsiderBorrowingParamHelp, RelationshipHelp, TraitImplDiff};
use crate::errors::{ConsiderBorrowingParamHelp, TraitImplDiff};
use crate::infer::{RegionResolutionError, ValuePairs};

impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
Expand Down Expand Up @@ -117,7 +117,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
trait_sp,
note: (),
param_help: ConsiderBorrowingParamHelp { spans: visitor.types.to_vec() },
rel_help: visitor.types.is_empty().then_some(RelationshipHelp),
rel_help: visitor.types.is_empty(),
expected,
found,
};
Expand Down
14 changes: 4 additions & 10 deletions compiler/rustc_trait_selection/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1230,12 +1230,6 @@ impl Subdiagnostic for ConsiderBorrowingParamHelp {
}
}

#[derive(Subdiagnostic)]
#[help(
"verify the lifetime relationships in the `trait` and `impl` between the `self` argument, the other inputs and its output"
)]
pub struct RelationshipHelp;

#[derive(Diagnostic)]
#[diag("`impl` item signature doesn't match `trait` item signature")]
pub struct TraitImplDiff {
Expand All @@ -1251,10 +1245,10 @@ pub struct TraitImplDiff {
pub note: (),
#[subdiagnostic]
pub param_help: ConsiderBorrowingParamHelp,
#[subdiagnostic]
// Seems like subdiagnostics are always pushed to the end, so this one
// also has to be a subdiagnostic to maintain order.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may have been previously true but I verified that it no longer is

pub rel_help: Option<RelationshipHelp>,
#[help(
"verify the lifetime relationships in the `trait` and `impl` between the `self` argument, the other inputs and its output"
)]
pub rel_help: bool,
pub expected: String,
pub found: String,
}
Expand Down
Loading