1
Fork 0

Auto merge of #80790 - JohnTitor:rollup-js1noez, r=JohnTitor

Rollup of 10 pull requests

Successful merges:

 - #80012 (Add pointing const identifier when emitting E0435)
 - #80521 (MIR Inline is incompatible with coverage)
 - #80659 (Edit rustc_ast::tokenstream docs)
 - #80660 (Properly handle primitive disambiguators in rustdoc)
 - #80738 (Remove bottom margin from crate version when the docs sidebar is collapsed)
 - #80744 (rustdoc: Turn `next_def_id` comments into docs)
 - #80750 (Don't use to_string on Symbol in rustc_passes/check_attr.rs)
 - #80769 (Improve wording of parse doc)
 - #80780 (Return EOF_CHAR constant instead of magic char.)
 - #80784 (rustc_parse: Better spans for synthesized token streams)

Failed merges:

 - #80785 (rustc_ast_pretty: Remove `PrintState::insert_extra_parens`)

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2021-01-07 18:20:12 +00:00
commit c8915eebea
43 changed files with 607 additions and 372 deletions

View file

@ -771,7 +771,7 @@ impl fmt::Display for NonterminalKind {
} }
impl Nonterminal { impl Nonterminal {
fn span(&self) -> Span { pub fn span(&self) -> Span {
match self { match self {
NtItem(item) => item.span, NtItem(item) => item.span,
NtBlock(block) => block.span, NtBlock(block) => block.span,

View file

@ -1,15 +1,15 @@
//! # Token Streams //! # Token Streams
//! //!
//! `TokenStream`s represent syntactic objects before they are converted into ASTs. //! `TokenStream`s represent syntactic objects before they are converted into ASTs.
//! A `TokenStream` is, roughly speaking, a sequence (eg stream) of `TokenTree`s, //! A `TokenStream` is, roughly speaking, a sequence of [`TokenTree`]s,
//! which are themselves a single `Token` or a `Delimited` subsequence of tokens. //! which are themselves a single [`Token`] or a `Delimited` subsequence of tokens.
//! //!
//! ## Ownership //! ## Ownership
//! //!
//! `TokenStream`s are persistent data structures constructed as ropes with reference //! `TokenStream`s are persistent data structures constructed as ropes with reference
//! counted-children. In general, this means that calling an operation on a `TokenStream` //! counted-children. In general, this means that calling an operation on a `TokenStream`
//! (such as `slice`) produces an entirely new `TokenStream` from the borrowed reference to //! (such as `slice`) produces an entirely new `TokenStream` from the borrowed reference to
//! the original. This essentially coerces `TokenStream`s into 'views' of their subparts, //! the original. This essentially coerces `TokenStream`s into "views" of their subparts,
//! and a borrowed `TokenStream` is sufficient to build an owned `TokenStream` without taking //! and a borrowed `TokenStream` is sufficient to build an owned `TokenStream` without taking
//! ownership of the original. //! ownership of the original.
@ -24,9 +24,9 @@ use smallvec::{smallvec, SmallVec};
use std::{fmt, iter, mem}; use std::{fmt, iter, mem};
/// When the main rust parser encounters a syntax-extension invocation, it /// When the main Rust parser encounters a syntax-extension invocation, it
/// parses the arguments to the invocation as a token-tree. This is a very /// parses the arguments to the invocation as a token tree. This is a very
/// loose structure, such that all sorts of different AST-fragments can /// loose structure, such that all sorts of different AST fragments can
/// be passed to syntax extensions using a uniform type. /// be passed to syntax extensions using a uniform type.
/// ///
/// If the syntax extension is an MBE macro, it will attempt to match its /// If the syntax extension is an MBE macro, it will attempt to match its
@ -38,9 +38,9 @@ use std::{fmt, iter, mem};
/// Nothing special happens to misnamed or misplaced `SubstNt`s. /// Nothing special happens to misnamed or misplaced `SubstNt`s.
#[derive(Debug, Clone, PartialEq, Encodable, Decodable, HashStable_Generic)] #[derive(Debug, Clone, PartialEq, Encodable, Decodable, HashStable_Generic)]
pub enum TokenTree { pub enum TokenTree {
/// A single token /// A single token.
Token(Token), Token(Token),
/// A delimited sequence of token trees /// A delimited sequence of token trees.
Delimited(DelimSpan, DelimToken, TokenStream), Delimited(DelimSpan, DelimToken, TokenStream),
} }
@ -62,7 +62,7 @@ where
} }
impl TokenTree { impl TokenTree {
/// Checks if this TokenTree is equal to the other, regardless of span information. /// Checks if this `TokenTree` is equal to the other, regardless of span information.
pub fn eq_unspanned(&self, other: &TokenTree) -> bool { pub fn eq_unspanned(&self, other: &TokenTree) -> bool {
match (self, other) { match (self, other) {
(TokenTree::Token(token), TokenTree::Token(token2)) => token.kind == token2.kind, (TokenTree::Token(token), TokenTree::Token(token2)) => token.kind == token2.kind,
@ -73,7 +73,7 @@ impl TokenTree {
} }
} }
/// Retrieves the TokenTree's span. /// Retrieves the `TokenTree`'s span.
pub fn span(&self) -> Span { pub fn span(&self) -> Span {
match self { match self {
TokenTree::Token(token) => token.span, TokenTree::Token(token) => token.span,
@ -140,7 +140,7 @@ impl CreateTokenStream for TokenStream {
} }
} }
/// A lazy version of `TokenStream`, which defers creation /// A lazy version of [`TokenStream`], which defers creation
/// of an actual `TokenStream` until it is needed. /// of an actual `TokenStream` until it is needed.
/// `Box` is here only to reduce the structure size. /// `Box` is here only to reduce the structure size.
#[derive(Clone)] #[derive(Clone)]
@ -188,11 +188,12 @@ impl<CTX> HashStable<CTX> for LazyTokenStream {
} }
} }
/// A `TokenStream` is an abstract sequence of tokens, organized into `TokenTree`s. /// A `TokenStream` is an abstract sequence of tokens, organized into [`TokenTree`]s.
/// ///
/// The goal is for procedural macros to work with `TokenStream`s and `TokenTree`s /// The goal is for procedural macros to work with `TokenStream`s and `TokenTree`s
/// instead of a representation of the abstract syntax tree. /// instead of a representation of the abstract syntax tree.
/// Today's `TokenTree`s can still contain AST via `token::Interpolated` for back-compat. /// Today's `TokenTree`s can still contain AST via `token::Interpolated` for
/// backwards compatability.
#[derive(Clone, Debug, Default, Encodable, Decodable)] #[derive(Clone, Debug, Default, Encodable, Decodable)]
pub struct TokenStream(pub(crate) Lrc<Vec<TreeAndSpacing>>); pub struct TokenStream(pub(crate) Lrc<Vec<TreeAndSpacing>>);
@ -429,7 +430,7 @@ impl TokenStreamBuilder {
} }
} }
/// By-reference iterator over a `TokenStream`. /// By-reference iterator over a [`TokenStream`].
#[derive(Clone)] #[derive(Clone)]
pub struct CursorRef<'t> { pub struct CursorRef<'t> {
stream: &'t TokenStream, stream: &'t TokenStream,
@ -457,8 +458,8 @@ impl<'t> Iterator for CursorRef<'t> {
} }
} }
/// Owning by-value iterator over a `TokenStream`. /// Owning by-value iterator over a [`TokenStream`].
/// FIXME: Many uses of this can be replaced with by-reference iterator to avoid clones. // FIXME: Many uses of this can be replaced with by-reference iterator to avoid clones.
#[derive(Clone)] #[derive(Clone)]
pub struct Cursor { pub struct Cursor {
pub stream: TokenStream, pub stream: TokenStream,

View file

@ -206,8 +206,7 @@ pub trait ResolverAstLowering {
) -> LocalDefId; ) -> LocalDefId;
} }
type NtToTokenstream = type NtToTokenstream = fn(&Nonterminal, &ParseSess, CanSynthesizeMissingTokens) -> TokenStream;
fn(&Nonterminal, &ParseSess, Span, CanSynthesizeMissingTokens) -> TokenStream;
/// Context of `impl Trait` in code, which determines whether it is allowed in an HIR subtree, /// Context of `impl Trait` in code, which determines whether it is allowed in an HIR subtree,
/// and if so, what meaning it has. /// and if so, what meaning it has.
@ -417,12 +416,7 @@ impl<'a> TokenStreamLowering<'a> {
fn lower_token(&mut self, token: Token) -> TokenStream { fn lower_token(&mut self, token: Token) -> TokenStream {
match token.kind { match token.kind {
token::Interpolated(nt) => { token::Interpolated(nt) => {
let tts = (self.nt_to_tokenstream)( let tts = (self.nt_to_tokenstream)(&nt, self.parse_sess, self.synthesize_tokens);
&nt,
self.parse_sess,
token.span,
self.synthesize_tokens,
);
TokenTree::Delimited( TokenTree::Delimited(
DelimSpan::from_single(token.span), DelimSpan::from_single(token.span),
DelimToken::NoDelim, DelimToken::NoDelim,

View file

@ -7,6 +7,12 @@ let foo = 42;
let a: [u8; foo]; // error: attempt to use a non-constant value in a constant let a: [u8; foo]; // error: attempt to use a non-constant value in a constant
``` ```
'constant' means 'a compile-time value'.
More details can be found in the [Variables and Mutability] section of the book.
[Variables and Mutability]: https://doc.rust-lang.org/book/ch03-01-variables-and-mutability.html#differences-between-variables-and-constants
To fix this error, please replace the value with a constant. Example: To fix this error, please replace the value with a constant. Example:
``` ```

View file

@ -141,7 +141,7 @@ impl Annotatable {
} }
crate fn into_tokens(self, sess: &ParseSess) -> TokenStream { crate fn into_tokens(self, sess: &ParseSess) -> TokenStream {
nt_to_tokenstream(&self.into_nonterminal(), sess, DUMMY_SP, CanSynthesizeMissingTokens::No) nt_to_tokenstream(&self.into_nonterminal(), sess, CanSynthesizeMissingTokens::No)
} }
pub fn expect_item(self) -> P<ast::Item> { pub fn expect_item(self) -> P<ast::Item> {

View file

@ -743,7 +743,6 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
AttrStyle::Inner => rustc_parse::fake_token_stream( AttrStyle::Inner => rustc_parse::fake_token_stream(
&self.cx.sess.parse_sess, &self.cx.sess.parse_sess,
&item.into_nonterminal(), &item.into_nonterminal(),
span,
), ),
}; };
let attr_item = attr.unwrap_normal_item(); let attr_item = attr.unwrap_normal_item();

View file

@ -94,12 +94,7 @@ impl MultiItemModifier for ProcMacroDerive {
let input = if item.pretty_printing_compatibility_hack() { let input = if item.pretty_printing_compatibility_hack() {
TokenTree::token(token::Interpolated(Lrc::new(item)), DUMMY_SP).into() TokenTree::token(token::Interpolated(Lrc::new(item)), DUMMY_SP).into()
} else { } else {
nt_to_tokenstream( nt_to_tokenstream(&item, &ecx.sess.parse_sess, CanSynthesizeMissingTokens::Yes)
&item,
&ecx.sess.parse_sess,
DUMMY_SP,
CanSynthesizeMissingTokens::Yes,
)
}; };
let server = proc_macro_server::Rustc::new(ecx); let server = proc_macro_server::Rustc::new(ecx);

View file

@ -179,7 +179,7 @@ impl FromInternal<(TreeAndSpacing, &'_ ParseSess, &'_ mut Vec<Self>)>
{ {
TokenTree::Ident(Ident::new(sess, name.name, is_raw, name.span)) TokenTree::Ident(Ident::new(sess, name.name, is_raw, name.span))
} else { } else {
let stream = nt_to_tokenstream(&nt, sess, span, CanSynthesizeMissingTokens::No); let stream = nt_to_tokenstream(&nt, sess, CanSynthesizeMissingTokens::No);
TokenTree::Group(Group { TokenTree::Group(Group {
delimiter: Delimiter::None, delimiter: Delimiter::None,
stream, stream,

View file

@ -33,7 +33,7 @@ impl<'a> Cursor<'a> {
#[cfg(not(debug_assertions))] #[cfg(not(debug_assertions))]
{ {
'\0' EOF_CHAR
} }
} }

View file

@ -41,6 +41,15 @@ impl<'tcx> MirPass<'tcx> for Inline {
return; return;
} }
if tcx.sess.opts.debugging_opts.instrument_coverage {
// Since `Inline` happens after `InstrumentCoverage`, the function-specific coverage
// counters can be invalidated, such as by merging coverage counter statements from
// a pre-inlined function into a different function. This kind of change is invalid,
// so inlining must be skipped. Note: This check is performed here so inlining can
// be disabled without preventing other optimizations (regardless of `mir_opt_level`).
return;
}
if inline(tcx, body) { if inline(tcx, body) {
debug!("running simplify cfg on {:?}", body.source); debug!("running simplify cfg on {:?}", body.source);
CfgSimplifier::new(body).simplify(); CfgSimplifier::new(body).simplify();

View file

@ -236,7 +236,6 @@ pub fn parse_in<'a, T>(
pub fn nt_to_tokenstream( pub fn nt_to_tokenstream(
nt: &Nonterminal, nt: &Nonterminal,
sess: &ParseSess, sess: &ParseSess,
span: Span,
synthesize_tokens: CanSynthesizeMissingTokens, synthesize_tokens: CanSynthesizeMissingTokens,
) -> TokenStream { ) -> TokenStream {
// A `Nonterminal` is often a parsed AST item. At this point we now // A `Nonterminal` is often a parsed AST item. At this point we now
@ -256,11 +255,9 @@ pub fn nt_to_tokenstream(
|tokens: Option<&LazyTokenStream>| tokens.as_ref().map(|t| t.create_token_stream()); |tokens: Option<&LazyTokenStream>| tokens.as_ref().map(|t| t.create_token_stream());
let tokens = match *nt { let tokens = match *nt {
Nonterminal::NtItem(ref item) => { Nonterminal::NtItem(ref item) => prepend_attrs(sess, &item.attrs, nt, item.tokens.as_ref()),
prepend_attrs(sess, &item.attrs, nt, span, item.tokens.as_ref())
}
Nonterminal::NtBlock(ref block) => convert_tokens(block.tokens.as_ref()), Nonterminal::NtBlock(ref block) => convert_tokens(block.tokens.as_ref()),
Nonterminal::NtStmt(ref stmt) => prepend_attrs(sess, stmt.attrs(), nt, span, stmt.tokens()), Nonterminal::NtStmt(ref stmt) => prepend_attrs(sess, stmt.attrs(), nt, stmt.tokens()),
Nonterminal::NtPat(ref pat) => convert_tokens(pat.tokens.as_ref()), Nonterminal::NtPat(ref pat) => convert_tokens(pat.tokens.as_ref()),
Nonterminal::NtTy(ref ty) => convert_tokens(ty.tokens.as_ref()), Nonterminal::NtTy(ref ty) => convert_tokens(ty.tokens.as_ref()),
Nonterminal::NtIdent(ident, is_raw) => { Nonterminal::NtIdent(ident, is_raw) => {
@ -277,31 +274,30 @@ pub fn nt_to_tokenstream(
if expr.tokens.is_none() { if expr.tokens.is_none() {
debug!("missing tokens for expr {:?}", expr); debug!("missing tokens for expr {:?}", expr);
} }
prepend_attrs(sess, &expr.attrs, nt, span, expr.tokens.as_ref()) prepend_attrs(sess, &expr.attrs, nt, expr.tokens.as_ref())
} }
}; };
if let Some(tokens) = tokens { if let Some(tokens) = tokens {
return tokens; return tokens;
} else if matches!(synthesize_tokens, CanSynthesizeMissingTokens::Yes) { } else if matches!(synthesize_tokens, CanSynthesizeMissingTokens::Yes) {
return fake_token_stream(sess, nt, span); return fake_token_stream(sess, nt);
} else { } else {
let pretty = rustc_ast_pretty::pprust::nonterminal_to_string_no_extra_parens(&nt); let pretty = rustc_ast_pretty::pprust::nonterminal_to_string_no_extra_parens(&nt);
panic!("Missing tokens at {:?} for nt {:?}", span, pretty); panic!("Missing tokens for nt {:?}", pretty);
} }
} }
pub fn fake_token_stream(sess: &ParseSess, nt: &Nonterminal, span: Span) -> TokenStream { pub fn fake_token_stream(sess: &ParseSess, nt: &Nonterminal) -> TokenStream {
let source = pprust::nonterminal_to_string(nt); let source = pprust::nonterminal_to_string(nt);
let filename = FileName::macro_expansion_source_code(&source); let filename = FileName::macro_expansion_source_code(&source);
parse_stream_from_source_str(filename, source, sess, Some(span)) parse_stream_from_source_str(filename, source, sess, Some(nt.span()))
} }
fn prepend_attrs( fn prepend_attrs(
sess: &ParseSess, sess: &ParseSess,
attrs: &[ast::Attribute], attrs: &[ast::Attribute],
nt: &Nonterminal, nt: &Nonterminal,
span: Span,
tokens: Option<&tokenstream::LazyTokenStream>, tokens: Option<&tokenstream::LazyTokenStream>,
) -> Option<tokenstream::TokenStream> { ) -> Option<tokenstream::TokenStream> {
if attrs.is_empty() { if attrs.is_empty() {
@ -312,7 +308,7 @@ fn prepend_attrs(
// FIXME: Correctly handle tokens for inner attributes. // FIXME: Correctly handle tokens for inner attributes.
// For now, we fall back to reparsing the original AST node // For now, we fall back to reparsing the original AST node
if attr.style == ast::AttrStyle::Inner { if attr.style == ast::AttrStyle::Inner {
return Some(fake_token_stream(sess, nt, span)); return Some(fake_token_stream(sess, nt));
} }
builder.push(attr.tokens()); builder.push(attr.tokens());
} }

View file

@ -359,7 +359,7 @@ impl CheckAttrVisitor<'tcx> {
return false; return false;
} }
let item_name = self.tcx.hir().name(hir_id); let item_name = self.tcx.hir().name(hir_id);
if item_name.to_string() == doc_alias { if &*item_name.as_str() == doc_alias {
self.tcx self.tcx
.sess .sess
.struct_span_err( .struct_span_err(

View file

@ -398,13 +398,19 @@ impl<'a> Resolver<'a> {
err.help("use the `|| { ... }` closure form instead"); err.help("use the `|| { ... }` closure form instead");
err err
} }
ResolutionError::AttemptToUseNonConstantValueInConstant => { ResolutionError::AttemptToUseNonConstantValueInConstant(ident, sugg) => {
let mut err = struct_span_err!( let mut err = struct_span_err!(
self.session, self.session,
span, span,
E0435, E0435,
"attempt to use a non-constant value in a constant" "attempt to use a non-constant value in a constant"
); );
err.span_suggestion(
ident.span,
&sugg,
"".to_string(),
Applicability::MaybeIncorrect,
);
err.span_label(span, "non-constant value"); err.span_label(span, "non-constant value");
err err
} }

View file

@ -92,6 +92,12 @@ crate enum HasGenericParams {
No, No,
} }
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
crate enum ConstantItemKind {
Const,
Static,
}
/// The rib kind restricts certain accesses, /// The rib kind restricts certain accesses,
/// e.g. to a `Res::Local` of an outer item. /// e.g. to a `Res::Local` of an outer item.
#[derive(Copy, Clone, Debug)] #[derive(Copy, Clone, Debug)]
@ -119,7 +125,7 @@ crate enum RibKind<'a> {
/// ///
/// The `bool` indicates if this constant may reference generic parameters /// The `bool` indicates if this constant may reference generic parameters
/// and is used to only allow generic parameters to be used in trivial constant expressions. /// and is used to only allow generic parameters to be used in trivial constant expressions.
ConstantItemRibKind(bool), ConstantItemRibKind(bool, Option<(Ident, ConstantItemKind)>),
/// We passed through a module. /// We passed through a module.
ModuleRibKind(Module<'a>), ModuleRibKind(Module<'a>),
@ -145,7 +151,7 @@ impl RibKind<'_> {
NormalRibKind NormalRibKind
| ClosureOrAsyncRibKind | ClosureOrAsyncRibKind
| FnItemRibKind | FnItemRibKind
| ConstantItemRibKind(_) | ConstantItemRibKind(..)
| ModuleRibKind(_) | ModuleRibKind(_)
| MacroDefinition(_) | MacroDefinition(_)
| ConstParamTyRibKind => false, | ConstParamTyRibKind => false,
@ -634,7 +640,7 @@ impl<'a: 'ast, 'ast> Visitor<'ast> for LateResolutionVisitor<'a, '_, 'ast> {
// Note that we might not be inside of an repeat expression here, // Note that we might not be inside of an repeat expression here,
// but considering that `IsRepeatExpr` is only relevant for // but considering that `IsRepeatExpr` is only relevant for
// non-trivial constants this is doesn't matter. // non-trivial constants this is doesn't matter.
self.with_constant_rib(IsRepeatExpr::No, true, |this| { self.with_constant_rib(IsRepeatExpr::No, true, None, |this| {
this.smart_resolve_path( this.smart_resolve_path(
ty.id, ty.id,
qself.as_ref(), qself.as_ref(),
@ -843,7 +849,7 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
| ClosureOrAsyncRibKind | ClosureOrAsyncRibKind
| FnItemRibKind | FnItemRibKind
| ItemRibKind(..) | ItemRibKind(..)
| ConstantItemRibKind(_) | ConstantItemRibKind(..)
| ModuleRibKind(..) | ModuleRibKind(..)
| ForwardTyParamBanRibKind | ForwardTyParamBanRibKind
| ConstParamTyRibKind => { | ConstParamTyRibKind => {
@ -970,6 +976,7 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
this.with_constant_rib( this.with_constant_rib(
IsRepeatExpr::No, IsRepeatExpr::No,
true, true,
None,
|this| this.visit_expr(expr), |this| this.visit_expr(expr),
); );
} }
@ -1012,11 +1019,19 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
self.with_item_rib(HasGenericParams::No, |this| { self.with_item_rib(HasGenericParams::No, |this| {
this.visit_ty(ty); this.visit_ty(ty);
if let Some(expr) = expr { if let Some(expr) = expr {
let constant_item_kind = match item.kind {
ItemKind::Const(..) => ConstantItemKind::Const,
ItemKind::Static(..) => ConstantItemKind::Static,
_ => unreachable!(),
};
// We already forbid generic params because of the above item rib, // We already forbid generic params because of the above item rib,
// so it doesn't matter whether this is a trivial constant. // so it doesn't matter whether this is a trivial constant.
this.with_constant_rib(IsRepeatExpr::No, true, |this| { this.with_constant_rib(
this.visit_expr(expr) IsRepeatExpr::No,
}); true,
Some((item.ident, constant_item_kind)),
|this| this.visit_expr(expr),
);
} }
}); });
} }
@ -1118,15 +1133,16 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
&mut self, &mut self,
is_repeat: IsRepeatExpr, is_repeat: IsRepeatExpr,
is_trivial: bool, is_trivial: bool,
item: Option<(Ident, ConstantItemKind)>,
f: impl FnOnce(&mut Self), f: impl FnOnce(&mut Self),
) { ) {
debug!("with_constant_rib: is_repeat={:?} is_trivial={}", is_repeat, is_trivial); debug!("with_constant_rib: is_repeat={:?} is_trivial={}", is_repeat, is_trivial);
self.with_rib(ValueNS, ConstantItemRibKind(is_trivial), |this| { self.with_rib(ValueNS, ConstantItemRibKind(is_trivial, item), |this| {
this.with_rib( this.with_rib(
TypeNS, TypeNS,
ConstantItemRibKind(is_repeat == IsRepeatExpr::Yes || is_trivial), ConstantItemRibKind(is_repeat == IsRepeatExpr::Yes || is_trivial, item),
|this| { |this| {
this.with_label_rib(ConstantItemRibKind(is_trivial), f); this.with_label_rib(ConstantItemRibKind(is_trivial, item), f);
}, },
) )
}); });
@ -1266,6 +1282,7 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
this.with_constant_rib( this.with_constant_rib(
IsRepeatExpr::No, IsRepeatExpr::No,
true, true,
None,
|this| { |this| {
visit::walk_assoc_item( visit::walk_assoc_item(
this, this,
@ -2200,6 +2217,7 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
self.with_constant_rib( self.with_constant_rib(
is_repeat, is_repeat,
constant.value.is_potential_trivial_const_param(), constant.value.is_potential_trivial_const_param(),
None,
|this| { |this| {
visit::walk_anon_const(this, constant); visit::walk_anon_const(this, constant);
}, },

View file

@ -64,7 +64,7 @@ use tracing::debug;
use diagnostics::{extend_span_to_previous_binding, find_span_of_binding_until_next_binding}; use diagnostics::{extend_span_to_previous_binding, find_span_of_binding_until_next_binding};
use diagnostics::{ImportSuggestion, LabelSuggestion, Suggestion}; use diagnostics::{ImportSuggestion, LabelSuggestion, Suggestion};
use imports::{Import, ImportKind, ImportResolver, NameResolution}; use imports::{Import, ImportKind, ImportResolver, NameResolution};
use late::{HasGenericParams, PathSource, Rib, RibKind::*}; use late::{ConstantItemKind, HasGenericParams, PathSource, Rib, RibKind::*};
use macros::{MacroRulesBinding, MacroRulesScope, MacroRulesScopeRef}; use macros::{MacroRulesBinding, MacroRulesScope, MacroRulesScopeRef};
type Res = def::Res<NodeId>; type Res = def::Res<NodeId>;
@ -210,7 +210,7 @@ enum ResolutionError<'a> {
/// Error E0434: can't capture dynamic environment in a fn item. /// Error E0434: can't capture dynamic environment in a fn item.
CannotCaptureDynamicEnvironmentInFnItem, CannotCaptureDynamicEnvironmentInFnItem,
/// Error E0435: attempt to use a non-constant value in a constant. /// Error E0435: attempt to use a non-constant value in a constant.
AttemptToUseNonConstantValueInConstant, AttemptToUseNonConstantValueInConstant(Ident, String),
/// Error E0530: `X` bindings cannot shadow `Y`s. /// Error E0530: `X` bindings cannot shadow `Y`s.
BindingShadowsSomethingUnacceptable(&'static str, Symbol, &'a NameBinding<'a>), BindingShadowsSomethingUnacceptable(&'static str, Symbol, &'a NameBinding<'a>),
/// Error E0128: type parameters with a default cannot use forward-declared identifiers. /// Error E0128: type parameters with a default cannot use forward-declared identifiers.
@ -1837,14 +1837,16 @@ impl<'a> Resolver<'a> {
// Use the rib kind to determine whether we are resolving parameters // Use the rib kind to determine whether we are resolving parameters
// (macro 2.0 hygiene) or local variables (`macro_rules` hygiene). // (macro 2.0 hygiene) or local variables (`macro_rules` hygiene).
let rib_ident = if ribs[i].kind.contains_params() { normalized_ident } else { ident }; let rib_ident = if ribs[i].kind.contains_params() { normalized_ident } else { ident };
if let Some(res) = ribs[i].bindings.get(&rib_ident).cloned() { if let Some((original_rib_ident_def, res)) = ribs[i].bindings.get_key_value(&rib_ident)
{
// The ident resolves to a type parameter or local variable. // The ident resolves to a type parameter or local variable.
return Some(LexicalScopeBinding::Res(self.validate_res_from_ribs( return Some(LexicalScopeBinding::Res(self.validate_res_from_ribs(
i, i,
rib_ident, rib_ident,
res, *res,
record_used, record_used,
path_span, path_span,
*original_rib_ident_def,
ribs, ribs,
))); )));
} }
@ -2556,6 +2558,7 @@ impl<'a> Resolver<'a> {
mut res: Res, mut res: Res,
record_used: bool, record_used: bool,
span: Span, span: Span,
original_rib_ident_def: Ident,
all_ribs: &[Rib<'a>], all_ribs: &[Rib<'a>],
) -> Res { ) -> Res {
const CG_BUG_STR: &str = "min_const_generics resolve check didn't stop compilation"; const CG_BUG_STR: &str = "min_const_generics resolve check didn't stop compilation";
@ -2602,10 +2605,31 @@ impl<'a> Resolver<'a> {
res_err = Some(CannotCaptureDynamicEnvironmentInFnItem); res_err = Some(CannotCaptureDynamicEnvironmentInFnItem);
} }
} }
ConstantItemRibKind(_) => { ConstantItemRibKind(_, item) => {
// Still doesn't deal with upvars // Still doesn't deal with upvars
if record_used { if record_used {
self.report_error(span, AttemptToUseNonConstantValueInConstant); let (span, resolution_error) =
if let Some((ident, constant_item_kind)) = item {
let kind_str = match constant_item_kind {
ConstantItemKind::Const => "const",
ConstantItemKind::Static => "static",
};
let sugg = format!(
"consider using `let` instead of `{}`",
kind_str
);
(span, AttemptToUseNonConstantValueInConstant(ident, sugg))
} else {
let sugg = "consider using `const` instead of `let`";
(
rib_ident.span,
AttemptToUseNonConstantValueInConstant(
original_rib_ident_def,
sugg.to_string(),
),
)
};
self.report_error(span, resolution_error);
} }
return Res::Err; return Res::Err;
} }
@ -2641,7 +2665,7 @@ impl<'a> Resolver<'a> {
in_ty_param_default = true; in_ty_param_default = true;
continue; continue;
} }
ConstantItemRibKind(trivial) => { ConstantItemRibKind(trivial, _) => {
let features = self.session.features_untracked(); let features = self.session.features_untracked();
// HACK(min_const_generics): We currently only allow `N` or `{ N }`. // HACK(min_const_generics): We currently only allow `N` or `{ N }`.
if !(trivial if !(trivial
@ -2734,7 +2758,7 @@ impl<'a> Resolver<'a> {
in_ty_param_default = true; in_ty_param_default = true;
continue; continue;
} }
ConstantItemRibKind(trivial) => { ConstantItemRibKind(trivial, _) => {
let features = self.session.features_untracked(); let features = self.session.features_untracked();
// HACK(min_const_generics): We currently only allow `N` or `{ N }`. // HACK(min_const_generics): We currently only allow `N` or `{ N }`.
if !(trivial if !(trivial

View file

@ -1829,11 +1829,17 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
} }
if debugging_opts.mir_opt_level > 1 { if debugging_opts.mir_opt_level > 1 {
// Functions inlined during MIR transform can, at best, make it impossible to
// effectively cover inlined functions, and, at worst, break coverage map generation
// during LLVM codegen. For example, function counter IDs are only unique within a
// function. Inlining after these counters are injected can produce duplicate counters,
// resulting in an invalid coverage map (and ICE); so this option combination is not
// allowed.
early_warn( early_warn(
error_format, error_format,
&format!( &format!(
"`-Z mir-opt-level={}` (any level > 1) enables function inlining, which \ "`-Z mir-opt-level={}` (or any level > 1) enables function inlining, which \
limits the effectiveness of `-Z instrument-coverage`.", is incompatible with `-Z instrument-coverage`. Inlining will be disabled.",
debugging_opts.mir_opt_level, debugging_opts.mir_opt_level,
), ),
); );

View file

@ -2175,7 +2175,7 @@ impl str {
/// helps the inference algorithm understand specifically which type /// helps the inference algorithm understand specifically which type
/// you're trying to parse into. /// you're trying to parse into.
/// ///
/// `parse` can parse any type that implements the [`FromStr`] trait. /// `parse` can parse into any type that implements the [`FromStr`] trait.
/// ///
/// # Errors /// # Errors

View file

@ -291,7 +291,9 @@ impl Item {
} }
} }
/// See comments on next_def_id /// See the documentation for [`next_def_id()`].
///
/// [`next_def_id()`]: DocContext::next_def_id()
crate fn is_fake(&self) -> bool { crate fn is_fake(&self) -> bool {
MAX_DEF_ID.with(|m| { MAX_DEF_ID.with(|m| {
m.borrow().get(&self.def_id.krate).map(|id| self.def_id >= *id).unwrap_or(false) m.borrow().get(&self.def_id.krate).map(|id| self.def_id >= *id).unwrap_or(false)

View file

@ -120,14 +120,20 @@ impl<'tcx> DocContext<'tcx> {
r r
} }
// This is an ugly hack, but it's the simplest way to handle synthetic impls without greatly /// Create a new "fake" [`DefId`].
// refactoring either librustdoc or librustc_middle. In particular, allowing new DefIds to be ///
// registered after the AST is constructed would require storing the defid mapping in a /// This is an ugly hack, but it's the simplest way to handle synthetic impls without greatly
// RefCell, decreasing the performance for normal compilation for very little gain. /// refactoring either rustdoc or [`rustc_middle`]. In particular, allowing new [`DefId`]s
// /// to be registered after the AST is constructed would require storing the [`DefId`] mapping
// Instead, we construct 'fake' def ids, which start immediately after the last DefId. /// in a [`RefCell`], decreasing the performance for normal compilation for very little gain.
// In the Debug impl for clean::Item, we explicitly check for fake ///
// def ids, as we'll end up with a panic if we use the DefId Debug impl for fake DefIds /// Instead, we construct "fake" [`DefId`]s, which start immediately after the last `DefId`.
/// In the [`Debug`] impl for [`clean::Item`], we explicitly check for fake `DefId`s,
/// as we'll end up with a panic if we use the `DefId` `Debug` impl for fake `DefId`s.
///
/// [`RefCell`]: std::cell::RefCell
/// [`Debug`]: std::fmt::Debug
/// [`clean::Item`]: crate::clean::types::Item
crate fn next_def_id(&self, crate_num: CrateNum) -> DefId { crate fn next_def_id(&self, crate_num: CrateNum) -> DefId {
let start_def_id = { let start_def_id = {
let num_def_ids = if crate_num == LOCAL_CRATE { let num_def_ids = if crate_num == LOCAL_CRATE {

View file

@ -1412,6 +1412,7 @@ h4 > .notable-traits {
.sidebar > .block.version { .sidebar > .block.version {
border-bottom: none; border-bottom: none;
margin-top: 12px; margin-top: 12px;
margin-bottom: 0;
} }
nav.sub { nav.sub {

View file

@ -394,10 +394,14 @@ impl<'a, 'tcx> LinkCollector<'a, 'tcx> {
ns, ns,
impl_, impl_,
) )
.map(|item| match item.kind { .map(|item| {
let kind = item.kind;
self.kind_side_channel.set(Some((kind.as_def_kind(), item.def_id)));
match kind {
ty::AssocKind::Fn => "method", ty::AssocKind::Fn => "method",
ty::AssocKind::Const => "associatedconstant", ty::AssocKind::Const => "associatedconstant",
ty::AssocKind::Type => "associatedtype", ty::AssocKind::Type => "associatedtype",
}
}) })
.map(|out| { .map(|out| {
( (
@ -1142,17 +1146,8 @@ impl LinkCollector<'_, '_> {
callback, callback,
); );
}; };
match res {
Res::Primitive(_) => match disambiguator { let verify = |kind: DefKind, id: DefId| {
Some(Disambiguator::Primitive | Disambiguator::Namespace(_)) | None => {
Some(ItemLink { link: ori_link.link, link_text, did: None, fragment })
}
Some(other) => {
report_mismatch(other, Disambiguator::Primitive);
None
}
},
Res::Def(kind, id) => {
debug!("intra-doc link to {} resolved to {:?}", path_str, res); debug!("intra-doc link to {} resolved to {:?}", path_str, res);
// Disallow e.g. linking to enums with `struct@` // Disallow e.g. linking to enums with `struct@`
@ -1191,6 +1186,35 @@ impl LinkCollector<'_, '_> {
privacy_error(cx, &item, &path_str, dox, &ori_link); privacy_error(cx, &item, &path_str, dox, &ori_link);
} }
} }
Some((kind, id))
};
match res {
Res::Primitive(_) => {
if let Some((kind, id)) = self.kind_side_channel.take() {
// We're actually resolving an associated item of a primitive, so we need to
// verify the disambiguator (if any) matches the type of the associated item.
// This case should really follow the same flow as the `Res::Def` branch below,
// but attempting to add a call to `clean::register_res` causes an ICE. @jyn514
// thinks `register_res` is only needed for cross-crate re-exports, but Rust
// doesn't allow statements like `use str::trim;`, making this a (hopefully)
// valid omission. See https://github.com/rust-lang/rust/pull/80660#discussion_r551585677
// for discussion on the matter.
verify(kind, id)?;
} else {
match disambiguator {
Some(Disambiguator::Primitive | Disambiguator::Namespace(_)) | None => {}
Some(other) => {
report_mismatch(other, Disambiguator::Primitive);
return None;
}
}
}
Some(ItemLink { link: ori_link.link, link_text, did: None, fragment })
}
Res::Def(kind, id) => {
let (kind, id) = verify(kind, id)?;
let id = clean::register_res(cx, rustc_hir::def::Res::Def(kind, id)); let id = clean::register_res(cx, rustc_hir::def::Res::Def(kind, id));
Some(ItemLink { link: ori_link.link, link_text, did: Some(id), fragment }) Some(ItemLink { link: ori_link.link, link_text, did: Some(id), fragment })
} }

View file

@ -21,50 +21,86 @@
20| |//! 20| |//!
21| |//! doctest returning a result: 21| |//! doctest returning a result:
22| 1|//! ``` 22| 1|//! ```
23| 1|//! #[derive(Debug)] 23| 2|//! #[derive(Debug, PartialEq)]
24| 1|//! struct SomeError; ^1
25| 1|//! let mut res = Err(SomeError); 24| 1|//! struct SomeError {
26| 1|//! if res.is_ok() { 25| 1|//! msg: String,
27| 0|//! res?; 26| 1|//! }
28| 1|//! } else { 27| 1|//! let mut res = Err(SomeError { msg: String::from("a message") });
29| 1|//! res = Ok(0); 28| 1|//! if res.is_ok() {
30| 1|//! } 29| 0|//! res?;
31| |//! // need to be explicit because rustdoc cant infer the return type 30| |//! } else {
32| 1|//! Ok::<(), SomeError>(()) 31| 1|//! if *res.as_ref().unwrap_err() == *res.as_ref().unwrap_err() {
33| 1|//! ``` 32| 1|//! println!("{:?}", res);
34| |//! 33| 1|//! }
35| |//! doctest with custom main: ^0
36| |//! ``` 34| 1|//! if *res.as_ref().unwrap_err() == *res.as_ref().unwrap_err() {
37| |//! #[derive(Debug)] 35| 1|//! res = Ok(1);
38| |//! struct SomeError; 36| 1|//! }
39| |//! ^0
40| |//! extern crate doctest_crate; 37| 1|//! res = Ok(0);
41| |//! 38| |//! }
42| 1|//! fn doctest_main() -> Result<(), SomeError> { 39| |//! // need to be explicit because rustdoc cant infer the return type
43| 1|//! doctest_crate::fn_run_in_doctests(2); 40| 1|//! Ok::<(), SomeError>(())
44| 1|//! Ok(()) 41| 1|//! ```
45| 1|//! } 42| |//!
46| |//! 43| |//! doctest with custom main:
47| |//! // this `main` is not shown as covered, as it clashes with all the other 44| |//! ```
48| |//! // `main` functions that were automatically generated for doctests 45| 1|//! fn some_func() {
49| |//! fn main() -> Result<(), SomeError> { 46| 1|//! println!("called some_func()");
50| |//! doctest_main() 47| 1|//! }
51| |//! } 48| |//!
52| |//! ``` 49| |//! #[derive(Debug)]
53| | 50| |//! struct SomeError;
54| |/// doctest attached to fn testing external code: 51| |//!
55| |/// ``` 52| |//! extern crate doctest_crate;
56| 1|/// extern crate doctest_crate; 53| |//!
57| 1|/// doctest_crate::fn_run_in_doctests(3); 54| 1|//! fn doctest_main() -> Result<(), SomeError> {
58| 1|/// ``` 55| 1|//! some_func();
59| |/// 56| 1|//! doctest_crate::fn_run_in_doctests(2);
60| 1|fn main() { 57| 1|//! Ok(())
61| 1| if true { 58| 1|//! }
62| 1| assert_eq!(1, 1); 59| |//!
63| | } else { 60| |//! // this `main` is not shown as covered, as it clashes with all the other
64| | assert_eq!(1, 2); 61| |//! // `main` functions that were automatically generated for doctests
65| | } 62| |//! fn main() -> Result<(), SomeError> {
66| 1|} 63| |//! doctest_main()
64| |//! }
65| |//! ```
66| |
67| |/// doctest attached to fn testing external code:
68| |/// ```
69| 1|/// extern crate doctest_crate;
70| 1|/// doctest_crate::fn_run_in_doctests(3);
71| 1|/// ```
72| |///
73| 1|fn main() {
74| 1| if true {
75| 1| assert_eq!(1, 1);
76| | } else {
77| | assert_eq!(1, 2);
78| | }
79| 1|}
80| |
81| |// FIXME(Swatinem): Fix known issue that coverage code region columns need to be offset by the
82| |// doc comment line prefix (`///` or `//!`) and any additional indent (before or after the doc
83| |// comment characters). This test produces `llvm-cov show` results demonstrating the problem.
84| |//
85| |// One of the above tests now includes: `derive(Debug, PartialEq)`, producing an `llvm-cov show`
86| |// result with a distinct count for `Debug`, denoted by `^1`, but the caret points to the wrong
87| |// column. Similarly, the `if` blocks without `else` blocks show `^0`, which should point at, or
88| |// one character past, the `if` block's closing brace. In both cases, these are most likely off
89| |// by the number of characters stripped from the beginning of each doc comment line: indent
90| |// whitespace, if any, doc comment prefix (`//!` in this case) and (I assume) one space character
91| |// (?). Note, when viewing `llvm-cov show` results in `--color` mode, the column offset errors are
92| |// more pronounced, and show up in more places, with background color used to show some distinct
93| |// code regions with different coverage counts.
94| |//
95| |// NOTE: Since the doc comment line prefix may vary, one possible solution is to replace each
96| |// character stripped from the beginning of doc comment lines with a space. This will give coverage
97| |// results the correct column offsets, and I think it should compile correctly, but I don't know
98| |// what affect it might have on diagnostic messages from the compiler, and whether anyone would care
99| |// if the indentation changed. I don't know if there is a more viable solution.
../coverage/lib/doctest_crate.rs: ../coverage/lib/doctest_crate.rs:
1| |/// A function run only from within doctests 1| |/// A function run only from within doctests

View file

@ -69,59 +69,59 @@ For revisions in Pull Requests (PR):
</style> </style>
</head> </head>
<body> <body>
<div class="code" style="counter-reset: line 59"><span class="line"><span><span class="code even" style="--layer: 1"><span class="annotation">@0⦊</span>fn main() <span class="annotation">⦉@0</span></span></span><span class="code" style="--layer: 0">{</span></span> <div class="code" style="counter-reset: line 72"><span class="line"><span><span class="code even" style="--layer: 1"><span class="annotation">@0⦊</span>fn main() <span class="annotation">⦉@0</span></span></span><span class="code" style="--layer: 0">{</span></span>
<span class="line"><span class="code" style="--layer: 0"> if </span><span><span class="code even" style="--layer: 1" title="61:8-61:12: @0[1]: _1 = const true <span class="line"><span class="code" style="--layer: 0"> if </span><span><span class="code even" style="--layer: 1" title="74:8-74:12: @0[1]: _1 = const true
61:8-61:12: @0[2]: FakeRead(ForMatchedPlace, _1)"><span class="annotation">@0⦊</span>true<span class="annotation">⦉@0</span></span></span><span class="code" style="--layer: 0"> {</span></span> 74:8-74:12: @0[2]: FakeRead(ForMatchedPlace, _1)"><span class="annotation">@0⦊</span>true<span class="annotation">⦉@0</span></span></span><span class="code" style="--layer: 0"> {</span></span>
<span class="line"><span class="code" style="--layer: 0"> </span><span><span class="code odd" style="--layer: 1" title="62:9-62:26: @5[0]: _2 = const ()"><span class="annotation">@5⦊</span></span></span><span class="code even" style="--layer: 2" title="62:9-62:26: @6[5]: _75 = const main::promoted[3] <span class="line"><span class="code" style="--layer: 0"> </span><span><span class="code odd" style="--layer: 1" title="75:9-75:26: @5[0]: _2 = const ()"><span class="annotation">@5⦊</span></span></span><span class="code even" style="--layer: 2" title="75:9-75:26: @6[5]: _75 = const main::promoted[3]
62:9-62:26: @6[6]: _18 = &amp;(*_75) 75:9-75:26: @6[6]: _18 = &amp;(*_75)
62:9-62:26: @6[7]: _17 = &amp;(*_18) 75:9-75:26: @6[7]: _17 = &amp;(*_18)
62:9-62:26: @6[8]: _16 = move _17 as &amp;[&amp;str] (Pointer(Unsize)) 75:9-75:26: @6[8]: _16 = move _17 as &amp;[&amp;str] (Pointer(Unsize))
62:9-62:26: @6[17]: _26 = &amp;(*_8) 75:9-75:26: @6[17]: _26 = &amp;(*_8)
62:9-62:26: @6[18]: _25 = &amp;_26 75:9-75:26: @6[18]: _25 = &amp;_26
62:9-62:26: @6[21]: _28 = &amp;(*_9) 75:9-75:26: @6[21]: _28 = &amp;(*_9)
62:9-62:26: @6[22]: _27 = &amp;_28 75:9-75:26: @6[22]: _27 = &amp;_28
62:9-62:26: @6[23]: _24 = (move _25, move _27) 75:9-75:26: @6[23]: _24 = (move _25, move _27)
62:9-62:26: @6[26]: FakeRead(ForMatchedPlace, _24) 75:9-75:26: @6[26]: FakeRead(ForMatchedPlace, _24)
62:9-62:26: @6[28]: _29 = (_24.0: &amp;&amp;i32) 75:9-75:26: @6[28]: _29 = (_24.0: &amp;&amp;i32)
62:9-62:26: @6[30]: _30 = (_24.1: &amp;&amp;i32) 75:9-75:26: @6[30]: _30 = (_24.1: &amp;&amp;i32)
62:9-62:26: @6[33]: _32 = &amp;(*_29) 75:9-75:26: @6[33]: _32 = &amp;(*_29)
62:9-62:26: @6[35]: _33 = &lt;&amp;i32 as Debug&gt;::fmt as for&lt;&#39;r, &#39;s, &#39;t0&gt; fn(&amp;&#39;r &amp;i32, &amp;&#39;s mut std::fmt::Formatter&lt;&#39;t0&gt;) -&gt; std::result::Result&lt;(), std::fmt::Error&gt; (Pointer(ReifyFnPointer)) 75:9-75:26: @6[35]: _33 = &lt;&amp;i32 as Debug&gt;::fmt as for&lt;&#39;r, &#39;s, &#39;t0&gt; fn(&amp;&#39;r &amp;i32, &amp;&#39;s mut std::fmt::Formatter&lt;&#39;t0&gt;) -&gt; std::result::Result&lt;(), std::fmt::Error&gt; (Pointer(ReifyFnPointer))
62:9-62:26: @6.Call: _31 = ArgumentV1::new::&lt;&amp;i32&gt;(move _32, move _33) -&gt; [return: bb7, unwind: bb17] 75:9-75:26: @6.Call: _31 = ArgumentV1::new::&lt;&amp;i32&gt;(move _32, move _33) -&gt; [return: bb7, unwind: bb17]
62:9-62:26: @7[4]: _35 = &amp;(*_30) 75:9-75:26: @7[4]: _35 = &amp;(*_30)
62:9-62:26: @7[6]: _36 = &lt;&amp;i32 as Debug&gt;::fmt as for&lt;&#39;r, &#39;s, &#39;t0&gt; fn(&amp;&#39;r &amp;i32, &amp;&#39;s mut std::fmt::Formatter&lt;&#39;t0&gt;) -&gt; std::result::Result&lt;(), std::fmt::Error&gt; (Pointer(ReifyFnPointer)) 75:9-75:26: @7[6]: _36 = &lt;&amp;i32 as Debug&gt;::fmt as for&lt;&#39;r, &#39;s, &#39;t0&gt; fn(&amp;&#39;r &amp;i32, &amp;&#39;s mut std::fmt::Formatter&lt;&#39;t0&gt;) -&gt; std::result::Result&lt;(), std::fmt::Error&gt; (Pointer(ReifyFnPointer))
62:9-62:26: @7.Call: _34 = ArgumentV1::new::&lt;&amp;i32&gt;(move _35, move _36) -&gt; [return: bb8, unwind: bb17] 75:9-75:26: @7.Call: _34 = ArgumentV1::new::&lt;&amp;i32&gt;(move _35, move _36) -&gt; [return: bb8, unwind: bb17]
62:9-62:26: @8[2]: _23 = [move _31, move _34] 75:9-75:26: @8[2]: _23 = [move _31, move _34]
62:9-62:26: @8[7]: _22 = &amp;_23 75:9-75:26: @8[7]: _22 = &amp;_23
62:9-62:26: @8[8]: _21 = &amp;(*_22) 75:9-75:26: @8[8]: _21 = &amp;(*_22)
62:9-62:26: @8[9]: _20 = move _21 as &amp;[std::fmt::ArgumentV1] (Pointer(Unsize)) 75:9-75:26: @8[9]: _20 = move _21 as &amp;[std::fmt::ArgumentV1] (Pointer(Unsize))
62:9-62:26: @8.Call: _15 = Arguments::new_v1(move _16, move _20) -&gt; [return: bb9, unwind: bb17] 75:9-75:26: @8.Call: _15 = Arguments::new_v1(move _16, move _20) -&gt; [return: bb9, unwind: bb17]
62:9-62:26: @9.Call: core::panicking::panic_fmt(move _15) -&gt; bb17"><span class="annotation">@4,6,7,8,9⦊</span>assert_eq!(1, 1);<span class="annotation">⦉@4,6,7,8,9</span></span><span><span class="code odd" style="--layer: 1" title="62:9-62:26: @5[0]: _2 = const ()"><span class="annotation">⦉@5</span></span></span><span class="code" style="--layer: 0"></span></span> 75:9-75:26: @9.Call: core::panicking::panic_fmt(move _15) -&gt; bb17"><span class="annotation">@4,6,7,8,9⦊</span>assert_eq!(1, 1);<span class="annotation">⦉@4,6,7,8,9</span></span><span><span class="code odd" style="--layer: 1" title="75:9-75:26: @5[0]: _2 = const ()"><span class="annotation">⦉@5</span></span></span><span class="code" style="--layer: 0"></span></span>
<span class="line"><span class="code" style="--layer: 0"> } else {</span></span> <span class="line"><span class="code" style="--layer: 0"> } else {</span></span>
<span class="line"><span class="code" style="--layer: 0"> </span><span><span class="code even" style="--layer: 1" title="64:9-64:26: @11[0]: _37 = const ()"><span class="annotation">@11⦊</span></span></span><span class="code even" style="--layer: 2" title="64:9-64:26: @12[5]: _72 = const main::promoted[0] <span class="line"><span class="code" style="--layer: 0"> </span><span><span class="code even" style="--layer: 1" title="77:9-77:26: @11[0]: _37 = const ()"><span class="annotation">@11⦊</span></span></span><span class="code even" style="--layer: 2" title="77:9-77:26: @12[5]: _72 = const main::promoted[0]
64:9-64:26: @12[6]: _53 = &amp;(*_72) 77:9-77:26: @12[6]: _53 = &amp;(*_72)
64:9-64:26: @12[7]: _52 = &amp;(*_53) 77:9-77:26: @12[7]: _52 = &amp;(*_53)
64:9-64:26: @12[8]: _51 = move _52 as &amp;[&amp;str] (Pointer(Unsize)) 77:9-77:26: @12[8]: _51 = move _52 as &amp;[&amp;str] (Pointer(Unsize))
64:9-64:26: @12[17]: _61 = &amp;(*_43) 77:9-77:26: @12[17]: _61 = &amp;(*_43)
64:9-64:26: @12[18]: _60 = &amp;_61 77:9-77:26: @12[18]: _60 = &amp;_61
64:9-64:26: @12[21]: _63 = &amp;(*_44) 77:9-77:26: @12[21]: _63 = &amp;(*_44)
64:9-64:26: @12[22]: _62 = &amp;_63 77:9-77:26: @12[22]: _62 = &amp;_63
64:9-64:26: @12[23]: _59 = (move _60, move _62) 77:9-77:26: @12[23]: _59 = (move _60, move _62)
64:9-64:26: @12[26]: FakeRead(ForMatchedPlace, _59) 77:9-77:26: @12[26]: FakeRead(ForMatchedPlace, _59)
64:9-64:26: @12[28]: _64 = (_59.0: &amp;&amp;i32) 77:9-77:26: @12[28]: _64 = (_59.0: &amp;&amp;i32)
64:9-64:26: @12[30]: _65 = (_59.1: &amp;&amp;i32) 77:9-77:26: @12[30]: _65 = (_59.1: &amp;&amp;i32)
64:9-64:26: @12[33]: _67 = &amp;(*_64) 77:9-77:26: @12[33]: _67 = &amp;(*_64)
64:9-64:26: @12[35]: _68 = &lt;&amp;i32 as Debug&gt;::fmt as for&lt;&#39;r, &#39;s, &#39;t0&gt; fn(&amp;&#39;r &amp;i32, &amp;&#39;s mut std::fmt::Formatter&lt;&#39;t0&gt;) -&gt; std::result::Result&lt;(), std::fmt::Error&gt; (Pointer(ReifyFnPointer)) 77:9-77:26: @12[35]: _68 = &lt;&amp;i32 as Debug&gt;::fmt as for&lt;&#39;r, &#39;s, &#39;t0&gt; fn(&amp;&#39;r &amp;i32, &amp;&#39;s mut std::fmt::Formatter&lt;&#39;t0&gt;) -&gt; std::result::Result&lt;(), std::fmt::Error&gt; (Pointer(ReifyFnPointer))
64:9-64:26: @12.Call: _66 = ArgumentV1::new::&lt;&amp;i32&gt;(move _67, move _68) -&gt; [return: bb13, unwind: bb17] 77:9-77:26: @12.Call: _66 = ArgumentV1::new::&lt;&amp;i32&gt;(move _67, move _68) -&gt; [return: bb13, unwind: bb17]
64:9-64:26: @13[4]: _70 = &amp;(*_65) 77:9-77:26: @13[4]: _70 = &amp;(*_65)
64:9-64:26: @13[6]: _71 = &lt;&amp;i32 as Debug&gt;::fmt as for&lt;&#39;r, &#39;s, &#39;t0&gt; fn(&amp;&#39;r &amp;i32, &amp;&#39;s mut std::fmt::Formatter&lt;&#39;t0&gt;) -&gt; std::result::Result&lt;(), std::fmt::Error&gt; (Pointer(ReifyFnPointer)) 77:9-77:26: @13[6]: _71 = &lt;&amp;i32 as Debug&gt;::fmt as for&lt;&#39;r, &#39;s, &#39;t0&gt; fn(&amp;&#39;r &amp;i32, &amp;&#39;s mut std::fmt::Formatter&lt;&#39;t0&gt;) -&gt; std::result::Result&lt;(), std::fmt::Error&gt; (Pointer(ReifyFnPointer))
64:9-64:26: @13.Call: _69 = ArgumentV1::new::&lt;&amp;i32&gt;(move _70, move _71) -&gt; [return: bb14, unwind: bb17] 77:9-77:26: @13.Call: _69 = ArgumentV1::new::&lt;&amp;i32&gt;(move _70, move _71) -&gt; [return: bb14, unwind: bb17]
64:9-64:26: @14[2]: _58 = [move _66, move _69] 77:9-77:26: @14[2]: _58 = [move _66, move _69]
64:9-64:26: @14[7]: _57 = &amp;_58 77:9-77:26: @14[7]: _57 = &amp;_58
64:9-64:26: @14[8]: _56 = &amp;(*_57) 77:9-77:26: @14[8]: _56 = &amp;(*_57)
64:9-64:26: @14[9]: _55 = move _56 as &amp;[std::fmt::ArgumentV1] (Pointer(Unsize)) 77:9-77:26: @14[9]: _55 = move _56 as &amp;[std::fmt::ArgumentV1] (Pointer(Unsize))
64:9-64:26: @14.Call: _50 = Arguments::new_v1(move _51, move _55) -&gt; [return: bb15, unwind: bb17] 77:9-77:26: @14.Call: _50 = Arguments::new_v1(move _51, move _55) -&gt; [return: bb15, unwind: bb17]
64:9-64:26: @15.Call: core::panicking::panic_fmt(move _50) -&gt; bb17"><span class="annotation">@10,12,13,14,15⦊</span>assert_eq!(1, 2);<span class="annotation">⦉@10,12,13,14,15</span></span><span><span class="code even" style="--layer: 1" title="64:9-64:26: @11[0]: _37 = const ()"><span class="annotation">⦉@11</span></span></span><span class="code" style="--layer: 0"></span></span> 77:9-77:26: @15.Call: core::panicking::panic_fmt(move _50) -&gt; bb17"><span class="annotation">@10,12,13,14,15⦊</span>assert_eq!(1, 2);<span class="annotation">⦉@10,12,13,14,15</span></span><span><span class="code even" style="--layer: 1" title="77:9-77:26: @11[0]: _37 = const ()"><span class="annotation">⦉@11</span></span></span><span class="code" style="--layer: 0"></span></span>
<span class="line"><span class="code" style="--layer: 0"> }</span></span> <span class="line"><span class="code" style="--layer: 0"> }</span></span>
<span class="line"><span class="code" style="--layer: 0">}</span><span><span class="code odd" style="--layer: 1" title="66:2-66:2: @16.Return: return"><span class="annotation">@16⦊</span><span class="annotation">⦉@16</span></span></span></span></div> <span class="line"><span class="code" style="--layer: 0">}</span><span><span class="code odd" style="--layer: 1" title="79:2-79:2: @16.Return: return"><span class="annotation">@16⦊</span><span class="annotation">⦉@16</span></span></span></span></div>
</body> </body>
</html> </html>

View file

@ -20,12 +20,20 @@
//! //!
//! doctest returning a result: //! doctest returning a result:
//! ``` //! ```
//! #[derive(Debug)] //! #[derive(Debug, PartialEq)]
//! struct SomeError; //! struct SomeError {
//! let mut res = Err(SomeError); //! msg: String,
//! }
//! let mut res = Err(SomeError { msg: String::from("a message") });
//! if res.is_ok() { //! if res.is_ok() {
//! res?; //! res?;
//! } else { //! } else {
//! if *res.as_ref().unwrap_err() == *res.as_ref().unwrap_err() {
//! println!("{:?}", res);
//! }
//! if *res.as_ref().unwrap_err() == *res.as_ref().unwrap_err() {
//! res = Ok(1);
//! }
//! res = Ok(0); //! res = Ok(0);
//! } //! }
//! // need to be explicit because rustdoc cant infer the return type //! // need to be explicit because rustdoc cant infer the return type
@ -34,12 +42,17 @@
//! //!
//! doctest with custom main: //! doctest with custom main:
//! ``` //! ```
//! fn some_func() {
//! println!("called some_func()");
//! }
//!
//! #[derive(Debug)] //! #[derive(Debug)]
//! struct SomeError; //! struct SomeError;
//! //!
//! extern crate doctest_crate; //! extern crate doctest_crate;
//! //!
//! fn doctest_main() -> Result<(), SomeError> { //! fn doctest_main() -> Result<(), SomeError> {
//! some_func();
//! doctest_crate::fn_run_in_doctests(2); //! doctest_crate::fn_run_in_doctests(2);
//! Ok(()) //! Ok(())
//! } //! }
@ -64,3 +77,23 @@ fn main() {
assert_eq!(1, 2); assert_eq!(1, 2);
} }
} }
// FIXME(Swatinem): Fix known issue that coverage code region columns need to be offset by the
// doc comment line prefix (`///` or `//!`) and any additional indent (before or after the doc
// comment characters). This test produces `llvm-cov show` results demonstrating the problem.
//
// One of the above tests now includes: `derive(Debug, PartialEq)`, producing an `llvm-cov show`
// result with a distinct count for `Debug`, denoted by `^1`, but the caret points to the wrong
// column. Similarly, the `if` blocks without `else` blocks show `^0`, which should point at, or
// one character past, the `if` block's closing brace. In both cases, these are most likely off
// by the number of characters stripped from the beginning of each doc comment line: indent
// whitespace, if any, doc comment prefix (`//!` in this case) and (I assume) one space character
// (?). Note, when viewing `llvm-cov show` results in `--color` mode, the column offset errors are
// more pronounced, and show up in more places, with background color used to show some distinct
// code regions with different coverage counts.
//
// NOTE: Since the doc comment line prefix may vary, one possible solution is to replace each
// character stripped from the beginning of doc comment lines with a space. This will give coverage
// results the correct column offsets, and I think it should compile correctly, but I don't know
// what affect it might have on diagnostic messages from the compiler, and whether anyone would care
// if the indentation changed. I don't know if there is a more viable solution.

View file

@ -0,0 +1,3 @@
#![deny(broken_intra_doc_links)]
//! [static@u8::MIN]
//~^ ERROR incompatible link kind

View file

@ -0,0 +1,15 @@
error: incompatible link kind for `u8::MIN`
--> $DIR/incompatible-primitive-disambiguator.rs:2:6
|
LL | //! [static@u8::MIN]
| ^^^^^^^^^^^^^^ help: to link to the associated constant, prefix with `const@`: `const@u8::MIN`
|
note: the lint level is defined here
--> $DIR/incompatible-primitive-disambiguator.rs:1:9
|
LL | #![deny(broken_intra_doc_links)]
| ^^^^^^^^^^^^^^^^^^^^^^
= note: this link resolved to an associated constant, which is not a static
error: aborting due to previous error

View file

@ -0,0 +1,4 @@
#![deny(broken_intra_doc_links)]
// @has primitive_disambiguators/index.html
// @has - '//a/@href' 'https://doc.rust-lang.org/nightly/std/primitive.str.html#method.trim'
//! [str::trim()]

View file

@ -1,6 +1,8 @@
error[E0435]: attempt to use a non-constant value in a constant error[E0435]: attempt to use a non-constant value in a constant
--> $DIR/E0435.rs:3:17 --> $DIR/E0435.rs:3:17
| |
LL | let foo = 42u32;
| --- help: consider using `const` instead of `let`
LL | let _: [u8; foo]; LL | let _: [u8; foo];
| ^^^ non-constant value | ^^^ non-constant value

View file

@ -2,25 +2,33 @@ error[E0435]: attempt to use a non-constant value in a constant
--> $DIR/bindings.rs:5:29 --> $DIR/bindings.rs:5:29
| |
LL | const foo: impl Clone = x; LL | const foo: impl Clone = x;
| ^ non-constant value | --- ^ non-constant value
| |
| help: consider using `let` instead of `const`
error[E0435]: attempt to use a non-constant value in a constant error[E0435]: attempt to use a non-constant value in a constant
--> $DIR/bindings.rs:11:33 --> $DIR/bindings.rs:11:33
| |
LL | const foo: impl Clone = x; LL | const foo: impl Clone = x;
| ^ non-constant value | --- ^ non-constant value
| |
| help: consider using `let` instead of `const`
error[E0435]: attempt to use a non-constant value in a constant error[E0435]: attempt to use a non-constant value in a constant
--> $DIR/bindings.rs:18:33 --> $DIR/bindings.rs:18:33
| |
LL | const foo: impl Clone = x; LL | const foo: impl Clone = x;
| ^ non-constant value | --- ^ non-constant value
| |
| help: consider using `let` instead of `const`
error[E0435]: attempt to use a non-constant value in a constant error[E0435]: attempt to use a non-constant value in a constant
--> $DIR/bindings.rs:25:33 --> $DIR/bindings.rs:25:33
| |
LL | const foo: impl Clone = x; LL | const foo: impl Clone = x;
| ^ non-constant value | --- ^ non-constant value
| |
| help: consider using `let` instead of `const`
warning: the feature `impl_trait_in_bindings` is incomplete and may not be safe to use and/or cause compiler crashes warning: the feature `impl_trait_in_bindings` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/bindings.rs:1:12 --> $DIR/bindings.rs:1:12

View file

@ -2,7 +2,9 @@ error[E0435]: attempt to use a non-constant value in a constant
--> $DIR/issue-27433.rs:3:23 --> $DIR/issue-27433.rs:3:23
| |
LL | const FOO : u32 = foo; LL | const FOO : u32 = foo;
| ^^^ non-constant value | --- ^^^ non-constant value
| |
| help: consider using `let` instead of `const`
error: aborting due to previous error error: aborting due to previous error

View file

@ -2,7 +2,9 @@ error[E0435]: attempt to use a non-constant value in a constant
--> $DIR/issue-3521-2.rs:4:23 --> $DIR/issue-3521-2.rs:4:23
| |
LL | static y: isize = foo + 1; LL | static y: isize = foo + 1;
| ^^^ non-constant value | - ^^^ non-constant value
| |
| help: consider using `let` instead of `static`
error: aborting due to previous error error: aborting due to previous error

View file

@ -1,6 +1,9 @@
error[E0435]: attempt to use a non-constant value in a constant error[E0435]: attempt to use a non-constant value in a constant
--> $DIR/issue-3521.rs:6:15 --> $DIR/issue-3521.rs:6:15
| |
LL | let foo = 100;
| --- help: consider using `const` instead of `let`
...
LL | Bar = foo LL | Bar = foo
| ^^^ non-constant value | ^^^ non-constant value

View file

@ -2,7 +2,9 @@ error[E0435]: attempt to use a non-constant value in a constant
--> $DIR/issue-3668-2.rs:2:27 --> $DIR/issue-3668-2.rs:2:27
| |
LL | static child: isize = x + 1; LL | static child: isize = x + 1;
| ^ non-constant value | ----- ^ non-constant value
| |
| help: consider using `let` instead of `static`
error: aborting due to previous error error: aborting due to previous error

View file

@ -2,7 +2,9 @@ error[E0435]: attempt to use a non-constant value in a constant
--> $DIR/issue-3668.rs:8:34 --> $DIR/issue-3668.rs:8:34
| |
LL | static childVal: Box<P> = self.child.get(); LL | static childVal: Box<P> = self.child.get();
| ^^^^ non-constant value | -------- ^^^^ non-constant value
| |
| help: consider using `let` instead of `static`
error: aborting due to previous error error: aborting due to previous error

View file

@ -1,12 +1,16 @@
error[E0435]: attempt to use a non-constant value in a constant error[E0435]: attempt to use a non-constant value in a constant
--> $DIR/issue-42060.rs:3:23 --> $DIR/issue-42060.rs:3:23
| |
LL | let thing = ();
| ----- help: consider using `const` instead of `let`
LL | let other: typeof(thing) = thing; LL | let other: typeof(thing) = thing;
| ^^^^^ non-constant value | ^^^^^ non-constant value
error[E0435]: attempt to use a non-constant value in a constant error[E0435]: attempt to use a non-constant value in a constant
--> $DIR/issue-42060.rs:9:13 --> $DIR/issue-42060.rs:9:13
| |
LL | let q = 1;
| - help: consider using `const` instead of `let`
LL | <typeof(q)>::N LL | <typeof(q)>::N
| ^ non-constant value | ^ non-constant value

View file

@ -1,6 +1,9 @@
error[E0435]: attempt to use a non-constant value in a constant error[E0435]: attempt to use a non-constant value in a constant
--> $DIR/issue-44239.rs:6:26 --> $DIR/issue-44239.rs:6:26
| |
LL | let n = 0;
| - help: consider using `const` instead of `let`
...
LL | const N: usize = n; LL | const N: usize = n;
| ^ non-constant value | ^ non-constant value

View file

@ -0,0 +1,21 @@
// Ensures -Zmir-opt-level=2 (specifically, inlining) is not allowed with -Zinstrument-coverage.
// Regression test for issue #80060.
//
// needs-profiler-support
// build-pass
// compile-flags: -Zmir-opt-level=2 -Zinstrument-coverage
#[inline(never)]
fn foo() {}
pub fn baz() {
bar();
}
#[inline(always)]
fn bar() {
foo();
}
fn main() {
bar();
}

View file

@ -0,0 +1,2 @@
warning: `-Z mir-opt-level=2` (or any level > 1) enables function inlining, which is incompatible with `-Z instrument-coverage`. Inlining will be disabled.

View file

@ -1,6 +1,8 @@
error[E0435]: attempt to use a non-constant value in a constant error[E0435]: attempt to use a non-constant value in a constant
--> $DIR/non-constant-expr-for-arr-len.rs:5:22 --> $DIR/non-constant-expr-for-arr-len.rs:5:22
| |
LL | fn bar(n: usize) {
| - help: consider using `const` instead of `let`
LL | let _x = [0; n]; LL | let _x = [0; n];
| ^ non-constant value | ^ non-constant value

View file

@ -1211,141 +1211,141 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [
Punct { Punct {
ch: '#', ch: '#',
spacing: Alone, spacing: Alone,
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Group { Group {
delimiter: Bracket, delimiter: Bracket,
stream: TokenStream [ stream: TokenStream [
Ident { Ident {
ident: "allow", ident: "allow",
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Group { Group {
delimiter: Parenthesis, delimiter: Parenthesis,
stream: TokenStream [ stream: TokenStream [
Ident { Ident {
ident: "dead_code", ident: "dead_code",
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
], ],
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
], ],
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Punct { Punct {
ch: '#', ch: '#',
spacing: Alone, spacing: Alone,
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Group { Group {
delimiter: Bracket, delimiter: Bracket,
stream: TokenStream [ stream: TokenStream [
Ident { Ident {
ident: "print_helper", ident: "print_helper",
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Group { Group {
delimiter: Parenthesis, delimiter: Parenthesis,
stream: TokenStream [ stream: TokenStream [
Ident { Ident {
ident: "b", ident: "b",
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
], ],
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
], ],
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Punct { Punct {
ch: '#', ch: '#',
spacing: Alone, spacing: Alone,
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Group { Group {
delimiter: Bracket, delimiter: Bracket,
stream: TokenStream [ stream: TokenStream [
Ident { Ident {
ident: "print_helper", ident: "print_helper",
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Group { Group {
delimiter: Parenthesis, delimiter: Parenthesis,
stream: TokenStream [ stream: TokenStream [
Ident { Ident {
ident: "a", ident: "a",
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
], ],
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
], ],
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Ident { Ident {
ident: "struct", ident: "struct",
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Ident { Ident {
ident: "Foo", ident: "Foo",
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Punct { Punct {
ch: '<', ch: '<',
spacing: Alone, spacing: Alone,
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Ident { Ident {
ident: "B", ident: "B",
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Punct { Punct {
ch: '>', ch: '>',
spacing: Alone, spacing: Alone,
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Group { Group {
delimiter: Brace, delimiter: Brace,
stream: TokenStream [ stream: TokenStream [
Ident { Ident {
ident: "second", ident: "second",
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Punct { Punct {
ch: ':', ch: ':',
spacing: Alone, spacing: Alone,
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Ident { Ident {
ident: "bool", ident: "bool",
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Punct { Punct {
ch: ',', ch: ',',
spacing: Alone, spacing: Alone,
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Ident { Ident {
ident: "third", ident: "third",
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Punct { Punct {
ch: ':', ch: ':',
spacing: Alone, spacing: Alone,
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Group { Group {
delimiter: Bracket, delimiter: Bracket,
stream: TokenStream [ stream: TokenStream [
Ident { Ident {
ident: "u8", ident: "u8",
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Punct { Punct {
ch: ';', ch: ';',
spacing: Alone, spacing: Alone,
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Group { Group {
delimiter: Brace, delimiter: Brace,
@ -1353,58 +1353,58 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [
Punct { Punct {
ch: '#', ch: '#',
spacing: Alone, spacing: Alone,
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Group { Group {
delimiter: Bracket, delimiter: Bracket,
stream: TokenStream [ stream: TokenStream [
Ident { Ident {
ident: "cfg", ident: "cfg",
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Group { Group {
delimiter: Parenthesis, delimiter: Parenthesis,
stream: TokenStream [ stream: TokenStream [
Ident { Ident {
ident: "not", ident: "not",
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Group { Group {
delimiter: Parenthesis, delimiter: Parenthesis,
stream: TokenStream [ stream: TokenStream [
Ident { Ident {
ident: "FALSE", ident: "FALSE",
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
], ],
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
], ],
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
], ],
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Ident { Ident {
ident: "struct", ident: "struct",
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Ident { Ident {
ident: "Inner", ident: "Inner",
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Punct { Punct {
ch: ';', ch: ';',
spacing: Alone, spacing: Alone,
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Ident { Ident {
ident: "match", ident: "match",
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Ident { Ident {
ident: "true", ident: "true",
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Group { Group {
delimiter: Brace, delimiter: Brace,
@ -1412,146 +1412,146 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [
Punct { Punct {
ch: '#', ch: '#',
spacing: Alone, spacing: Alone,
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Group { Group {
delimiter: Bracket, delimiter: Bracket,
stream: TokenStream [ stream: TokenStream [
Ident { Ident {
ident: "allow", ident: "allow",
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Group { Group {
delimiter: Parenthesis, delimiter: Parenthesis,
stream: TokenStream [ stream: TokenStream [
Ident { Ident {
ident: "warnings", ident: "warnings",
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
], ],
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
], ],
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Ident { Ident {
ident: "false", ident: "false",
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Punct { Punct {
ch: '=', ch: '=',
spacing: Joint, spacing: Joint,
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Punct { Punct {
ch: '>', ch: '>',
spacing: Alone, spacing: Alone,
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Group { Group {
delimiter: Brace, delimiter: Brace,
stream: TokenStream [], stream: TokenStream [],
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Ident { Ident {
ident: "_", ident: "_",
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Punct { Punct {
ch: '=', ch: '=',
spacing: Joint, spacing: Joint,
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Punct { Punct {
ch: '>', ch: '>',
spacing: Alone, spacing: Alone,
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Group { Group {
delimiter: Brace, delimiter: Brace,
stream: TokenStream [], stream: TokenStream [],
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
], ],
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Punct { Punct {
ch: ';', ch: ';',
spacing: Alone, spacing: Alone,
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Punct { Punct {
ch: '#', ch: '#',
spacing: Alone, spacing: Alone,
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Group { Group {
delimiter: Bracket, delimiter: Bracket,
stream: TokenStream [ stream: TokenStream [
Ident { Ident {
ident: "print_helper", ident: "print_helper",
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Group { Group {
delimiter: Parenthesis, delimiter: Parenthesis,
stream: TokenStream [ stream: TokenStream [
Ident { Ident {
ident: "c", ident: "c",
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
], ],
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
], ],
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Punct { Punct {
ch: '#', ch: '#',
spacing: Alone, spacing: Alone,
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Group { Group {
delimiter: Bracket, delimiter: Bracket,
stream: TokenStream [ stream: TokenStream [
Ident { Ident {
ident: "cfg", ident: "cfg",
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Group { Group {
delimiter: Parenthesis, delimiter: Parenthesis,
stream: TokenStream [ stream: TokenStream [
Ident { Ident {
ident: "not", ident: "not",
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Group { Group {
delimiter: Parenthesis, delimiter: Parenthesis,
stream: TokenStream [ stream: TokenStream [
Ident { Ident {
ident: "FALSE", ident: "FALSE",
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
], ],
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
], ],
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
], ],
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Ident { Ident {
ident: "fn", ident: "fn",
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Ident { Ident {
ident: "kept_fn", ident: "kept_fn",
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Group { Group {
delimiter: Parenthesis, delimiter: Parenthesis,
stream: TokenStream [], stream: TokenStream [],
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Group { Group {
delimiter: Brace, delimiter: Brace,
@ -1559,82 +1559,82 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [
Punct { Punct {
ch: '#', ch: '#',
spacing: Joint, spacing: Joint,
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Punct { Punct {
ch: '!', ch: '!',
spacing: Alone, spacing: Alone,
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Group { Group {
delimiter: Bracket, delimiter: Bracket,
stream: TokenStream [ stream: TokenStream [
Ident { Ident {
ident: "cfg", ident: "cfg",
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Group { Group {
delimiter: Parenthesis, delimiter: Parenthesis,
stream: TokenStream [ stream: TokenStream [
Ident { Ident {
ident: "not", ident: "not",
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Group { Group {
delimiter: Parenthesis, delimiter: Parenthesis,
stream: TokenStream [ stream: TokenStream [
Ident { Ident {
ident: "FALSE", ident: "FALSE",
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
], ],
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
], ],
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
], ],
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Ident { Ident {
ident: "let", ident: "let",
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Ident { Ident {
ident: "my_val", ident: "my_val",
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Punct { Punct {
ch: '=', ch: '=',
spacing: Alone, spacing: Alone,
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Ident { Ident {
ident: "true", ident: "true",
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Punct { Punct {
ch: ';', ch: ';',
spacing: Alone, spacing: Alone,
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
], ],
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Ident { Ident {
ident: "enum", ident: "enum",
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Ident { Ident {
ident: "TupleEnum", ident: "TupleEnum",
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Group { Group {
delimiter: Brace, delimiter: Brace,
stream: TokenStream [ stream: TokenStream [
Ident { Ident {
ident: "Foo", ident: "Foo",
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Group { Group {
delimiter: Parenthesis, delimiter: Parenthesis,
@ -1642,69 +1642,69 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [
Punct { Punct {
ch: '#', ch: '#',
spacing: Alone, spacing: Alone,
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Group { Group {
delimiter: Bracket, delimiter: Bracket,
stream: TokenStream [ stream: TokenStream [
Ident { Ident {
ident: "cfg", ident: "cfg",
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Group { Group {
delimiter: Parenthesis, delimiter: Parenthesis,
stream: TokenStream [ stream: TokenStream [
Ident { Ident {
ident: "not", ident: "not",
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Group { Group {
delimiter: Parenthesis, delimiter: Parenthesis,
stream: TokenStream [ stream: TokenStream [
Ident { Ident {
ident: "FALSE", ident: "FALSE",
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
], ],
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
], ],
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
], ],
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Ident { Ident {
ident: "i32", ident: "i32",
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Punct { Punct {
ch: ',', ch: ',',
spacing: Alone, spacing: Alone,
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Ident { Ident {
ident: "u8", ident: "u8",
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
], ],
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Punct { Punct {
ch: ',', ch: ',',
spacing: Alone, spacing: Alone,
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
], ],
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Ident { Ident {
ident: "struct", ident: "struct",
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Ident { Ident {
ident: "TupleStruct", ident: "TupleStruct",
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Group { Group {
delimiter: Parenthesis, delimiter: Parenthesis,
@ -1712,120 +1712,120 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [
Punct { Punct {
ch: '#', ch: '#',
spacing: Alone, spacing: Alone,
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Group { Group {
delimiter: Bracket, delimiter: Bracket,
stream: TokenStream [ stream: TokenStream [
Ident { Ident {
ident: "cfg", ident: "cfg",
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Group { Group {
delimiter: Parenthesis, delimiter: Parenthesis,
stream: TokenStream [ stream: TokenStream [
Ident { Ident {
ident: "not", ident: "not",
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Group { Group {
delimiter: Parenthesis, delimiter: Parenthesis,
stream: TokenStream [ stream: TokenStream [
Ident { Ident {
ident: "FALSE", ident: "FALSE",
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
], ],
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
], ],
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
], ],
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Ident { Ident {
ident: "i32", ident: "i32",
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Punct { Punct {
ch: ',', ch: ',',
spacing: Alone, spacing: Alone,
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Ident { Ident {
ident: "u8", ident: "u8",
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
], ],
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Punct { Punct {
ch: ';', ch: ';',
spacing: Alone, spacing: Alone,
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Literal { Literal {
kind: Integer, kind: Integer,
symbol: "0", symbol: "0",
suffix: None, suffix: None,
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
], ],
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
], ],
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Punct { Punct {
ch: ',', ch: ',',
spacing: Alone, spacing: Alone,
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Punct { Punct {
ch: '#', ch: '#',
spacing: Alone, spacing: Alone,
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Group { Group {
delimiter: Bracket, delimiter: Bracket,
stream: TokenStream [ stream: TokenStream [
Ident { Ident {
ident: "print_helper", ident: "print_helper",
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Group { Group {
delimiter: Parenthesis, delimiter: Parenthesis,
stream: TokenStream [ stream: TokenStream [
Ident { Ident {
ident: "d", ident: "d",
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
], ],
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
], ],
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Ident { Ident {
ident: "fourth", ident: "fourth",
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Punct { Punct {
ch: ':', ch: ':',
spacing: Alone, spacing: Alone,
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Ident { Ident {
ident: "B", ident: "B",
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
Punct { Punct {
ch: ',', ch: ',',
spacing: Alone, spacing: Alone,
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
], ],
span: $DIR/issue-75930-derive-cfg.rs:1:1: 1:1 (#0), span: $DIR/issue-75930-derive-cfg.rs:21:1: 64:2 (#0),
}, },
] ]

View file

@ -34,11 +34,11 @@ PRINT-BANG INPUT (DEBUG): TokenStream [
stream: TokenStream [ stream: TokenStream [
Ident { Ident {
ident: "mod", ident: "mod",
span: $DIR/issue-78675-captured-inner-attrs.rs:22:13: 22:18 (#4), span: $DIR/issue-78675-captured-inner-attrs.rs:27:5: 29:6 (#0),
}, },
Ident { Ident {
ident: "bar", ident: "bar",
span: $DIR/issue-78675-captured-inner-attrs.rs:22:13: 22:18 (#4), span: $DIR/issue-78675-captured-inner-attrs.rs:27:5: 29:6 (#0),
}, },
Group { Group {
delimiter: Brace, delimiter: Brace,
@ -46,36 +46,36 @@ PRINT-BANG INPUT (DEBUG): TokenStream [
Punct { Punct {
ch: '#', ch: '#',
spacing: Joint, spacing: Joint,
span: $DIR/issue-78675-captured-inner-attrs.rs:22:13: 22:18 (#4), span: $DIR/issue-78675-captured-inner-attrs.rs:27:5: 29:6 (#0),
}, },
Punct { Punct {
ch: '!', ch: '!',
spacing: Alone, spacing: Alone,
span: $DIR/issue-78675-captured-inner-attrs.rs:22:13: 22:18 (#4), span: $DIR/issue-78675-captured-inner-attrs.rs:27:5: 29:6 (#0),
}, },
Group { Group {
delimiter: Bracket, delimiter: Bracket,
stream: TokenStream [ stream: TokenStream [
Ident { Ident {
ident: "doc", ident: "doc",
span: $DIR/issue-78675-captured-inner-attrs.rs:22:13: 22:18 (#4), span: $DIR/issue-78675-captured-inner-attrs.rs:27:5: 29:6 (#0),
}, },
Punct { Punct {
ch: '=', ch: '=',
spacing: Alone, spacing: Alone,
span: $DIR/issue-78675-captured-inner-attrs.rs:22:13: 22:18 (#4), span: $DIR/issue-78675-captured-inner-attrs.rs:27:5: 29:6 (#0),
}, },
Literal { Literal {
kind: StrRaw(0), kind: StrRaw(0),
symbol: " Foo", symbol: " Foo",
suffix: None, suffix: None,
span: $DIR/issue-78675-captured-inner-attrs.rs:22:13: 22:18 (#4), span: $DIR/issue-78675-captured-inner-attrs.rs:27:5: 29:6 (#0),
}, },
], ],
span: $DIR/issue-78675-captured-inner-attrs.rs:22:13: 22:18 (#4), span: $DIR/issue-78675-captured-inner-attrs.rs:27:5: 29:6 (#0),
}, },
], ],
span: $DIR/issue-78675-captured-inner-attrs.rs:22:13: 22:18 (#4), span: $DIR/issue-78675-captured-inner-attrs.rs:27:5: 29:6 (#0),
}, },
], ],
span: $DIR/issue-78675-captured-inner-attrs.rs:22:13: 22:18 (#4), span: $DIR/issue-78675-captured-inner-attrs.rs:22:13: 22:18 (#4),

View file

@ -1,6 +1,8 @@
error[E0435]: attempt to use a non-constant value in a constant error[E0435]: attempt to use a non-constant value in a constant
--> $DIR/repeat_count.rs:5:17 --> $DIR/repeat_count.rs:5:17
| |
LL | let n = 1;
| - help: consider using `const` instead of `let`
LL | let a = [0; n]; LL | let a = [0; n];
| ^ non-constant value | ^ non-constant value

View file

@ -2,7 +2,9 @@ error[E0435]: attempt to use a non-constant value in a constant
--> $DIR/type-dependent-def-issue-49241.rs:3:22 --> $DIR/type-dependent-def-issue-49241.rs:3:22
| |
LL | const l: usize = v.count(); LL | const l: usize = v.count();
| ^ non-constant value | - ^ non-constant value
| |
| help: consider using `let` instead of `const`
error: aborting due to previous error error: aborting due to previous error