Auto merge of #119088 - George-lewis:glewis/suggest-upgrading-compiler, r=Nilstrieb

Suggest Upgrading Compiler for Gated Features

This PR addresses #117318

I have a few questions:

1. Do we want to specify the current version and release date of the compiler? I have added this in via environment variables, which I found in the code for the rustc cli where it handles the `--version` flag
  a. How can I handle the changing message in the tests?
3. Do we want to only show this message when the compiler is old?
  a. How can we determine when the compiler is old?

I'll wait until we figure out the message to bless the tests
This commit is contained in:
bors 2024-01-13 20:06:03 +00:00
commit d78329b92e
451 changed files with 1568 additions and 544 deletions

View File

@ -48,7 +48,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
);
if !is_stable && !self.tcx.features().asm_experimental_arch {
feature_err(
&self.tcx.sess.parse_sess,
&self.tcx.sess,
sym::asm_experimental_arch,
sp,
"inline assembly is not stable yet on this architecture",
@ -63,13 +63,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
self.dcx().emit_err(AttSyntaxOnlyX86 { span: sp });
}
if asm.options.contains(InlineAsmOptions::MAY_UNWIND) && !self.tcx.features().asm_unwind {
feature_err(
&self.tcx.sess.parse_sess,
sym::asm_unwind,
sp,
"the `may_unwind` option is unstable",
)
.emit();
feature_err(&self.tcx.sess, sym::asm_unwind, sp, "the `may_unwind` option is unstable")
.emit();
}
let mut clobber_abis = FxIndexMap::default();
@ -183,7 +178,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
InlineAsmOperand::Const { anon_const } => {
if !self.tcx.features().asm_const {
feature_err(
&sess.parse_sess,
sess,
sym::asm_const,
*op_sp,
"const operands for inline assembly are unstable",

View File

@ -1512,7 +1512,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
Some(hir::CoroutineKind::Coroutine(_)) => {
if !self.tcx.features().coroutines {
rustc_session::parse::feature_err(
&self.tcx.sess.parse_sess,
&self.tcx.sess,
sym::coroutines,
span,
"yield syntax is experimental",
@ -1524,7 +1524,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
None => {
if !self.tcx.features().coroutines {
rustc_session::parse::feature_err(
&self.tcx.sess.parse_sess,
&self.tcx.sess,
sym::coroutines,
span,
"yield syntax is experimental",

View File

@ -1043,7 +1043,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
{
add_feature_diagnostics(
&mut err,
&self.tcx.sess.parse_sess,
&self.tcx.sess,
sym::return_type_notation,
);
}
@ -2310,7 +2310,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
hir::ArrayLen::Infer(self.lower_node_id(c.id), self.lower_span(c.value.span))
} else {
feature_err(
&self.tcx.sess.parse_sess,
&self.tcx.sess,
sym::generic_arg_infer,
c.value.span,
"using `_` for array lengths is unstable",

View File

@ -17,14 +17,12 @@ use crate::errors;
macro_rules! gate {
($visitor:expr, $feature:ident, $span:expr, $explain:expr) => {{
if !$visitor.features.$feature && !$span.allows_unstable(sym::$feature) {
feature_err(&$visitor.sess.parse_sess, sym::$feature, $span, $explain).emit();
feature_err(&$visitor.sess, sym::$feature, $span, $explain).emit();
}
}};
($visitor:expr, $feature:ident, $span:expr, $explain:expr, $help:expr) => {{
if !$visitor.features.$feature && !$span.allows_unstable(sym::$feature) {
feature_err(&$visitor.sess.parse_sess, sym::$feature, $span, $explain)
.with_help($help)
.emit();
feature_err(&$visitor.sess, sym::$feature, $span, $explain).with_help($help).emit();
}
}};
}
@ -33,7 +31,7 @@ macro_rules! gate {
macro_rules! gate_alt {
($visitor:expr, $has_feature:expr, $name:expr, $span:expr, $explain:expr) => {{
if !$has_feature && !$span.allows_unstable($name) {
feature_err(&$visitor.sess.parse_sess, $name, $span, $explain).emit();
feature_err(&$visitor.sess, $name, $span, $explain).emit();
}
}};
}
@ -45,7 +43,7 @@ macro_rules! gate_multi {
let spans: Vec<_> =
$spans.filter(|span| !span.allows_unstable(sym::$feature)).collect();
if !spans.is_empty() {
feature_err(&$visitor.sess.parse_sess, sym::$feature, spans, $explain).emit();
feature_err(&$visitor.sess, sym::$feature, spans, $explain).emit();
}
}
}};
@ -55,7 +53,7 @@ macro_rules! gate_multi {
macro_rules! gate_legacy {
($visitor:expr, $feature:ident, $span:expr, $explain:expr) => {{
if !$visitor.features.$feature && !$span.allows_unstable(sym::$feature) {
feature_warn(&$visitor.sess.parse_sess, sym::$feature, $span, $explain);
feature_warn(&$visitor.sess, sym::$feature, $span, $explain);
}
}};
}
@ -91,14 +89,7 @@ impl<'a> PostExpansionVisitor<'a> {
match abi::is_enabled(self.features, span, symbol_unescaped.as_str()) {
Ok(()) => (),
Err(abi::AbiDisabled::Unstable { feature, explain }) => {
feature_err_issue(
&self.sess.parse_sess,
feature,
span,
GateIssue::Language,
explain,
)
.emit();
feature_err_issue(&self.sess, feature, span, GateIssue::Language, explain).emit();
}
Err(abi::AbiDisabled::Unrecognized) => {
if self.sess.opts.pretty.map_or(true, |ppm| ppm.needs_hir()) {
@ -571,13 +562,8 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session, features: &Features) {
if let Ok(snippet) = sm.span_to_snippet(span)
&& snippet == "!"
{
feature_err(
&sess.parse_sess,
sym::never_patterns,
span,
"`!` patterns are experimental",
)
.emit();
feature_err(sess, sym::never_patterns, span, "`!` patterns are experimental")
.emit();
} else {
let suggestion = span.shrink_to_hi();
sess.dcx().emit_err(errors::MatchArmWithNoBody { span, suggestion });

View File

@ -9,7 +9,7 @@ use rustc_macros::HashStable_Generic;
use rustc_session::config::ExpectedValues;
use rustc_session::lint::builtin::UNEXPECTED_CFGS;
use rustc_session::lint::BuiltinLintDiagnostics;
use rustc_session::parse::{feature_err, ParseSess};
use rustc_session::parse::feature_err;
use rustc_session::{RustcVersion, Session};
use rustc_span::hygiene::Transparency;
use rustc_span::{symbol::sym, symbol::Symbol, Span};
@ -518,15 +518,15 @@ pub struct Condition {
/// Tests if a cfg-pattern matches the cfg set
pub fn cfg_matches(
cfg: &ast::MetaItem,
sess: &ParseSess,
sess: &Session,
lint_node_id: NodeId,
features: Option<&Features>,
) -> bool {
eval_condition(cfg, sess, features, &mut |cfg| {
try_gate_cfg(cfg.name, cfg.span, sess, features);
match sess.check_config.expecteds.get(&cfg.name) {
match sess.parse_sess.check_config.expecteds.get(&cfg.name) {
Some(ExpectedValues::Some(values)) if !values.contains(&cfg.value) => {
sess.buffer_lint_with_diagnostic(
sess.parse_sess.buffer_lint_with_diagnostic(
UNEXPECTED_CFGS,
cfg.span,
lint_node_id,
@ -541,8 +541,8 @@ pub fn cfg_matches(
),
);
}
None if sess.check_config.exhaustive_names => {
sess.buffer_lint_with_diagnostic(
None if sess.parse_sess.check_config.exhaustive_names => {
sess.parse_sess.buffer_lint_with_diagnostic(
UNEXPECTED_CFGS,
cfg.span,
lint_node_id,
@ -555,18 +555,18 @@ pub fn cfg_matches(
}
_ => { /* not unexpected */ }
}
sess.config.contains(&(cfg.name, cfg.value))
sess.parse_sess.config.contains(&(cfg.name, cfg.value))
})
}
fn try_gate_cfg(name: Symbol, span: Span, sess: &ParseSess, features: Option<&Features>) {
fn try_gate_cfg(name: Symbol, span: Span, sess: &Session, features: Option<&Features>) {
let gate = find_gated_cfg(|sym| sym == name);
if let (Some(feats), Some(gated_cfg)) = (features, gate) {
gate_cfg(gated_cfg, span, sess, feats);
}
}
fn gate_cfg(gated_cfg: &GatedCfg, cfg_span: Span, sess: &ParseSess, features: &Features) {
fn gate_cfg(gated_cfg: &GatedCfg, cfg_span: Span, sess: &Session, features: &Features) {
let (cfg, feature, has_feature) = gated_cfg;
if !has_feature(features) && !cfg_span.allows_unstable(*feature) {
let explain = format!("`cfg({cfg})` is experimental and subject to change");
@ -594,11 +594,11 @@ fn parse_version(s: Symbol) -> Option<RustcVersion> {
/// evaluate individual items.
pub fn eval_condition(
cfg: &ast::MetaItem,
sess: &ParseSess,
sess: &Session,
features: Option<&Features>,
eval: &mut impl FnMut(Condition) -> bool,
) -> bool {
let dcx = &sess.dcx;
let dcx = &sess.parse_sess.dcx;
match &cfg.kind {
ast::MetaItemKind::List(mis) if cfg.name_or_empty() == sym::version => {
try_gate_cfg(sym::version, cfg.span, sess, features);
@ -626,7 +626,7 @@ pub fn eval_condition(
};
// See https://github.com/rust-lang/rust/issues/64796#issuecomment-640851454 for details
if sess.assume_incomplete_release {
if sess.parse_sess.assume_incomplete_release {
RustcVersion::CURRENT > min_version
} else {
RustcVersion::CURRENT >= min_version

View File

@ -22,7 +22,7 @@ pub fn expand_cfg(
Ok(cfg) => {
let matches_cfg = attr::cfg_matches(
&cfg,
&cx.sess.parse_sess,
&cx.sess,
cx.current_expansion.lint_node_id,
Some(cx.ecfg.features),
);

View File

@ -107,7 +107,7 @@ pub fn expand_include<'cx>(
return DummyResult::any(sp);
};
// The file will be added to the code map by the parser
let file = match resolve_path(&cx.sess.parse_sess, file.as_str(), sp) {
let file = match resolve_path(&cx.sess, file.as_str(), sp) {
Ok(f) => f,
Err(err) => {
err.emit();
@ -179,7 +179,7 @@ pub fn expand_include_str(
let Some(file) = get_single_str_from_tts(cx, sp, tts, "include_str!") else {
return DummyResult::any(sp);
};
let file = match resolve_path(&cx.sess.parse_sess, file.as_str(), sp) {
let file = match resolve_path(&cx.sess, file.as_str(), sp) {
Ok(f) => f,
Err(err) => {
err.emit();
@ -213,7 +213,7 @@ pub fn expand_include_bytes(
let Some(file) = get_single_str_from_tts(cx, sp, tts, "include_bytes!") else {
return DummyResult::any(sp);
};
let file = match resolve_path(&cx.sess.parse_sess, file.as_str(), sp) {
let file = match resolve_path(&cx.sess, file.as_str(), sp) {
Ok(f) => f,
Err(err) => {
err.emit();

View File

@ -2870,7 +2870,7 @@ fn add_dynamic_crate(cmd: &mut dyn Linker, sess: &Session, cratepath: &Path) {
fn relevant_lib(sess: &Session, lib: &NativeLib) -> bool {
match lib.cfg {
Some(ref cfg) => rustc_attr::cfg_matches(cfg, &sess.parse_sess, CRATE_NODE_ID, None),
Some(ref cfg) => rustc_attr::cfg_matches(cfg, sess, CRATE_NODE_ID, None),
None => true,
}
}

View File

@ -155,7 +155,7 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {
Some([item]) if item.has_name(sym::linker) => {
if !tcx.features().used_with_arg {
feature_err(
&tcx.sess.parse_sess,
&tcx.sess,
sym::used_with_arg,
attr.span,
"`#[used(linker)]` is currently unstable",
@ -167,7 +167,7 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {
Some([item]) if item.has_name(sym::compiler) => {
if !tcx.features().used_with_arg {
feature_err(
&tcx.sess.parse_sess,
&tcx.sess,
sym::used_with_arg,
attr.span,
"`#[used(compiler)]` is currently unstable",
@ -251,7 +251,7 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {
&& !attr.span.allows_unstable(sym::closure_track_caller)
{
feature_err(
&tcx.sess.parse_sess,
&tcx.sess,
sym::closure_track_caller,
attr.span,
"`#[track_caller]` on closures is currently unstable",
@ -304,7 +304,7 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {
// `#[target_feature]` on `main` and `start`.
} else if !tcx.features().target_feature_11 {
feature_err(
&tcx.sess.parse_sess,
&tcx.sess,
sym::target_feature_11,
attr.span,
"`#[target_feature(..)]` can only be applied to `unsafe` functions",

View File

@ -82,7 +82,7 @@ pub fn from_target_feature(
};
if !allowed {
feature_err(
&tcx.sess.parse_sess,
&tcx.sess,
feature_gate.unwrap(),
item.span(),
format!("the target feature `{feature}` is currently unstable"),

View File

@ -64,7 +64,7 @@ impl<'tcx> NonConstOp<'tcx> for FloatingPointOp {
fn build_error(&self, ccx: &ConstCx<'_, 'tcx>, span: Span) -> DiagnosticBuilder<'tcx> {
feature_err(
&ccx.tcx.sess.parse_sess,
&ccx.tcx.sess,
sym::const_fn_floating_point_arithmetic,
span,
format!("floating point arithmetic is not allowed in {}s", ccx.const_kind()),
@ -553,7 +553,7 @@ impl<'tcx> NonConstOp<'tcx> for RawMutPtrDeref {
fn build_error(&self, ccx: &ConstCx<'_, 'tcx>, span: Span) -> DiagnosticBuilder<'tcx> {
feature_err(
&ccx.tcx.sess.parse_sess,
&ccx.tcx.sess,
sym::const_mut_refs,
span,
format!("dereferencing raw mutable pointers in {}s is unstable", ccx.const_kind(),),
@ -624,7 +624,7 @@ pub mod ty {
fn build_error(&self, ccx: &ConstCx<'_, 'tcx>, span: Span) -> DiagnosticBuilder<'tcx> {
feature_err(
&ccx.tcx.sess.parse_sess,
&ccx.tcx.sess,
sym::const_mut_refs,
span,
format!("mutable references are not allowed in {}s", ccx.const_kind()),

View File

@ -1150,7 +1150,7 @@ impl<'a> ExtCtxt<'a> {
///
/// This unifies the logic used for resolving `include_X!`.
pub fn resolve_path(
parse_sess: &ParseSess,
parse_sess: &Session,
path: impl Into<PathBuf>,
span: Span,
) -> PResult<'_, PathBuf> {
@ -1166,7 +1166,7 @@ pub fn resolve_path(
.expect("attempting to resolve a file path in an external file"),
FileName::DocTest(path, _) => path,
other => {
return Err(parse_sess.dcx.create_err(errors::ResolveRelativePath {
return Err(parse_sess.dcx().create_err(errors::ResolveRelativePath {
span,
path: parse_sess.source_map().filename_for_diagnostics(&other).to_string(),
}));
@ -1390,7 +1390,7 @@ pub fn parse_macro_name_and_helper_attrs(
/// asserts in old versions of those crates and their wide use in the ecosystem.
/// See issue #73345 for more details.
/// FIXME(#73933): Remove this eventually.
fn pretty_printing_compatibility_hack(item: &Item, sess: &ParseSess) -> bool {
fn pretty_printing_compatibility_hack(item: &Item, sess: &Session) -> bool {
let name = item.ident.name;
if name == sym::ProceduralMasqueradeDummyType {
if let ast::ItemKind::Enum(enum_def, _) = &item.kind {
@ -1418,7 +1418,7 @@ fn pretty_printing_compatibility_hack(item: &Item, sess: &ParseSess) -> bool {
};
if crate_matches {
sess.buffer_lint_with_diagnostic(
sess.parse_sess.buffer_lint_with_diagnostic(
PROC_MACRO_BACK_COMPAT,
item.ident.span,
ast::CRATE_NODE_ID,
@ -1439,7 +1439,7 @@ fn pretty_printing_compatibility_hack(item: &Item, sess: &ParseSess) -> bool {
false
}
pub(crate) fn ann_pretty_printing_compatibility_hack(ann: &Annotatable, sess: &ParseSess) -> bool {
pub(crate) fn ann_pretty_printing_compatibility_hack(ann: &Annotatable, sess: &Session) -> bool {
let item = match ann {
Annotatable::Item(item) => item,
Annotatable::Stmt(stmt) => match &stmt.kind {
@ -1451,7 +1451,7 @@ pub(crate) fn ann_pretty_printing_compatibility_hack(ann: &Annotatable, sess: &P
pretty_printing_compatibility_hack(item, sess)
}
pub(crate) fn nt_pretty_printing_compatibility_hack(nt: &Nonterminal, sess: &ParseSess) -> bool {
pub(crate) fn nt_pretty_printing_compatibility_hack(nt: &Nonterminal, sess: &Session) -> bool {
let item = match nt {
Nonterminal::NtItem(item) => item,
Nonterminal::NtStmt(stmt) => match &stmt.kind {

View File

@ -256,12 +256,7 @@ impl<'a> StripUnconfigured<'a> {
);
}
if !attr::cfg_matches(
&cfg_predicate,
&self.sess.parse_sess,
self.lint_node_id,
self.features,
) {
if !attr::cfg_matches(&cfg_predicate, &self.sess, self.lint_node_id, self.features) {
return vec![];
}
@ -369,12 +364,7 @@ impl<'a> StripUnconfigured<'a> {
};
(
parse_cfg(&meta_item, self.sess).map_or(true, |meta_item| {
attr::cfg_matches(
meta_item,
&self.sess.parse_sess,
self.lint_node_id,
self.features,
)
attr::cfg_matches(meta_item, &self.sess, self.lint_node_id, self.features)
}),
Some(meta_item),
)
@ -385,7 +375,7 @@ impl<'a> StripUnconfigured<'a> {
pub(crate) fn maybe_emit_expr_attr_err(&self, attr: &Attribute) {
if self.features.is_some_and(|features| !features.stmt_expr_attributes) {
let mut err = feature_err(
&self.sess.parse_sess,
&self.sess,
sym::stmt_expr_attributes,
attr.span,
"attributes on expressions are experimental",

View File

@ -30,8 +30,8 @@ use rustc_parse::parser::{
use rustc_parse::validate_attr;
use rustc_session::lint::builtin::{UNUSED_ATTRIBUTES, UNUSED_DOC_COMMENTS};
use rustc_session::lint::BuiltinLintDiagnostics;
use rustc_session::parse::{feature_err, ParseSess};
use rustc_session::Limit;
use rustc_session::parse::feature_err;
use rustc_session::{Limit, Session};
use rustc_span::symbol::{sym, Ident};
use rustc_span::{FileName, LocalExpnId, Span};
@ -800,7 +800,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
return;
}
feature_err(
&self.cx.sess.parse_sess,
&self.cx.sess,
sym::proc_macro_hygiene,
span,
format!("custom attributes cannot be applied to {kind}"),
@ -810,7 +810,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
fn gate_proc_macro_input(&self, annotatable: &Annotatable) {
struct GateProcMacroInput<'a> {
parse_sess: &'a ParseSess,
sess: &'a Session,
}
impl<'ast, 'a> Visitor<'ast> for GateProcMacroInput<'a> {
@ -820,7 +820,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
if !matches!(mod_kind, ModKind::Loaded(_, Inline::Yes, _)) =>
{
feature_err(
self.parse_sess,
self.sess,
sym::proc_macro_hygiene,
item.span,
"non-inline modules in proc macro input are unstable",
@ -835,8 +835,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
}
if !self.cx.ecfg.features.proc_macro_hygiene {
annotatable
.visit_with(&mut GateProcMacroInput { parse_sess: &self.cx.sess.parse_sess });
annotatable.visit_with(&mut GateProcMacroInput { sess: &self.cx.sess });
}
}

View File

@ -477,14 +477,14 @@ pub fn compile_declarative_macro(
let tt = mbe::quoted::parse(
&TokenStream::new(vec![tt.clone()]),
true,
&sess.parse_sess,
sess,
def.id,
features,
edition,
)
.pop()
.unwrap();
valid &= check_lhs_nt_follows(&sess.parse_sess, def, &tt);
valid &= check_lhs_nt_follows(sess, def, &tt);
return tt;
}
sess.dcx().span_bug(def.span, "wrong-structured lhs")
@ -501,7 +501,7 @@ pub fn compile_declarative_macro(
return mbe::quoted::parse(
&TokenStream::new(vec![tt.clone()]),
false,
&sess.parse_sess,
sess,
def.id,
features,
edition,
@ -516,12 +516,12 @@ pub fn compile_declarative_macro(
};
for rhs in &rhses {
valid &= check_rhs(&sess.parse_sess, rhs);
valid &= check_rhs(sess, rhs);
}
// don't abort iteration early, so that errors for multiple lhses can be reported
for lhs in &lhses {
valid &= check_lhs_no_empty_seq(&sess.parse_sess, slice::from_ref(lhs));
valid &= check_lhs_no_empty_seq(sess, slice::from_ref(lhs));
}
valid &= macro_check::check_meta_variables(&sess.parse_sess, def.id, def.span, &lhses, &rhses);
@ -588,21 +588,21 @@ pub fn compile_declarative_macro(
(mk_syn_ext(expander), rule_spans)
}
fn check_lhs_nt_follows(sess: &ParseSess, def: &ast::Item, lhs: &mbe::TokenTree) -> bool {
fn check_lhs_nt_follows(sess: &Session, def: &ast::Item, lhs: &mbe::TokenTree) -> bool {
// lhs is going to be like TokenTree::Delimited(...), where the
// entire lhs is those tts. Or, it can be a "bare sequence", not wrapped in parens.
if let mbe::TokenTree::Delimited(.., delimited) = lhs {
check_matcher(sess, def, &delimited.tts)
} else {
let msg = "invalid macro matcher; matchers must be contained in balanced delimiters";
sess.dcx.span_err(lhs.span(), msg);
sess.dcx().span_err(lhs.span(), msg);
false
}
// we don't abort on errors on rejection, the driver will do that for us
// after parsing/expansion. we can report every error in every macro this way.
}
fn is_empty_token_tree(sess: &ParseSess, seq: &mbe::SequenceRepetition) -> bool {
fn is_empty_token_tree(sess: &Session, seq: &mbe::SequenceRepetition) -> bool {
if seq.separator.is_some() {
false
} else {
@ -621,7 +621,7 @@ fn is_empty_token_tree(sess: &ParseSess, seq: &mbe::SequenceRepetition) -> bool
iter.next();
}
let span = t.span.to(now.span);
sess.dcx.span_note(span, "doc comments are ignored in matcher position");
sess.dcx().span_note(span, "doc comments are ignored in matcher position");
}
mbe::TokenTree::Sequence(_, sub_seq)
if (sub_seq.kleene.op == mbe::KleeneOp::ZeroOrMore
@ -635,7 +635,7 @@ fn is_empty_token_tree(sess: &ParseSess, seq: &mbe::SequenceRepetition) -> bool
/// Checks that the lhs contains no repetition which could match an empty token
/// tree, because then the matcher would hang indefinitely.
fn check_lhs_no_empty_seq(sess: &ParseSess, tts: &[mbe::TokenTree]) -> bool {
fn check_lhs_no_empty_seq(sess: &Session, tts: &[mbe::TokenTree]) -> bool {
use mbe::TokenTree;
for tt in tts {
match tt {
@ -651,7 +651,7 @@ fn check_lhs_no_empty_seq(sess: &ParseSess, tts: &[mbe::TokenTree]) -> bool {
TokenTree::Sequence(span, seq) => {
if is_empty_token_tree(sess, seq) {
let sp = span.entire();
sess.dcx.span_err(sp, "repetition matches empty token tree");
sess.dcx().span_err(sp, "repetition matches empty token tree");
return false;
}
if !check_lhs_no_empty_seq(sess, &seq.tts) {
@ -664,22 +664,22 @@ fn check_lhs_no_empty_seq(sess: &ParseSess, tts: &[mbe::TokenTree]) -> bool {
true
}
fn check_rhs(sess: &ParseSess, rhs: &mbe::TokenTree) -> bool {
fn check_rhs(sess: &Session, rhs: &mbe::TokenTree) -> bool {
match *rhs {
mbe::TokenTree::Delimited(..) => return true,
_ => {
sess.dcx.span_err(rhs.span(), "macro rhs must be delimited");
sess.dcx().span_err(rhs.span(), "macro rhs must be delimited");
}
}
false
}
fn check_matcher(sess: &ParseSess, def: &ast::Item, matcher: &[mbe::TokenTree]) -> bool {
fn check_matcher(sess: &Session, def: &ast::Item, matcher: &[mbe::TokenTree]) -> bool {
let first_sets = FirstSets::new(matcher);
let empty_suffix = TokenSet::empty();
let err = sess.dcx.err_count();
let err = sess.dcx().err_count();
check_matcher_core(sess, def, &first_sets, matcher, &empty_suffix);
err == sess.dcx.err_count()
err == sess.dcx().err_count()
}
fn has_compile_error_macro(rhs: &mbe::TokenTree) -> bool {
@ -1014,7 +1014,7 @@ impl<'tt> TokenSet<'tt> {
// Requires that `first_sets` is pre-computed for `matcher`;
// see `FirstSets::new`.
fn check_matcher_core<'tt>(
sess: &ParseSess,
sess: &Session,
def: &ast::Item,
first_sets: &FirstSets<'tt>,
matcher: &'tt [mbe::TokenTree],
@ -1139,7 +1139,7 @@ fn check_matcher_core<'tt>(
name,
Some(NonterminalKind::PatParam { inferred: false }),
));
sess.buffer_lint_with_diagnostic(
sess.parse_sess.buffer_lint_with_diagnostic(
RUST_2021_INCOMPATIBLE_OR_PATTERNS,
span,
ast::CRATE_NODE_ID,
@ -1158,7 +1158,7 @@ fn check_matcher_core<'tt>(
};
let sp = next_token.span();
let mut err = sess.dcx.struct_span_err(
let mut err = sess.dcx().struct_span_err(
sp,
format!(
"`${name}:{frag}` {may_be} followed by `{next}`, which \
@ -1172,7 +1172,7 @@ fn check_matcher_core<'tt>(
err.span_label(sp, format!("not allowed after `{kind}` fragments"));
if kind == NonterminalKind::PatWithOr
&& sess.edition.at_least_rust_2021()
&& sess.parse_sess.edition.at_least_rust_2021()
&& next_token.is_token(&BinOp(token::BinOpToken::Or))
{
let suggestion = quoted_tt_to_string(&TokenTree::MetaVarDecl(

View File

@ -5,7 +5,8 @@ use rustc_ast::token::{self, Delimiter, Token};
use rustc_ast::{tokenstream, NodeId};
use rustc_ast_pretty::pprust;
use rustc_feature::Features;
use rustc_session::parse::{feature_err, ParseSess};
use rustc_session::parse::feature_err;
use rustc_session::Session;
use rustc_span::symbol::{kw, sym, Ident};
use rustc_span::edition::Edition;
@ -38,7 +39,7 @@ const VALID_FRAGMENT_NAMES_MSG: &str = "valid fragment specifiers are \
pub(super) fn parse(
input: &tokenstream::TokenStream,
parsing_patterns: bool,
sess: &ParseSess,
sess: &Session,
node_id: NodeId,
features: &Features,
edition: Edition,
@ -84,7 +85,7 @@ pub(super) fn parse(
"invalid fragment specifier `{}`",
frag.name
);
sess.dcx
sess.dcx()
.struct_span_err(span, msg)
.with_help(VALID_FRAGMENT_NAMES_MSG)
.emit();
@ -113,7 +114,7 @@ pub(super) fn parse(
}
/// Asks for the `macro_metavar_expr` feature if it is not already declared
fn maybe_emit_macro_metavar_expr_feature(features: &Features, sess: &ParseSess, span: Span) {
fn maybe_emit_macro_metavar_expr_feature(features: &Features, sess: &Session, span: Span) {
if !features.macro_metavar_expr {
let msg = "meta-variable expressions are unstable";
feature_err(sess, sym::macro_metavar_expr, span, msg).emit();
@ -138,7 +139,7 @@ fn parse_tree<'a>(
tree: &'a tokenstream::TokenTree,
outer_trees: &mut impl Iterator<Item = &'a tokenstream::TokenTree>,
parsing_patterns: bool,
sess: &ParseSess,
sess: &Session,
node_id: NodeId,
features: &Features,
edition: Edition,
@ -174,7 +175,8 @@ fn parse_tree<'a>(
// The delimiter is `{`. This indicates the beginning
// of a meta-variable expression (e.g. `${count(ident)}`).
// Try to parse the meta-variable expression.
match MetaVarExpr::parse(tts, delim_span.entire(), sess) {
match MetaVarExpr::parse(tts, delim_span.entire(), &sess.parse_sess)
{
Err(err) => {
err.emit();
// Returns early the same read `$` to avoid spanning
@ -195,7 +197,7 @@ fn parse_tree<'a>(
_ => {
let tok = pprust::token_kind_to_string(&token::OpenDelim(delim));
let msg = format!("expected `(` or `{{`, found `{tok}`");
sess.dcx.span_err(delim_span.entire(), msg);
sess.dcx().span_err(delim_span.entire(), msg);
}
}
}
@ -244,7 +246,7 @@ fn parse_tree<'a>(
Some(tokenstream::TokenTree::Token(token, _)) => {
let msg =
format!("expected identifier, found `{}`", pprust::token_to_string(token),);
sess.dcx.span_err(token.span, msg);
sess.dcx().span_err(token.span, msg);
TokenTree::MetaVar(token.span, Ident::empty())
}
@ -313,7 +315,7 @@ fn parse_kleene_op<'a>(
fn parse_sep_and_kleene_op<'a>(
input: &mut impl Iterator<Item = &'a tokenstream::TokenTree>,
span: Span,
sess: &ParseSess,
sess: &Session,
) -> (Option<Token>, KleeneToken) {
// We basically look at two token trees here, denoted as #1 and #2 below
let span = match parse_kleene_op(input, span) {
@ -325,7 +327,7 @@ fn parse_sep_and_kleene_op<'a>(
// #2 is the `?` Kleene op, which does not take a separator (error)
Ok(Ok((KleeneOp::ZeroOrOne, span))) => {
// Error!
sess.dcx.span_err(
sess.dcx().span_err(
token.span,
"the `?` macro repetition operator does not take a separator",
);
@ -346,7 +348,7 @@ fn parse_sep_and_kleene_op<'a>(
};
// If we ever get to this point, we have experienced an "unexpected token" error
sess.dcx.span_err(span, "expected one of: `*`, `+`, or `?`");
sess.dcx().span_err(span, "expected one of: `*`, `+`, or `?`");
// Return a dummy
(None, KleeneToken::new(KleeneOp::ZeroOrMore, span))
@ -355,9 +357,10 @@ fn parse_sep_and_kleene_op<'a>(
// `$$` or a meta-variable is the lhs of a macro but shouldn't.
//
// For example, `macro_rules! foo { ( ${length()} ) => {} }`
fn span_dollar_dollar_or_metavar_in_the_lhs_err(sess: &ParseSess, token: &Token) {
sess.dcx.span_err(token.span, format!("unexpected token: {}", pprust::token_to_string(token)));
sess.dcx.span_note(
fn span_dollar_dollar_or_metavar_in_the_lhs_err(sess: &Session, token: &Token) {
sess.dcx()
.span_err(token.span, format!("unexpected token: {}", pprust::token_to_string(token)));
sess.dcx().span_note(
token.span,
"`$$` and meta-variable expressions are not allowed inside macro parameter definitions",
);

View File

@ -119,7 +119,7 @@ impl MultiItemModifier for DeriveProcMacro {
// We need special handling for statement items
// (e.g. `fn foo() { #[derive(Debug)] struct Bar; }`)
let is_stmt = matches!(item, Annotatable::Stmt(..));
let hack = crate::base::ann_pretty_printing_compatibility_hack(&item, &ecx.sess.parse_sess);
let hack = crate::base::ann_pretty_printing_compatibility_hack(&item, &ecx.sess);
let input = if hack {
let nt = match item {
Annotatable::Item(item) => token::NtItem(item),

View File

@ -258,7 +258,7 @@ impl FromInternal<(TokenStream, &mut Rustc<'_, '_>)> for Vec<TokenTree<TokenStre
// represented as a delimited group.
// FIXME: It needs to be removed, but there are some
// compatibility issues (see #73345).
if crate::base::nt_pretty_printing_compatibility_hack(&nt.0, rustc.sess()) {
if crate::base::nt_pretty_printing_compatibility_hack(&nt.0, rustc.ecx.sess) {
trees.extend(Self::from_internal((stream, rustc)));
} else {
trees.push(TokenTree::Group(Group {

View File

@ -59,7 +59,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
if trait_segment.args().parenthesized == hir::GenericArgsParentheses::ParenSugar {
// For now, require that parenthetical notation be used only with `Fn()` etc.
feature_err(
&self.tcx().sess.parse_sess,
&self.tcx().sess,
sym::unboxed_closures,
span,
"parenthetical notation is only stable when used with `Fn`-family traits",
@ -75,7 +75,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
if trait_segment.args().parenthesized != hir::GenericArgsParentheses::ParenSugar {
// For now, require that parenthetical notation be used only with `Fn()` etc.
let mut err = feature_err(
&sess.parse_sess,
sess,
sym::unboxed_closures,
span,
"the precise format of `Fn`-family traits' type parameters is subject to change",

View File

@ -996,7 +996,7 @@ pub(super) fn check_transparent<'tcx>(tcx: TyCtxt<'tcx>, adt: ty::AdtDef<'tcx>)
if adt.is_union() && !tcx.features().transparent_unions {
feature_err(
&tcx.sess.parse_sess,
&tcx.sess,
sym::transparent_unions,
tcx.def_span(adt.did()),
"transparent unions are unstable",
@ -1128,7 +1128,7 @@ fn check_enum(tcx: TyCtxt<'_>, def_id: LocalDefId) {
if repr_type_ty == tcx.types.i128 || repr_type_ty == tcx.types.u128 {
if !tcx.features().repr128 {
feature_err(
&tcx.sess.parse_sess,
&tcx.sess,
sym::repr128,
tcx.def_span(def_id),
"repr with 128-bit type is unstable",

View File

@ -293,7 +293,7 @@ fn default_body_is_unstable(
rustc_session::parse::add_feature_diagnostics_for_issue(
&mut err,
&tcx.sess.parse_sess,
&tcx.sess,
feature,
rustc_feature::GateIssue::Library(issue),
false,

View File

@ -1591,7 +1591,7 @@ fn check_method_receiver<'tcx>(
return Err(if receiver_is_valid(wfcx, span, receiver_ty, self_ty, true) {
// Report error; would have worked with `arbitrary_self_types`.
feature_err(
&tcx.sess.parse_sess,
&tcx.sess,
sym::arbitrary_self_types,
span,
format!(

View File

@ -1189,12 +1189,13 @@ impl<'a, 'tcx> BoundVarContext<'a, 'tcx> {
&& !self.tcx.asyncness(lifetime_ref.hir_id.owner.def_id).is_async()
&& !self.tcx.features().anonymous_lifetime_in_impl_trait
{
let mut diag = rustc_session::parse::feature_err(
&self.tcx.sess.parse_sess,
sym::anonymous_lifetime_in_impl_trait,
lifetime_ref.ident.span,
"anonymous lifetimes in `impl Trait` are unstable",
);
let mut diag: rustc_errors::DiagnosticBuilder<'_> =
rustc_session::parse::feature_err(
&self.tcx.sess,
sym::anonymous_lifetime_in_impl_trait,
lifetime_ref.ident.span,
"anonymous lifetimes in `impl Trait` are unstable",
);
if let Some(generics) =
self.tcx.hir().get_generics(lifetime_ref.hir_id.owner.def_id)

View File

@ -639,7 +639,7 @@ fn check_feature_inherent_assoc_ty(tcx: TyCtxt<'_>, span: Span) {
use rustc_session::parse::feature_err;
use rustc_span::symbol::sym;
feature_err(
&tcx.sess.parse_sess,
&tcx.sess,
sym::inherent_associated_types,
span,
"inherent associated types are unstable",

View File

@ -134,13 +134,8 @@ fn require_c_abi_if_c_variadic(tcx: TyCtxt<'_>, decl: &hir::FnDecl<'_>, abi: Abi
// Using this ABI would be ok, if the feature for additional ABI support was enabled.
// Return CONVENTIONS_STABLE, because we want the other error to look the same.
(false, true) => {
feature_err(
&tcx.sess.parse_sess,
sym::extended_varargs_abi_support,
span,
UNSTABLE_EXPLAIN,
)
.emit();
feature_err(&tcx.sess, sym::extended_varargs_abi_support, span, UNSTABLE_EXPLAIN)
.emit();
CONVENTIONS_STABLE
}

View File

@ -704,7 +704,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
if has_unsized_tuple_coercion && !self.tcx.features().unsized_tuple_coercion {
feature_err(
&self.tcx.sess.parse_sess,
&self.tcx.sess,
sym::unsized_tuple_coercion,
self.cause.span,
"unsized tuple coercion is not stable enough for use and is subject to change",

View File

@ -1865,7 +1865,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
(ty::Adt(adt, _), ty::Adt(base_adt, _)) if adt == base_adt);
if self.tcx.sess.is_nightly_build() && same_adt {
feature_err(
&self.tcx.sess.parse_sess,
&self.tcx.sess,
sym::type_changing_struct_update,
base_expr.span,
"type changing struct updating is experimental",
@ -3262,7 +3262,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
if !self.tcx.features().offset_of_enum {
rustc_session::parse::feature_err(
&self.tcx.sess.parse_sess,
&self.tcx.sess,
sym::offset_of_enum,
ident.span,
"using enums in offset_of is experimental",

View File

@ -1306,10 +1306,7 @@ impl<'tcx> LateLintPass<'tcx> for UngatedAsyncFnTrackCaller {
cx.emit_spanned_lint(
UNGATED_ASYNC_FN_TRACK_CALLER,
attr.span,
BuiltinUngatedAsyncFnTrackCaller {
label: span,
parse_sess: &cx.tcx.sess.parse_sess,
},
BuiltinUngatedAsyncFnTrackCaller { label: span, session: &cx.tcx.sess },
);
}
}

View File

@ -786,7 +786,7 @@ impl<'s, P: LintLevelsProvider> LintLevelsBuilder<'s, P> {
if let ast::LitKind::Str(rationale, _) = name_value.kind {
if !self.features.lint_reasons {
feature_err(
&self.sess.parse_sess,
&self.sess,
sym::lint_reasons,
item.span,
"lint reasons are experimental",
@ -1074,7 +1074,7 @@ impl<'s, P: LintLevelsProvider> LintLevelsBuilder<'s, P> {
lint.note(fluent::lint_note);
rustc_session::parse::add_feature_diagnostics_for_issue(
lint,
&self.sess.parse_sess,
&self.sess,
feature,
GateIssue::Language,
lint_from_cli,

View File

@ -13,7 +13,7 @@ use rustc_macros::{LintDiagnostic, Subdiagnostic};
use rustc_middle::ty::{
inhabitedness::InhabitedPredicate, Clause, PolyExistentialTraitRef, Ty, TyCtxt,
};
use rustc_session::parse::ParseSess;
use rustc_session::Session;
use rustc_span::{edition::Edition, sym, symbol::Ident, Span, Symbol};
use crate::{
@ -235,7 +235,7 @@ pub struct BuiltinUnstableFeatures;
// lint_ungated_async_fn_track_caller
pub struct BuiltinUngatedAsyncFnTrackCaller<'a> {
pub label: Span,
pub parse_sess: &'a ParseSess,
pub session: &'a Session,
}
impl<'a> DecorateLint<'a, ()> for BuiltinUngatedAsyncFnTrackCaller<'_> {
@ -243,7 +243,7 @@ impl<'a> DecorateLint<'a, ()> for BuiltinUngatedAsyncFnTrackCaller<'_> {
diag.span_label(self.label, fluent::lint_label);
rustc_session::parse::add_feature_diagnostics(
diag,
self.parse_sess,
self.session,
sym::async_fn_track_caller,
);
}

View File

@ -82,7 +82,7 @@ pub(crate) fn collect(tcx: TyCtxt<'_>, LocalCrate: LocalCrate) -> Vec<NativeLib>
pub(crate) fn relevant_lib(sess: &Session, lib: &NativeLib) -> bool {
match lib.cfg {
Some(ref cfg) => attr::cfg_matches(cfg, &sess.parse_sess, CRATE_NODE_ID, None),
Some(ref cfg) => attr::cfg_matches(cfg, sess, CRATE_NODE_ID, None),
None => true,
}
}
@ -163,7 +163,7 @@ impl<'tcx> Collector<'tcx> {
"link-arg" => {
if !features.link_arg_attribute {
feature_err(
&sess.parse_sess,
sess,
sym::link_arg_attribute,
span,
"link kind `link-arg` is unstable",
@ -206,13 +206,8 @@ impl<'tcx> Collector<'tcx> {
continue;
};
if !features.link_cfg {
feature_err(
&sess.parse_sess,
sym::link_cfg,
item.span(),
"link cfg is unstable",
)
.emit();
feature_err(sess, sym::link_cfg, item.span(), "link cfg is unstable")
.emit();
}
cfg = Some(link_cfg.clone());
}
@ -277,7 +272,7 @@ impl<'tcx> Collector<'tcx> {
macro report_unstable_modifier($feature: ident) {
if !features.$feature {
feature_err(
&sess.parse_sess,
sess,
sym::$feature,
span,
format!("linking modifier `{modifier}` is unstable"),

View File

@ -116,8 +116,7 @@ pub fn report_unstable(
if is_soft {
soft_handler(SOFT_UNSTABLE, span, msg)
} else {
let mut err =
feature_err_issue(&sess.parse_sess, feature, span, GateIssue::Library(issue), msg);
let mut err = feature_err_issue(sess, feature, span, GateIssue::Library(issue), msg);
if let Some((inner_types, msg, sugg, applicability)) = suggestion {
err.span_suggestion(inner_types, msg, sugg, applicability);
}

View File

@ -1170,7 +1170,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
sym::rust_logo => {
if !self.tcx.features().rustdoc_internals {
feature_err(
&self.tcx.sess.parse_sess,
&self.tcx.sess,
sym::rustdoc_internals,
meta.span(),
"the `#[doc(rust_logo)]` attribute is used for Rust branding",
@ -1815,7 +1815,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
(target, self.tcx.features().fn_align)
{
feature_err(
&self.tcx.sess.parse_sess,
&self.tcx.sess,
sym::fn_align,
hint.span(),
"`repr(align)` attributes on functions are unstable",

View File

@ -147,7 +147,7 @@ impl<'tcx> CheckConstVisitor<'tcx> {
[missing_primary, ref missing_secondary @ ..] => {
let msg =
format!("{} is not allowed in a `{}`", expr.name(), const_kind.keyword_name());
let mut err = feature_err(&tcx.sess.parse_sess, *missing_primary, span, msg);
let mut err = feature_err(&tcx.sess, *missing_primary, span, msg);
// If multiple feature gates would be required to enable this expression, include
// them as help messages. Don't emit a separate error for each missing feature gate.

View File

@ -45,14 +45,13 @@ impl DebuggerVisualizerCollector<'_> {
}
};
let file =
match resolve_path(&self.sess.parse_sess, visualizer_path.as_str(), attr.span) {
Ok(file) => file,
Err(err) => {
err.emit();
return;
}
};
let file = match resolve_path(&self.sess, visualizer_path.as_str(), attr.span) {
Ok(file) => file,
Err(err) => {
err.emit();
return;
}
};
match std::fs::read(&file) {
Ok(contents) => {

View File

@ -135,7 +135,7 @@ fn configure_main(tcx: TyCtxt<'_>, visitor: &EntryContext<'_>) -> Option<(DefId,
if main_def.is_import && !tcx.features().imported_main {
let span = main_def.span;
feature_err(
&tcx.sess.parse_sess,
&tcx.sess,
sym::imported_main,
span,
"using an imported function as entry point `main` is experimental",

View File

@ -594,13 +594,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
if soft_custom_inner_attributes_gate {
self.tcx.sess.parse_sess.buffer_lint(SOFT_UNSTABLE, path.span, node_id, msg);
} else {
feature_err(
&self.tcx.sess.parse_sess,
sym::custom_inner_attributes,
path.span,
msg,
)
.emit();
feature_err(&self.tcx.sess, sym::custom_inner_attributes, path.span, msg).emit();
}
}

View File

@ -24,6 +24,9 @@ session_feature_diagnostic_for_issue =
session_feature_diagnostic_help =
add `#![feature({$feature})]` to the crate attributes to enable
session_feature_suggest_upgrade_compiler =
this compiler was built on {$date}; consider upgrading it if it is out of date
session_file_is_not_writeable = output file {$file} is not writeable -- check its permissions
session_file_write_fail = failed to write `{$path}` due to error `{$err}`

View File

@ -1,6 +1,5 @@
use std::num::NonZeroU32;
use crate::parse::ParseSess;
use rustc_ast::token;
use rustc_ast::util::literal::LitError;
use rustc_errors::{
@ -10,6 +9,8 @@ use rustc_macros::Diagnostic;
use rustc_span::{BytePos, Span, Symbol};
use rustc_target::spec::{SplitDebuginfo, StackProtector, TargetTriple};
use crate::parse::ParseSess;
pub struct FeatureGateError {
pub span: MultiSpan,
pub explain: DiagnosticMessage,
@ -30,6 +31,24 @@ pub struct FeatureDiagnosticForIssue {
pub n: NonZeroU32,
}
#[derive(Subdiagnostic)]
#[note(session_feature_suggest_upgrade_compiler)]
pub struct SuggestUpgradeCompiler {
date: &'static str,
}
impl SuggestUpgradeCompiler {
pub fn ui_testing() -> Self {
Self { date: "YYYY-MM-DD" }
}
pub fn new() -> Option<Self> {
let date = option_env!("CFG_VER_DATE")?;
Some(Self { date })
}
}
#[derive(Subdiagnostic)]
#[help(session_feature_diagnostic_help)]
pub struct FeatureDiagnosticHelp {

View File

@ -4,10 +4,12 @@
use crate::config::{Cfg, CheckCfg};
use crate::errors::{
CliFeatureDiagnosticHelp, FeatureDiagnosticForIssue, FeatureDiagnosticHelp, FeatureGateError,
SuggestUpgradeCompiler,
};
use crate::lint::{
builtin::UNSTABLE_SYNTAX_PRE_EXPANSION, BufferedEarlyLint, BuiltinLintDiagnostics, Lint, LintId,
};
use crate::Session;
use rustc_ast::node_id::NodeId;
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
use rustc_data_structures::sync::{AppendOnlyVec, Lock, Lrc};
@ -75,11 +77,12 @@ impl SymbolGallery {
}
}
// todo: this function now accepts `Session` instead of `ParseSess` and should be relocated
/// Construct a diagnostic for a language feature error due to the given `span`.
/// The `feature`'s `Symbol` is the one you used in `unstable.rs` and `rustc_span::symbols`.
#[track_caller]
pub fn feature_err(
sess: &ParseSess,
sess: &Session,
feature: Symbol,
span: impl Into<MultiSpan>,
explain: impl Into<DiagnosticMessage>,
@ -93,7 +96,7 @@ pub fn feature_err(
/// Almost always, you want to use this for a language feature. If so, prefer `feature_err`.
#[track_caller]
pub fn feature_err_issue(
sess: &ParseSess,
sess: &Session,
feature: Symbol,
span: impl Into<MultiSpan>,
issue: GateIssue,
@ -103,12 +106,14 @@ pub fn feature_err_issue(
// Cancel an earlier warning for this same error, if it exists.
if let Some(span) = span.primary_span() {
if let Some(err) = sess.dcx.steal_diagnostic(span, StashKey::EarlySyntaxWarning) {
if let Some(err) = sess.parse_sess.dcx.steal_diagnostic(span, StashKey::EarlySyntaxWarning)
{
err.cancel()
}
}
let mut err = sess.dcx.create_err(FeatureGateError { span, explain: explain.into() });
let mut err =
sess.parse_sess.dcx.create_err(FeatureGateError { span, explain: explain.into() });
add_feature_diagnostics_for_issue(&mut err, sess, feature, issue, false);
err
}
@ -117,7 +122,7 @@ pub fn feature_err_issue(
///
/// This diagnostic is only a warning and *does not cause compilation to fail*.
#[track_caller]
pub fn feature_warn(sess: &ParseSess, feature: Symbol, span: Span, explain: &'static str) {
pub fn feature_warn(sess: &Session, feature: Symbol, span: Span, explain: &'static str) {
feature_warn_issue(sess, feature, span, GateIssue::Language, explain);
}
@ -131,13 +136,13 @@ pub fn feature_warn(sess: &ParseSess, feature: Symbol, span: Span, explain: &'st
#[allow(rustc::untranslatable_diagnostic)]
#[track_caller]
pub fn feature_warn_issue(
sess: &ParseSess,
sess: &Session,
feature: Symbol,
span: Span,
issue: GateIssue,
explain: &'static str,
) {
let mut err = sess.dcx.struct_span_warn(span, explain);
let mut err = sess.parse_sess.dcx.struct_span_warn(span, explain);
add_feature_diagnostics_for_issue(&mut err, sess, feature, issue, false);
// Decorate this as a future-incompatibility lint as in rustc_middle::lint::struct_lint_level
@ -152,7 +157,7 @@ pub fn feature_warn_issue(
}
/// Adds the diagnostics for a feature to an existing error.
pub fn add_feature_diagnostics(err: &mut Diagnostic, sess: &ParseSess, feature: Symbol) {
pub fn add_feature_diagnostics(err: &mut Diagnostic, sess: &Session, feature: Symbol) {
add_feature_diagnostics_for_issue(err, sess, feature, GateIssue::Language, false);
}
@ -163,7 +168,7 @@ pub fn add_feature_diagnostics(err: &mut Diagnostic, sess: &ParseSess, feature:
/// `add_feature_diagnostics`.
pub fn add_feature_diagnostics_for_issue(
err: &mut Diagnostic,
sess: &ParseSess,
sess: &Session,
feature: Symbol,
issue: GateIssue,
feature_from_cli: bool,
@ -173,12 +178,18 @@ pub fn add_feature_diagnostics_for_issue(
}
// #23973: do not suggest `#![feature(...)]` if we are in beta/stable
if sess.unstable_features.is_nightly_build() {
if sess.parse_sess.unstable_features.is_nightly_build() {
if feature_from_cli {
err.subdiagnostic(CliFeatureDiagnosticHelp { feature });
} else {
err.subdiagnostic(FeatureDiagnosticHelp { feature });
}
if sess.opts.unstable_opts.ui_testing {
err.subdiagnostic(SuggestUpgradeCompiler::ui_testing());
} else if let Some(suggestion) = SuggestUpgradeCompiler::new() {
err.subdiagnostic(suggestion);
}
}
}

View File

@ -318,7 +318,7 @@ impl Session {
if err.code.is_none() {
err.code(error_code!(E0658));
}
add_feature_diagnostics(&mut err, &self.parse_sess, feature);
add_feature_diagnostics(&mut err, self, feature);
err
}

View File

@ -408,7 +408,7 @@ impl<'tcx> OnUnimplementedDirective {
.ok_or_else(|| tcx.dcx().emit_err(EmptyOnClauseInOnUnimplemented { span }))?
.meta_item()
.ok_or_else(|| tcx.dcx().emit_err(InvalidOnClauseInOnUnimplemented { span }))?;
attr::eval_condition(cond, &tcx.sess.parse_sess, Some(tcx.features()), &mut |cfg| {
attr::eval_condition(cond, &tcx.sess, Some(tcx.features()), &mut |cfg| {
if let Some(value) = cfg.value
&& let Err(guar) = parse_value(value, cfg.span)
{
@ -682,31 +682,22 @@ impl<'tcx> OnUnimplementedDirective {
for command in self.subcommands.iter().chain(Some(self)).rev() {
if let Some(ref condition) = command.condition
&& !attr::eval_condition(
condition,
&tcx.sess.parse_sess,
Some(tcx.features()),
&mut |cfg| {
let value = cfg.value.map(|v| {
// `with_no_visible_paths` is also used when generating the options,
// so we need to match it here.
ty::print::with_no_visible_paths!(
OnUnimplementedFormatString {
symbol: v,
span: cfg.span,
is_diagnostic_namespace_variant: false
}
.format(
tcx,
trait_ref,
&options_map
)
)
});
&& !attr::eval_condition(condition, &tcx.sess, Some(tcx.features()), &mut |cfg| {
let value = cfg.value.map(|v| {
// `with_no_visible_paths` is also used when generating the options,
// so we need to match it here.
ty::print::with_no_visible_paths!(
OnUnimplementedFormatString {
symbol: v,
span: cfg.span,
is_diagnostic_namespace_variant: false
}
.format(tcx, trait_ref, &options_map)
)
});
options.contains(&(cfg.name, value))
},
)
options.contains(&(cfg.name, value))
})
{
debug!("evaluate: skipping {:?} due to condition", command);
continue;

View File

@ -65,9 +65,10 @@ pub(crate) fn look_for_custom_classes<'tcx>(cx: &DocContext<'tcx>, item: &Item)
if !tests.custom_classes_found.is_empty() {
let span = item.attr_span(cx.tcx);
let sess = &cx.tcx.sess.parse_sess;
let mut err =
sess.dcx.struct_span_warn(span, "custom classes in code blocks will change behaviour");
let sess = &cx.tcx.sess;
let mut err = sess
.dcx()
.struct_span_warn(span, "custom classes in code blocks will change behaviour");
add_feature_diagnostics_for_issue(
&mut err,
sess,

View File

@ -1223,7 +1223,7 @@ impl LinkCollector<'_, '_> {
)
.unwrap_or_else(|| item.attr_span(self.cx.tcx));
rustc_session::parse::feature_err(
&self.cx.tcx.sess.parse_sess,
&self.cx.tcx.sess,
sym::intra_doc_pointers,
span,
"linking to associated items of raw pointers is experimental",

View File

@ -6,6 +6,7 @@
//~^^^ WARNING custom classes in code blocks will change behaviour
//~| NOTE found these custom classes: class=language-c
//~| NOTE see issue #79483 <https://github.com/rust-lang/rust/issues/79483>
//~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
//~| HELP add `#![feature(custom_code_classes_in_docs)]` to the crate attributes to enable
pub struct Bar;

View File

@ -8,6 +8,7 @@ LL | | /// ```
|
= note: see issue #79483 <https://github.com/rust-lang/rust/issues/79483> for more information
= help: add `#![feature(custom_code_classes_in_docs)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
= note: found these custom classes: class=language-c
warning: 1 warning emitted

View File

@ -6,6 +6,7 @@ LL | #![doc(cfg_hide(test))]
|
= note: see issue #43781 <https://github.com/rust-lang/rust/issues/43781> for more information
= help: add `#![feature(doc_cfg_hide)]` 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: aborting due to 1 previous error

View File

@ -6,6 +6,7 @@ LL | //! [pointer::add]
|
= note: see issue #80896 <https://github.com/rust-lang/rust/issues/80896> for more information
= help: add `#![feature(intra_doc_pointers)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
= note: rustdoc does not allow disambiguating between `*const` and `*mut`, and pointers are unstable until it does
error[E0658]: linking to associated items of raw pointers is experimental
@ -16,6 +17,7 @@ LL | //! [pointer::wrapping_add]
|
= note: see issue #80896 <https://github.com/rust-lang/rust/issues/80896> for more information
= help: add `#![feature(intra_doc_pointers)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
= note: rustdoc does not allow disambiguating between `*const` and `*mut`, and pointers are unstable until it does
error: aborting due to 2 previous errors

View File

@ -5,3 +5,4 @@
//~^ ERROR unknown lint
//~| NOTE lint is unstable
//~| NOTE see issue
//~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

View File

@ -7,6 +7,7 @@ LL | #![allow(rustdoc::missing_doc_code_examples)]
= note: the `rustdoc::missing_doc_code_examples` lint is unstable
= note: see issue #101730 <https://github.com/rust-lang/rust/issues/101730> for more information
= help: add `#![feature(rustdoc_missing_doc_code_examples)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
note: the lint level is defined here
--> $DIR/feature-gate-rustdoc_missing_doc_code_examples.rs:2:9
|

View File

@ -1,16 +1,31 @@
// ignore-stage1
// compile-flags: -Zdeduplicate-diagnostics=yes
extern crate rustc_data_structures;
//~^ use of unstable library feature 'rustc_private'
//~| NOTE: issue #27812 <https://github.com/rust-lang/rust/issues/27812> for more information
//~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
extern crate rustc_macros;
//~^ use of unstable library feature 'rustc_private'
//~| NOTE: see issue #27812 <https://github.com/rust-lang/rust/issues/27812> for more information
//~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
extern crate rustc_query_system;
//~^ use of unstable library feature 'rustc_private'
//~| NOTE: see issue #27812 <https://github.com/rust-lang/rust/issues/27812> for more information
//~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
use rustc_macros::HashStable;
//~^ use of unstable library feature 'rustc_private'
//~| NOTE: see issue #27812 <https://github.com/rust-lang/rust/issues/27812> for more information
//~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
#[derive(HashStable)]
//~^ use of unstable library feature 'rustc_private'
//~| NOTE: in this expansion of #[derive(HashStable)]
//~| NOTE: in this expansion of #[derive(HashStable)]
//~| NOTE: in this expansion of #[derive(HashStable)]
//~| NOTE: in this expansion of #[derive(HashStable)]
//~| NOTE: see issue #27812 <https://github.com/rust-lang/rust/issues/27812> for more information
//~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
struct Test;
fn main() {}

View File

@ -1,47 +1,52 @@
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead?
--> $DIR/hash-stable-is-unstable.rs:2:1
--> $DIR/hash-stable-is-unstable.rs:3:1
|
LL | extern crate rustc_data_structures;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #27812 <https://github.com/rust-lang/rust/issues/27812> for more information
= help: add `#![feature(rustc_private)]` 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[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead?
--> $DIR/hash-stable-is-unstable.rs:4:1
--> $DIR/hash-stable-is-unstable.rs:7:1
|
LL | extern crate rustc_macros;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #27812 <https://github.com/rust-lang/rust/issues/27812> for more information
= help: add `#![feature(rustc_private)]` 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[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead?
--> $DIR/hash-stable-is-unstable.rs:6:1
--> $DIR/hash-stable-is-unstable.rs:11:1
|
LL | extern crate rustc_query_system;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #27812 <https://github.com/rust-lang/rust/issues/27812> for more information
= help: add `#![feature(rustc_private)]` 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[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead?
--> $DIR/hash-stable-is-unstable.rs:9:5
--> $DIR/hash-stable-is-unstable.rs:16:5
|
LL | use rustc_macros::HashStable;
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #27812 <https://github.com/rust-lang/rust/issues/27812> for more information
= help: add `#![feature(rustc_private)]` 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[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead?
--> $DIR/hash-stable-is-unstable.rs:12:10
--> $DIR/hash-stable-is-unstable.rs:21:10
|
LL | #[derive(HashStable)]
| ^^^^^^^^^^
|
= note: see issue #27812 <https://github.com/rust-lang/rust/issues/27812> for more information
= help: add `#![feature(rustc_private)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
= note: this error originates in the derive macro `HashStable` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 5 previous errors

View File

@ -1,4 +1,5 @@
// edition:2018
// ignore-stage1
// compile-flags:--extern rustc_middle
// Test that `--extern rustc_middle` fails with `rustc_private`.

View File

@ -1,11 +1,12 @@
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead?
--> $DIR/pathless-extern-unstable.rs:6:9
--> $DIR/pathless-extern-unstable.rs:7:9
|
LL | pub use rustc_middle;
| ^^^^^^^^^^^^
|
= note: see issue #27812 <https://github.com/rust-lang/rust/issues/27812> for more information
= help: add `#![feature(rustc_private)]` 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: aborting due to 1 previous error

View File

@ -48,6 +48,7 @@ LL | const Foo: [i32; _] = [1, 2, 3];
|
= note: see issue #85077 <https://github.com/rust-lang/rust/issues/85077> for more information
= help: add `#![feature(generic_arg_infer)]` 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[E0658]: using `_` for array lengths is unstable
--> $DIR/suggest-array-length.rs:8:26
@ -57,6 +58,7 @@ LL | const REF_FOO: &[u8; _] = &[1];
|
= note: see issue #85077 <https://github.com/rust-lang/rust/issues/85077> for more information
= help: add `#![feature(generic_arg_infer)]` 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[E0658]: using `_` for array lengths is unstable
--> $DIR/suggest-array-length.rs:11:20
@ -66,6 +68,7 @@ LL | let foo: [i32; _] = [1, 2, 3];
|
= note: see issue #85077 <https://github.com/rust-lang/rust/issues/85077> for more information
= help: add `#![feature(generic_arg_infer)]` 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[E0658]: using `_` for array lengths is unstable
--> $DIR/suggest-array-length.rs:14:20
@ -75,6 +78,7 @@ LL | let bar: [i32; _] = [0; 3];
|
= note: see issue #85077 <https://github.com/rust-lang/rust/issues/85077> for more information
= help: add `#![feature(generic_arg_infer)]` 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[E0658]: using `_` for array lengths is unstable
--> $DIR/suggest-array-length.rs:17:25
@ -84,6 +88,7 @@ LL | let ref_foo: &[i32; _] = &[1, 2, 3];
|
= note: see issue #85077 <https://github.com/rust-lang/rust/issues/85077> for more information
= help: add `#![feature(generic_arg_infer)]` 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[E0658]: using `_` for array lengths is unstable
--> $DIR/suggest-array-length.rs:20:25
@ -93,6 +98,7 @@ LL | let ref_bar: &[i32; _] = &[0; 3];
|
= note: see issue #85077 <https://github.com/rust-lang/rust/issues/85077> for more information
= help: add `#![feature(generic_arg_infer)]` 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[E0658]: using `_` for array lengths is unstable
--> $DIR/suggest-array-length.rs:23:35
@ -102,6 +108,7 @@ LL | let multiple_ref_foo: &&[i32; _] = &&[1, 2, 3];
|
= note: see issue #85077 <https://github.com/rust-lang/rust/issues/85077> for more information
= help: add `#![feature(generic_arg_infer)]` 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: aborting due to 14 previous errors

View File

@ -23,6 +23,7 @@ LL | fn foo<A: TraitWAssocConst<A=32>>() {
|
= note: see issue #92827 <https://github.com/rust-lang/rust/issues/92827> for more information
= help: add `#![feature(associated_const_equality)]` 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[E0658]: associated const equality is incomplete
--> $DIR/issue-105330.rs:15:29
@ -32,6 +33,7 @@ LL | fn main<A: TraitWAssocConst<A=32>>() {
|
= note: see issue #92827 <https://github.com/rust-lang/rust/issues/92827> for more information
= help: add `#![feature(associated_const_equality)]` 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[E0562]: `impl Trait` is not allowed in impl headers
--> $DIR/issue-105330.rs:6:27

View File

@ -24,6 +24,7 @@ LL | type_ascribe!(p, a<p:p<e=6>>);
|
= note: see issue #92827 <https://github.com/rust-lang/rust/issues/92827> for more information
= help: add `#![feature(associated_const_equality)]` 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[E0658]: associated type bounds are unstable
--> $DIR/issue-93835.rs:4:24
@ -33,6 +34,7 @@ LL | type_ascribe!(p, a<p:p<e=6>>);
|
= note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information
= help: add `#![feature(associated_type_bounds)]` 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: aborting due to 5 previous errors

View File

@ -5,6 +5,7 @@ LL | type Data = aux::Owner::Data;
| ^^^^^^^^^^^^^^^^
|
= help: add `#![feature(data)]` 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: aborting due to 1 previous error

View File

@ -17,6 +17,7 @@ LL | impl S { type P = (); }
|
= note: see issue #8995 <https://github.com/rust-lang/rust/issues/8995> for more information
= help: add `#![feature(inherent_associated_types)]` 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: aborting due to 2 previous errors

View File

@ -28,6 +28,7 @@ LL | type Item = &[T];
|
= note: see issue #8995 <https://github.com/rust-lang/rust/issues/8995> for more information
= help: add `#![feature(inherent_associated_types)]` 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[E0223]: ambiguous associated type
--> $DIR/issue-109071.rs:15:22

View File

@ -28,6 +28,7 @@ LL | type AssocType3 = T;
|
= note: see issue #8995 <https://github.com/rust-lang/rust/issues/8995> for more information
= help: add `#![feature(inherent_associated_types)]` 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[E0061]: this struct takes 1 argument but 0 arguments were supplied
--> $DIR/issue-109768.rs:10:56

View File

@ -6,6 +6,7 @@ LL | fn get_iter(vec: &[i32]) -> impl Iterator<Item = {}> + '_ {
|
= note: see issue #92827 <https://github.com/rust-lang/rust/issues/92827> for more information
= help: add `#![feature(associated_const_equality)]` 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: expected type, found constant
--> $DIR/issue-99828.rs:1:50

View File

@ -12,6 +12,7 @@ LL | fn foo<T: Trait<method(i32): Send>>() {}
|
= note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information
= help: add `#![feature(associated_type_bounds)]` 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[E0658]: associated type bounds are unstable
--> $DIR/bad-inputs-and-output.rs:14:17
@ -21,6 +22,7 @@ LL | fn bar<T: Trait<method() -> (): Send>>() {}
|
= note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/bad-inputs-and-output.rs:3:12

View File

@ -6,6 +6,7 @@ LL | fn foo<T: Trait<method(i32): Send>>() {}
|
= note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information
= help: add `#![feature(associated_type_bounds)]` 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: aborting due to 1 previous error

View File

@ -6,6 +6,7 @@ LL | let _ = async || {};
|
= note: see issue #62290 <https://github.com/rust-lang/rust/issues/62290> for more information
= help: add `#![feature(async_closure)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
= help: to use an async block, remove the `||`: `async {`
error: aborting due to 1 previous error

View File

@ -6,6 +6,7 @@ LL | for await _i in core::async_iter::from_iter(0..3) {
|
= note: see issue #118898 <https://github.com/rust-lang/rust/issues/118898> for more information
= help: add `#![feature(async_for_loop)]` 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[E0658]: `for await` loops are experimental
--> $DIR/feature-async-for-loop.rs:17:13
@ -15,6 +16,7 @@ LL | for await _i in core::async_iter::from_iter(0..3) {
|
= note: see issue #118898 <https://github.com/rust-lang/rust/issues/118898> for more information
= help: add `#![feature(async_for_loop)]` 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: aborting due to 2 previous errors

View File

@ -12,6 +12,7 @@ LL | async fn new() -> [u8; _];
|
= note: see issue #85077 <https://github.com/rust-lang/rust/issues/85077> for more information
= help: add `#![feature(generic_arg_infer)]` 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: aborting due to 2 previous errors

View File

@ -6,6 +6,7 @@ LL | let _ = #[track_caller] async {
|
= note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
= help: add `#![feature(closure_track_caller)]` 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[E0658]: `#[track_caller]` on closures is currently unstable
--> $DIR/async-block.rs:15:13
@ -15,6 +16,7 @@ LL | let _ = #[track_caller] async {
|
= note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
= help: add `#![feature(closure_track_caller)]` 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[E0658]: `#[track_caller]` on closures is currently unstable
--> $DIR/async-block.rs:23:17
@ -24,6 +26,7 @@ LL | let _ = #[track_caller] async {
|
= note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
= help: add `#![feature(closure_track_caller)]` 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: aborting due to 3 previous errors

View File

@ -6,6 +6,7 @@ LL | let _ = #[track_caller] async {
|
= note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
= help: add `#![feature(closure_track_caller)]` 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[E0658]: `#[track_caller]` on closures is currently unstable
--> $DIR/async-block.rs:15:13
@ -15,6 +16,7 @@ LL | let _ = #[track_caller] async {
|
= note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
= help: add `#![feature(closure_track_caller)]` 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[E0658]: `#[track_caller]` on closures is currently unstable
--> $DIR/async-block.rs:23:17
@ -24,6 +26,7 @@ LL | let _ = #[track_caller] async {
|
= note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
= help: add `#![feature(closure_track_caller)]` 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: aborting due to 3 previous errors

View File

@ -6,6 +6,7 @@ LL | let _ = #[track_caller] async || {
|
= note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
= help: add `#![feature(closure_track_caller)]` 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[E0658]: `#[track_caller]` on closures is currently unstable
--> $DIR/async-closure-gate.rs:15:13
@ -15,6 +16,7 @@ LL | let _ = #[track_caller] async || {
|
= note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
= help: add `#![feature(closure_track_caller)]` 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[E0658]: `#[track_caller]` on closures is currently unstable
--> $DIR/async-closure-gate.rs:21:13
@ -24,6 +26,7 @@ LL | let _ = #[track_caller] || {
|
= note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
= help: add `#![feature(closure_track_caller)]` 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[E0658]: `#[track_caller]` on closures is currently unstable
--> $DIR/async-closure-gate.rs:29:17
@ -33,6 +36,7 @@ LL | let _ = #[track_caller] || {
|
= note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
= help: add `#![feature(closure_track_caller)]` 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[E0658]: `#[track_caller]` on closures is currently unstable
--> $DIR/async-closure-gate.rs:37:9
@ -42,6 +46,7 @@ LL | #[track_caller] || {
|
= note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
= help: add `#![feature(closure_track_caller)]` 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[E0658]: `#[track_caller]` on closures is currently unstable
--> $DIR/async-closure-gate.rs:47:13
@ -51,6 +56,7 @@ LL | #[track_caller] || {
|
= note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
= help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0308]: mismatched types
--> $DIR/async-closure-gate.rs:27:5

View File

@ -6,6 +6,7 @@ LL | let _ = #[track_caller] async || {
|
= note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
= help: add `#![feature(closure_track_caller)]` 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[E0658]: `#[track_caller]` on closures is currently unstable
--> $DIR/async-closure-gate.rs:15:13
@ -15,6 +16,7 @@ LL | let _ = #[track_caller] async || {
|
= note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
= help: add `#![feature(closure_track_caller)]` 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[E0658]: `#[track_caller]` on closures is currently unstable
--> $DIR/async-closure-gate.rs:21:13
@ -24,6 +26,7 @@ LL | let _ = #[track_caller] || {
|
= note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
= help: add `#![feature(closure_track_caller)]` 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[E0658]: `#[track_caller]` on closures is currently unstable
--> $DIR/async-closure-gate.rs:29:17
@ -33,6 +36,7 @@ LL | let _ = #[track_caller] || {
|
= note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
= help: add `#![feature(closure_track_caller)]` 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[E0658]: `#[track_caller]` on closures is currently unstable
--> $DIR/async-closure-gate.rs:37:9
@ -42,6 +46,7 @@ LL | #[track_caller] || {
|
= note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
= help: add `#![feature(closure_track_caller)]` 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[E0658]: `#[track_caller]` on closures is currently unstable
--> $DIR/async-closure-gate.rs:47:13
@ -51,6 +56,7 @@ LL | #[track_caller] || {
|
= note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
= help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0308]: mismatched types
--> $DIR/async-closure-gate.rs:27:5

View File

@ -11,6 +11,7 @@ LL | | }
|
= note: see issue #110011 <https://github.com/rust-lang/rust/issues/110011> for more information
= help: add `#![feature(async_fn_track_caller)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
= note: `#[warn(ungated_async_fn_track_caller)]` on by default
warning: `#[track_caller]` on async functions is a no-op
@ -26,6 +27,7 @@ LL | | }
|
= note: see issue #110011 <https://github.com/rust-lang/rust/issues/110011> for more information
= help: add `#![feature(async_fn_track_caller)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
warning: 2 warnings emitted

View File

@ -11,6 +11,7 @@ LL | | }
|
= note: see issue #110011 <https://github.com/rust-lang/rust/issues/110011> for more information
= help: add `#![feature(async_fn_track_caller)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
= note: `#[warn(ungated_async_fn_track_caller)]` on by default
warning: `#[track_caller]` on async functions is a no-op
@ -26,6 +27,7 @@ LL | | }
|
= note: see issue #110011 <https://github.com/rust-lang/rust/issues/110011> for more information
= help: add `#![feature(async_fn_track_caller)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
warning: 2 warnings emitted

View File

@ -14,6 +14,7 @@ LL | auto trait Trait<P> {}
|
= note: see issue #13231 <https://github.com/rust-lang/rust/issues/13231> for more information
= help: add `#![feature(auto_traits)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error: aborting due to 2 previous errors

View File

@ -6,6 +6,7 @@ LL | auto trait Foo {}
|
= note: see issue #13231 <https://github.com/rust-lang/rust/issues/13231> for more information
= help: add `#![feature(auto_traits)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
= warning: unstable syntax can change at any point in the future, causing a hard error!
= note: for more information, see issue #65860 <https://github.com/rust-lang/rust/issues/65860>

View File

@ -24,6 +24,7 @@ LL | type D = for<'a, T> fn();
|
= note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
= help: add `#![feature(non_lifetime_binders)]` 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[E0658]: only lifetime parameters can be used in this context
--> $DIR/bounds-lifetime.rs:5:18
@ -33,6 +34,7 @@ LL | type E = dyn for<T, U> Fn();
|
= note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
= help: add `#![feature(non_lifetime_binders)]` 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: aborting due to 5 previous errors

View File

@ -6,6 +6,7 @@ LL | let _boxed: Box<u32, _> = Box::new(10);
|
= note: see issue #32838 <https://github.com/rust-lang/rust/issues/32838> for more information
= help: add `#![feature(allocator_api)]` 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: aborting due to 1 previous error

View File

@ -6,6 +6,7 @@ LL | fn efiapi(f: extern "efiapi" fn(usize, ...)) {
|
= note: see issue #100189 <https://github.com/rust-lang/rust/issues/100189> for more information
= help: add `#![feature(extended_varargs_abi_support)]` 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[E0045]: C-variadic function must have a compatible calling convention, like `C` or `cdecl`
--> $DIR/feature-gate-extended_varargs_abi_support.rs:1:14
@ -21,6 +22,7 @@ LL | fn sysv(f: extern "sysv64" fn(usize, ...)) {
|
= note: see issue #100189 <https://github.com/rust-lang/rust/issues/100189> for more information
= help: add `#![feature(extended_varargs_abi_support)]` 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[E0045]: C-variadic function must have a compatible calling convention, like `C` or `cdecl`
--> $DIR/feature-gate-extended_varargs_abi_support.rs:6:12
@ -36,6 +38,7 @@ LL | fn win(f: extern "win64" fn(usize, ...)) {
|
= note: see issue #100189 <https://github.com/rust-lang/rust/issues/100189> for more information
= help: add `#![feature(extended_varargs_abi_support)]` 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[E0045]: C-variadic function must have a compatible calling convention, like `C` or `cdecl`
--> $DIR/feature-gate-extended_varargs_abi_support.rs:11:11

View File

@ -6,6 +6,7 @@ LL | trait A = Clone;
|
= note: see issue #41517 <https://github.com/rust-lang/rust/issues/41517> for more information
= help: add `#![feature(trait_alias)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
= warning: unstable syntax can change at any point in the future, causing a hard error!
= note: for more information, see issue #65860 <https://github.com/rust-lang/rust/issues/65860>
@ -17,6 +18,7 @@ LL | let box _ = Box::new(0);
|
= note: see issue #29641 <https://github.com/rust-lang/rust/issues/29641> for more information
= help: add `#![feature(box_patterns)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
= warning: unstable syntax can change at any point in the future, causing a hard error!
= note: for more information, see issue #65860 <https://github.com/rust-lang/rust/issues/65860>

View File

@ -8,6 +8,7 @@ fn main() {
let mut c = #[rustc_capture_analysis]
//~^ ERROR: attributes on expressions are experimental
//~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701>
//~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|| {
//~^ ERROR: First Pass analysis includes:
//~| ERROR: Min Capture analysis includes:

View File

@ -6,9 +6,10 @@ LL | let mut c = #[rustc_capture_analysis]
|
= note: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> for more information
= help: add `#![feature(stmt_expr_attributes)]` 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: First Pass analysis includes:
--> $DIR/arrays-completely-captured.rs:11:5
--> $DIR/arrays-completely-captured.rs:12:5
|
LL | / || {
LL | |
@ -20,18 +21,18 @@ LL | | };
| |_____^
|
note: Capturing m[] -> MutBorrow
--> $DIR/arrays-completely-captured.rs:14:9
--> $DIR/arrays-completely-captured.rs:15:9
|
LL | m[0] += 10;
| ^
note: Capturing m[] -> MutBorrow
--> $DIR/arrays-completely-captured.rs:17:9
--> $DIR/arrays-completely-captured.rs:18:9
|
LL | m[1] += 40;
| ^
error: Min Capture analysis includes:
--> $DIR/arrays-completely-captured.rs:11:5
--> $DIR/arrays-completely-captured.rs:12:5
|
LL | / || {
LL | |
@ -43,7 +44,7 @@ LL | | };
| |_____^
|
note: Min Capture m[] -> MutBorrow
--> $DIR/arrays-completely-captured.rs:14:9
--> $DIR/arrays-completely-captured.rs:15:9
|
LL | m[0] += 10;
| ^

View File

@ -18,6 +18,7 @@ fn big_box() {
let c = #[rustc_capture_analysis]
//~^ ERROR: attributes on expressions are experimental
//~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701>
//~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|| {
//~^ First Pass analysis includes:
//~| Min Capture analysis includes:

View File

@ -6,9 +6,10 @@ LL | let c = #[rustc_capture_analysis]
|
= note: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> for more information
= help: add `#![feature(stmt_expr_attributes)]` 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: First Pass analysis includes:
--> $DIR/by_value.rs:21:5
--> $DIR/by_value.rs:22:5
|
LL | / || {
LL | |
@ -20,18 +21,18 @@ LL | | };
| |_____^
|
note: Capturing t[(0, 0),Deref,(0, 0)] -> ByValue
--> $DIR/by_value.rs:24:17
--> $DIR/by_value.rs:25:17
|
LL | let p = t.0.0;
| ^^^^^
note: Capturing t[(1, 0)] -> ImmBorrow
--> $DIR/by_value.rs:27:29
--> $DIR/by_value.rs:28:29
|
LL | println!("{} {:?}", t.1, p);
| ^^^
error: Min Capture analysis includes:
--> $DIR/by_value.rs:21:5
--> $DIR/by_value.rs:22:5
|
LL | / || {
LL | |
@ -43,12 +44,12 @@ LL | | };
| |_____^
|
note: Min Capture t[(0, 0)] -> ByValue
--> $DIR/by_value.rs:24:17
--> $DIR/by_value.rs:25:17
|
LL | let p = t.0.0;
| ^^^^^
note: Min Capture t[(1, 0)] -> ImmBorrow
--> $DIR/by_value.rs:27:29
--> $DIR/by_value.rs:28:29
|
LL | println!("{} {:?}", t.1, p);
| ^^^

View File

@ -15,6 +15,7 @@ fn main() {
let c = #[rustc_capture_analysis]
//~^ ERROR: attributes on expressions are experimental
//~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701>
//~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|| {
//~^ First Pass analysis includes:
//~| Min Capture analysis includes:

View File

@ -6,9 +6,10 @@ LL | let c = #[rustc_capture_analysis]
|
= note: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> for more information
= help: add `#![feature(stmt_expr_attributes)]` 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: First Pass analysis includes:
--> $DIR/capture-analysis-1.rs:18:5
--> $DIR/capture-analysis-1.rs:19:5
|
LL | / || {
LL | |
@ -20,28 +21,28 @@ LL | | };
| |_____^
|
note: Capturing p[] -> ImmBorrow
--> $DIR/capture-analysis-1.rs:21:26
--> $DIR/capture-analysis-1.rs:22:26
|
LL | println!("{:?}", p);
| ^
note: Capturing p[(0, 0)] -> ImmBorrow
--> $DIR/capture-analysis-1.rs:24:26
--> $DIR/capture-analysis-1.rs:25:26
|
LL | println!("{:?}", p.x);
| ^^^
note: Capturing q[(0, 0)] -> ImmBorrow
--> $DIR/capture-analysis-1.rs:27:26
--> $DIR/capture-analysis-1.rs:28:26
|
LL | println!("{:?}", q.x);
| ^^^
note: Capturing q[] -> ImmBorrow
--> $DIR/capture-analysis-1.rs:29:26
--> $DIR/capture-analysis-1.rs:30:26
|
LL | println!("{:?}", q);
| ^
error: Min Capture analysis includes:
--> $DIR/capture-analysis-1.rs:18:5
--> $DIR/capture-analysis-1.rs:19:5
|
LL | / || {
LL | |
@ -53,12 +54,12 @@ LL | | };
| |_____^
|
note: Min Capture p[] -> ImmBorrow
--> $DIR/capture-analysis-1.rs:21:26
--> $DIR/capture-analysis-1.rs:22:26
|
LL | println!("{:?}", p);
| ^
note: Min Capture q[] -> ImmBorrow
--> $DIR/capture-analysis-1.rs:29:26
--> $DIR/capture-analysis-1.rs:30:26
|
LL | println!("{:?}", q);
| ^

View File

@ -14,6 +14,7 @@ fn main() {
let c = #[rustc_capture_analysis]
//~^ ERROR: attributes on expressions are experimental
//~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701>
//~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|| {
//~^ First Pass analysis includes:
//~| Min Capture analysis includes:

View File

@ -6,9 +6,10 @@ LL | let c = #[rustc_capture_analysis]
|
= note: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> for more information
= help: add `#![feature(stmt_expr_attributes)]` 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: First Pass analysis includes:
--> $DIR/capture-analysis-2.rs:17:5
--> $DIR/capture-analysis-2.rs:18:5
|
LL | / || {
LL | |
@ -20,18 +21,18 @@ LL | | };
| |_____^
|
note: Capturing p[(0, 0)] -> ByValue
--> $DIR/capture-analysis-2.rs:20:18
--> $DIR/capture-analysis-2.rs:21:18
|
LL | let _x = p.x;
| ^^^
note: Capturing p[] -> ImmBorrow
--> $DIR/capture-analysis-2.rs:23:26
--> $DIR/capture-analysis-2.rs:24:26
|
LL | println!("{:?}", p);
| ^
error: Min Capture analysis includes:
--> $DIR/capture-analysis-2.rs:17:5
--> $DIR/capture-analysis-2.rs:18:5
|
LL | / || {
LL | |
@ -43,7 +44,7 @@ LL | | };
| |_____^
|
note: Min Capture p[] -> ByValue
--> $DIR/capture-analysis-2.rs:20:18
--> $DIR/capture-analysis-2.rs:21:18
|
LL | let _x = p.x;
| ^^^ p[] captured as ByValue here

View File

@ -19,6 +19,7 @@ fn main() {
let c = #[rustc_capture_analysis]
//~^ ERROR: attributes on expressions are experimental
//~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701>
//~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|| {
//~^ First Pass analysis includes:
//~| Min Capture analysis includes:

View File

@ -6,9 +6,10 @@ LL | let c = #[rustc_capture_analysis]
|
= note: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> for more information
= help: add `#![feature(stmt_expr_attributes)]` 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: First Pass analysis includes:
--> $DIR/capture-analysis-3.rs:22:5
--> $DIR/capture-analysis-3.rs:23:5
|
LL | / || {
LL | |
@ -20,18 +21,18 @@ LL | | };
| |_____^
|
note: Capturing a[(0, 0),(0, 0)] -> ByValue
--> $DIR/capture-analysis-3.rs:25:18
--> $DIR/capture-analysis-3.rs:26:18
|
LL | let _x = a.b.c;
| ^^^^^
note: Capturing a[(0, 0)] -> ImmBorrow
--> $DIR/capture-analysis-3.rs:28:26
--> $DIR/capture-analysis-3.rs:29:26
|
LL | println!("{:?}", a.b);
| ^^^
error: Min Capture analysis includes:
--> $DIR/capture-analysis-3.rs:22:5
--> $DIR/capture-analysis-3.rs:23:5
|
LL | / || {
LL | |
@ -43,7 +44,7 @@ LL | | };
| |_____^
|
note: Min Capture a[(0, 0)] -> ByValue
--> $DIR/capture-analysis-3.rs:25:18
--> $DIR/capture-analysis-3.rs:26:18
|
LL | let _x = a.b.c;
| ^^^^^ a[(0, 0)] captured as ByValue here

View File

@ -19,6 +19,7 @@ fn main() {
let c = #[rustc_capture_analysis]
//~^ ERROR: attributes on expressions are experimental
//~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701>
//~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|| {
//~^ First Pass analysis includes:
//~| Min Capture analysis includes:

View File

@ -6,9 +6,10 @@ LL | let c = #[rustc_capture_analysis]
|
= note: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> for more information
= help: add `#![feature(stmt_expr_attributes)]` 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: First Pass analysis includes:
--> $DIR/capture-analysis-4.rs:22:5
--> $DIR/capture-analysis-4.rs:23:5
|
LL | / || {
LL | |
@ -20,18 +21,18 @@ LL | | };
| |_____^
|
note: Capturing a[(0, 0)] -> ByValue
--> $DIR/capture-analysis-4.rs:25:18
--> $DIR/capture-analysis-4.rs:26:18
|
LL | let _x = a.b;
| ^^^
note: Capturing a[(0, 0),(0, 0)] -> ImmBorrow
--> $DIR/capture-analysis-4.rs:28:26
--> $DIR/capture-analysis-4.rs:29:26
|
LL | println!("{:?}", a.b.c);
| ^^^^^
error: Min Capture analysis includes:
--> $DIR/capture-analysis-4.rs:22:5
--> $DIR/capture-analysis-4.rs:23:5
|
LL | / || {
LL | |
@ -43,7 +44,7 @@ LL | | };
| |_____^
|
note: Min Capture a[(0, 0)] -> ByValue
--> $DIR/capture-analysis-4.rs:25:18
--> $DIR/capture-analysis-4.rs:26:18
|
LL | let _x = a.b;
| ^^^

View File

@ -13,6 +13,7 @@ fn main() {
let c = #[rustc_capture_analysis]
//~^ ERROR: attributes on expressions are experimental
//~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701>
//~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|| {
//~^ First Pass analysis includes:
//~| Min Capture analysis includes:

View File

@ -6,9 +6,10 @@ LL | let c = #[rustc_capture_analysis]
|
= note: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> for more information
= help: add `#![feature(stmt_expr_attributes)]` 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: First Pass analysis includes:
--> $DIR/capture-disjoint-field-struct.rs:16:5
--> $DIR/capture-disjoint-field-struct.rs:17:5
|
LL | / || {
LL | |
@ -20,13 +21,13 @@ LL | | };
| |_____^
|
note: Capturing p[(0, 0)] -> ImmBorrow
--> $DIR/capture-disjoint-field-struct.rs:19:24
--> $DIR/capture-disjoint-field-struct.rs:20:24
|
LL | println!("{}", p.x);
| ^^^
error: Min Capture analysis includes:
--> $DIR/capture-disjoint-field-struct.rs:16:5
--> $DIR/capture-disjoint-field-struct.rs:17:5
|
LL | / || {
LL | |
@ -38,7 +39,7 @@ LL | | };
| |_____^
|
note: Min Capture p[(0, 0)] -> ImmBorrow
--> $DIR/capture-disjoint-field-struct.rs:19:24
--> $DIR/capture-disjoint-field-struct.rs:20:24
|
LL | println!("{}", p.x);
| ^^^

View File

@ -8,6 +8,7 @@ fn main() {
let c = #[rustc_capture_analysis]
//~^ ERROR: attributes on expressions are experimental
//~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701>
//~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|| {
//~^ First Pass analysis includes:
//~| Min Capture analysis includes:

View File

@ -6,9 +6,10 @@ LL | let c = #[rustc_capture_analysis]
|
= note: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> for more information
= help: add `#![feature(stmt_expr_attributes)]` 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: First Pass analysis includes:
--> $DIR/capture-disjoint-field-tuple.rs:11:5
--> $DIR/capture-disjoint-field-tuple.rs:12:5
|
LL | / || {
LL | |
@ -20,13 +21,13 @@ LL | | };
| |_____^
|
note: Capturing t[(0, 0)] -> ImmBorrow
--> $DIR/capture-disjoint-field-tuple.rs:14:24
--> $DIR/capture-disjoint-field-tuple.rs:15:24
|
LL | println!("{}", t.0);
| ^^^
error: Min Capture analysis includes:
--> $DIR/capture-disjoint-field-tuple.rs:11:5
--> $DIR/capture-disjoint-field-tuple.rs:12:5
|
LL | / || {
LL | |
@ -38,7 +39,7 @@ LL | | };
| |_____^
|
note: Min Capture t[(0, 0)] -> ImmBorrow
--> $DIR/capture-disjoint-field-tuple.rs:14:24
--> $DIR/capture-disjoint-field-tuple.rs:15:24
|
LL | println!("{}", t.0);
| ^^^

View File

@ -16,6 +16,7 @@ fn multi_variant_enum() {
let c = #[rustc_capture_analysis]
//~^ ERROR: attributes on expressions are experimental
//~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701>
//~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|| {
//~^ First Pass analysis includes:
//~| Min Capture analysis includes:
@ -47,6 +48,7 @@ fn single_variant_enum() {
let c = #[rustc_capture_analysis]
//~^ ERROR: attributes on expressions are experimental
//~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701>
//~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|| {
//~^ First Pass analysis includes:
//~| Min Capture analysis includes:

View File

@ -6,18 +6,20 @@ LL | let c = #[rustc_capture_analysis]
|
= note: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> for more information
= help: add `#![feature(stmt_expr_attributes)]` 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[E0658]: attributes on expressions are experimental
--> $DIR/capture-enums.rs:47:13
--> $DIR/capture-enums.rs:48:13
|
LL | let c = #[rustc_capture_analysis]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> for more information
= help: add `#![feature(stmt_expr_attributes)]` 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: First Pass analysis includes:
--> $DIR/capture-enums.rs:19:5
--> $DIR/capture-enums.rs:20:5
|
LL | / || {
LL | |
@ -29,28 +31,28 @@ LL | | };
| |_____^
|
note: Capturing point[] -> ImmBorrow
--> $DIR/capture-enums.rs:22:41
--> $DIR/capture-enums.rs:23:41
|
LL | if let Info::Point(_, _, str) = point {
| ^^^^^
note: Capturing point[(2, 0)] -> ByValue
--> $DIR/capture-enums.rs:22:41
--> $DIR/capture-enums.rs:23:41
|
LL | if let Info::Point(_, _, str) = point {
| ^^^^^
note: Capturing meta[] -> ImmBorrow
--> $DIR/capture-enums.rs:29:35
--> $DIR/capture-enums.rs:30:35
|
LL | if let Info::Meta(_, v) = meta {
| ^^^^
note: Capturing meta[(1, 1)] -> ByValue
--> $DIR/capture-enums.rs:29:35
--> $DIR/capture-enums.rs:30:35
|
LL | if let Info::Meta(_, v) = meta {
| ^^^^
error: Min Capture analysis includes:
--> $DIR/capture-enums.rs:19:5
--> $DIR/capture-enums.rs:20:5
|
LL | / || {
LL | |
@ -62,18 +64,18 @@ LL | | };
| |_____^
|
note: Min Capture point[] -> ByValue
--> $DIR/capture-enums.rs:22:41
--> $DIR/capture-enums.rs:23:41
|
LL | if let Info::Point(_, _, str) = point {
| ^^^^^
note: Min Capture meta[] -> ByValue
--> $DIR/capture-enums.rs:29:35
--> $DIR/capture-enums.rs:30:35
|
LL | if let Info::Meta(_, v) = meta {
| ^^^^
error: First Pass analysis includes:
--> $DIR/capture-enums.rs:50:5
--> $DIR/capture-enums.rs:52:5
|
LL | / || {
LL | |
@ -85,13 +87,13 @@ LL | | };
| |_____^
|
note: Capturing point[(2, 0)] -> ByValue
--> $DIR/capture-enums.rs:53:47
--> $DIR/capture-enums.rs:55:47
|
LL | let SingleVariant::Point(_, _, str) = point;
| ^^^^^
error: Min Capture analysis includes:
--> $DIR/capture-enums.rs:50:5
--> $DIR/capture-enums.rs:52:5
|
LL | / || {
LL | |
@ -103,7 +105,7 @@ LL | | };
| |_____^
|
note: Min Capture point[(2, 0)] -> ByValue
--> $DIR/capture-enums.rs:53:47
--> $DIR/capture-enums.rs:55:47
|
LL | let SingleVariant::Point(_, _, str) = point;
| ^^^^^

View File

@ -34,6 +34,7 @@ fn main() {
let c = #[rustc_capture_analysis]
//~^ ERROR: attributes on expressions are experimental
//~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701>
//~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|| {
//~^ ERROR: First Pass analysis includes:
//~| ERROR: Min Capture analysis includes:

View File

@ -6,9 +6,10 @@ LL | let c = #[rustc_capture_analysis]
|
= note: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> for more information
= help: add `#![feature(stmt_expr_attributes)]` 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: First Pass analysis includes:
--> $DIR/deep-multilevel-struct.rs:37:5
--> $DIR/deep-multilevel-struct.rs:38:5
|
LL | / || {
LL | |
@ -20,23 +21,23 @@ LL | | };
| |_____^
|
note: Capturing p[(0, 0),(0, 0),(0, 0)] -> ImmBorrow
--> $DIR/deep-multilevel-struct.rs:40:18
--> $DIR/deep-multilevel-struct.rs:41:18
|
LL | let x = &p.a.p.x;
| ^^^^^^^
note: Capturing p[(1, 0),(1, 0),(1, 0)] -> MutBorrow
--> $DIR/deep-multilevel-struct.rs:42:9
--> $DIR/deep-multilevel-struct.rs:43:9
|
LL | p.b.q.y = 9;
| ^^^^^^^
note: Capturing p[] -> ImmBorrow
--> $DIR/deep-multilevel-struct.rs:45:26
--> $DIR/deep-multilevel-struct.rs:46:26
|
LL | println!("{:?}", p);
| ^
error: Min Capture analysis includes:
--> $DIR/deep-multilevel-struct.rs:37:5
--> $DIR/deep-multilevel-struct.rs:38:5
|
LL | / || {
LL | |
@ -48,7 +49,7 @@ LL | | };
| |_____^
|
note: Min Capture p[] -> MutBorrow
--> $DIR/deep-multilevel-struct.rs:42:9
--> $DIR/deep-multilevel-struct.rs:43:9
|
LL | p.b.q.y = 9;
| ^^^^^^^ p[] captured as MutBorrow here

View File

@ -8,6 +8,7 @@ fn main() {
let c = #[rustc_capture_analysis]
//~^ ERROR: attributes on expressions are experimental
//~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701>
//~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|| {
//~^ ERROR: First Pass analysis includes:
//~| ERROR: Min Capture analysis includes:

Some files were not shown because too many files have changed in this diff Show More