Auto merge of #82634 - osa1:osa1/remove_old_fixme, r=Mark-Simulacrum
Remove an old FIXME comment and inline attribute
Apparently #35870 caused a problem in this code (which originally
returned an impl trait) and `#[inline]` was added as a workaround, in
ade79d76090.
The issue is now fixed and the comment and `#[inline]` can now be
removed.
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 13b312a..99a0c0b 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -63,7 +63,7 @@
run: "echo \"[CI_PR_NUMBER=$num]\""
env:
num: "${{ github.event.number }}"
- if: "success() && !env.SKIP_JOBS && github.event_name == 'pull_request'"
+ if: "success() && !env.SKIP_JOB && github.event_name == 'pull_request'"
- name: add extra environment variables
run: src/ci/scripts/setup-environment.sh
env:
@@ -425,7 +425,7 @@
run: "echo \"[CI_PR_NUMBER=$num]\""
env:
num: "${{ github.event.number }}"
- if: "success() && !env.SKIP_JOBS && github.event_name == 'pull_request'"
+ if: "success() && !env.SKIP_JOB && github.event_name == 'pull_request'"
- name: add extra environment variables
run: src/ci/scripts/setup-environment.sh
env:
@@ -532,7 +532,7 @@
run: "echo \"[CI_PR_NUMBER=$num]\""
env:
num: "${{ github.event.number }}"
- if: "success() && !env.SKIP_JOBS && github.event_name == 'pull_request'"
+ if: "success() && !env.SKIP_JOB && github.event_name == 'pull_request'"
- name: add extra environment variables
run: src/ci/scripts/setup-environment.sh
env:
diff --git a/Cargo.lock b/Cargo.lock
index 6e95fd6a..2e46d43 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1767,7 +1767,7 @@
"regex",
"serde",
"serde_json",
- "shlex",
+ "shlex 0.1.1",
]
[[package]]
@@ -2122,9 +2122,9 @@
[[package]]
name = "mdbook"
-version = "0.4.6"
+version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b3d948b64449003363127ed6c6139f03273982c3fe97da4cb3dee933e38ce38f"
+checksum = "28f6a882f3880ec68e96f60d6b543c34941e2f307ad10e2992e4db9acfe96529"
dependencies = [
"ammonia",
"anyhow",
@@ -2142,7 +2142,7 @@
"serde",
"serde_derive",
"serde_json",
- "shlex",
+ "shlex 1.0.0",
"tempfile",
"toml",
]
@@ -4554,6 +4554,9 @@
"serde_json",
"smallvec 1.6.1",
"tempfile",
+ "tracing",
+ "tracing-subscriber",
+ "tracing-tree",
]
[[package]]
@@ -4859,6 +4862,12 @@
checksum = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2"
[[package]]
+name = "shlex"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "42a568c8f2cd051a4d283bd6eb0343ac214c1b0f1ac19f93e1175b2dee38c73d"
+
+[[package]]
name = "signal-hook-registry"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
diff --git a/RELEASES.md b/RELEASES.md
index 25f9c80..5dca7ab 100644
--- a/RELEASES.md
+++ b/RELEASES.md
@@ -68,7 +68,7 @@
- `saturating_pow` for all integer types.
- `wrapping_pow` for all integer types.
- `next_power_of_two` for all unsigned integer types.
-- `checked_power_of_two` for all unsigned integer types.
+- `checked_next_power_of_two` for all unsigned integer types.
Cargo
-----------------------
diff --git a/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/find_anon_type.rs b/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/find_anon_type.rs
index ffdaedf..d9ab831 100644
--- a/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/find_anon_type.rs
+++ b/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/find_anon_type.rs
@@ -19,7 +19,7 @@
/// { x.push(y); }
/// ```
/// The function returns the nested type corresponding to the anonymous region
-/// for e.g., `&u8` and Vec<`&u8`.
+/// for e.g., `&u8` and `Vec<&u8>`.
pub(crate) fn find_anon_type(
tcx: TyCtxt<'tcx>,
region: Region<'tcx>,
diff --git a/compiler/rustc_infer/src/infer/nll_relate/mod.rs b/compiler/rustc_infer/src/infer/nll_relate/mod.rs
index e720a6f..e5eb771 100644
--- a/compiler/rustc_infer/src/infer/nll_relate/mod.rs
+++ b/compiler/rustc_infer/src/infer/nll_relate/mod.rs
@@ -44,7 +44,7 @@ pub struct TypeRelating<'me, 'tcx, D>
{
infcx: &'me InferCtxt<'me, 'tcx>,
- /// Callback to use when we deduce an outlives relationship
+ /// Callback to use when we deduce an outlives relationship.
delegate: D,
/// How are we relating `a` and `b`?
@@ -768,7 +768,7 @@ fn visit_region(&mut self, r: ty::Region<'tcx>) -> ControlFlow<Self::BreakTy> {
}
}
-/// The "type generalize" is used when handling inference variables.
+/// The "type generalizer" is used when handling inference variables.
///
/// The basic strategy for handling a constraint like `?A <: B` is to
/// apply a "generalization strategy" to the type `B` -- this replaces
diff --git a/compiler/rustc_lint/src/levels.rs b/compiler/rustc_lint/src/levels.rs
index cc5b7ef..dbcab72 100644
--- a/compiler/rustc_lint/src/levels.rs
+++ b/compiler/rustc_lint/src/levels.rs
@@ -321,17 +321,18 @@ pub(crate) fn push(
None
};
let name = meta_item.path.segments.last().expect("empty lint name").ident.name;
- match store.check_lint_name(&name.as_str(), tool_name) {
+ let lint_result = store.check_lint_name(&name.as_str(), tool_name);
+ match &lint_result {
CheckLintNameResult::Ok(ids) => {
let src = LintLevelSource::Node(name, li.span(), reason);
- for &id in ids {
+ for &id in *ids {
self.check_gated_lint(id, attr.span);
self.insert_spec(&mut specs, id, (level, src));
}
}
CheckLintNameResult::Tool(result) => {
- match result {
+ match *result {
Ok(ids) => {
let complete_name = &format!("{}::{}", tool_name.unwrap(), name);
let src = LintLevelSource::Node(
@@ -343,7 +344,7 @@ pub(crate) fn push(
self.insert_spec(&mut specs, *id, (level, src));
}
}
- Err((Some(ids), new_lint_name)) => {
+ Err((Some(ids), ref new_lint_name)) => {
let lint = builtin::RENAMED_AND_REMOVED_LINTS;
let (lvl, src) =
self.sets.get_lint_level(lint, self.cur, Some(&specs), &sess);
@@ -392,21 +393,21 @@ pub(crate) fn push(
CheckLintNameResult::Warning(msg, renamed) => {
let lint = builtin::RENAMED_AND_REMOVED_LINTS;
- let (level, src) =
+ let (renamed_lint_level, src) =
self.sets.get_lint_level(lint, self.cur, Some(&specs), &sess);
struct_lint_level(
self.sess,
lint,
- level,
+ renamed_lint_level,
src,
Some(li.span().into()),
|lint| {
let mut err = lint.build(&msg);
- if let Some(new_name) = renamed {
+ if let Some(new_name) = &renamed {
err.span_suggestion(
li.span(),
"use the new name",
- new_name,
+ new_name.to_string(),
Applicability::MachineApplicable,
);
}
@@ -444,6 +445,22 @@ pub(crate) fn push(
);
}
}
+ // If this lint was renamed, apply the new lint instead of ignoring the attribute.
+ // This happens outside of the match because the new lint should be applied even if
+ // we don't warn about the name change.
+ if let CheckLintNameResult::Warning(_, Some(new_name)) = lint_result {
+ // Ignore any errors or warnings that happen because the new name is inaccurate
+ if let CheckLintNameResult::Ok(ids) =
+ store.check_lint_name(&new_name, tool_name)
+ {
+ let src =
+ LintLevelSource::Node(Symbol::intern(&new_name), li.span(), reason);
+ for &id in ids {
+ self.check_gated_lint(id, attr.span);
+ self.insert_spec(&mut specs, id, (level, src));
+ }
+ }
+ }
}
}
diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs
index 686d09d..46138df 100644
--- a/compiler/rustc_lint_defs/src/builtin.rs
+++ b/compiler/rustc_lint_defs/src/builtin.rs
@@ -1080,6 +1080,7 @@
pub UNALIGNED_REFERENCES,
Allow,
"detects unaligned references to fields of packed structs",
+ report_in_external_macro
}
declare_lint! {
diff --git a/compiler/rustc_mir/src/transform/check_consts/ops.rs b/compiler/rustc_mir/src/transform/check_consts/ops.rs
index 6f98760..a18c1f7 100644
--- a/compiler/rustc_mir/src/transform/check_consts/ops.rs
+++ b/compiler/rustc_mir/src/transform/check_consts/ops.rs
@@ -377,6 +377,18 @@ fn build_error(&self, ccx: &ConstCx<'_, 'tcx>, span: Span) -> DiagnosticBuilder<
}
}
+/// A call to a `panic()` lang item where the first argument is _not_ a `&str`.
+#[derive(Debug)]
+pub struct PanicNonStr;
+impl NonConstOp for PanicNonStr {
+ fn build_error(&self, ccx: &ConstCx<'_, 'tcx>, span: Span) -> DiagnosticBuilder<'tcx> {
+ ccx.tcx.sess.struct_span_err(
+ span,
+ "argument to `panic!()` in a const context must have type `&str`",
+ )
+ }
+}
+
#[derive(Debug)]
pub struct RawPtrComparison;
impl NonConstOp for RawPtrComparison {
diff --git a/compiler/rustc_mir/src/transform/check_consts/validation.rs b/compiler/rustc_mir/src/transform/check_consts/validation.rs
index a826368..2845f27 100644
--- a/compiler/rustc_mir/src/transform/check_consts/validation.rs
+++ b/compiler/rustc_mir/src/transform/check_consts/validation.rs
@@ -819,7 +819,7 @@ fn visit_terminator(&mut self, terminator: &Terminator<'tcx>, location: Location
self.super_terminator(terminator, location);
match &terminator.kind {
- TerminatorKind::Call { func, .. } => {
+ TerminatorKind::Call { func, args, .. } => {
let ConstCx { tcx, body, param_env, .. } = *self.ccx;
let caller = self.def_id().to_def_id();
@@ -881,9 +881,17 @@ fn visit_terminator(&mut self, terminator: &Terminator<'tcx>, location: Location
}
// At this point, we are calling a function, `callee`, whose `DefId` is known...
-
if is_lang_panic_fn(tcx, callee) {
self.check_op(ops::Panic);
+
+ // const-eval of the `begin_panic` fn assumes the argument is `&str`
+ if Some(callee) == tcx.lang_items().begin_panic_fn() {
+ match args[0].ty(&self.ccx.body.local_decls, tcx).kind() {
+ ty::Ref(_, ty, _) if ty.is_str() => (),
+ _ => self.check_op(ops::PanicNonStr),
+ }
+ }
+
return;
}
diff --git a/compiler/rustc_mir/src/transform/mod.rs b/compiler/rustc_mir/src/transform/mod.rs
index a79f855..cc6b2ff 100644
--- a/compiler/rustc_mir/src/transform/mod.rs
+++ b/compiler/rustc_mir/src/transform/mod.rs
@@ -42,6 +42,7 @@
pub mod nrvo;
pub mod promote_consts;
pub mod remove_noop_landing_pads;
+pub mod remove_storage_markers;
pub mod remove_unneeded_drops;
pub mod required_consts;
pub mod rustc_peek;
@@ -493,6 +494,7 @@ fn run_optimization_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
// The main optimizations that we do on MIR.
let optimizations: &[&dyn MirPass<'tcx>] = &[
+ &remove_storage_markers::RemoveStorageMarkers,
&const_goto::ConstGoto,
&remove_unneeded_drops::RemoveUnneededDrops,
&match_branches::MatchBranchSimplification,
diff --git a/compiler/rustc_mir/src/transform/remove_storage_markers.rs b/compiler/rustc_mir/src/transform/remove_storage_markers.rs
new file mode 100644
index 0000000..2d529fe
--- /dev/null
+++ b/compiler/rustc_mir/src/transform/remove_storage_markers.rs
@@ -0,0 +1,25 @@
+//! This pass removes storage markers if they won't be emitted during codegen.
+
+use crate::transform::MirPass;
+use rustc_middle::mir::*;
+use rustc_middle::ty::TyCtxt;
+
+pub struct RemoveStorageMarkers;
+
+impl<'tcx> MirPass<'tcx> for RemoveStorageMarkers {
+ fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
+ if tcx.sess.emit_lifetime_markers() {
+ return;
+ }
+
+ trace!("Running RemoveStorageMarkers on {:?}", body.source);
+ for data in body.basic_blocks_mut() {
+ data.statements.retain(|statement| match statement.kind {
+ StatementKind::StorageLive(..)
+ | StatementKind::StorageDead(..)
+ | StatementKind::Nop => false,
+ _ => true,
+ })
+ }
+ }
+}
diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs
index cf08881..afd1642 100644
--- a/compiler/rustc_passes/src/check_attr.rs
+++ b/compiler/rustc_passes/src/check_attr.rs
@@ -544,6 +544,41 @@ fn check_doc_attrs(&self, attr: &Attribute, hir_id: HirId, target: Target) -> bo
{
return false;
}
+ } else if let Some(i_meta) = meta.meta_item() {
+ if ![
+ sym::cfg,
+ sym::hidden,
+ sym::html_favicon_url,
+ sym::html_logo_url,
+ sym::html_no_source,
+ sym::html_playground_url,
+ sym::html_root_url,
+ sym::include,
+ sym::inline,
+ sym::issue_tracker_base_url,
+ sym::masked,
+ sym::no_default_passes, // deprecated
+ sym::no_inline,
+ sym::passes, // deprecated
+ sym::primitive,
+ sym::spotlight,
+ sym::test,
+ ]
+ .iter()
+ .any(|m| i_meta.has_name(*m))
+ {
+ self.tcx
+ .sess
+ .struct_span_err(
+ meta.span(),
+ &format!(
+ "unknown `doc` attribute `{}`",
+ i_meta.name_or_empty(),
+ ),
+ )
+ .emit();
+ return false;
+ }
}
}
}
diff --git a/compiler/rustc_passes/src/liveness.rs b/compiler/rustc_passes/src/liveness.rs
index 82f1977..a96f332 100644
--- a/compiler/rustc_passes/src/liveness.rs
+++ b/compiler/rustc_passes/src/liveness.rs
@@ -1494,12 +1494,13 @@ fn check_unused_vars_in_pat(
// bindings, and we also consider the first pattern to be the "authoritative" set of ids.
// However, we should take the ids and spans of variables with the same name from the later
// patterns so the suggestions to prefix with underscores will apply to those too.
- let mut vars: FxIndexMap<Symbol, (LiveNode, Variable, Vec<(HirId, Span)>)> = <_>::default();
+ let mut vars: FxIndexMap<Symbol, (LiveNode, Variable, Vec<(HirId, Span, Span)>)> =
+ <_>::default();
pat.each_binding(|_, hir_id, pat_sp, ident| {
let ln = entry_ln.unwrap_or_else(|| self.live_node(hir_id, pat_sp));
let var = self.variable(hir_id, ident.span);
- let id_and_sp = (hir_id, pat_sp);
+ let id_and_sp = (hir_id, pat_sp, ident.span);
vars.entry(self.ir.variable_name(var))
.and_modify(|(.., hir_ids_and_spans)| hir_ids_and_spans.push(id_and_sp))
.or_insert_with(|| (ln, var, vec![id_and_sp]));
@@ -1508,7 +1509,8 @@ fn check_unused_vars_in_pat(
for (_, (ln, var, hir_ids_and_spans)) in vars {
if self.used_on_entry(ln, var) {
let id = hir_ids_and_spans[0].0;
- let spans = hir_ids_and_spans.into_iter().map(|(_, sp)| sp).collect();
+ let spans =
+ hir_ids_and_spans.into_iter().map(|(_, _, ident_span)| ident_span).collect();
on_used_on_entry(spans, id, ln, var);
} else {
self.report_unused(hir_ids_and_spans, ln, var);
@@ -1516,7 +1518,12 @@ fn check_unused_vars_in_pat(
}
}
- fn report_unused(&self, hir_ids_and_spans: Vec<(HirId, Span)>, ln: LiveNode, var: Variable) {
+ fn report_unused(
+ &self,
+ hir_ids_and_spans: Vec<(HirId, Span, Span)>,
+ ln: LiveNode,
+ var: Variable,
+ ) {
let first_hir_id = hir_ids_and_spans[0].0;
if let Some(name) = self.should_warn(var).filter(|name| name != "self") {
@@ -1530,7 +1537,10 @@ fn report_unused(&self, hir_ids_and_spans: Vec<(HirId, Span)>, ln: LiveNode, var
self.ir.tcx.struct_span_lint_hir(
lint::builtin::UNUSED_VARIABLES,
first_hir_id,
- hir_ids_and_spans.into_iter().map(|(_, sp)| sp).collect::<Vec<_>>(),
+ hir_ids_and_spans
+ .into_iter()
+ .map(|(_, _, ident_span)| ident_span)
+ .collect::<Vec<_>>(),
|lint| {
lint.build(&format!("variable `{}` is assigned to, but never used", name))
.note(&format!("consider using `_{}` instead", name))
@@ -1538,54 +1548,67 @@ fn report_unused(&self, hir_ids_and_spans: Vec<(HirId, Span)>, ln: LiveNode, var
},
)
} else {
- self.ir.tcx.struct_span_lint_hir(
- lint::builtin::UNUSED_VARIABLES,
- first_hir_id,
- hir_ids_and_spans.iter().map(|(_, sp)| *sp).collect::<Vec<_>>(),
- |lint| {
- let mut err = lint.build(&format!("unused variable: `{}`", name));
+ let (shorthands, non_shorthands): (Vec<_>, Vec<_>) =
+ hir_ids_and_spans.iter().copied().partition(|(hir_id, _, ident_span)| {
+ let var = self.variable(*hir_id, *ident_span);
+ self.ir.variable_is_shorthand(var)
+ });
- let (shorthands, non_shorthands): (Vec<_>, Vec<_>) =
- hir_ids_and_spans.into_iter().partition(|(hir_id, span)| {
- let var = self.variable(*hir_id, *span);
- self.ir.variable_is_shorthand(var)
- });
+ // If we have both shorthand and non-shorthand, prefer the "try ignoring
+ // the field" message, and suggest `_` for the non-shorthands. If we only
+ // have non-shorthand, then prefix with an underscore instead.
+ if !shorthands.is_empty() {
+ let shorthands = shorthands
+ .into_iter()
+ .map(|(_, pat_span, _)| (pat_span, format!("{}: _", name)))
+ .chain(
+ non_shorthands
+ .into_iter()
+ .map(|(_, pat_span, _)| (pat_span, "_".to_string())),
+ )
+ .collect::<Vec<_>>();
- let mut shorthands = shorthands
- .into_iter()
- .map(|(_, span)| (span, format!("{}: _", name)))
- .collect::<Vec<_>>();
-
- // If we have both shorthand and non-shorthand, prefer the "try ignoring
- // the field" message, and suggest `_` for the non-shorthands. If we only
- // have non-shorthand, then prefix with an underscore instead.
- if !shorthands.is_empty() {
- shorthands.extend(
- non_shorthands
- .into_iter()
- .map(|(_, span)| (span, "_".to_string()))
- .collect::<Vec<_>>(),
- );
-
+ self.ir.tcx.struct_span_lint_hir(
+ lint::builtin::UNUSED_VARIABLES,
+ first_hir_id,
+ hir_ids_and_spans
+ .iter()
+ .map(|(_, pat_span, _)| *pat_span)
+ .collect::<Vec<_>>(),
+ |lint| {
+ let mut err = lint.build(&format!("unused variable: `{}`", name));
err.multipart_suggestion(
"try ignoring the field",
shorthands,
Applicability::MachineApplicable,
);
- } else {
+ err.emit()
+ },
+ );
+ } else {
+ let non_shorthands = non_shorthands
+ .into_iter()
+ .map(|(_, _, ident_span)| (ident_span, format!("_{}", name)))
+ .collect::<Vec<_>>();
+
+ self.ir.tcx.struct_span_lint_hir(
+ lint::builtin::UNUSED_VARIABLES,
+ first_hir_id,
+ hir_ids_and_spans
+ .iter()
+ .map(|(_, _, ident_span)| *ident_span)
+ .collect::<Vec<_>>(),
+ |lint| {
+ let mut err = lint.build(&format!("unused variable: `{}`", name));
err.multipart_suggestion(
"if this is intentional, prefix it with an underscore",
- non_shorthands
- .into_iter()
- .map(|(_, span)| (span, format!("_{}", name)))
- .collect::<Vec<_>>(),
+ non_shorthands,
Applicability::MachineApplicable,
);
- }
-
- err.emit()
- },
- );
+ err.emit()
+ },
+ );
+ }
}
}
}
diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs
index 38da52b..a3900eb 100644
--- a/compiler/rustc_session/src/config.rs
+++ b/compiler/rustc_session/src/config.rs
@@ -1536,7 +1536,7 @@ fn parse_target_triple(matches: &getopts::Matches, error_format: ErrorOutputType
early_error(error_format, &format!("target file {:?} does not exist", path))
})
}
- Some(target) => TargetTriple::from_alias(target),
+ Some(target) => TargetTriple::TargetTriple(target),
_ => TargetTriple::from_triple(host_triple()),
}
}
diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs
index 6fe65a8..f87267da 100644
--- a/compiler/rustc_span/src/symbol.rs
+++ b/compiler/rustc_span/src/symbol.rs
@@ -126,6 +126,9 @@
Argument,
ArgumentV1,
Arguments,
+ BTreeMap,
+ BTreeSet,
+ BinaryHeap,
C,
CString,
Center,
@@ -163,6 +166,7 @@
Iterator,
Layout,
Left,
+ LinkedList,
LintPass,
None,
Ok,
@@ -191,6 +195,7 @@
RangeToInclusive,
Rc,
Ready,
+ Receiver,
Result,
Return,
Right,
@@ -592,6 +597,8 @@
gt,
half_open_range_patterns,
hash,
+ hashmap_type,
+ hashset_type,
hexagon_target_feature,
hidden,
homogeneous_aggregate,
@@ -1256,6 +1263,7 @@
variant_count,
vec,
vec_type,
+ vecdeque_type,
version,
vis,
visible_private_types,
diff --git a/compiler/rustc_target/src/spec/aarch64_apple_ios_macabi.rs b/compiler/rustc_target/src/spec/aarch64_apple_ios_macabi.rs
index 3a88197..758950b 100644
--- a/compiler/rustc_target/src/spec/aarch64_apple_ios_macabi.rs
+++ b/compiler/rustc_target/src/spec/aarch64_apple_ios_macabi.rs
@@ -4,12 +4,12 @@
pub fn target() -> Target {
let base = opts("ios", Arch::Arm64_macabi);
Target {
- llvm_target: "arm64-apple-ios-macabi".to_string(),
+ llvm_target: "arm64-apple-ios14.0-macabi".to_string(),
pointer_width: 64,
data_layout: "e-m:o-i64:64-i128:128-n32:64-S128".to_string(),
arch: "aarch64".to_string(),
options: TargetOptions {
- features: "+neon,+fp-armv8,+apple-a7".to_string(),
+ features: "+neon,+fp-armv8,+apple-a12".to_string(),
eliminate_frame_pointer: false,
max_atomic_width: Some(128),
unsupported_abis: super::arm_base::unsupported_abis(),
@@ -18,11 +18,9 @@ pub fn target() -> Target {
// These arguments are not actually invoked - they just have
// to look right to pass App Store validation.
bitcode_llvm_cmdline: "-triple\0\
- arm64-apple-ios-macabi\0\
+ arm64-apple-ios14.0-macabi\0\
-emit-obj\0\
-disable-llvm-passes\0\
- -target-abi\0\
- darwinpcs\0\
-Os\0"
.to_string(),
..base
diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs
index b53d851..039e9a8 100644
--- a/compiler/rustc_target/src/spec/mod.rs
+++ b/compiler/rustc_target/src/spec/mod.rs
@@ -736,9 +736,8 @@ fn to_json(&self) -> Json {
("armv7r-none-eabi", armv7r_none_eabi),
("armv7r-none-eabihf", armv7r_none_eabihf),
- // `x86_64-pc-solaris` is an alias for `x86_64_sun_solaris` for backwards compatibility reasons.
- // (See <https://github.com/rust-lang/rust/issues/40531>.)
- ("x86_64-sun-solaris", "x86_64-pc-solaris", x86_64_sun_solaris),
+ ("x86_64-pc-solaris", x86_64_pc_solaris),
+ ("x86_64-sun-solaris", x86_64_sun_solaris),
("sparcv9-sun-solaris", sparcv9_sun_solaris),
("x86_64-unknown-illumos", x86_64_unknown_illumos),
@@ -1986,24 +1985,6 @@ pub fn from_path(path: &Path) -> Result<Self, io::Error> {
Ok(TargetTriple::TargetPath(canonicalized_path))
}
- /// Creates a target triple from its alias
- pub fn from_alias(triple: String) -> Self {
- macro_rules! target_aliases {
- ( $(($alias:literal, $target:literal ),)+ ) => {
- match triple.as_str() {
- $( $alias => TargetTriple::from_triple($target), )+
- _ => TargetTriple::TargetTriple(triple),
- }
- }
- }
-
- target_aliases! {
- // `x86_64-pc-solaris` is an alias for `x86_64_sun_solaris` for backwards compatibility reasons.
- // (See <https://github.com/rust-lang/rust/issues/40531>.)
- ("x86_64-pc-solaris", "x86_64-sun-solaris"),
- }
- }
-
/// Returns a string triple for this target.
///
/// If this target is a path, the file name (without extension) is returned.
diff --git a/compiler/rustc_target/src/spec/solaris_base.rs b/compiler/rustc_target/src/spec/solaris_base.rs
index 33e0cf8..59731f2 100644
--- a/compiler/rustc_target/src/spec/solaris_base.rs
+++ b/compiler/rustc_target/src/spec/solaris_base.rs
@@ -3,7 +3,6 @@
pub fn opts() -> TargetOptions {
TargetOptions {
os: "solaris".to_string(),
- vendor: "sun".to_string(),
dynamic_linking: true,
executables: true,
has_rpath: true,
diff --git a/compiler/rustc_target/src/spec/sparcv9_sun_solaris.rs b/compiler/rustc_target/src/spec/sparcv9_sun_solaris.rs
index 9ac56ca..abc46a8 100644
--- a/compiler/rustc_target/src/spec/sparcv9_sun_solaris.rs
+++ b/compiler/rustc_target/src/spec/sparcv9_sun_solaris.rs
@@ -7,6 +7,7 @@ pub fn target() -> Target {
base.pre_link_args.insert(LinkerFlavor::Gcc, vec!["-m64".to_string()]);
// llvm calls this "v9"
base.cpu = "v9".to_string();
+ base.vendor = "sun".to_string();
base.max_atomic_width = Some(64);
Target {
diff --git a/compiler/rustc_target/src/spec/x86_64_pc_solaris.rs b/compiler/rustc_target/src/spec/x86_64_pc_solaris.rs
new file mode 100644
index 0000000..75eece7
--- /dev/null
+++ b/compiler/rustc_target/src/spec/x86_64_pc_solaris.rs
@@ -0,0 +1,19 @@
+use crate::spec::{LinkerFlavor, StackProbeType, Target};
+
+pub fn target() -> Target {
+ let mut base = super::solaris_base::opts();
+ base.pre_link_args.insert(LinkerFlavor::Gcc, vec!["-m64".to_string()]);
+ base.cpu = "x86-64".to_string();
+ base.vendor = "pc".to_string();
+ base.max_atomic_width = Some(64);
+ base.stack_probes = StackProbeType::InlineOrCall { min_llvm_version_for_inline: (11, 0, 1) };
+
+ Target {
+ llvm_target: "x86_64-pc-solaris".to_string(),
+ pointer_width: 64,
+ data_layout: "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
+ .to_string(),
+ arch: "x86_64".to_string(),
+ options: base,
+ }
+}
diff --git a/compiler/rustc_target/src/spec/x86_64_sun_solaris.rs b/compiler/rustc_target/src/spec/x86_64_sun_solaris.rs
index 0fe462e..63e524f 100644
--- a/compiler/rustc_target/src/spec/x86_64_sun_solaris.rs
+++ b/compiler/rustc_target/src/spec/x86_64_sun_solaris.rs
@@ -4,6 +4,7 @@ pub fn target() -> Target {
let mut base = super::solaris_base::opts();
base.pre_link_args.insert(LinkerFlavor::Gcc, vec!["-m64".to_string()]);
base.cpu = "x86-64".to_string();
+ base.vendor = "sun".to_string();
base.max_atomic_width = Some(64);
base.stack_probes = StackProbeType::InlineOrCall { min_llvm_version_for_inline: (11, 0, 1) };
diff --git a/config.toml.example b/config.toml.example
index f3bc98d..5c4392a 100644
--- a/config.toml.example
+++ b/config.toml.example
@@ -290,6 +290,12 @@
# tracking over time)
#print-step-timings = false
+# Print out resource usage data for each rustbuild step, as defined by the Unix
+# struct rusage. (Note that this setting is completely unstable: the data it
+# captures, what platforms it supports, the format of its associated output, and
+# this setting's very existence, are all subject to change.)
+#print-step-rusage = false
+
# =============================================================================
# General install configuration options
# =============================================================================
@@ -631,7 +637,9 @@
# The full path to the musl libdir.
#musl-libdir = musl-root/lib
-# The root location of the `wasm32-wasi` sysroot.
+# The root location of the `wasm32-wasi` sysroot. Only used for the
+# `wasm32-wasi` target. If you are building wasm32-wasi target, make sure to
+# create a `[target.wasm32-wasi]` section and move this field there.
#wasi-root = "..."
# Used in testing for configuring where the QEMU images are located, you
diff --git a/library/alloc/benches/btree/map.rs b/library/alloc/benches/btree/map.rs
index 7c2e569..21a0fb8 100644
--- a/library/alloc/benches/btree/map.rs
+++ b/library/alloc/benches/btree/map.rs
@@ -296,11 +296,6 @@ fn slim_map(n: usize) -> BTreeMap<usize, usize> {
(0..n).map(|i| (i, [i; FAT])).collect::<BTreeMap<_, _>>()
}
-// The returned map has large keys and values.
-fn fat_map(n: usize) -> BTreeMap<[usize; FAT], [usize; FAT]> {
- (0..n).map(|i| ([i; FAT], [i; FAT])).collect::<BTreeMap<_, _>>()
-}
-
#[bench]
pub fn clone_slim_100(b: &mut Bencher) {
let src = slim_map(100);
@@ -513,74 +508,3 @@ pub fn clone_fat_val_100_and_remove_half(b: &mut Bencher) {
map
})
}
-
-#[bench]
-pub fn clone_fat_100(b: &mut Bencher) {
- let src = fat_map(100);
- b.iter(|| src.clone())
-}
-
-#[bench]
-pub fn clone_fat_100_and_clear(b: &mut Bencher) {
- let src = fat_map(100);
- b.iter(|| src.clone().clear())
-}
-
-#[bench]
-pub fn clone_fat_100_and_drain_all(b: &mut Bencher) {
- let src = fat_map(100);
- b.iter(|| src.clone().drain_filter(|_, _| true).count())
-}
-
-#[bench]
-pub fn clone_fat_100_and_drain_half(b: &mut Bencher) {
- let src = fat_map(100);
- b.iter(|| {
- let mut map = src.clone();
- assert_eq!(map.drain_filter(|i, _| i[0] % 2 == 0).count(), 100 / 2);
- assert_eq!(map.len(), 100 / 2);
- })
-}
-
-#[bench]
-pub fn clone_fat_100_and_into_iter(b: &mut Bencher) {
- let src = fat_map(100);
- b.iter(|| src.clone().into_iter().count())
-}
-
-#[bench]
-pub fn clone_fat_100_and_pop_all(b: &mut Bencher) {
- let src = fat_map(100);
- b.iter(|| {
- let mut map = src.clone();
- while map.pop_first().is_some() {}
- map
- });
-}
-
-#[bench]
-pub fn clone_fat_100_and_remove_all(b: &mut Bencher) {
- let src = fat_map(100);
- b.iter(|| {
- let mut map = src.clone();
- while let Some(elt) = map.iter().map(|(&i, _)| i).next() {
- let v = map.remove(&elt);
- debug_assert!(v.is_some());
- }
- map
- });
-}
-
-#[bench]
-pub fn clone_fat_100_and_remove_half(b: &mut Bencher) {
- let src = fat_map(100);
- b.iter(|| {
- let mut map = src.clone();
- for i in (0..100).step_by(2) {
- let v = map.remove(&[i; FAT]);
- debug_assert!(v.is_some());
- }
- assert_eq!(map.len(), 100 / 2);
- map
- })
-}
diff --git a/library/alloc/src/collections/binary_heap.rs b/library/alloc/src/collections/binary_heap.rs
index 33bd98d..4377780 100644
--- a/library/alloc/src/collections/binary_heap.rs
+++ b/library/alloc/src/collections/binary_heap.rs
@@ -247,6 +247,7 @@
/// [peek]: BinaryHeap::peek
/// [peek\_mut]: BinaryHeap::peek_mut
#[stable(feature = "rust1", since = "1.0.0")]
+#[cfg_attr(not(test), rustc_diagnostic_item = "BinaryHeap")]
pub struct BinaryHeap<T> {
data: Vec<T>,
}
diff --git a/library/alloc/src/collections/btree/map.rs b/library/alloc/src/collections/btree/map.rs
index 3ba95d9..783f88f 100644
--- a/library/alloc/src/collections/btree/map.rs
+++ b/library/alloc/src/collections/btree/map.rs
@@ -138,6 +138,7 @@
/// *stat += random_stat_buff();
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
+#[cfg_attr(not(test), rustc_diagnostic_item = "BTreeMap")]
pub struct BTreeMap<K, V> {
root: Option<Root<K, V>>,
length: usize,
diff --git a/library/alloc/src/collections/btree/map/tests.rs b/library/alloc/src/collections/btree/map/tests.rs
index 56d6ae5..4e48db7 100644
--- a/library/alloc/src/collections/btree/map/tests.rs
+++ b/library/alloc/src/collections/btree/map/tests.rs
@@ -136,8 +136,9 @@ fn assert_min_len(self, min_len: usize) {
}
}
-// Tests our value of MIN_INSERTS_HEIGHT_2. It may change according to the
-// implementation of insertion, but it's best to be aware of when it does.
+// Tests our value of MIN_INSERTS_HEIGHT_2. Failure may mean you just need to
+// adapt that value to match a change in node::CAPACITY or the choices made
+// during insertion, otherwise other test cases may fail or be less useful.
#[test]
fn test_levels() {
let mut map = BTreeMap::new();
diff --git a/library/alloc/src/collections/btree/navigate.rs b/library/alloc/src/collections/btree/navigate.rs
index e0b9a01..c2c99a9 100644
--- a/library/alloc/src/collections/btree/navigate.rs
+++ b/library/alloc/src/collections/btree/navigate.rs
@@ -1,11 +1,8 @@
use core::borrow::Borrow;
-use core::cmp::Ordering;
-use core::ops::Bound::{Excluded, Included, Unbounded};
use core::ops::RangeBounds;
use core::ptr;
use super::node::{marker, ForceResult::*, Handle, NodeRef};
-use super::search::SearchResult;
pub struct LeafRange<BorrowType, K, V> {
pub front: Option<Handle<NodeRef<BorrowType, K, V, marker::Leaf>, marker::Edge>>,
@@ -30,100 +27,50 @@ pub fn reborrow(&self) -> LeafRange<marker::Immut<'_>, K, V> {
}
}
-/// Finds the leaf edges delimiting a specified range in or underneath a node.
-///
-/// The result is meaningful only if the tree is ordered by key, like the tree
-/// in a `BTreeMap` is.
-fn range_search<BorrowType: marker::BorrowType, K, V, Q, R>(
- root1: NodeRef<BorrowType, K, V, marker::LeafOrInternal>,
- root2: NodeRef<BorrowType, K, V, marker::LeafOrInternal>,
- range: R,
-) -> LeafRange<BorrowType, K, V>
-where
- Q: ?Sized + Ord,
- K: Borrow<Q>,
- R: RangeBounds<Q>,
-{
- // WARNING: Inlining these variables would be unsound (#81138)
- // We assume the bounds reported by `range` remain the same, but
- // an adversarial implementation could change between calls
- let start = range.start_bound();
- let end = range.end_bound();
- match (start, end) {
- (Excluded(s), Excluded(e)) if s == e => {
- panic!("range start and end are equal and excluded in BTreeMap")
- }
- (Included(s) | Excluded(s), Included(e) | Excluded(e)) if s > e => {
- panic!("range start is greater than range end in BTreeMap")
- }
- _ => {}
- };
-
- let mut min_node = root1;
- let mut max_node = root2;
- let mut min_found = false;
- let mut max_found = false;
-
- loop {
- // Using `range` again would be unsound (#81138)
- let front = match (min_found, start) {
- (false, Included(key)) => match min_node.search_node(key) {
- SearchResult::Found(kv) => {
- min_found = true;
- kv.left_edge()
+impl<BorrowType: marker::BorrowType, K, V> NodeRef<BorrowType, K, V, marker::LeafOrInternal> {
+ /// Finds the distinct leaf edges delimiting a specified range in a tree.
+ /// Returns either a pair of different handles into the same tree or a pair
+ /// of empty options.
+ /// # Safety
+ /// Unless `BorrowType` is `Immut`, do not use the duplicate handles to
+ /// visit the same KV twice.
+ unsafe fn find_leaf_edges_spanning_range<Q: ?Sized, R>(
+ self,
+ range: R,
+ ) -> LeafRange<BorrowType, K, V>
+ where
+ Q: Ord,
+ K: Borrow<Q>,
+ R: RangeBounds<Q>,
+ {
+ match self.search_tree_for_bifurcation(&range) {
+ Err(_) => LeafRange::none(),
+ Ok((
+ node,
+ lower_edge_idx,
+ upper_edge_idx,
+ mut lower_child_bound,
+ mut upper_child_bound,
+ )) => {
+ let mut lower_edge = unsafe { Handle::new_edge(ptr::read(&node), lower_edge_idx) };
+ let mut upper_edge = unsafe { Handle::new_edge(node, upper_edge_idx) };
+ loop {
+ match (lower_edge.force(), upper_edge.force()) {
+ (Leaf(f), Leaf(b)) => return LeafRange { front: Some(f), back: Some(b) },
+ (Internal(f), Internal(b)) => {
+ (lower_edge, lower_child_bound) =
+ f.descend().find_lower_bound_edge(lower_child_bound);
+ (upper_edge, upper_child_bound) =
+ b.descend().find_upper_bound_edge(upper_child_bound);
+ }
+ _ => unreachable!("BTreeMap has different depths"),
+ }
}
- SearchResult::GoDown(edge) => edge,
- },
- (false, Excluded(key)) => match min_node.search_node(key) {
- SearchResult::Found(kv) => {
- min_found = true;
- kv.right_edge()
- }
- SearchResult::GoDown(edge) => edge,
- },
- (true, Included(_)) => min_node.last_edge(),
- (true, Excluded(_)) => min_node.first_edge(),
- (_, Unbounded) => min_node.first_edge(),
- };
-
- // Using `range` again would be unsound (#81138)
- let back = match (max_found, end) {
- (false, Included(key)) => match max_node.search_node(key) {
- SearchResult::Found(kv) => {
- max_found = true;
- kv.right_edge()
- }
- SearchResult::GoDown(edge) => edge,
- },
- (false, Excluded(key)) => match max_node.search_node(key) {
- SearchResult::Found(kv) => {
- max_found = true;
- kv.left_edge()
- }
- SearchResult::GoDown(edge) => edge,
- },
- (true, Included(_)) => max_node.first_edge(),
- (true, Excluded(_)) => max_node.last_edge(),
- (_, Unbounded) => max_node.last_edge(),
- };
-
- if front.partial_cmp(&back) == Some(Ordering::Greater) {
- panic!("Ord is ill-defined in BTreeMap range");
- }
- match (front.force(), back.force()) {
- (Leaf(f), Leaf(b)) => {
- return LeafRange { front: Some(f), back: Some(b) };
}
- (Internal(min_int), Internal(max_int)) => {
- min_node = min_int.descend();
- max_node = max_int.descend();
- }
- _ => unreachable!("BTreeMap has different depths"),
- };
+ }
}
}
-/// Equivalent to `range_search(root1, root2, ..)` but without the `Ord` bound.
/// Equivalent to `(root1.first_leaf_edge(), root2.last_leaf_edge())` but more efficient.
fn full_range<BorrowType: marker::BorrowType, K, V>(
root1: NodeRef<BorrowType, K, V, marker::LeafOrInternal>,
@@ -158,7 +105,8 @@ pub fn range_search<Q, R>(self, range: R) -> LeafRange<marker::Immut<'a>, K, V>
K: Borrow<Q>,
R: RangeBounds<Q>,
{
- range_search(self, self, range)
+ // SAFETY: our borrow type is immutable.
+ unsafe { self.find_leaf_edges_spanning_range(range) }
}
/// Finds the pair of leaf edges delimiting an entire tree.
@@ -174,16 +122,16 @@ impl<'a, K: 'a, V: 'a> NodeRef<marker::ValMut<'a>, K, V, marker::LeafOrInternal>
///
/// The result is meaningful only if the tree is ordered by key, like the tree
/// in a `BTreeMap` is.
+ ///
+ /// # Safety
+ /// Do not use the duplicate handles to visit the same KV twice.
pub fn range_search<Q, R>(self, range: R) -> LeafRange<marker::ValMut<'a>, K, V>
where
Q: ?Sized + Ord,
K: Borrow<Q>,
R: RangeBounds<Q>,
{
- // We duplicate the root NodeRef here -- we will never visit the same KV
- // twice, and never end up with overlapping value references.
- let self2 = unsafe { ptr::read(&self) };
- range_search(self, self2, range)
+ unsafe { self.find_leaf_edges_spanning_range(range) }
}
/// Splits a unique reference into a pair of leaf edges delimiting the full range of the tree.
diff --git a/library/alloc/src/collections/btree/node.rs b/library/alloc/src/collections/btree/node.rs
index 4fc3230..eb8ec7c 100644
--- a/library/alloc/src/collections/btree/node.rs
+++ b/library/alloc/src/collections/btree/node.rs
@@ -31,7 +31,6 @@
// since leaf edges are empty and need no data representation. In an internal node,
// an edge both identifies a position and contains a pointer to a child node.
-use core::cmp::Ordering;
use core::marker::PhantomData;
use core::mem::{self, MaybeUninit};
use core::ptr::{self, NonNull};
@@ -461,7 +460,7 @@ pub unsafe fn deallocate_and_ascend(
}
}
-impl<'a, K, V, Type> NodeRef<marker::Mut<'a>, K, V, Type> {
+impl<'a, K, V> NodeRef<marker::Mut<'a>, K, V, marker::LeafOrInternal> {
/// Unsafely asserts to the compiler the static information that this node is a `Leaf`.
unsafe fn cast_to_leaf_unchecked(self) -> NodeRef<marker::Mut<'a>, K, V, marker::Leaf> {
debug_assert!(self.height == 0);
@@ -473,7 +472,9 @@ unsafe fn cast_to_internal_unchecked(self) -> NodeRef<marker::Mut<'a>, K, V, mar
debug_assert!(self.height > 0);
NodeRef { height: self.height, node: self.node, _marker: PhantomData }
}
+}
+impl<'a, K, V, Type> NodeRef<marker::Mut<'a>, K, V, Type> {
/// Temporarily takes out another, mutable reference to the same node. Beware, as
/// this method is very dangerous, doubly so since it may not immediately appear
/// dangerous.
@@ -742,15 +743,6 @@ fn eq(&self, other: &Self) -> bool {
}
}
-impl<BorrowType, K, V, NodeType, HandleType> PartialOrd
- for Handle<NodeRef<BorrowType, K, V, NodeType>, HandleType>
-{
- fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
- let Self { node, idx, _marker } = self;
- if node.eq(&other.node) { Some(idx.cmp(&other.idx)) } else { None }
- }
-}
-
impl<BorrowType, K, V, NodeType, HandleType>
Handle<NodeRef<BorrowType, K, V, NodeType>, HandleType>
{
@@ -761,15 +753,17 @@ pub fn reborrow(&self) -> Handle<NodeRef<marker::Immut<'_>, K, V, NodeType>, Han
}
}
-impl<'a, K, V, NodeType, HandleType> Handle<NodeRef<marker::Mut<'a>, K, V, NodeType>, HandleType> {
+impl<'a, K, V, Type> Handle<NodeRef<marker::Mut<'a>, K, V, marker::LeafOrInternal>, Type> {
/// Unsafely asserts to the compiler the static information that the handle's node is a `Leaf`.
pub unsafe fn cast_to_leaf_unchecked(
self,
- ) -> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Leaf>, HandleType> {
+ ) -> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Leaf>, Type> {
let node = unsafe { self.node.cast_to_leaf_unchecked() };
Handle { node, idx: self.idx, _marker: PhantomData }
}
+}
+impl<'a, K, V, NodeType, HandleType> Handle<NodeRef<marker::Mut<'a>, K, V, NodeType>, HandleType> {
/// Temporarily takes out another, mutable handle on the same location. Beware, as
/// this method is very dangerous, doubly so since it may not immediately appear
/// dangerous.
@@ -1519,15 +1513,13 @@ pub fn forget_node_type(
}
}
-impl<BorrowType, K, V, HandleType>
- Handle<NodeRef<BorrowType, K, V, marker::LeafOrInternal>, HandleType>
-{
+impl<BorrowType, K, V, Type> Handle<NodeRef<BorrowType, K, V, marker::LeafOrInternal>, Type> {
/// Checks whether the underlying node is an `Internal` node or a `Leaf` node.
pub fn force(
self,
) -> ForceResult<
- Handle<NodeRef<BorrowType, K, V, marker::Leaf>, HandleType>,
- Handle<NodeRef<BorrowType, K, V, marker::Internal>, HandleType>,
+ Handle<NodeRef<BorrowType, K, V, marker::Leaf>, Type>,
+ Handle<NodeRef<BorrowType, K, V, marker::Internal>, Type>,
> {
match self.node.force() {
ForceResult::Leaf(node) => {
diff --git a/library/alloc/src/collections/btree/node/tests.rs b/library/alloc/src/collections/btree/node/tests.rs
index acb7210..5e44735 100644
--- a/library/alloc/src/collections/btree/node/tests.rs
+++ b/library/alloc/src/collections/btree/node/tests.rs
@@ -2,7 +2,6 @@
use super::*;
use crate::fmt::Debug;
use crate::string::String;
-use core::cmp::Ordering::*;
impl<'a, K: 'a, V: 'a> NodeRef<marker::Immut<'a>, K, V, marker::LeafOrInternal> {
// Asserts that the back pointer in each reachable node points to its parent.
@@ -67,7 +66,7 @@ fn test_splitpoint() {
}
#[test]
-fn test_partial_cmp_eq() {
+fn test_partial_eq() {
let mut root1 = NodeRef::new_leaf();
root1.borrow_mut().push(1, ());
let mut root1 = NodeRef::new_internal(root1.forget_type()).forget_type();
@@ -87,13 +86,6 @@ fn test_partial_cmp_eq() {
assert!(top_edge_1 == top_edge_1);
assert!(top_edge_1 != top_edge_2);
- assert_eq!(leaf_edge_1a.partial_cmp(&leaf_edge_1a), Some(Equal));
- assert_eq!(leaf_edge_1a.partial_cmp(&leaf_edge_1b), Some(Less));
- assert_eq!(leaf_edge_1a.partial_cmp(&top_edge_1), None);
- assert_eq!(leaf_edge_1a.partial_cmp(&top_edge_2), None);
- assert_eq!(top_edge_1.partial_cmp(&top_edge_1), Some(Equal));
- assert_eq!(top_edge_1.partial_cmp(&top_edge_2), None);
-
root1.pop_internal_level();
unsafe { root1.into_dying().deallocate_and_ascend() };
unsafe { root2.into_dying().deallocate_and_ascend() };
@@ -103,7 +95,7 @@ fn test_partial_cmp_eq() {
#[cfg(target_arch = "x86_64")]
fn test_sizes() {
assert_eq!(core::mem::size_of::<LeafNode<(), ()>>(), 16);
- assert_eq!(core::mem::size_of::<LeafNode<i64, i64>>(), 16 + CAPACITY * 8 * 2);
- assert_eq!(core::mem::size_of::<InternalNode<(), ()>>(), 112);
- assert_eq!(core::mem::size_of::<InternalNode<i64, i64>>(), 112 + CAPACITY * 8 * 2);
+ assert_eq!(core::mem::size_of::<LeafNode<i64, i64>>(), 16 + CAPACITY * 2 * 8);
+ assert_eq!(core::mem::size_of::<InternalNode<(), ()>>(), 16 + (CAPACITY + 1) * 8);
+ assert_eq!(core::mem::size_of::<InternalNode<i64, i64>>(), 16 + (CAPACITY * 3 + 1) * 8);
}
diff --git a/library/alloc/src/collections/btree/search.rs b/library/alloc/src/collections/btree/search.rs
index f87444b..f376b3c 100644
--- a/library/alloc/src/collections/btree/search.rs
+++ b/library/alloc/src/collections/btree/search.rs
@@ -1,10 +1,33 @@
use core::borrow::Borrow;
use core::cmp::Ordering;
+use core::ops::{Bound, RangeBounds};
use super::node::{marker, ForceResult::*, Handle, NodeRef};
+use SearchBound::*;
use SearchResult::*;
+pub enum SearchBound<T> {
+ /// An inclusive bound to look for, just like `Bound::Included(T)`.
+ Included(T),
+ /// An exclusive bound to look for, just like `Bound::Excluded(T)`.
+ Excluded(T),
+ /// An unconditional inclusive bound, just like `Bound::Unbounded`.
+ AllIncluded,
+ /// An unconditional exclusive bound.
+ AllExcluded,
+}
+
+impl<T> SearchBound<T> {
+ pub fn from_range(range_bound: Bound<T>) -> Self {
+ match range_bound {
+ Bound::Included(t) => Included(t),
+ Bound::Excluded(t) => Excluded(t),
+ Bound::Unbounded => AllIncluded,
+ }
+ }
+}
+
pub enum SearchResult<BorrowType, K, V, FoundType, GoDownType> {
Found(Handle<NodeRef<BorrowType, K, V, FoundType>, marker::KV>),
GoDown(Handle<NodeRef<BorrowType, K, V, GoDownType>, marker::Edge>),
@@ -40,6 +63,112 @@ pub fn search_tree<Q: ?Sized>(
}
}
}
+
+ /// Descends to the nearest node where the edge matching the lower bound
+ /// of the range is different from the edge matching the upper bound, i.e.,
+ /// the nearest node that has at least one key contained in the range.
+ ///
+ /// If found, returns an `Ok` with that node, the pair of edge indices in it
+ /// delimiting the range, and the corresponding pair of bounds for
+ /// continuing the search in the child nodes, in case the node is internal.
+ ///
+ /// If not found, returns an `Err` with the leaf edge matching the entire
+ /// range.
+ ///
+ /// The result is meaningful only if the tree is ordered by key.
+ pub fn search_tree_for_bifurcation<'r, Q: ?Sized, R>(
+ mut self,
+ range: &'r R,
+ ) -> Result<
+ (
+ NodeRef<BorrowType, K, V, marker::LeafOrInternal>,
+ usize,
+ usize,
+ SearchBound<&'r Q>,
+ SearchBound<&'r Q>,
+ ),
+ Handle<NodeRef<BorrowType, K, V, marker::Leaf>, marker::Edge>,
+ >
+ where
+ Q: Ord,
+ K: Borrow<Q>,
+ R: RangeBounds<Q>,
+ {
+ // WARNING: Inlining these variables would be unsound (#81138)
+ // We assume the bounds reported by `range` remain the same, but
+ // an adversarial implementation could change between calls
+ let (start, end) = (range.start_bound(), range.end_bound());
+ match (start, end) {
+ (Bound::Excluded(s), Bound::Excluded(e)) if s == e => {
+ panic!("range start and end are equal and excluded in BTreeMap")
+ }
+ (Bound::Included(s) | Bound::Excluded(s), Bound::Included(e) | Bound::Excluded(e))
+ if s > e =>
+ {
+ panic!("range start is greater than range end in BTreeMap")
+ }
+ _ => {}
+ }
+ let mut lower_bound = SearchBound::from_range(start);
+ let mut upper_bound = SearchBound::from_range(end);
+ loop {
+ let (lower_edge_idx, lower_child_bound) = self.find_lower_bound_index(lower_bound);
+ let (upper_edge_idx, upper_child_bound) = self.find_upper_bound_index(upper_bound);
+ if lower_edge_idx > upper_edge_idx {
+ panic!("Ord is ill-defined in BTreeMap range")
+ }
+ if lower_edge_idx < upper_edge_idx {
+ return Ok((
+ self,
+ lower_edge_idx,
+ upper_edge_idx,
+ lower_child_bound,
+ upper_child_bound,
+ ));
+ }
+ let common_edge = unsafe { Handle::new_edge(self, lower_edge_idx) };
+ match common_edge.force() {
+ Leaf(common_edge) => return Err(common_edge),
+ Internal(common_edge) => {
+ self = common_edge.descend();
+ lower_bound = lower_child_bound;
+ upper_bound = upper_child_bound;
+ }
+ }
+ }
+ }
+
+ /// Finds an edge in the node delimiting the lower bound of a range.
+ /// Also returns the lower bound to be used for continuing the search in
+ /// the matching child node, if `self` is an internal node.
+ ///
+ /// The result is meaningful only if the tree is ordered by key.
+ pub fn find_lower_bound_edge<'r, Q>(
+ self,
+ bound: SearchBound<&'r Q>,
+ ) -> (Handle<Self, marker::Edge>, SearchBound<&'r Q>)
+ where
+ Q: ?Sized + Ord,
+ K: Borrow<Q>,
+ {
+ let (edge_idx, bound) = self.find_lower_bound_index(bound);
+ let edge = unsafe { Handle::new_edge(self, edge_idx) };
+ (edge, bound)
+ }
+
+ /// Clone of `find_lower_bound_edge` for the upper bound.
+ pub fn find_upper_bound_edge<'r, Q>(
+ self,
+ bound: SearchBound<&'r Q>,
+ ) -> (Handle<Self, marker::Edge>, SearchBound<&'r Q>)
+ where
+ Q: ?Sized + Ord,
+ K: Borrow<Q>,
+ {
+ let (edge_idx, bound) = self.find_upper_bound_index(bound);
+ let edge = unsafe { Handle::new_edge(self, edge_idx) };
+ (edge, bound)
+ }
}
impl<BorrowType, K, V, Type> NodeRef<BorrowType, K, V, Type> {
@@ -55,7 +184,7 @@ pub fn search_node<Q: ?Sized>(self, key: &Q) -> SearchResult<BorrowType, K, V, T
Q: Ord,
K: Borrow<Q>,
{
- match self.find_index(key) {
+ match self.find_key_index(key) {
IndexResult::KV(idx) => Found(unsafe { Handle::new_kv(self, idx) }),
IndexResult::Edge(idx) => GoDown(unsafe { Handle::new_edge(self, idx) }),
}
@@ -66,7 +195,7 @@ pub fn search_node<Q: ?Sized>(self, key: &Q) -> SearchResult<BorrowType, K, V, T
///
/// The result is meaningful only if the tree is ordered by key, like the tree
/// in a `BTreeMap` is.
- fn find_index<Q: ?Sized>(&self, key: &Q) -> IndexResult
+ fn find_key_index<Q: ?Sized>(&self, key: &Q) -> IndexResult
where
Q: Ord,
K: Borrow<Q>,
@@ -82,4 +211,54 @@ fn find_index<Q: ?Sized>(&self, key: &Q) -> IndexResult
}
IndexResult::Edge(keys.len())
}
+
+ /// Finds an edge index in the node delimiting the lower bound of a range.
+ /// Also returns the lower bound to be used for continuing the search in
+ /// the matching child node, if `self` is an internal node.
+ ///
+ /// The result is meaningful only if the tree is ordered by key.
+ fn find_lower_bound_index<'r, Q>(
+ &self,
+ bound: SearchBound<&'r Q>,
+ ) -> (usize, SearchBound<&'r Q>)
+ where
+ Q: ?Sized + Ord,
+ K: Borrow<Q>,
+ {
+ match bound {
+ Included(key) => match self.find_key_index(key) {
+ IndexResult::KV(idx) => (idx, AllExcluded),
+ IndexResult::Edge(idx) => (idx, bound),
+ },
+ Excluded(key) => match self.find_key_index(key) {
+ IndexResult::KV(idx) => (idx + 1, AllIncluded),
+ IndexResult::Edge(idx) => (idx, bound),
+ },
+ AllIncluded => (0, AllIncluded),
+ AllExcluded => (self.len(), AllExcluded),
+ }
+ }
+
+ /// Clone of `find_lower_bound_index` for the upper bound.
+ fn find_upper_bound_index<'r, Q>(
+ &self,
+ bound: SearchBound<&'r Q>,
+ ) -> (usize, SearchBound<&'r Q>)
+ where
+ Q: ?Sized + Ord,
+ K: Borrow<Q>,
+ {
+ match bound {
+ Included(key) => match self.find_key_index(key) {
+ IndexResult::KV(idx) => (idx + 1, AllExcluded),
+ IndexResult::Edge(idx) => (idx, bound),
+ },
+ Excluded(key) => match self.find_key_index(key) {
+ IndexResult::KV(idx) => (idx, AllIncluded),
+ IndexResult::Edge(idx) => (idx, bound),
+ },
+ AllIncluded => (self.len(), AllIncluded),
+ AllExcluded => (0, AllExcluded),
+ }
+ }
}
diff --git a/library/alloc/src/collections/btree/set.rs b/library/alloc/src/collections/btree/set.rs
index f2ec277..a331b8d 100644
--- a/library/alloc/src/collections/btree/set.rs
+++ b/library/alloc/src/collections/btree/set.rs
@@ -61,6 +61,7 @@
/// ```
#[derive(Hash, PartialEq, Eq, Ord, PartialOrd)]
#[stable(feature = "rust1", since = "1.0.0")]
+#[cfg_attr(not(test), rustc_diagnostic_item = "BTreeSet")]
pub struct BTreeSet<T> {
map: BTreeMap<T, ()>,
}
diff --git a/library/alloc/src/collections/linked_list.rs b/library/alloc/src/collections/linked_list.rs
index 397e774..a5481fd 100644
--- a/library/alloc/src/collections/linked_list.rs
+++ b/library/alloc/src/collections/linked_list.rs
@@ -35,6 +35,7 @@
/// array-based containers are generally faster,
/// more memory efficient, and make better use of CPU cache.
#[stable(feature = "rust1", since = "1.0.0")]
+#[cfg_attr(not(test), rustc_diagnostic_item = "LinkedList")]
pub struct LinkedList<T> {
head: Option<NonNull<Node<T>>>,
tail: Option<NonNull<Node<T>>>,
diff --git a/library/alloc/src/lib.rs b/library/alloc/src/lib.rs
index d991cd7..7cce6ae 100644
--- a/library/alloc/src/lib.rs
+++ b/library/alloc/src/lib.rs
@@ -92,6 +92,7 @@
#![feature(const_fn)]
#![feature(cow_is_borrowed)]
#![feature(const_cow_is_borrowed)]
+#![feature(destructuring_assignment)]
#![feature(dispatch_from_dyn)]
#![feature(core_intrinsics)]
#![feature(dropck_eyepatch)]
diff --git a/library/core/src/alloc/global.rs b/library/core/src/alloc/global.rs
index 6ec0f0b..6dcc110 100644
--- a/library/core/src/alloc/global.rs
+++ b/library/core/src/alloc/global.rs
@@ -122,7 +122,7 @@ pub unsafe trait GlobalAlloc {
/// this allocator,
///
/// * `layout` must be the same layout that was used
- /// to allocate that block of memory,
+ /// to allocate that block of memory.
#[stable(feature = "global_alloc", since = "1.28.0")]
unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout);
@@ -167,7 +167,10 @@ unsafe fn alloc_zeroed(&self, layout: Layout) -> *mut u8 {
/// and should be considered unusable (unless of course it was
/// transferred back to the caller again via the return value of
/// this method). The new memory block is allocated with `layout`, but
- /// with the `size` updated to `new_size`.
+ /// with the `size` updated to `new_size`. This new layout should be
+ /// used when deallocating the new memory block with `dealloc`. The range
+ /// `0..min(layout.size(), new_size)` of the new memory block is
+ /// guaranteed to have the same values as the original block.
///
/// If this method returns null, then ownership of the memory
/// block has not been transferred to this allocator, and the
diff --git a/library/core/src/num/dec2flt/table.rs b/library/core/src/num/dec2flt/table.rs
index 1bd94ff..97b497e 100644
--- a/library/core/src/num/dec2flt/table.rs
+++ b/library/core/src/num/dec2flt/table.rs
@@ -5,7 +5,7 @@
pub const MAX_E: i16 = 305;
#[rustfmt::skip]
-pub const POWERS: ([u64; 611], [i16; 611]) = (
+pub static POWERS: ([u64; 611], [i16; 611]) = (
[
0xe0b62e2929aba83c,
0x8c71dcd9ba0b4926,
diff --git a/library/std/src/lazy.rs b/library/std/src/lazy.rs
index aec2a2a..974851a 100644
--- a/library/std/src/lazy.rs
+++ b/library/std/src/lazy.rs
@@ -177,7 +177,10 @@ pub fn get_mut(&mut self) -> Option<&mut T> {
/// Sets the contents of this cell to `value`.
///
- /// Returns `Ok(())` if the cell's value was updated.
+ /// May block if another thread is currently attempting to initialize the cell. The cell is
+ /// guaranteed to contain a value when set returns, though not necessarily the one provided.
+ ///
+ /// Returns `Ok(())` if the cell's value was set by this call.
///
/// # Examples
///
diff --git a/library/std/src/os/mod.rs b/library/std/src/os/mod.rs
index 500e826..31e39b5 100644
--- a/library/std/src/os/mod.rs
+++ b/library/std/src/os/mod.rs
@@ -23,6 +23,7 @@
pub mod linux;
#[cfg(doc)]
+#[stable(feature = "wasi_ext_doc", since = "1.35.0")]
pub use crate::sys::wasi_ext as wasi;
// If we're not documenting libstd then we just expose the main modules as we otherwise would.
diff --git a/library/std/src/sync/mpsc/mod.rs b/library/std/src/sync/mpsc/mod.rs
index db0777e..b12e7ee 100644
--- a/library/std/src/sync/mpsc/mod.rs
+++ b/library/std/src/sync/mpsc/mod.rs
@@ -310,6 +310,7 @@
/// println!("{}", recv.recv().unwrap()); // Received after 2 seconds
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
+#[cfg_attr(not(test), rustc_diagnostic_item = "Receiver")]
pub struct Receiver<T> {
inner: UnsafeCell<Flavor<T>>,
}
diff --git a/library/std/src/sys/mod.rs b/library/std/src/sys/mod.rs
index d3f5380..1e79a5c 100644
--- a/library/std/src/sys/mod.rs
+++ b/library/std/src/sys/mod.rs
@@ -111,7 +111,7 @@ pub mod windows_ext {}
cfg_if::cfg_if! {
if #[cfg(target_os = "wasi")] {
// On WASI we'll document what's already available
- #[stable(feature = "rust1", since = "1.0.0")]
+ #[stable(feature = "wasi_ext_doc", since = "1.35.0")]
pub use self::ext as wasi_ext;
} else if #[cfg(any(target_os = "hermit",
target_arch = "wasm32",
@@ -125,6 +125,7 @@ pub mod wasi_ext {}
} else {
// On other platforms like Windows document the bare bones of WASI
#[path = "wasi/ext/mod.rs"]
+ #[stable(feature = "wasi_ext_doc", since = "1.35.0")]
pub mod wasi_ext;
}
}
diff --git a/src/bootstrap/bin/rustc.rs b/src/bootstrap/bin/rustc.rs
index 3694bdb..6b1be0c 100644
--- a/src/bootstrap/bin/rustc.rs
+++ b/src/bootstrap/bin/rustc.rs
@@ -139,6 +139,12 @@ fn main() {
}
if verbose > 1 {
+ let rust_env_vars =
+ env::vars().filter(|(k, _)| k.starts_with("RUST") || k.starts_with("CARGO"));
+ for (i, (k, v)) in rust_env_vars.enumerate() {
+ eprintln!("rustc env[{}]: {:?}={:?}", i, k, v);
+ }
+ eprintln!("rustc working directory: {}", env::current_dir().unwrap().display());
eprintln!(
"rustc command: {:?}={:?} {:?}",
bootstrap::util::dylib_path_var(),
@@ -155,16 +161,24 @@ fn main() {
cmd.status().expect(&errmsg)
};
- if env::var_os("RUSTC_PRINT_STEP_TIMINGS").is_some() {
+ if env::var_os("RUSTC_PRINT_STEP_TIMINGS").is_some()
+ || env::var_os("RUSTC_PRINT_STEP_RUSAGE").is_some()
+ {
if let Some(crate_name) = crate_name {
let dur = start.elapsed();
let is_test = args.iter().any(|a| a == "--test");
+ // If the user requested resource usage data, then
+ // include that in addition to the timing output.
+ let rusage_data =
+ env::var_os("RUSTC_PRINT_STEP_RUSAGE").and_then(|_| format_rusage_data());
eprintln!(
- "[RUSTC-TIMING] {} test:{} {}.{:03}",
+ "[RUSTC-TIMING] {} test:{} {}.{:03}{}{}",
crate_name,
is_test,
dur.as_secs(),
- dur.subsec_millis()
+ dur.subsec_millis(),
+ if rusage_data.is_some() { " " } else { "" },
+ rusage_data.unwrap_or(String::new()),
);
}
}
@@ -192,3 +206,71 @@ fn main() {
}
}
}
+
+#[cfg(not(unix))]
+/// getrusage is not available on non-unix platforms. So for now, we do not
+/// bother trying to make a shim for it.
+fn format_rusage_data() -> Option<String> {
+ None
+}
+
+#[cfg(unix)]
+/// Tries to build a string with human readable data for several of the rusage
+/// fields. Note that we are focusing mainly on data that we believe to be
+/// supplied on Linux (the `rusage` struct has other fields in it but they are
+/// currently unsupported by Linux).
+fn format_rusage_data() -> Option<String> {
+ let rusage: libc::rusage = unsafe {
+ let mut recv = std::mem::zeroed();
+ // -1 is RUSAGE_CHILDREN, which means to get the rusage for all children
+ // (and grandchildren, etc) processes that have respectively terminated
+ // and been waited for.
+ let retval = libc::getrusage(-1, &mut recv);
+ if retval != 0 {
+ return None;
+ }
+ recv
+ };
+ // Mac OS X reports the maxrss in bytes, not kb.
+ let divisor = if env::consts::OS == "macos" { 1024 } else { 1 };
+ let maxrss = rusage.ru_maxrss + (divisor - 1) / divisor;
+
+ let mut init_str = format!(
+ "user: {USER_SEC}.{USER_USEC:03} \
+ sys: {SYS_SEC}.{SYS_USEC:03} \
+ max rss (kb): {MAXRSS}",
+ USER_SEC = rusage.ru_utime.tv_sec,
+ USER_USEC = rusage.ru_utime.tv_usec,
+ SYS_SEC = rusage.ru_stime.tv_sec,
+ SYS_USEC = rusage.ru_stime.tv_usec,
+ MAXRSS = maxrss
+ );
+
+ // The remaining rusage stats vary in platform support. So we treat
+ // uniformly zero values in each category as "not worth printing", since it
+ // either means no events of that type occurred, or that the platform
+ // does not support it.
+
+ let minflt = rusage.ru_minflt;
+ let majflt = rusage.ru_majflt;
+ if minflt != 0 || majflt != 0 {
+ init_str.push_str(&format!(" page reclaims: {} page faults: {}", minflt, majflt));
+ }
+
+ let inblock = rusage.ru_inblock;
+ let oublock = rusage.ru_oublock;
+ if inblock != 0 || oublock != 0 {
+ init_str.push_str(&format!(" fs block inputs: {} fs block outputs: {}", inblock, oublock));
+ }
+
+ let nvcsw = rusage.ru_nvcsw;
+ let nivcsw = rusage.ru_nivcsw;
+ if nvcsw != 0 || nivcsw != 0 {
+ init_str.push_str(&format!(
+ " voluntary ctxt switches: {} involuntary ctxt switches: {}",
+ nvcsw, nivcsw
+ ));
+ }
+
+ return Some(init_str);
+}
diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py
index a438e92..62bf4ff 100644
--- a/src/bootstrap/bootstrap.py
+++ b/src/bootstrap/bootstrap.py
@@ -240,13 +240,16 @@
else:
ostype = 'unknown-linux-gnu'
elif ostype == 'SunOS':
- ostype = 'sun-solaris'
+ ostype = 'pc-solaris'
# On Solaris, uname -m will return a machine classification instead
# of a cpu type, so uname -p is recommended instead. However, the
# output from that option is too generic for our purposes (it will
# always emit 'i386' on x86/amd64 systems). As such, isainfo -k
# must be used instead.
cputype = require(['isainfo', '-k']).decode(default_encoding)
+ # sparc cpus have sun as a target vendor
+ if 'sparc' in cputype:
+ ostype = 'sun-solaris'
elif ostype.startswith('MINGW'):
# msys' `uname` does not print gcc configuration, but prints msys
# configuration. so we cannot believe `uname -m`:
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
index 61554a3..2008348 100644
--- a/src/bootstrap/builder.rs
+++ b/src/bootstrap/builder.rs
@@ -57,14 +57,6 @@ pub trait Step: 'static + Clone + Debug + PartialEq + Eq + Hash {
/// `true` here can still be overwritten by `should_run` calling `default_condition`.
const DEFAULT: bool = false;
- /// Whether this step should be run even when `download-rustc` is set.
- ///
- /// Most steps are not important when the compiler is downloaded, since they will be included in
- /// the pre-compiled sysroot. Steps can set this to `true` to be built anyway.
- ///
- /// When in doubt, set this to `false`.
- const ENABLE_DOWNLOAD_RUSTC: bool = false;
-
/// If true, then this rule should be skipped if --target was specified, but --host was not
const ONLY_HOSTS: bool = false;
@@ -107,7 +99,6 @@ pub fn build_triple(&self) -> TargetSelection {
struct StepDescription {
default: bool,
- enable_download_rustc: bool,
only_hosts: bool,
should_run: fn(ShouldRun<'_>) -> ShouldRun<'_>,
make_run: fn(RunConfig<'_>),
@@ -162,7 +153,6 @@ impl StepDescription {
fn from<S: Step>() -> StepDescription {
StepDescription {
default: S::DEFAULT,
- enable_download_rustc: S::ENABLE_DOWNLOAD_RUSTC,
only_hosts: S::ONLY_HOSTS,
should_run: S::should_run,
make_run: S::make_run,
@@ -179,14 +169,6 @@ fn maybe_run(&self, builder: &Builder<'_>, pathset: &PathSet) {
"{:?} not skipped for {:?} -- not in {:?}",
pathset, self.name, builder.config.exclude
);
- } else if builder.config.download_rustc && !self.enable_download_rustc {
- if !builder.config.dry_run {
- eprintln!(
- "Not running {} because its artifacts have been downloaded from CI (`download-rustc` is set)",
- self.name
- );
- }
- return;
}
// Determine the targets participating in this rule.
@@ -939,6 +921,12 @@ pub fn cargo(
// but this breaks CI. At the very least, stage0 `rustdoc` needs `--cfg bootstrap`. See
// #71458.
let mut rustdocflags = rustflags.clone();
+ rustdocflags.propagate_cargo_env("RUSTDOCFLAGS");
+ if stage == 0 {
+ rustdocflags.env("RUSTDOCFLAGS_BOOTSTRAP");
+ } else {
+ rustdocflags.env("RUSTDOCFLAGS_NOT_BOOTSTRAP");
+ }
if let Ok(s) = env::var("CARGOFLAGS") {
cargo.args(s.split_whitespace());
@@ -1259,6 +1247,10 @@ pub fn cargo(
cargo.env("RUSTC_PRINT_STEP_TIMINGS", "1");
}
+ if self.config.print_step_rusage {
+ cargo.env("RUSTC_PRINT_STEP_RUSAGE", "1");
+ }
+
if self.config.backtrace_on_ice {
cargo.env("RUSTC_BACKTRACE_ON_ICE", "1");
}
@@ -1544,23 +1536,29 @@ pub fn ensure<S: Step>(&'a self, step: S) -> S::Output {
mod tests;
#[derive(Debug, Clone)]
-struct Rustflags(String);
+struct Rustflags(String, TargetSelection);
impl Rustflags {
fn new(target: TargetSelection) -> Rustflags {
- let mut ret = Rustflags(String::new());
-
- // Inherit `RUSTFLAGS` by default ...
- ret.env("RUSTFLAGS");
-
- // ... and also handle target-specific env RUSTFLAGS if they're
- // configured.
- let target_specific = format!("CARGO_TARGET_{}_RUSTFLAGS", crate::envify(&target.triple));
- ret.env(&target_specific);
-
+ let mut ret = Rustflags(String::new(), target);
+ ret.propagate_cargo_env("RUSTFLAGS");
ret
}
+ /// By default, cargo will pick up on various variables in the environment. However, bootstrap
+ /// reuses those variables to pass additional flags to rustdoc, so by default they get overriden.
+ /// Explicitly add back any previous value in the environment.
+ ///
+ /// `prefix` is usually `RUSTFLAGS` or `RUSTDOCFLAGS`.
+ fn propagate_cargo_env(&mut self, prefix: &str) {
+ // Inherit `RUSTFLAGS` by default ...
+ self.env(prefix);
+
+ // ... and also handle target-specific env RUSTFLAGS if they're configured.
+ let target_specific = format!("CARGO_TARGET_{}_{}", crate::envify(&self.1.triple), prefix);
+ self.env(&target_specific);
+ }
+
fn env(&mut self, env: &str) {
if let Ok(s) = env::var(env) {
for part in s.split(' ') {
diff --git a/src/bootstrap/check.rs b/src/bootstrap/check.rs
index 9b80f1c..6626fea 100644
--- a/src/bootstrap/check.rs
+++ b/src/bootstrap/check.rs
@@ -62,7 +62,6 @@ fn cargo_subcommand(kind: Kind) -> &'static str {
impl Step for Std {
type Output = ();
const DEFAULT: bool = true;
- const ENABLE_DOWNLOAD_RUSTC: bool = true;
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
run.all_krates("test")
@@ -156,7 +155,6 @@ impl Step for Rustc {
type Output = ();
const ONLY_HOSTS: bool = true;
const DEFAULT: bool = true;
- const ENABLE_DOWNLOAD_RUSTC: bool = true;
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
run.all_krates("rustc-main")
@@ -235,7 +233,6 @@ impl Step for CodegenBackend {
type Output = ();
const ONLY_HOSTS: bool = true;
const DEFAULT: bool = true;
- const ENABLE_DOWNLOAD_RUSTC: bool = true;
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
run.paths(&["compiler/rustc_codegen_cranelift", "rustc_codegen_cranelift"])
@@ -293,7 +290,6 @@ impl Step for $name {
type Output = ();
const ONLY_HOSTS: bool = true;
const DEFAULT: bool = true;
- const ENABLE_DOWNLOAD_RUSTC: bool = true;
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
run.path($path)
diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs
index 859e38d..24800b7 100644
--- a/src/bootstrap/compile.rs
+++ b/src/bootstrap/compile.rs
@@ -63,6 +63,12 @@ fn run(self, builder: &Builder<'_>) {
let target = self.target;
let compiler = self.compiler;
+ // These artifacts were already copied (in `impl Step for Sysroot`).
+ // Don't recompile them.
+ if builder.config.download_rustc {
+ return;
+ }
+
if builder.config.keep_stage.contains(&compiler.stage)
|| builder.config.keep_stage_std.contains(&compiler.stage)
{
@@ -178,7 +184,9 @@ fn copy_self_contained_objects(
// To do that we have to distribute musl startup objects as a part of Rust toolchain
// and link with them manually in the self-contained mode.
if target.contains("musl") {
- let srcdir = builder.musl_libdir(target).unwrap();
+ let srcdir = builder.musl_libdir(target).unwrap_or_else(|| {
+ panic!("Target {:?} does not have a \"musl-libdir\" key", target.triple)
+ });
for &obj in &["crt1.o", "Scrt1.o", "rcrt1.o", "crti.o", "crtn.o"] {
copy_and_stamp(
builder,
@@ -196,7 +204,12 @@ fn copy_self_contained_objects(
target_deps.push((target, DependencyType::TargetSelfContained));
}
} else if target.ends_with("-wasi") {
- let srcdir = builder.wasi_root(target).unwrap().join("lib/wasm32-wasi");
+ let srcdir = builder
+ .wasi_root(target)
+ .unwrap_or_else(|| {
+ panic!("Target {:?} does not have a \"wasi-root\" key", target.triple)
+ })
+ .join("lib/wasm32-wasi");
for &obj in &["crt1.o", "crt1-reactor.o"] {
copy_and_stamp(
builder,
@@ -500,6 +513,13 @@ fn run(self, builder: &Builder<'_>) {
let compiler = self.compiler;
let target = self.target;
+ if builder.config.download_rustc {
+ // Copy the existing artifacts instead of rebuilding them.
+ // NOTE: this path is only taken for tools linking to rustc-dev.
+ builder.ensure(Sysroot { compiler });
+ return;
+ }
+
builder.ensure(Std { compiler, target });
if builder.config.keep_stage.contains(&compiler.stage) {
diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs
index d50d605..b2af8e5 100644
--- a/src/bootstrap/config.rs
+++ b/src/bootstrap/config.rs
@@ -161,6 +161,7 @@ pub struct Config {
pub verbose_tests: bool,
pub save_toolstates: Option<PathBuf>,
pub print_step_timings: bool,
+ pub print_step_rusage: bool,
pub missing_tools: bool,
// Fallback musl-root for all targets
@@ -380,6 +381,7 @@ struct Build {
configure_args: Option<Vec<String>>,
local_rebuild: Option<bool>,
print_step_timings: Option<bool>,
+ print_step_rusage: Option<bool>,
check_stage: Option<u32>,
doc_stage: Option<u32>,
build_stage: Option<u32>,
@@ -679,6 +681,7 @@ pub fn parse(args: &[String]) -> Config {
set(&mut config.configure_args, build.configure_args);
set(&mut config.local_rebuild, build.local_rebuild);
set(&mut config.print_step_timings, build.print_step_timings);
+ set(&mut config.print_step_rusage, build.print_step_rusage);
// See https://github.com/rust-lang/compiler-team/issues/326
config.stage = match config.cmd {
diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs
index 49d56f4..c0cd24d 100644
--- a/src/bootstrap/test.rs
+++ b/src/bootstrap/test.rs
@@ -212,6 +212,7 @@ fn run(self, builder: &Builder<'_>) {
if !builder.fail_fast {
cargo.arg("--no-fail-fast");
}
+ cargo.arg("--").args(builder.config.cmd.test_args());
// Don't run cross-compile tests, we may not have cross-compiled libstd libs
// available.
diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs
index 5c874f6..3fc3b68 100644
--- a/src/bootstrap/tool.rs
+++ b/src/bootstrap/tool.rs
@@ -47,7 +47,7 @@ fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
fn run(self, builder: &Builder<'_>) -> Option<PathBuf> {
let compiler = self.compiler;
let target = self.target;
- let tool = self.tool;
+ let mut tool = self.tool;
let path = self.path;
let is_optional_tool = self.is_optional_tool;
@@ -208,6 +208,12 @@ fn run(self, builder: &Builder<'_>) -> Option<PathBuf> {
None
}
} else {
+ // HACK(#82501): on Windows, the tools directory gets added to PATH when running tests, and
+ // compiletest confuses HTML tidy with the in-tree tidy. Name the in-tree tidy something
+ // different so the problem doesn't come up.
+ if tool == "tidy" {
+ tool = "rust-tidy";
+ }
let cargo_out =
builder.cargo_out(compiler, self.mode, target).join(exe(tool, compiler.host));
let bin = builder.tools_dir(compiler).join(exe(tool, compiler.host));
@@ -477,7 +483,6 @@ pub struct Rustdoc {
impl Step for Rustdoc {
type Output = PathBuf;
const DEFAULT: bool = true;
- const ENABLE_DOWNLOAD_RUSTC: bool = true;
const ONLY_HOSTS: bool = true;
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
diff --git a/src/ci/docker/host-x86_64/dist-various-2/Dockerfile b/src/ci/docker/host-x86_64/dist-various-2/Dockerfile
index 6cfacc3..7bb3cb1 100644
--- a/src/ci/docker/host-x86_64/dist-various-2/Dockerfile
+++ b/src/ci/docker/host-x86_64/dist-various-2/Dockerfile
@@ -39,9 +39,9 @@
AR_sparcv9_sun_solaris=sparcv9-sun-solaris2.10-ar \
CC_sparcv9_sun_solaris=sparcv9-sun-solaris2.10-gcc \
CXX_sparcv9_sun_solaris=sparcv9-sun-solaris2.10-g++ \
- AR_x86_64_sun_solaris=x86_64-sun-solaris2.10-ar \
- CC_x86_64_sun_solaris=x86_64-sun-solaris2.10-gcc \
- CXX_x86_64_sun_solaris=x86_64-sun-solaris2.10-g++ \
+ AR_x86_64_pc_solaris=x86_64-pc-solaris2.10-ar \
+ CC_x86_64_pc_solaris=x86_64-pc-solaris2.10-gcc \
+ CXX_x86_64_pc_solaris=x86_64-pc-solaris2.10-g++ \
CC_armv7_unknown_linux_gnueabi=arm-linux-gnueabi-gcc-8 \
CXX_armv7_unknown_linux_gnueabi=arm-linux-gnueabi-g++-8 \
AR_x86_64_fortanix_unknown_sgx=ar \
@@ -100,7 +100,7 @@
ENV TARGETS=$TARGETS,wasm32-unknown-unknown
ENV TARGETS=$TARGETS,wasm32-wasi
ENV TARGETS=$TARGETS,sparcv9-sun-solaris
-ENV TARGETS=$TARGETS,x86_64-sun-solaris
+ENV TARGETS=$TARGETS,x86_64-pc-solaris
ENV TARGETS=$TARGETS,x86_64-unknown-linux-gnux32
ENV TARGETS=$TARGETS,x86_64-fortanix-unknown-sgx
ENV TARGETS=$TARGETS,nvptx64-nvidia-cuda
diff --git a/src/ci/docker/host-x86_64/dist-various-2/build-solaris-toolchain.sh b/src/ci/docker/host-x86_64/dist-various-2/build-solaris-toolchain.sh
index 14fb399..ee76faf 100755
--- a/src/ci/docker/host-x86_64/dist-various-2/build-solaris-toolchain.sh
+++ b/src/ci/docker/host-x86_64/dist-various-2/build-solaris-toolchain.sh
@@ -9,6 +9,19 @@
BINUTILS=2.28.1
GCC=6.5.0
+# Choose correct target based on the $ARCH
+case "$ARCH" in
+x86_64)
+ TARGET=x86_64-pc-solaris2.10
+ ;;
+sparcv9)
+ TARGET=sparcv9-sun-solaris2.10
+ ;;
+*)
+ printf 'ERROR: unknown architecture: %s\n' "$ARCH"
+ exit 1
+esac
+
# First up, build binutils
mkdir binutils
cd binutils
@@ -16,7 +29,7 @@
curl https://ftp.gnu.org/gnu/binutils/binutils-$BINUTILS.tar.xz | tar xJf -
mkdir binutils-build
cd binutils-build
-hide_output ../binutils-$BINUTILS/configure --target=$ARCH-sun-solaris2.10
+hide_output ../binutils-$BINUTILS/configure --target=$TARGET
hide_output make -j10
hide_output make install
@@ -62,13 +75,13 @@
-extern size_t strnlen(const char *, size_t);
EOF
-mkdir /usr/local/$ARCH-sun-solaris2.10/usr
-mv usr/include /usr/local/$ARCH-sun-solaris2.10/usr/include
-mv usr/lib/$LIB_ARCH/* /usr/local/$ARCH-sun-solaris2.10/lib
-mv lib/$LIB_ARCH/* /usr/local/$ARCH-sun-solaris2.10/lib
+mkdir /usr/local/$TARGET/usr
+mv usr/include /usr/local/$TARGET/usr/include
+mv usr/lib/$LIB_ARCH/* /usr/local/$TARGET/lib
+mv lib/$LIB_ARCH/* /usr/local/$TARGET/lib
-ln -s usr/include /usr/local/$ARCH-sun-solaris2.10/sys-include
-ln -s usr/include /usr/local/$ARCH-sun-solaris2.10/include
+ln -s usr/include /usr/local/$TARGET/sys-include
+ln -s usr/include /usr/local/$TARGET/include
cd ..
rm -rf solaris
@@ -84,7 +97,7 @@
cd ../gcc-build
hide_output ../gcc-$GCC/configure \
--enable-languages=c,c++ \
- --target=$ARCH-sun-solaris2.10 \
+ --target=$TARGET \
--with-gnu-as \
--with-gnu-ld \
--disable-multilib \
diff --git a/src/ci/docker/scripts/illumos-toolchain.sh b/src/ci/docker/scripts/illumos-toolchain.sh
index 8cb5712..3f1d5f3 100644
--- a/src/ci/docker/scripts/illumos-toolchain.sh
+++ b/src/ci/docker/scripts/illumos-toolchain.sh
@@ -18,7 +18,7 @@
exit 1
esac
-BUILD_TARGET="$ARCH-sun-solaris2.10"
+BUILD_TARGET="$ARCH-pc-solaris2.10"
#
# The illumos and the Solaris build both use the same GCC-level host triple,
diff --git a/src/ci/github-actions/ci.yml b/src/ci/github-actions/ci.yml
index 5b9b779..7125b33 100644
--- a/src/ci/github-actions/ci.yml
+++ b/src/ci/github-actions/ci.yml
@@ -110,7 +110,7 @@
run: echo "[CI_PR_NUMBER=$num]"
env:
num: ${{ github.event.number }}
- if: success() && !env.SKIP_JOBS && github.event_name == 'pull_request'
+ if: success() && !env.SKIP_JOB && github.event_name == 'pull_request'
- name: add extra environment variables
run: src/ci/scripts/setup-environment.sh
diff --git a/src/doc/rustc/src/platform-support.md b/src/doc/rustc/src/platform-support.md
index a4ace91..d3b88c0 100644
--- a/src/doc/rustc/src/platform-support.md
+++ b/src/doc/rustc/src/platform-support.md
@@ -133,7 +133,7 @@
`x86_64-fortanix-unknown-sgx` | ✓ | | [Fortanix ABI] for 64-bit Intel SGX
`x86_64-fuchsia` | ✓ | | 64-bit Fuchsia
`x86_64-linux-android` | ✓ | | 64-bit x86 Android
-`x86_64-sun-solaris` | ✓ | | 64-bit Solaris 10/11, illumos
+`x86_64-pc-solaris` | ✓ | | 64-bit Solaris 10/11, illumos
`x86_64-unknown-freebsd` | ✓ | ✓ | 64-bit FreeBSD
`x86_64-unknown-illumos` | ✓ | ✓ | illumos
`x86_64-unknown-linux-gnux32` | ✓ | | 64-bit Linux (x32 ABI) (kernel 4.15, glibc 2.27)
@@ -218,7 +218,7 @@
`x86_64-apple-ios-macabi` | ✓ | | Apple Catalyst on x86_64
`x86_64-apple-tvos` | * | | x86 64-bit tvOS
`x86_64-linux-kernel` | * | | Linux kernel modules
-`x86_64-pc-solaris` | ? | |
+`x86_64-sun-solaris` | ? | | Deprecated target for 64-bit Solaris 10/11, illumos
`x86_64-pc-windows-msvc` | ✓ | | 64-bit Windows XP support
`x86_64-unknown-dragonfly` | ✓ | ✓ | 64-bit DragonFlyBSD
`x86_64-unknown-haiku` | ✓ | ✓ | 64-bit Haiku
diff --git a/src/etc/dec2flt_table.py b/src/etc/dec2flt_table.py
index 9bbcaf7..ad2292e 100755
--- a/src/etc/dec2flt_table.py
+++ b/src/etc/dec2flt_table.py
@@ -113,7 +113,7 @@
print()
print("#[rustfmt::skip]")
typ = "([u64; {0}], [i16; {0}])".format(len(powers))
- print("pub const POWERS: ", typ, " = (", sep='')
+ print("pub static POWERS: ", typ, " = (", sep='')
print(" [")
for z in powers:
print(" 0x{:x},".format(z.sig))
diff --git a/src/librustdoc/Cargo.toml b/src/librustdoc/Cargo.toml
index 1b9a35e..44c2c3b 100644
--- a/src/librustdoc/Cargo.toml
+++ b/src/librustdoc/Cargo.toml
@@ -19,6 +19,13 @@
itertools = "0.9"
regex = "1"
rustdoc-json-types = { path = "../rustdoc-json-types" }
+tracing = "0.1"
+tracing-tree = "0.1.6"
+
+[dependencies.tracing-subscriber]
+version = "0.2.13"
+default-features = false
+features = ["fmt", "env-filter", "smallvec", "parking_lot", "ansi"]
[dev-dependencies]
expect-test = "1.0"
diff --git a/src/librustdoc/clean/auto_trait.rs b/src/librustdoc/clean/auto_trait.rs
index a24cb0a..c23c087 100644
--- a/src/librustdoc/clean/auto_trait.rs
+++ b/src/librustdoc/clean/auto_trait.rs
@@ -34,7 +34,7 @@ fn generate_for_trait(
ty: Ty<'tcx>,
trait_def_id: DefId,
param_env: ty::ParamEnv<'tcx>,
- param_env_def_id: DefId,
+ item_def_id: DefId,
f: &auto_trait::AutoTraitFinder<'tcx>,
// If this is set, show only negative trait implementations, not positive ones.
discard_positive_impl: bool,
@@ -50,7 +50,7 @@ fn generate_for_trait(
let region_data = info.region_data;
let names_map = tcx
- .generics_of(param_env_def_id)
+ .generics_of(item_def_id)
.params
.iter()
.filter_map(|param| match param.kind {
@@ -62,16 +62,16 @@ fn generate_for_trait(
let lifetime_predicates = Self::handle_lifetimes(®ion_data, &names_map);
let new_generics = self.param_env_to_generics(
infcx.tcx,
- param_env_def_id,
+ item_def_id,
info.full_user_env,
lifetime_predicates,
info.vid_to_region,
);
debug!(
- "find_auto_trait_generics(param_env_def_id={:?}, trait_def_id={:?}): \
+ "find_auto_trait_generics(item_def_id={:?}, trait_def_id={:?}): \
finished with {:?}",
- param_env_def_id, trait_def_id, new_generics
+ item_def_id, trait_def_id, new_generics
);
new_generics
@@ -101,7 +101,7 @@ fn generate_for_trait(
// Instead, we generate `impl !Send for Foo<T>`, which better
// expresses the fact that `Foo<T>` never implements `Send`,
// regardless of the choice of `T`.
- let params = (tcx.generics_of(param_env_def_id), ty::GenericPredicates::default())
+ let params = (tcx.generics_of(item_def_id), ty::GenericPredicates::default())
.clean(self.cx)
.params;
@@ -115,7 +115,7 @@ fn generate_for_trait(
name: None,
attrs: Default::default(),
visibility: Inherited,
- def_id: self.cx.next_def_id(param_env_def_id.krate),
+ def_id: self.cx.next_def_id(item_def_id.krate),
kind: box ImplItem(Impl {
unsafety: hir::Unsafety::Normal,
generics: new_generics,
@@ -130,26 +130,25 @@ fn generate_for_trait(
})
}
- // FIXME(eddyb) figure out a better way to pass information about
- // parametrization of `ty` than `param_env_def_id`.
- crate fn get_auto_trait_impls(&mut self, ty: Ty<'tcx>, param_env_def_id: DefId) -> Vec<Item> {
+ crate fn get_auto_trait_impls(&mut self, item_def_id: DefId) -> Vec<Item> {
let tcx = self.cx.tcx;
- let param_env = tcx.param_env(param_env_def_id);
- let f = auto_trait::AutoTraitFinder::new(self.cx.tcx);
+ let param_env = tcx.param_env(item_def_id);
+ let ty = tcx.type_of(item_def_id);
+ let f = auto_trait::AutoTraitFinder::new(tcx);
debug!("get_auto_trait_impls({:?})", ty);
let auto_traits: Vec<_> = self.cx.auto_traits.iter().cloned().collect();
let mut auto_traits: Vec<Item> = auto_traits
.into_iter()
.filter_map(|trait_def_id| {
- self.generate_for_trait(ty, trait_def_id, param_env, param_env_def_id, &f, false)
+ self.generate_for_trait(ty, trait_def_id, param_env, item_def_id, &f, false)
})
.collect();
// We are only interested in case the type *doesn't* implement the Sized trait.
- if !ty.is_sized(self.cx.tcx.at(rustc_span::DUMMY_SP), param_env) {
+ if !ty.is_sized(tcx.at(rustc_span::DUMMY_SP), param_env) {
// In case `#![no_core]` is used, `sized_trait` returns nothing.
- if let Some(item) = self.cx.tcx.lang_items().sized_trait().and_then(|sized_trait_did| {
- self.generate_for_trait(ty, sized_trait_did, param_env, param_env_def_id, &f, true)
+ if let Some(item) = tcx.lang_items().sized_trait().and_then(|sized_trait_did| {
+ self.generate_for_trait(ty, sized_trait_did, param_env, item_def_id, &f, true)
}) {
auto_traits.push(item);
}
@@ -445,15 +444,15 @@ fn make_final_bounds(
fn param_env_to_generics(
&mut self,
tcx: TyCtxt<'tcx>,
- param_env_def_id: DefId,
+ item_def_id: DefId,
param_env: ty::ParamEnv<'tcx>,
mut existing_predicates: Vec<WherePredicate>,
vid_to_region: FxHashMap<ty::RegionVid, ty::Region<'tcx>>,
) -> Generics {
debug!(
- "param_env_to_generics(param_env_def_id={:?}, param_env={:?}, \
+ "param_env_to_generics(item_def_id={:?}, param_env={:?}, \
existing_predicates={:?})",
- param_env_def_id, param_env, existing_predicates
+ item_def_id, param_env, existing_predicates
);
// The `Sized` trait must be handled specially, since we only display it when
@@ -463,7 +462,7 @@ fn param_env_to_generics(
let mut replacer = RegionReplacer { vid_to_region: &vid_to_region, tcx };
let orig_bounds: FxHashSet<_> =
- self.cx.tcx.param_env(param_env_def_id).caller_bounds().iter().collect();
+ self.cx.tcx.param_env(item_def_id).caller_bounds().iter().collect();
let clean_where_predicates = param_env
.caller_bounds()
.iter()
@@ -477,14 +476,11 @@ fn param_env_to_generics(
.map(|p| p.fold_with(&mut replacer));
let mut generic_params =
- (tcx.generics_of(param_env_def_id), tcx.explicit_predicates_of(param_env_def_id))
+ (tcx.generics_of(item_def_id), tcx.explicit_predicates_of(item_def_id))
.clean(self.cx)
.params;
- debug!(
- "param_env_to_generics({:?}): generic_params={:?}",
- param_env_def_id, generic_params
- );
+ debug!("param_env_to_generics({:?}): generic_params={:?}", item_def_id, generic_params);
let mut has_sized = FxHashSet::default();
let mut ty_to_bounds: FxHashMap<_, FxHashSet<_>> = Default::default();
@@ -648,13 +644,10 @@ fn param_env_to_generics(
.or_default()
.insert(*trait_.clone());
}
- _ => panic!(
- "Unexpected trait {:?} for {:?}",
- trait_, param_env_def_id,
- ),
+ _ => panic!("Unexpected trait {:?} for {:?}", trait_, item_def_id),
}
}
- _ => panic!("Unexpected LHS {:?} for {:?}", lhs, param_env_def_id),
+ _ => panic!("Unexpected LHS {:?} for {:?}", lhs, item_def_id),
}
}
};
diff --git a/src/librustdoc/clean/blanket_impl.rs b/src/librustdoc/clean/blanket_impl.rs
index 94b8203..4e4e1e5 100644
--- a/src/librustdoc/clean/blanket_impl.rs
+++ b/src/librustdoc/clean/blanket_impl.rs
@@ -14,15 +14,14 @@
}
impl<'a, 'tcx> BlanketImplFinder<'a, 'tcx> {
- // FIXME(eddyb) figure out a better way to pass information about
- // parametrization of `ty` than `param_env_def_id`.
- crate fn get_blanket_impls(&mut self, ty: Ty<'tcx>, param_env_def_id: DefId) -> Vec<Item> {
- let param_env = self.cx.tcx.param_env(param_env_def_id);
+ crate fn get_blanket_impls(&mut self, item_def_id: DefId) -> Vec<Item> {
+ let param_env = self.cx.tcx.param_env(item_def_id);
+ let ty = self.cx.tcx.type_of(item_def_id);
debug!("get_blanket_impls({:?})", ty);
let mut impls = Vec::new();
for &trait_def_id in self.cx.tcx.all_traits(LOCAL_CRATE).iter() {
- if !self.cx.renderinfo.access_levels.is_public(trait_def_id)
+ if !self.cx.cache.access_levels.is_public(trait_def_id)
|| self.cx.generated_synthetics.get(&(ty, trait_def_id)).is_some()
{
continue;
@@ -39,7 +38,7 @@ impl<'a, 'tcx> BlanketImplFinder<'a, 'tcx> {
_ => return false,
}
- let substs = infcx.fresh_substs_for_item(DUMMY_SP, param_env_def_id);
+ let substs = infcx.fresh_substs_for_item(DUMMY_SP, item_def_id);
let ty = ty.subst(infcx.tcx, substs);
let param_env = param_env.subst(infcx.tcx, substs);
diff --git a/src/librustdoc/clean/inline.rs b/src/librustdoc/clean/inline.rs
index 9cfa721..47a7423 100644
--- a/src/librustdoc/clean/inline.rs
+++ b/src/librustdoc/clean/inline.rs
@@ -17,6 +17,7 @@
use crate::clean::{self, Attributes, GetDefId, ToSource, TypeKind};
use crate::core::DocContext;
+use crate::formats::item_type::ItemType;
use super::Clean;
@@ -122,7 +123,7 @@
let target_attrs = load_attrs(cx, did);
let attrs = box merge_attrs(cx, Some(parent_module), target_attrs, attrs_clone);
- cx.renderinfo.inlined.insert(did);
+ cx.inlined.insert(did);
let what_rustc_thinks = clean::Item::from_def_id_and_parts(did, Some(name), kind, cx);
ret.push(clean::Item { attrs, ..what_rustc_thinks });
Some(ret)
@@ -181,9 +182,9 @@
};
if did.is_local() {
- cx.renderinfo.exact_paths.insert(did, fqn);
+ cx.cache.exact_paths.insert(did, fqn);
} else {
- cx.renderinfo.external_paths.insert(did, (fqn, kind));
+ cx.cache.external_paths.insert(did, (fqn, ItemType::from(kind)));
}
}
@@ -315,7 +316,7 @@ fn merge_attrs(
attrs: Option<Attrs<'_>>,
ret: &mut Vec<clean::Item>,
) {
- if !cx.renderinfo.inlined.insert(did) {
+ if !cx.inlined.insert(did) {
return;
}
@@ -327,7 +328,7 @@ fn merge_attrs(
if !did.is_local() {
if let Some(traitref) = associated_trait {
let did = traitref.def_id;
- if !cx.renderinfo.access_levels.is_public(did) {
+ if !cx.cache.access_levels.is_public(did) {
return;
}
@@ -359,7 +360,7 @@ fn merge_attrs(
// reachable in rustdoc generated documentation
if !did.is_local() {
if let Some(did) = for_.def_id() {
- if !cx.renderinfo.access_levels.is_public(did) {
+ if !cx.cache.access_levels.is_public(did) {
return;
}
diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs
index 7aa3433..5d81498 100644
--- a/src/librustdoc/clean/mod.rs
+++ b/src/librustdoc/clean/mod.rs
@@ -1304,7 +1304,7 @@ fn clean_qpath(hir_ty: &hir::Ty<'_>, cx: &mut DocContext<'_>) -> Type {
// Substitute private type aliases
if let Some(def_id) = def_id.as_local() {
let hir_id = cx.tcx.hir().local_def_id_to_hir_id(def_id);
- if !cx.renderinfo.access_levels.is_exported(def_id.to_def_id()) {
+ if !cx.cache.access_levels.is_exported(def_id.to_def_id()) {
alias = Some(&cx.tcx.hir().expect_item(hir_id).kind);
}
}
diff --git a/src/librustdoc/clean/types.rs b/src/librustdoc/clean/types.rs
index 7fc48cd..09ba0e2 100644
--- a/src/librustdoc/clean/types.rs
+++ b/src/librustdoc/clean/types.rs
@@ -50,7 +50,6 @@
#[derive(Clone, Debug)]
crate struct Crate {
crate name: Symbol,
- crate version: Option<String>,
crate src: FileName,
crate module: Option<Item>,
crate externs: Vec<(CrateNum, ExternalCrate)>,
diff --git a/src/librustdoc/clean/utils.rs b/src/librustdoc/clean/utils.rs
index a0a2b78..a64e8c2 100644
--- a/src/librustdoc/clean/utils.rs
+++ b/src/librustdoc/clean/utils.rs
@@ -13,25 +13,25 @@
use rustc_hir::def_id::{DefId, LOCAL_CRATE};
use rustc_middle::mir::interpret::ConstValue;
use rustc_middle::ty::subst::{GenericArgKind, SubstsRef};
-use rustc_middle::ty::{self, DefIdTree, Ty, TyCtxt};
+use rustc_middle::ty::{self, DefIdTree, TyCtxt};
use rustc_span::symbol::{kw, sym, Symbol};
use std::mem;
-crate fn krate(mut cx: &mut DocContext<'_>) -> Crate {
+crate fn krate(cx: &mut DocContext<'_>) -> Crate {
use crate::visit_lib::LibEmbargoVisitor;
let krate = cx.tcx.hir().krate();
- let module = crate::visit_ast::RustdocVisitor::new(&mut cx).visit(krate);
+ let module = crate::visit_ast::RustdocVisitor::new(cx).visit(krate);
- cx.renderinfo.deref_trait_did = cx.tcx.lang_items().deref_trait();
- cx.renderinfo.deref_mut_trait_did = cx.tcx.lang_items().deref_mut_trait();
- cx.renderinfo.owned_box_did = cx.tcx.lang_items().owned_box();
+ cx.cache.deref_trait_did = cx.tcx.lang_items().deref_trait();
+ cx.cache.deref_mut_trait_did = cx.tcx.lang_items().deref_mut_trait();
+ cx.cache.owned_box_did = cx.tcx.lang_items().owned_box();
let mut externs = Vec::new();
for &cnum in cx.tcx.crates().iter() {
externs.push((cnum, cnum.clean(cx)));
// Analyze doc-reachability for extern items
- LibEmbargoVisitor::new(&mut cx).visit_lib(cnum);
+ LibEmbargoVisitor::new(cx).visit_lib(cnum);
}
externs.sort_by(|&(a, _), &(b, _)| a.cmp(&b));
@@ -77,7 +77,6 @@
Crate {
name,
- version: None,
src,
module: Some(module),
externs,
@@ -426,19 +425,18 @@ fn print_const_with_custom_print_scalar(cx: &DocContext<'_>, ct: &'tcx ty::Const
crate fn get_auto_trait_and_blanket_impls(
cx: &mut DocContext<'tcx>,
- ty: Ty<'tcx>,
- param_env_def_id: DefId,
+ item_def_id: DefId,
) -> impl Iterator<Item = Item> {
let auto_impls = cx
.sess()
.prof
.generic_activity("get_auto_trait_impls")
- .run(|| AutoTraitFinder::new(cx).get_auto_trait_impls(ty, param_env_def_id));
+ .run(|| AutoTraitFinder::new(cx).get_auto_trait_impls(item_def_id));
let blanket_impls = cx
.sess()
.prof
.generic_activity("get_blanket_impls")
- .run(|| BlanketImplFinder { cx }.get_blanket_impls(ty, param_env_def_id));
+ .run(|| BlanketImplFinder { cx }.get_blanket_impls(item_def_id));
auto_impls.into_iter().chain(blanket_impls)
}
diff --git a/src/librustdoc/config.rs b/src/librustdoc/config.rs
index 1478437..d9f5b5b 100644
--- a/src/librustdoc/config.rs
+++ b/src/librustdoc/config.rs
@@ -4,9 +4,7 @@
use std::fmt;
use std::path::PathBuf;
-use rustc_data_structures::fx::{FxHashMap, FxHashSet};
-use rustc_hir::def_id::DefId;
-use rustc_middle::middle::privacy::AccessLevels;
+use rustc_data_structures::fx::FxHashMap;
use rustc_session::config::{self, parse_crate_types_from_list, parse_externs, CrateType};
use rustc_session::config::{
build_codegen_options, build_debugging_options, get_cmd_lint_options, host_triple,
@@ -268,20 +266,6 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
crate unstable_features: rustc_feature::UnstableFeatures,
}
-/// Temporary storage for data obtained during `RustdocVisitor::clean()`.
-/// Later on moved into `cache`.
-#[derive(Default, Clone)]
-crate struct RenderInfo {
- crate inlined: FxHashSet<DefId>,
- crate external_paths: crate::core::ExternalPaths,
- crate exact_paths: FxHashMap<DefId, Vec<String>>,
- crate access_levels: AccessLevels<DefId>,
- crate deref_trait_did: Option<DefId>,
- crate deref_mut_trait_did: Option<DefId>,
- crate owned_box_did: Option<DefId>,
- crate output_format: OutputFormat,
-}
-
impl Options {
/// Parses the given command-line for options. If an error message or other early-return has
/// been printed, returns `Err` with the exit code.
diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs
index f0b3159..6218aaf 100644
--- a/src/librustdoc/core.rs
+++ b/src/librustdoc/core.rs
@@ -31,15 +31,12 @@
use crate::clean;
use crate::clean::inline::build_external_trait;
use crate::clean::{AttributesExt, TraitWithExtraInfo, MAX_DEF_IDX};
-use crate::config::{Options as RustdocOptions, RenderOptions};
-use crate::config::{OutputFormat, RenderInfo};
+use crate::config::{Options as RustdocOptions, OutputFormat, RenderOptions};
use crate::formats::cache::Cache;
use crate::passes::{self, Condition::*, ConditionalPass};
crate use rustc_session::config::{DebuggingOptions, Input, Options};
-crate type ExternalPaths = FxHashMap<DefId, (Vec<String>, clean::TypeKind)>;
-
crate struct DocContext<'tcx> {
crate tcx: TyCtxt<'tcx>,
/// Name resolver. Used for intra-doc links.
@@ -52,8 +49,6 @@
///
/// Most of this logic is copied from rustc_lint::late.
crate param_env: ParamEnv<'tcx>,
- /// Later on moved into `cache`
- crate renderinfo: RenderInfo,
/// Later on moved through `clean::Crate` into `cache`
crate external_traits: Rc<RefCell<FxHashMap<DefId, clean::TraitWithExtraInfo>>>,
/// Used while populating `external_traits` to ensure we don't process the same trait twice at
@@ -81,8 +76,12 @@
/// See `collect_intra_doc_links::traits_implemented_by` for more details.
/// `map<module, set<trait>>`
crate module_trait_cache: RefCell<FxHashMap<DefId, FxHashSet<DefId>>>,
- /// Fake empty cache used when cache is required as parameter.
+ /// This same cache is used throughout rustdoc, including in [`crate::html::render`].
crate cache: Cache,
+ /// Used by [`clean::inline`] to tell if an item has already been inlined.
+ crate inlined: FxHashSet<DefId>,
+ /// Used by `calculate_doc_coverage`.
+ crate output_format: OutputFormat,
}
impl<'tcx> DocContext<'tcx> {
@@ -465,7 +464,7 @@ pub(crate) fn init_lints<F>(
mut manual_passes: Vec<String>,
render_options: RenderOptions,
output_format: OutputFormat,
-) -> (clean::Crate, RenderInfo, RenderOptions) {
+) -> (clean::Crate, RenderOptions, Cache) {
// Certain queries assume that some checks were run elsewhere
// (see https://github.com/rust-lang/rust/pull/73566#issuecomment-656954425),
// so type-check everything other than function bodies in this crate before running lints.
@@ -492,6 +491,7 @@ pub(crate) fn init_lints<F>(
tcx.ensure().check_mod_attrs(module);
}
});
+ rustc_passes::stability::check_unused_or_stable_features(tcx);
let access_levels = tcx.privacy_access_levels(LOCAL_CRATE);
// Convert from a HirId set to a DefId set since we don't always have easy access
@@ -504,17 +504,12 @@ pub(crate) fn init_lints<F>(
.collect(),
};
- let mut renderinfo = RenderInfo::default();
- renderinfo.access_levels = access_levels;
- renderinfo.output_format = output_format;
-
let mut ctxt = DocContext {
tcx,
resolver,
param_env: ParamEnv::empty(),
external_traits: Default::default(),
active_extern_traits: Default::default(),
- renderinfo,
ty_substs: Default::default(),
lt_substs: Default::default(),
ct_substs: Default::default(),
@@ -527,9 +522,11 @@ pub(crate) fn init_lints<F>(
.cloned()
.filter(|trait_def_id| tcx.trait_is_auto(*trait_def_id))
.collect(),
- render_options,
module_trait_cache: RefCell::new(FxHashMap::default()),
- cache: Cache::default(),
+ cache: Cache::new(access_levels, render_options.document_private),
+ inlined: FxHashSet::default(),
+ output_format,
+ render_options,
};
// Small hack to force the Sized trait to be present.
@@ -647,10 +644,16 @@ fn report_deprecated_attr(name: &str, diag: &rustc_errors::Handler) {
ctxt.sess().abort_if_errors();
+ let render_options = ctxt.render_options;
+ let mut cache = ctxt.cache;
+ krate = tcx.sess.time("create_format_cache", || {
+ cache.populate(krate, tcx, &render_options.extern_html_root_urls, &render_options.output)
+ });
+
// The main crate doc comments are always collapsed.
krate.collapsed = true;
- (krate, ctxt.renderinfo, ctxt.render_options)
+ (krate, render_options, cache)
}
/// Due to <https://github.com/rust-lang/rust/pull/73566>,
diff --git a/src/librustdoc/formats/cache.rs b/src/librustdoc/formats/cache.rs
index e9c5dd5..f20296f 100644
--- a/src/librustdoc/formats/cache.rs
+++ b/src/librustdoc/formats/cache.rs
@@ -11,7 +11,6 @@
use rustc_span::Symbol;
use crate::clean::{self, GetDefId};
-use crate::config::RenderInfo;
use crate::fold::DocFolder;
use crate::formats::item_type::ItemType;
use crate::formats::Impl;
@@ -131,44 +130,23 @@ struct CacheBuilder<'a, 'tcx> {
}
impl Cache {
- crate fn from_krate<'tcx>(
- render_info: RenderInfo,
- document_private: bool,
+ crate fn new(access_levels: AccessLevels<DefId>, document_private: bool) -> Self {
+ Cache { access_levels, document_private, ..Cache::default() }
+ }
+
+ /// Populates the `Cache` with more data. The returned `Crate` will be missing some data that was
+ /// in `krate` due to the data being moved into the `Cache`.
+ crate fn populate(
+ &mut self,
+ mut krate: clean::Crate,
+ tcx: TyCtxt<'_>,
extern_html_root_urls: &BTreeMap<String, String>,
dst: &Path,
- mut krate: clean::Crate,
- tcx: TyCtxt<'tcx>,
- ) -> (clean::Crate, Cache) {
+ ) -> clean::Crate {
// Crawl the crate to build various caches used for the output
- let RenderInfo {
- inlined: _,
- external_paths,
- exact_paths,
- access_levels,
- deref_trait_did,
- deref_mut_trait_did,
- owned_box_did,
- ..
- } = render_info;
-
- let external_paths =
- external_paths.into_iter().map(|(k, (v, t))| (k, (v, ItemType::from(t)))).collect();
-
- let mut cache = Cache {
- external_paths,
- exact_paths,
- parent_is_trait_impl: false,
- stripped_mod: false,
- access_levels,
- crate_version: krate.version.take(),
- document_private,
- traits: krate.external_traits.replace(Default::default()),
- deref_trait_did,
- deref_mut_trait_did,
- owned_box_did,
- masked_crates: mem::take(&mut krate.masked_crates),
- ..Cache::default()
- };
+ debug!(?self.crate_version);
+ self.traits = krate.external_traits.take();
+ self.masked_crates = mem::take(&mut krate.masked_crates);
// Cache where all our extern crates are located
// FIXME: this part is specific to HTML so it'd be nice to remove it from the common code
@@ -181,12 +159,11 @@ impl Cache {
_ => PathBuf::new(),
};
let extern_url = extern_html_root_urls.get(&*e.name.as_str()).map(|u| &**u);
- cache
- .extern_locations
+ self.extern_locations
.insert(n, (e.name, src_root, extern_location(e, extern_url, &dst)));
let did = DefId { krate: n, index: CRATE_DEF_INDEX };
- cache.external_paths.insert(did, (vec![e.name.to_string()], ItemType::Module));
+ self.external_paths.insert(did, (vec![e.name.to_string()], ItemType::Module));
}
// Cache where all known primitives have their documentation located.
@@ -195,27 +172,26 @@ impl Cache {
// reverse topological order.
for &(_, ref e) in krate.externs.iter().rev() {
for &(def_id, prim) in &e.primitives {
- cache.primitive_locations.insert(prim, def_id);
+ self.primitive_locations.insert(prim, def_id);
}
}
for &(def_id, prim) in &krate.primitives {
- cache.primitive_locations.insert(prim, def_id);
+ self.primitive_locations.insert(prim, def_id);
}
- cache.stack.push(krate.name.to_string());
+ self.stack.push(krate.name.to_string());
- krate = CacheBuilder { tcx, cache: &mut cache, empty_cache: Cache::default() }
- .fold_crate(krate);
+ krate = CacheBuilder { tcx, cache: self, empty_cache: Cache::default() }.fold_crate(krate);
- for (trait_did, dids, impl_) in cache.orphan_trait_impls.drain(..) {
- if cache.traits.contains_key(&trait_did) {
+ for (trait_did, dids, impl_) in self.orphan_trait_impls.drain(..) {
+ if self.traits.contains_key(&trait_did) {
for did in dids {
- cache.impls.entry(did).or_default().push(impl_.clone());
+ self.impls.entry(did).or_default().push(impl_.clone());
}
}
}
- (krate, cache)
+ krate
}
}
diff --git a/src/librustdoc/formats/renderer.rs b/src/librustdoc/formats/renderer.rs
index 6437ba4..b779363 100644
--- a/src/librustdoc/formats/renderer.rs
+++ b/src/librustdoc/formats/renderer.rs
@@ -2,7 +2,7 @@
use rustc_span::edition::Edition;
use crate::clean;
-use crate::config::{RenderInfo, RenderOptions};
+use crate::config::RenderOptions;
use crate::error::Error;
use crate::formats::cache::Cache;
@@ -18,7 +18,6 @@
fn init(
krate: clean::Crate,
options: RenderOptions,
- render_info: RenderInfo,
edition: Edition,
cache: Cache,
tcx: TyCtxt<'tcx>,
@@ -49,26 +48,16 @@ fn after_krate(
crate fn run_format<'tcx, T: FormatRenderer<'tcx>>(
krate: clean::Crate,
options: RenderOptions,
- render_info: RenderInfo,
+ cache: Cache,
diag: &rustc_errors::Handler,
edition: Edition,
tcx: TyCtxt<'tcx>,
) -> Result<(), Error> {
- let (krate, cache) = tcx.sess.time("create_format_cache", || {
- Cache::from_krate(
- render_info.clone(),
- options.document_private,
- &options.extern_html_root_urls,
- &options.output,
- krate,
- tcx,
- )
- });
let prof = &tcx.sess.prof;
let (mut format_renderer, mut krate) = prof
.extra_verbose_generic_activity("create_renderer", T::descr())
- .run(|| T::init(krate, options, render_info, edition, cache, tcx))?;
+ .run(|| T::init(krate, options, edition, cache, tcx))?;
let mut item = match krate.module.take() {
Some(i) => i,
diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs
index 58e9e41..4e762a4 100644
--- a/src/librustdoc/html/render/mod.rs
+++ b/src/librustdoc/html/render/mod.rs
@@ -66,7 +66,7 @@
use serde::{Serialize, Serializer};
use crate::clean::{self, AttributesExt, GetDefId, RenderedLink, SelfTy, TypeKind};
-use crate::config::{RenderInfo, RenderOptions};
+use crate::config::RenderOptions;
use crate::docfs::{DocFS, PathError};
use crate::error::Error;
use crate::formats::cache::Cache;
@@ -385,7 +385,6 @@ fn descr() -> &'static str {
fn init(
mut krate: clean::Crate,
options: RenderOptions,
- _render_info: RenderInfo,
edition: Edition,
mut cache: Cache,
tcx: TyCtxt<'tcx>,
diff --git a/src/librustdoc/json/mod.rs b/src/librustdoc/json/mod.rs
index a3b2146..e6edf33 100644
--- a/src/librustdoc/json/mod.rs
+++ b/src/librustdoc/json/mod.rs
@@ -19,7 +19,7 @@
use rustdoc_json_types as types;
use crate::clean;
-use crate::config::{RenderInfo, RenderOptions};
+use crate::config::RenderOptions;
use crate::error::Error;
use crate::formats::cache::Cache;
use crate::formats::FormatRenderer;
@@ -133,7 +133,6 @@ fn descr() -> &'static str {
fn init(
krate: clean::Crate,
options: RenderOptions,
- _render_info: RenderInfo,
_edition: Edition,
cache: Cache,
tcx: TyCtxt<'tcx>,
@@ -200,7 +199,7 @@ fn mod_item_out(&mut self, _item_name: &str) -> Result<(), Error> {
fn after_krate(
&mut self,
- krate: &clean::Crate,
+ _krate: &clean::Crate,
_diag: &rustc_errors::Handler,
) -> Result<(), Error> {
debug!("Done with crate");
@@ -211,7 +210,7 @@ fn after_krate(
#[allow(rustc::default_hash_types)]
let output = types::Crate {
root: types::Id(String::from("0:0")),
- crate_version: krate.version.clone(),
+ crate_version: self.cache.crate_version.clone(),
includes_private: self.cache.document_private,
index: index.into_iter().collect(),
paths: self
diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs
index 2342ed3..6b37643 100644
--- a/src/librustdoc/lib.rs
+++ b/src/librustdoc/lib.rs
@@ -49,6 +49,7 @@
extern crate rustc_middle;
extern crate rustc_mir;
extern crate rustc_parse;
+extern crate rustc_passes;
extern crate rustc_resolve;
extern crate rustc_session;
extern crate rustc_span as rustc_span;
@@ -94,7 +95,19 @@
pub fn main() {
rustc_driver::set_sigpipe_handler();
rustc_driver::install_ice_hook();
+
+ // When using CI artifacts (with `download_stage1 = true`), tracing is unconditionally built
+ // with `--features=static_max_level_info`, which disables almost all rustdoc logging. To avoid
+ // this, compile our own version of `tracing` that logs all levels.
+ // NOTE: this compiles both versions of tracing unconditionally, because
+ // - The compile time hit is not that bad, especially compared to rustdoc's incremental times, and
+ // - Otherwise, there's no warning that logging is being ignored when `download_stage1 = true`.
+ // NOTE: The reason this doesn't show double logging when `download_stage1 = false` and
+ // `debug_logging = true` is because all rustc logging goes to its version of tracing (the one
+ // in the sysroot), and all of rustdoc's logging goes to its version (the one in Cargo.toml).
+ init_logging();
rustc_driver::init_env_logger("RUSTDOC_LOG");
+
let exit_code = rustc_driver::catch_with_exit_code(|| match get_args() {
Some(args) => main_args(&args),
_ => Err(ErrorReported),
@@ -102,6 +115,68 @@ pub fn main() {
process::exit(exit_code);
}
+fn init_logging() {
+ use std::io;
+
+ // FIXME remove these and use winapi 0.3 instead
+ // Duplicates: bootstrap/compile.rs, librustc_errors/emitter.rs, rustc_driver/lib.rs
+ #[cfg(unix)]
+ fn stdout_isatty() -> bool {
+ extern crate libc;
+ unsafe { libc::isatty(libc::STDOUT_FILENO) != 0 }
+ }
+
+ #[cfg(windows)]
+ fn stdout_isatty() -> bool {
+ extern crate winapi;
+ use winapi::um::consoleapi::GetConsoleMode;
+ use winapi::um::processenv::GetStdHandle;
+ use winapi::um::winbase::STD_OUTPUT_HANDLE;
+
+ unsafe {
+ let handle = GetStdHandle(STD_OUTPUT_HANDLE);
+ let mut out = 0;
+ GetConsoleMode(handle, &mut out) != 0
+ }
+ }
+
+ let color_logs = match std::env::var("RUSTDOC_LOG_COLOR") {
+ Ok(value) => match value.as_ref() {
+ "always" => true,
+ "never" => false,
+ "auto" => stdout_isatty(),
+ _ => early_error(
+ ErrorOutputType::default(),
+ &format!(
+ "invalid log color value '{}': expected one of always, never, or auto",
+ value
+ ),
+ ),
+ },
+ Err(std::env::VarError::NotPresent) => stdout_isatty(),
+ Err(std::env::VarError::NotUnicode(_value)) => early_error(
+ ErrorOutputType::default(),
+ "non-Unicode log color value: expected one of always, never, or auto",
+ ),
+ };
+ let filter = tracing_subscriber::EnvFilter::from_env("RUSTDOC_LOG");
+ let layer = tracing_tree::HierarchicalLayer::default()
+ .with_writer(io::stderr)
+ .with_indent_lines(true)
+ .with_ansi(color_logs)
+ .with_targets(true)
+ .with_wraparound(10)
+ .with_verbose_exit(true)
+ .with_verbose_entry(true)
+ .with_indent_amount(2);
+ #[cfg(parallel_compiler)]
+ let layer = layer.with_thread_ids(true).with_thread_names(true);
+
+ use tracing_subscriber::layer::SubscriberExt;
+ let subscriber = tracing_subscriber::Registry::default().with(filter).with(layer);
+ tracing::subscriber::set_global_default(subscriber).unwrap();
+}
+
fn get_args() -> Option<Vec<String>> {
env::args_os()
.enumerate()
@@ -479,12 +554,12 @@ fn wrap_return(diag: &rustc_errors::Handler, res: Result<(), String>) -> MainRes
fn run_renderer<'tcx, T: formats::FormatRenderer<'tcx>>(
krate: clean::Crate,
renderopts: config::RenderOptions,
- render_info: config::RenderInfo,
+ cache: formats::cache::Cache,
diag: &rustc_errors::Handler,
edition: rustc_span::edition::Edition,
tcx: TyCtxt<'tcx>,
) -> MainResult {
- match formats::run_format::<T>(krate, renderopts, render_info, &diag, edition, tcx) {
+ match formats::run_format::<T>(krate, renderopts, cache, &diag, edition, tcx) {
Ok(_) => Ok(()),
Err(e) => {
let mut msg = diag.struct_err(&format!("couldn't generate documentation: {}", e.error));
@@ -553,7 +628,7 @@ fn main_options(options: config::Options) -> MainResult {
let mut global_ctxt = abort_on_err(queries.global_ctxt(), sess).peek_mut();
global_ctxt.enter(|tcx| {
- let (mut krate, render_info, render_opts) = sess.time("run_global_ctxt", || {
+ let (krate, render_opts, mut cache) = sess.time("run_global_ctxt", || {
core::run_global_ctxt(
tcx,
resolver,
@@ -565,7 +640,7 @@ fn main_options(options: config::Options) -> MainResult {
});
info!("finished with rustc");
- krate.version = crate_version;
+ cache.crate_version = crate_version;
if show_coverage {
// if we ran coverage, bail early, we don't need to also generate docs at this point
@@ -584,7 +659,7 @@ fn main_options(options: config::Options) -> MainResult {
run_renderer::<html::render::Context<'_>>(
krate,
render_opts,
- render_info,
+ cache,
&diag,
edition,
tcx,
@@ -594,7 +669,7 @@ fn main_options(options: config::Options) -> MainResult {
run_renderer::<json::JsonRenderer<'_>>(
krate,
render_opts,
- render_info,
+ cache,
&diag,
edition,
tcx,
diff --git a/src/librustdoc/passes/calculate_doc_coverage.rs b/src/librustdoc/passes/calculate_doc_coverage.rs
index c3365b8..bb54523 100644
--- a/src/librustdoc/passes/calculate_doc_coverage.rs
+++ b/src/librustdoc/passes/calculate_doc_coverage.rs
@@ -127,7 +127,7 @@ fn to_json(&self) -> String {
}
fn print_results(&self) {
- let output_format = self.ctx.renderinfo.output_format;
+ let output_format = self.ctx.output_format;
if output_format.is_json() {
println!("{}", self.to_json());
return;
diff --git a/src/librustdoc/passes/collect_trait_impls.rs b/src/librustdoc/passes/collect_trait_impls.rs
index 0271a5b..685451b 100644
--- a/src/librustdoc/passes/collect_trait_impls.rs
+++ b/src/librustdoc/passes/collect_trait_impls.rs
@@ -46,10 +46,8 @@
// FIXME(eddyb) is this `doc(hidden)` check needed?
if !cx.tcx.get_attrs(def_id).lists(sym::doc).has_word(sym::hidden) {
- let self_ty = cx.tcx.type_of(def_id);
- let impls = get_auto_trait_and_blanket_impls(cx, self_ty, def_id);
-
- new_items.extend(impls.filter(|i| cx.renderinfo.inlined.insert(i.def_id)));
+ let impls = get_auto_trait_and_blanket_impls(cx, def_id);
+ new_items.extend(impls.filter(|i| cx.inlined.insert(i.def_id)));
}
});
}
@@ -170,11 +168,7 @@ fn fold_item(&mut self, i: Item) -> Option<Item> {
if i.is_struct() || i.is_enum() || i.is_union() {
// FIXME(eddyb) is this `doc(hidden)` check needed?
if !self.cx.tcx.get_attrs(i.def_id).lists(sym::doc).has_word(sym::hidden) {
- self.impls.extend(get_auto_trait_and_blanket_impls(
- self.cx,
- self.cx.tcx.type_of(i.def_id),
- i.def_id,
- ));
+ self.impls.extend(get_auto_trait_and_blanket_impls(self.cx, i.def_id));
}
}
diff --git a/src/librustdoc/passes/doc_test_lints.rs b/src/librustdoc/passes/doc_test_lints.rs
index e8e1bea..3b1508c 100644
--- a/src/librustdoc/passes/doc_test_lints.rs
+++ b/src/librustdoc/passes/doc_test_lints.rs
@@ -97,7 +97,7 @@ fn add_test(&mut self, _: String, config: LangString, _: usize) {
|lint| lint.build("missing code example in this documentation").emit(),
);
}
- } else if tests.found_tests > 0 && !cx.renderinfo.access_levels.is_public(item.def_id) {
+ } else if tests.found_tests > 0 && !cx.cache.access_levels.is_public(item.def_id) {
cx.tcx.struct_span_lint_hir(
lint::builtin::PRIVATE_DOC_TESTS,
hir_id,
diff --git a/src/librustdoc/passes/strip_private.rs b/src/librustdoc/passes/strip_private.rs
index f83eab6..fc8bbc9 100644
--- a/src/librustdoc/passes/strip_private.rs
+++ b/src/librustdoc/passes/strip_private.rs
@@ -17,13 +17,12 @@
crate fn strip_private(mut krate: clean::Crate, cx: &mut DocContext<'_>) -> clean::Crate {
// This stripper collects all *retained* nodes.
let mut retained = DefIdSet::default();
- let access_levels = cx.renderinfo.access_levels.clone();
// strip all private items
{
let mut stripper = Stripper {
retained: &mut retained,
- access_levels: &access_levels,
+ access_levels: &cx.cache.access_levels,
update_retained: true,
};
krate = ImportStripper.fold_crate(stripper.fold_crate(krate));
diff --git a/src/librustdoc/visit_ast.rs b/src/librustdoc/visit_ast.rs
index 4d42c18..5da7d2f 100644
--- a/src/librustdoc/visit_ast.rs
+++ b/src/librustdoc/visit_ast.rs
@@ -113,7 +113,7 @@ fn store_path(&mut self, did: DefId) {
assert_eq!(cur_mod_def_id, macro_parent_def_id);
cur_mod.macros.push((def, None));
}
- self.cx.renderinfo.exact_paths = self.exact_paths;
+ self.cx.cache.exact_paths = self.exact_paths;
top_level_module
}
@@ -199,7 +199,7 @@ fn inherits_doc_hidden(cx: &core::DocContext<'_>, mut node: hir::HirId) -> bool
} else {
// All items need to be handled here in case someone wishes to link
// to them with intra-doc links
- self.cx.renderinfo.access_levels.map.insert(did, AccessLevel::Public);
+ self.cx.cache.access_levels.map.insert(did, AccessLevel::Public);
}
}
}
@@ -211,7 +211,7 @@ fn inherits_doc_hidden(cx: &core::DocContext<'_>, mut node: hir::HirId) -> bool
None => return false,
};
- let is_private = !self.cx.renderinfo.access_levels.is_public(res_did);
+ let is_private = !self.cx.cache.access_levels.is_public(res_did);
let is_hidden = inherits_doc_hidden(self.cx, res_hir_id);
// Only inline if requested or if the item would otherwise be stripped.
diff --git a/src/librustdoc/visit_lib.rs b/src/librustdoc/visit_lib.rs
index daed5bd..3e06b41 100644
--- a/src/librustdoc/visit_lib.rs
+++ b/src/librustdoc/visit_lib.rs
@@ -25,7 +25,7 @@ impl<'a, 'tcx> LibEmbargoVisitor<'a, 'tcx> {
crate fn new(cx: &'a mut crate::core::DocContext<'tcx>) -> LibEmbargoVisitor<'a, 'tcx> {
LibEmbargoVisitor {
tcx: cx.tcx,
- access_levels: &mut cx.renderinfo.access_levels,
+ access_levels: &mut cx.cache.access_levels,
prev_level: Some(AccessLevel::Public),
visited_mods: FxHashSet::default(),
}
diff --git a/src/test/codegen/try_identity.rs b/src/test/codegen/try_identity.rs
index d30b706..d51bd57 100644
--- a/src/test/codegen/try_identity.rs
+++ b/src/test/codegen/try_identity.rs
@@ -1,4 +1,4 @@
-// compile-flags: -C no-prepopulate-passes -Z mir-opt-level=2 -Zunsound-mir-opts
+// compile-flags: -C no-prepopulate-passes -O -Z mir-opt-level=2 -Zunsound-mir-opts
// Ensure that `x?` has no overhead on `Result<T, E>` due to identity `match`es in lowering.
// This requires inlining to trigger the MIR optimizations in `SimplifyArmIdentity`.
diff --git a/src/test/mir-opt/remove_storage_markers.main.RemoveStorageMarkers.diff b/src/test/mir-opt/remove_storage_markers.main.RemoveStorageMarkers.diff
new file mode 100644
index 0000000..dd8a925
--- /dev/null
+++ b/src/test/mir-opt/remove_storage_markers.main.RemoveStorageMarkers.diff
@@ -0,0 +1,115 @@
+- // MIR for `main` before RemoveStorageMarkers
++ // MIR for `main` after RemoveStorageMarkers
+
+ fn main() -> () {
+ let mut _0: (); // return place in scope 0 at $DIR/remove_storage_markers.rs:6:11: 6:11
+ let mut _1: i32; // in scope 0 at $DIR/remove_storage_markers.rs:7:9: 7:16
+ let mut _2: std::ops::Range<i32>; // in scope 0 at $DIR/remove_storage_markers.rs:8:14: 8:19
+ let mut _3: std::ops::Range<i32>; // in scope 0 at $DIR/remove_storage_markers.rs:8:14: 8:19
+ let mut _5: (); // in scope 0 at $DIR/remove_storage_markers.rs:6:1: 11:2
+ let _7: (); // in scope 0 at $DIR/remove_storage_markers.rs:8:14: 8:19
+ let mut _8: std::option::Option<i32>; // in scope 0 at $DIR/remove_storage_markers.rs:8:14: 8:19
+ let mut _9: &mut std::ops::Range<i32>; // in scope 0 at $DIR/remove_storage_markers.rs:8:14: 8:19
+ let mut _10: &mut std::ops::Range<i32>; // in scope 0 at $DIR/remove_storage_markers.rs:8:14: 8:19
+ let mut _11: isize; // in scope 0 at $DIR/remove_storage_markers.rs:8:9: 8:10
+ let mut _13: i32; // in scope 0 at $DIR/remove_storage_markers.rs:8:9: 8:10
+ let mut _14: !; // in scope 0 at $DIR/remove_storage_markers.rs:8:5: 10:6
+ let _16: (); // in scope 0 at $DIR/remove_storage_markers.rs:8:20: 10:6
+ let mut _17: i32; // in scope 0 at $DIR/remove_storage_markers.rs:9:16: 9:17
+ scope 1 {
+ debug sum => _1; // in scope 1 at $DIR/remove_storage_markers.rs:7:9: 7:16
+ let mut _4: std::ops::Range<i32>; // in scope 1 at $DIR/remove_storage_markers.rs:8:14: 8:19
+ scope 2 {
+ debug iter => _4; // in scope 2 at $DIR/remove_storage_markers.rs:8:14: 8:19
+ let mut _6: i32; // in scope 2 at $DIR/remove_storage_markers.rs:8:14: 8:19
+ scope 3 {
+ debug __next => _6; // in scope 3 at $DIR/remove_storage_markers.rs:8:14: 8:19
+ let _12: i32; // in scope 3 at $DIR/remove_storage_markers.rs:8:9: 8:10
+ let _15: i32; // in scope 3 at $DIR/remove_storage_markers.rs:8:9: 8:10
+ scope 4 {
+ debug val => _12; // in scope 4 at $DIR/remove_storage_markers.rs:8:9: 8:10
+ }
+ scope 5 {
+ debug i => _15; // in scope 5 at $DIR/remove_storage_markers.rs:8:9: 8:10
+ }
+ }
+ }
+ scope 6 (inlined <std::ops::Range<i32> as IntoIterator>::into_iter) { // at $DIR/remove_storage_markers.rs:8:14: 8:19
+ debug self => _3; // in scope 6 at $DIR/remove_storage_markers.rs:8:14: 8:19
+ }
+ }
+
+ bb0: {
+- StorageLive(_1); // scope 0 at $DIR/remove_storage_markers.rs:7:9: 7:16
+ _1 = const 0_i32; // scope 0 at $DIR/remove_storage_markers.rs:7:19: 7:20
+- StorageLive(_2); // scope 1 at $DIR/remove_storage_markers.rs:8:14: 8:19
+- StorageLive(_3); // scope 1 at $DIR/remove_storage_markers.rs:8:14: 8:19
+ (_3.0: i32) = const 0_i32; // scope 1 at $DIR/remove_storage_markers.rs:8:14: 8:19
+ (_3.1: i32) = const 10_i32; // scope 1 at $DIR/remove_storage_markers.rs:8:14: 8:19
+ _2 = move _3; // scope 6 at $DIR/remove_storage_markers.rs:8:14: 8:19
+- StorageDead(_3); // scope 1 at $DIR/remove_storage_markers.rs:8:18: 8:19
+- StorageLive(_4); // scope 1 at $DIR/remove_storage_markers.rs:8:14: 8:19
+ _4 = move _2; // scope 1 at $DIR/remove_storage_markers.rs:8:14: 8:19
+ goto -> bb1; // scope 2 at $DIR/remove_storage_markers.rs:8:5: 10:6
+ }
+
+ bb1: {
+- StorageLive(_6); // scope 2 at $DIR/remove_storage_markers.rs:8:14: 8:19
+- StorageLive(_7); // scope 3 at $DIR/remove_storage_markers.rs:8:14: 8:19
+- StorageLive(_8); // scope 3 at $DIR/remove_storage_markers.rs:8:14: 8:19
+- StorageLive(_9); // scope 3 at $DIR/remove_storage_markers.rs:8:14: 8:19
+- StorageLive(_10); // scope 3 at $DIR/remove_storage_markers.rs:8:14: 8:19
+ _10 = &mut _4; // scope 3 at $DIR/remove_storage_markers.rs:8:14: 8:19
+ _9 = &mut (*_10); // scope 3 at $DIR/remove_storage_markers.rs:8:14: 8:19
+ _8 = <std::ops::Range<i32> as Iterator>::next(move _9) -> bb2; // scope 3 at $DIR/remove_storage_markers.rs:8:14: 8:19
+ // mir::Constant
+ // + span: $DIR/remove_storage_markers.rs:8:14: 8:19
+ // + literal: Const { ty: for<'r> fn(&'r mut std::ops::Range<i32>) -> std::option::Option<<std::ops::Range<i32> as std::iter::Iterator>::Item> {<std::ops::Range<i32> as std::iter::Iterator>::next}, val: Value(Scalar(<ZST>)) }
+ }
+
+ bb2: {
+- StorageDead(_9); // scope 3 at $DIR/remove_storage_markers.rs:8:18: 8:19
+ _11 = discriminant(_8); // scope 3 at $DIR/remove_storage_markers.rs:8:9: 8:10
+ switchInt(move _11) -> [0_isize: bb3, otherwise: bb4]; // scope 3 at $DIR/remove_storage_markers.rs:8:9: 8:10
+ }
+
+ bb3: {
+ _0 = const (); // scope 3 at $DIR/remove_storage_markers.rs:8:5: 10:6
+- StorageDead(_10); // scope 3 at $DIR/remove_storage_markers.rs:8:18: 8:19
+- StorageDead(_8); // scope 3 at $DIR/remove_storage_markers.rs:8:18: 8:19
+- StorageDead(_7); // scope 3 at $DIR/remove_storage_markers.rs:8:18: 8:19
+- StorageDead(_6); // scope 2 at $DIR/remove_storage_markers.rs:10:5: 10:6
+- StorageDead(_4); // scope 1 at $DIR/remove_storage_markers.rs:10:5: 10:6
+- StorageDead(_2); // scope 1 at $DIR/remove_storage_markers.rs:8:18: 8:19
+- StorageDead(_1); // scope 0 at $DIR/remove_storage_markers.rs:11:1: 11:2
+ return; // scope 0 at $DIR/remove_storage_markers.rs:11:2: 11:2
+ }
+
+ bb4: {
+- StorageLive(_12); // scope 3 at $DIR/remove_storage_markers.rs:8:9: 8:10
+ _12 = ((_8 as Some).0: i32); // scope 3 at $DIR/remove_storage_markers.rs:8:9: 8:10
+- StorageLive(_13); // scope 4 at $DIR/remove_storage_markers.rs:8:9: 8:10
+ _13 = _12; // scope 4 at $DIR/remove_storage_markers.rs:8:9: 8:10
+ _6 = move _13; // scope 4 at $DIR/remove_storage_markers.rs:8:9: 8:10
+ _7 = const (); // scope 4 at $DIR/remove_storage_markers.rs:8:9: 8:10
+- StorageDead(_13); // scope 4 at $DIR/remove_storage_markers.rs:8:9: 8:10
+- StorageDead(_12); // scope 3 at $DIR/remove_storage_markers.rs:8:9: 8:10
+- StorageDead(_10); // scope 3 at $DIR/remove_storage_markers.rs:8:18: 8:19
+- StorageDead(_8); // scope 3 at $DIR/remove_storage_markers.rs:8:18: 8:19
+- StorageDead(_7); // scope 3 at $DIR/remove_storage_markers.rs:8:18: 8:19
+- StorageLive(_15); // scope 3 at $DIR/remove_storage_markers.rs:8:9: 8:10
+ _15 = _6; // scope 3 at $DIR/remove_storage_markers.rs:8:14: 8:19
+- StorageLive(_16); // scope 5 at $DIR/remove_storage_markers.rs:8:20: 10:6
+- StorageLive(_17); // scope 5 at $DIR/remove_storage_markers.rs:9:16: 9:17
+ _17 = _15; // scope 5 at $DIR/remove_storage_markers.rs:9:16: 9:17
+ _1 = Add(_1, move _17); // scope 5 at $DIR/remove_storage_markers.rs:9:9: 9:17
+- StorageDead(_17); // scope 5 at $DIR/remove_storage_markers.rs:9:16: 9:17
+ _16 = const (); // scope 5 at $DIR/remove_storage_markers.rs:8:20: 10:6
+- StorageDead(_16); // scope 5 at $DIR/remove_storage_markers.rs:10:5: 10:6
+ _5 = const (); // scope 2 at $DIR/remove_storage_markers.rs:8:5: 10:6
+- StorageDead(_15); // scope 3 at $DIR/remove_storage_markers.rs:10:5: 10:6
+- StorageDead(_6); // scope 2 at $DIR/remove_storage_markers.rs:10:5: 10:6
+ goto -> bb1; // scope 2 at $DIR/remove_storage_markers.rs:8:5: 10:6
+ }
+ }
+
diff --git a/src/test/mir-opt/remove_storage_markers.rs b/src/test/mir-opt/remove_storage_markers.rs
new file mode 100644
index 0000000..c144d3f
--- /dev/null
+++ b/src/test/mir-opt/remove_storage_markers.rs
@@ -0,0 +1,11 @@
+// Checks that storage markers are removed at opt-level=0.
+//
+// compile-flags: -C opt-level=0 -Coverflow-checks=off
+
+// EMIT_MIR remove_storage_markers.main.RemoveStorageMarkers.diff
+fn main() {
+ let mut sum = 0;
+ for i in 0..10 {
+ sum += i;
+ }
+}
diff --git a/src/test/run-make/const_fn_mir/dump.mir b/src/test/run-make/const_fn_mir/dump.mir
index 3dac42c..45d018c 100644
--- a/src/test/run-make/const_fn_mir/dump.mir
+++ b/src/test/run-make/const_fn_mir/dump.mir
@@ -5,7 +5,6 @@
let _1: i32; // in scope 0 at main.rs:9:5: 9:10
bb0: {
- StorageLive(_1); // scope 0 at main.rs:9:5: 9:10
_1 = foo() -> bb1; // scope 0 at main.rs:9:5: 9:10
// mir::Constant
// + span: main.rs:9:5: 9:8
@@ -13,7 +12,6 @@
}
bb1: {
- StorageDead(_1); // scope 0 at main.rs:9:10: 9:11
_0 = const (); // scope 0 at main.rs:8:11: 10:2
return; // scope 0 at main.rs:10:2: 10:2
}
diff --git a/src/test/rustdoc-gui/search-input-mobile.goml b/src/test/rustdoc-gui/search-input-mobile.goml
new file mode 100644
index 0000000..3eec345
--- /dev/null
+++ b/src/test/rustdoc-gui/search-input-mobile.goml
@@ -0,0 +1,11 @@
+// Test to ensure that you can click on the search input, whatever the width.
+// The PR which fixed it is: https://github.com/rust-lang/rust/pull/81592
+goto: file://|DOC_PATH|/index.html
+size: (463, 700)
+// We first check that the search input isn't already focused.
+assert-false: ("input.search-input:focus")
+click: "input.search-input"
+reload:
+size: (750, 700)
+click: "input.search-input"
+assert: ("input.search-input:focus")
diff --git a/src/test/rustdoc-gui/shortcuts.goml b/src/test/rustdoc-gui/shortcuts.goml
new file mode 100644
index 0000000..c35b48f
--- /dev/null
+++ b/src/test/rustdoc-gui/shortcuts.goml
@@ -0,0 +1,26 @@
+// Check that the various shortcuts are working.
+goto: file://|DOC_PATH|/index.html
+// We first check that the search input isn't already focused.
+assert-false: "input.search-input:focus"
+press-key: "s"
+assert: "input.search-input:focus"
+press-key: "Escape"
+assert-false: "input.search-input:focus"
+// We now check for the help popup.
+press-key: "?"
+assert: ("#help", {"display": "flex"})
+assert-false: "#help.hidden"
+press-key: "Escape"
+assert: ("#help.hidden", {"display": "none"})
+// Check for the themes list.
+assert: ("#theme-choices", {"display": "none"})
+press-key: "t"
+assert: ("#theme-choices", {"display": "block"})
+press-key: "t"
+// We ensure that 't' hides back the menu.
+assert: ("#theme-choices", {"display": "none"})
+press-key: "t"
+assert: ("#theme-choices", {"display": "block"})
+press-key: "Escape"
+// We ensure that 'Escape' hides the menu too.
+assert: ("#theme-choices", {"display": "none"})
diff --git a/src/test/rustdoc-json/nested.rs b/src/test/rustdoc-json/nested.rs
index a3d4935..5bb66f7 100644
--- a/src/test/rustdoc-json/nested.rs
+++ b/src/test/rustdoc-json/nested.rs
@@ -1,6 +1,8 @@
// edition:2018
+// compile-flags: --crate-version 1.0.0
-// @is nested.json "$.index[*][?(@.name=='nested')].kind" \"module\"
+// @is nested.json "$.crate_version" \"1.0.0\"
+// @is - "$.index[*][?(@.name=='nested')].kind" \"module\"
// @is - "$.index[*][?(@.name=='nested')].inner.is_crate" true
// @count - "$.index[*][?(@.name=='nested')].inner.items[*]" 1
diff --git a/src/test/rustdoc-ui/deprecated-attrs.rs b/src/test/rustdoc-ui/deprecated-attrs.rs
index 0d5dfa7..ca626af 100644
--- a/src/test/rustdoc-ui/deprecated-attrs.rs
+++ b/src/test/rustdoc-ui/deprecated-attrs.rs
@@ -1,6 +1,6 @@
// check-pass
-#![doc(no_default_passes, passes = "collapse-docs unindent-comments")]
+#![doc(no_default_passes, passes = "unindent-comments")]
struct SomeStruct;
diff --git a/src/test/rustdoc-ui/doc-attr.rs b/src/test/rustdoc-ui/doc-attr.rs
new file mode 100644
index 0000000..37c69a2
--- /dev/null
+++ b/src/test/rustdoc-ui/doc-attr.rs
@@ -0,0 +1,5 @@
+#![crate_type = "lib"]
+#![doc(as_ptr)] //~ ERROR
+
+#[doc(as_ptr)] //~ ERROR
+pub fn foo() {}
diff --git a/src/test/rustdoc-ui/doc-attr.stderr b/src/test/rustdoc-ui/doc-attr.stderr
new file mode 100644
index 0000000..17bc3d6
--- /dev/null
+++ b/src/test/rustdoc-ui/doc-attr.stderr
@@ -0,0 +1,14 @@
+error: unknown `doc` attribute `as_ptr`
+ --> $DIR/doc-attr.rs:4:7
+ |
+LL | #[doc(as_ptr)]
+ | ^^^^^^
+
+error: unknown `doc` attribute `as_ptr`
+ --> $DIR/doc-attr.rs:2:8
+ |
+LL | #![doc(as_ptr)]
+ | ^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/rustdoc-ui/rustc-check-passes.rs b/src/test/rustdoc-ui/rustc-check-passes.rs
new file mode 100644
index 0000000..731cc8b
--- /dev/null
+++ b/src/test/rustdoc-ui/rustc-check-passes.rs
@@ -0,0 +1,4 @@
+#![feature(box_syntax)]
+#![feature(box_syntax)] //~ ERROR
+
+pub fn foo() {}
diff --git a/src/test/rustdoc-ui/rustc-check-passes.stderr b/src/test/rustdoc-ui/rustc-check-passes.stderr
new file mode 100644
index 0000000..9707895
--- /dev/null
+++ b/src/test/rustdoc-ui/rustc-check-passes.stderr
@@ -0,0 +1,9 @@
+error[E0636]: the feature `box_syntax` has already been declared
+ --> $DIR/rustc-check-passes.rs:2:12
+ |
+LL | #![feature(box_syntax)]
+ | ^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0636`.
diff --git a/src/test/rustdoc/implementor-stable-version.rs b/src/test/rustdoc/implementor-stable-version.rs
index 0a065d8..a1f3fd5 100644
--- a/src/test/rustdoc/implementor-stable-version.rs
+++ b/src/test/rustdoc/implementor-stable-version.rs
@@ -1,3 +1,4 @@
+#![stable(feature = "bar", since = "OLD 1.0")]
#![crate_name = "foo"]
#![feature(staged_api)]
@@ -8,6 +9,7 @@ pub trait Bar {}
#[stable(feature = "baz", since = "OLD 1.0")]
pub trait Baz {}
+#[stable(feature = "baz", since = "OLD 1.0")]
pub struct Foo;
// @has foo/trait.Bar.html '//div[@id="implementors-list"]//span[@class="since"]' 'NEW 2.0'
diff --git a/src/test/ui/attributes/doc-attr.rs b/src/test/ui/attributes/doc-attr.rs
new file mode 100644
index 0000000..37c69a2
--- /dev/null
+++ b/src/test/ui/attributes/doc-attr.rs
@@ -0,0 +1,5 @@
+#![crate_type = "lib"]
+#![doc(as_ptr)] //~ ERROR
+
+#[doc(as_ptr)] //~ ERROR
+pub fn foo() {}
diff --git a/src/test/ui/attributes/doc-attr.stderr b/src/test/ui/attributes/doc-attr.stderr
new file mode 100644
index 0000000..17bc3d6
--- /dev/null
+++ b/src/test/ui/attributes/doc-attr.stderr
@@ -0,0 +1,14 @@
+error: unknown `doc` attribute `as_ptr`
+ --> $DIR/doc-attr.rs:4:7
+ |
+LL | #[doc(as_ptr)]
+ | ^^^^^^
+
+error: unknown `doc` attribute `as_ptr`
+ --> $DIR/doc-attr.rs:2:8
+ |
+LL | #![doc(as_ptr)]
+ | ^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/consts/issue-66693-panic-in-array-len.rs b/src/test/ui/consts/issue-66693-panic-in-array-len.rs
new file mode 100644
index 0000000..718a190
--- /dev/null
+++ b/src/test/ui/consts/issue-66693-panic-in-array-len.rs
@@ -0,0 +1,17 @@
+// This is a separate test from `issue-66693.rs` because array lengths are evaluated
+// in a separate stage before `const`s and `statics` and so the error below is hit and
+// the compiler exits before generating errors for the others.
+
+#![feature(const_panic)]
+
+fn main() {
+ let _ = [0i32; panic!(2f32)];
+ //~^ ERROR: argument to `panic!()` in a const context must have type `&str`
+
+ // ensure that conforming panics are handled correctly
+ let _ = [false; panic!()];
+ //~^ ERROR: evaluation of constant value failed
+
+ // typechecking halts before getting to this one
+ let _ = ['a', panic!("panic in array len")];
+}
diff --git a/src/test/ui/consts/issue-66693-panic-in-array-len.stderr b/src/test/ui/consts/issue-66693-panic-in-array-len.stderr
new file mode 100644
index 0000000..e0ca9df
--- /dev/null
+++ b/src/test/ui/consts/issue-66693-panic-in-array-len.stderr
@@ -0,0 +1,19 @@
+error: argument to `panic!()` in a const context must have type `&str`
+ --> $DIR/issue-66693-panic-in-array-len.rs:8:20
+ |
+LL | let _ = [0i32; panic!(2f32)];
+ | ^^^^^^^^^^^^
+ |
+ = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0080]: evaluation of constant value failed
+ --> $DIR/issue-66693-panic-in-array-len.rs:12:21
+ |
+LL | let _ = [false; panic!()];
+ | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/issue-66693-panic-in-array-len.rs:12:21
+ |
+ = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/ui/consts/issue-66693.rs b/src/test/ui/consts/issue-66693.rs
new file mode 100644
index 0000000..77fe441
--- /dev/null
+++ b/src/test/ui/consts/issue-66693.rs
@@ -0,0 +1,24 @@
+// Tests that the compiler does not ICE when const-evaluating a `panic!()` invocation with a
+// non-`&str` argument.
+
+#![feature(const_panic)]
+
+const _: () = panic!(1);
+//~^ ERROR: argument to `panic!()` in a const context must have type `&str`
+
+static _FOO: () = panic!(true);
+//~^ ERROR: argument to `panic!()` in a const context must have type `&str`
+
+const fn _foo() {
+ panic!(&1); //~ ERROR: argument to `panic!()` in a const context must have type `&str`
+}
+
+// ensure that conforming panics don't cause an error
+const _: () = panic!();
+static _BAR: () = panic!("panic in static");
+
+const fn _bar() {
+ panic!("panic in const fn");
+}
+
+fn main() {}
diff --git a/src/test/ui/consts/issue-66693.stderr b/src/test/ui/consts/issue-66693.stderr
new file mode 100644
index 0000000..6bbde05
--- /dev/null
+++ b/src/test/ui/consts/issue-66693.stderr
@@ -0,0 +1,26 @@
+error: argument to `panic!()` in a const context must have type `&str`
+ --> $DIR/issue-66693.rs:13:5
+ |
+LL | panic!(&1);
+ | ^^^^^^^^^^^
+ |
+ = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: argument to `panic!()` in a const context must have type `&str`
+ --> $DIR/issue-66693.rs:6:15
+ |
+LL | const _: () = panic!(1);
+ | ^^^^^^^^^
+ |
+ = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: argument to `panic!()` in a const context must have type `&str`
+ --> $DIR/issue-66693.rs:9:19
+ |
+LL | static _FOO: () = panic!(true);
+ | ^^^^^^^^^^^^
+ |
+ = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/ui/consts/issue-76064.rs b/src/test/ui/consts/issue-76064.rs
index 2da764b..d511f75 100644
--- a/src/test/ui/consts/issue-76064.rs
+++ b/src/test/ui/consts/issue-76064.rs
@@ -1,3 +1,5 @@
-struct Bug([u8; panic!(1)]); //~ ERROR panicking in constants is unstable
+// Note: non-`&str` panic arguments gained a separate error in PR #80734
+// which is why this doesn't match the issue
+struct Bug([u8; panic!("panic")]); //~ ERROR panicking in constants is unstable
fn main() {}
diff --git a/src/test/ui/consts/issue-76064.stderr b/src/test/ui/consts/issue-76064.stderr
index f939ff3..9bda1b7 100644
--- a/src/test/ui/consts/issue-76064.stderr
+++ b/src/test/ui/consts/issue-76064.stderr
@@ -1,8 +1,8 @@
error[E0658]: panicking in constants is unstable
- --> $DIR/issue-76064.rs:1:17
+ --> $DIR/issue-76064.rs:3:17
|
-LL | struct Bug([u8; panic!(1)]);
- | ^^^^^^^^^
+LL | struct Bug([u8; panic!("panic")]);
+ | ^^^^^^^^^^^^^^^
|
= note: see issue #51999 <https://github.com/rust-lang/rust/issues/51999> for more information
= help: add `#![feature(const_panic)]` to the crate attributes to enable
diff --git a/src/test/ui/lint/auxiliary/unaligned_references_external_crate.rs b/src/test/ui/lint/auxiliary/unaligned_references_external_crate.rs
new file mode 100644
index 0000000..fb486c6
--- /dev/null
+++ b/src/test/ui/lint/auxiliary/unaligned_references_external_crate.rs
@@ -0,0 +1,28 @@
+#[macro_export]
+macro_rules! mac {
+ (
+ $(#[$attrs:meta])*
+ pub struct $ident:ident {
+ $(
+ $(#[$pin:ident])?
+ $field_vis:vis $field:ident: $field_ty:ty
+ ),+ $(,)?
+ }
+ ) => {
+ $(#[$attrs])*
+ pub struct $ident {
+ $(
+ $field_vis $field: $field_ty
+ ),+
+ }
+
+ const _: () = {
+ #[deny(unaligned_references)]
+ fn __f(this: &$ident) {
+ $(
+ let _ = &this.$field;
+ )+
+ }
+ };
+ };
+}
diff --git a/src/test/ui/lint/issue-47390-unused-variable-in-struct-pattern.stderr b/src/test/ui/lint/issue-47390-unused-variable-in-struct-pattern.stderr
index 3efd87f..2ef655e 100644
--- a/src/test/ui/lint/issue-47390-unused-variable-in-struct-pattern.stderr
+++ b/src/test/ui/lint/issue-47390-unused-variable-in-struct-pattern.stderr
@@ -12,16 +12,16 @@
= note: `#[warn(unused_variables)]` implied by `#[warn(unused)]`
warning: unused variable: `mut_unused_var`
- --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:33:9
+ --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:33:13
|
LL | let mut mut_unused_var = 1;
- | ^^^^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_mut_unused_var`
+ | ^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_mut_unused_var`
warning: unused variable: `var`
- --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:37:10
+ --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:37:14
|
LL | let (mut var, unused_var) = (1, 2);
- | ^^^^^^^ help: if this is intentional, prefix it with an underscore: `_var`
+ | ^^^ help: if this is intentional, prefix it with an underscore: `_var`
warning: unused variable: `unused_var`
--> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:37:19
@@ -36,10 +36,10 @@
| ^^^^^^^^^^^^^^^^^^ help: try ignoring the field: `corridors_of_light: _`
warning: variable `hours_are_suns` is assigned to, but never used
- --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:46:26
+ --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:46:30
|
LL | mut hours_are_suns,
- | ^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^
|
= note: consider using `_hours_are_suns` instead
diff --git a/src/test/ui/lint/issue-81314-unused-span-ident.fixed b/src/test/ui/lint/issue-81314-unused-span-ident.fixed
new file mode 100644
index 0000000..aac918f
--- /dev/null
+++ b/src/test/ui/lint/issue-81314-unused-span-ident.fixed
@@ -0,0 +1,12 @@
+// run-rustfix
+// Regression test for #81314: Unused variable lint should
+// span only the identifier and not the rest of the pattern
+
+#![deny(unused)]
+
+fn main() {
+ let [_rest @ ..] = [1, 2, 3]; //~ ERROR unused variable
+}
+
+pub fn foo([_rest @ ..]: &[i32]) { //~ ERROR unused variable
+}
diff --git a/src/test/ui/lint/issue-81314-unused-span-ident.rs b/src/test/ui/lint/issue-81314-unused-span-ident.rs
new file mode 100644
index 0000000..78296f4
--- /dev/null
+++ b/src/test/ui/lint/issue-81314-unused-span-ident.rs
@@ -0,0 +1,12 @@
+// run-rustfix
+// Regression test for #81314: Unused variable lint should
+// span only the identifier and not the rest of the pattern
+
+#![deny(unused)]
+
+fn main() {
+ let [rest @ ..] = [1, 2, 3]; //~ ERROR unused variable
+}
+
+pub fn foo([rest @ ..]: &[i32]) { //~ ERROR unused variable
+}
diff --git a/src/test/ui/lint/issue-81314-unused-span-ident.stderr b/src/test/ui/lint/issue-81314-unused-span-ident.stderr
new file mode 100644
index 0000000..519c71e
--- /dev/null
+++ b/src/test/ui/lint/issue-81314-unused-span-ident.stderr
@@ -0,0 +1,21 @@
+error: unused variable: `rest`
+ --> $DIR/issue-81314-unused-span-ident.rs:8:10
+ |
+LL | let [rest @ ..] = [1, 2, 3];
+ | ^^^^ help: if this is intentional, prefix it with an underscore: `_rest`
+ |
+note: the lint level is defined here
+ --> $DIR/issue-81314-unused-span-ident.rs:5:9
+ |
+LL | #![deny(unused)]
+ | ^^^^^^
+ = note: `#[deny(unused_variables)]` implied by `#[deny(unused)]`
+
+error: unused variable: `rest`
+ --> $DIR/issue-81314-unused-span-ident.rs:11:13
+ |
+LL | pub fn foo([rest @ ..]: &[i32]) {
+ | ^^^^ help: if this is intentional, prefix it with an underscore: `_rest`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/lint/renamed-lints-still-apply.rs b/src/test/ui/lint/renamed-lints-still-apply.rs
new file mode 100644
index 0000000..01cd325
--- /dev/null
+++ b/src/test/ui/lint/renamed-lints-still-apply.rs
@@ -0,0 +1,9 @@
+// compile-flags: --crate-type lib
+#![deny(single_use_lifetime)]
+//~^ WARNING renamed
+//~| NOTE `#[warn(renamed_and_removed_lints)]` on by default
+//~| NOTE defined here
+fn _foo<'a>(_x: &'a u32) {}
+//~^ ERROR only used once
+//~| NOTE this lifetime
+//~| NOTE is used only here
diff --git a/src/test/ui/lint/renamed-lints-still-apply.stderr b/src/test/ui/lint/renamed-lints-still-apply.stderr
new file mode 100644
index 0000000..33e5a03
--- /dev/null
+++ b/src/test/ui/lint/renamed-lints-still-apply.stderr
@@ -0,0 +1,28 @@
+warning: lint `single_use_lifetime` has been renamed to `single_use_lifetimes`
+ --> $DIR/renamed-lints-still-apply.rs:2:9
+ |
+LL | #![deny(single_use_lifetime)]
+ | ^^^^^^^^^^^^^^^^^^^ help: use the new name: `single_use_lifetimes`
+ |
+ = note: `#[warn(renamed_and_removed_lints)]` on by default
+
+error: lifetime parameter `'a` only used once
+ --> $DIR/renamed-lints-still-apply.rs:6:9
+ |
+LL | fn _foo<'a>(_x: &'a u32) {}
+ | ^^ -- ...is used only here
+ | |
+ | this lifetime...
+ |
+note: the lint level is defined here
+ --> $DIR/renamed-lints-still-apply.rs:2:9
+ |
+LL | #![deny(single_use_lifetime)]
+ | ^^^^^^^^^^^^^^^^^^^
+help: elide the single-use lifetime
+ |
+LL | fn _foo(_x: &u32) {}
+ | -- --
+
+error: aborting due to previous error; 1 warning emitted
+
diff --git a/src/test/ui/lint/unaligned_references_external_macro.rs b/src/test/ui/lint/unaligned_references_external_macro.rs
new file mode 100644
index 0000000..6ac501f
--- /dev/null
+++ b/src/test/ui/lint/unaligned_references_external_macro.rs
@@ -0,0 +1,14 @@
+// aux-build:unaligned_references_external_crate.rs
+
+#![allow(safe_packed_borrows)]
+
+extern crate unaligned_references_external_crate;
+
+unaligned_references_external_crate::mac! { //~ERROR reference to packed field is unaligned
+ #[repr(packed)]
+ pub struct X {
+ pub field: u16
+ }
+}
+
+fn main() {}
diff --git a/src/test/ui/lint/unaligned_references_external_macro.stderr b/src/test/ui/lint/unaligned_references_external_macro.stderr
new file mode 100644
index 0000000..140294b
--- /dev/null
+++ b/src/test/ui/lint/unaligned_references_external_macro.stderr
@@ -0,0 +1,26 @@
+error: reference to packed field is unaligned
+ --> $DIR/unaligned_references_external_macro.rs:7:1
+ |
+LL | / unaligned_references_external_crate::mac! {
+LL | | #[repr(packed)]
+LL | | pub struct X {
+LL | | pub field: u16
+LL | | }
+LL | | }
+ | |_^
+ |
+note: the lint level is defined here
+ --> $DIR/unaligned_references_external_macro.rs:7:1
+ |
+LL | / unaligned_references_external_crate::mac! {
+LL | | #[repr(packed)]
+LL | | pub struct X {
+LL | | pub field: u16
+LL | | }
+LL | | }
+ | |_^
+ = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
+ = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/liveness/liveness-consts.stderr b/src/test/ui/liveness/liveness-consts.stderr
index fa8a590..b1beec9 100644
--- a/src/test/ui/liveness/liveness-consts.stderr
+++ b/src/test/ui/liveness/liveness-consts.stderr
@@ -1,8 +1,8 @@
warning: variable `a` is assigned to, but never used
- --> $DIR/liveness-consts.rs:7:9
+ --> $DIR/liveness-consts.rs:7:13
|
LL | let mut a = 0;
- | ^^^^^
+ | ^
|
note: the lint level is defined here
--> $DIR/liveness-consts.rs:2:9
diff --git a/src/test/ui/liveness/liveness-dead.stderr b/src/test/ui/liveness/liveness-dead.stderr
index e9d20cf..12680ab 100644
--- a/src/test/ui/liveness/liveness-dead.stderr
+++ b/src/test/ui/liveness/liveness-dead.stderr
@@ -1,8 +1,8 @@
error: value assigned to `x` is never read
- --> $DIR/liveness-dead.rs:9:9
+ --> $DIR/liveness-dead.rs:9:13
|
LL | let mut x: isize = 3;
- | ^^^^^
+ | ^
|
note: the lint level is defined here
--> $DIR/liveness-dead.rs:2:9
@@ -20,10 +20,10 @@
= help: maybe it is overwritten before being read?
error: value passed to `x` is never read
- --> $DIR/liveness-dead.rs:20:7
+ --> $DIR/liveness-dead.rs:20:11
|
LL | fn f4(mut x: i32) {
- | ^^^^^
+ | ^
|
= help: maybe it is overwritten before being read?
diff --git a/src/test/ui/liveness/liveness-unused.stderr b/src/test/ui/liveness/liveness-unused.stderr
index 2c5550a..4a61226 100644
--- a/src/test/ui/liveness/liveness-unused.stderr
+++ b/src/test/ui/liveness/liveness-unused.stderr
@@ -44,10 +44,10 @@
| ^ help: if this is intentional, prefix it with an underscore: `_x`
error: variable `x` is assigned to, but never used
- --> $DIR/liveness-unused.rs:30:9
+ --> $DIR/liveness-unused.rs:30:13
|
LL | let mut x = 3;
- | ^^^^^
+ | ^
|
= note: consider using `_x` instead
@@ -65,10 +65,10 @@
= help: maybe it is overwritten before being read?
error: variable `z` is assigned to, but never used
- --> $DIR/liveness-unused.rs:37:9
+ --> $DIR/liveness-unused.rs:37:13
|
LL | let mut z = 3;
- | ^^^^^
+ | ^
|
= note: consider using `_z` instead
diff --git a/src/test/ui/proc-macro/attr-complex-fn.rs b/src/test/ui/proc-macro/attr-complex-fn.rs
new file mode 100644
index 0000000..47734c9
--- /dev/null
+++ b/src/test/ui/proc-macro/attr-complex-fn.rs
@@ -0,0 +1,26 @@
+// check-pass
+// compile-flags: -Z span-debug --error-format human
+// aux-build:test-macros.rs
+
+#![feature(stmt_expr_attributes)]
+#![feature(custom_inner_attributes)]
+#![feature(rustc_attrs)]
+
+#![no_std] // Don't load unnecessary hygiene information from std
+extern crate std;
+
+#[macro_use]
+extern crate test_macros;
+
+trait MyTrait<T> {}
+struct MyStruct<const N: bool>;
+
+#[print_attr]
+fn foo<T: MyTrait<MyStruct<{ true }>>>() {}
+
+impl<T> MyTrait<T> for MyStruct<{true}> {
+ #![print_attr]
+ #![rustc_dummy]
+}
+
+fn main() {}
diff --git a/src/test/ui/proc-macro/attr-complex-fn.stdout b/src/test/ui/proc-macro/attr-complex-fn.stdout
new file mode 100644
index 0000000..a395a9a
--- /dev/null
+++ b/src/test/ui/proc-macro/attr-complex-fn.stdout
@@ -0,0 +1,171 @@
+PRINT-ATTR INPUT (DISPLAY): fn foo < T : MyTrait < MyStruct < { true } >> > () { }
+PRINT-ATTR INPUT (DEBUG): TokenStream [
+ Ident {
+ ident: "fn",
+ span: $DIR/attr-complex-fn.rs:19:1: 19:3 (#0),
+ },
+ Ident {
+ ident: "foo",
+ span: $DIR/attr-complex-fn.rs:19:4: 19:7 (#0),
+ },
+ Punct {
+ ch: '<',
+ spacing: Alone,
+ span: $DIR/attr-complex-fn.rs:19:7: 19:8 (#0),
+ },
+ Ident {
+ ident: "T",
+ span: $DIR/attr-complex-fn.rs:19:8: 19:9 (#0),
+ },
+ Punct {
+ ch: ':',
+ spacing: Alone,
+ span: $DIR/attr-complex-fn.rs:19:9: 19:10 (#0),
+ },
+ Ident {
+ ident: "MyTrait",
+ span: $DIR/attr-complex-fn.rs:19:11: 19:18 (#0),
+ },
+ Punct {
+ ch: '<',
+ spacing: Alone,
+ span: $DIR/attr-complex-fn.rs:19:18: 19:19 (#0),
+ },
+ Ident {
+ ident: "MyStruct",
+ span: $DIR/attr-complex-fn.rs:19:19: 19:27 (#0),
+ },
+ Punct {
+ ch: '<',
+ spacing: Alone,
+ span: $DIR/attr-complex-fn.rs:19:27: 19:28 (#0),
+ },
+ Group {
+ delimiter: Brace,
+ stream: TokenStream [
+ Ident {
+ ident: "true",
+ span: $DIR/attr-complex-fn.rs:19:30: 19:34 (#0),
+ },
+ ],
+ span: $DIR/attr-complex-fn.rs:19:28: 19:36 (#0),
+ },
+ Punct {
+ ch: '>',
+ spacing: Joint,
+ span: $DIR/attr-complex-fn.rs:19:36: 19:38 (#0),
+ },
+ Punct {
+ ch: '>',
+ spacing: Joint,
+ span: $DIR/attr-complex-fn.rs:19:36: 19:38 (#0),
+ },
+ Punct {
+ ch: '>',
+ spacing: Alone,
+ span: $DIR/attr-complex-fn.rs:19:38: 19:39 (#0),
+ },
+ Group {
+ delimiter: Parenthesis,
+ stream: TokenStream [],
+ span: $DIR/attr-complex-fn.rs:19:39: 19:41 (#0),
+ },
+ Group {
+ delimiter: Brace,
+ stream: TokenStream [],
+ span: $DIR/attr-complex-fn.rs:19:42: 19:44 (#0),
+ },
+]
+PRINT-ATTR INPUT (DISPLAY): impl < T > MyTrait < T > for MyStruct < { true } > { # ! [rustc_dummy] }
+PRINT-ATTR INPUT (DEBUG): TokenStream [
+ Ident {
+ ident: "impl",
+ span: $DIR/attr-complex-fn.rs:21:1: 24:2 (#0),
+ },
+ Punct {
+ ch: '<',
+ spacing: Alone,
+ span: $DIR/attr-complex-fn.rs:21:1: 24:2 (#0),
+ },
+ Ident {
+ ident: "T",
+ span: $DIR/attr-complex-fn.rs:21:1: 24:2 (#0),
+ },
+ Punct {
+ ch: '>',
+ spacing: Alone,
+ span: $DIR/attr-complex-fn.rs:21:1: 24:2 (#0),
+ },
+ Ident {
+ ident: "MyTrait",
+ span: $DIR/attr-complex-fn.rs:21:1: 24:2 (#0),
+ },
+ Punct {
+ ch: '<',
+ spacing: Alone,
+ span: $DIR/attr-complex-fn.rs:21:1: 24:2 (#0),
+ },
+ Ident {
+ ident: "T",
+ span: $DIR/attr-complex-fn.rs:21:1: 24:2 (#0),
+ },
+ Punct {
+ ch: '>',
+ spacing: Alone,
+ span: $DIR/attr-complex-fn.rs:21:1: 24:2 (#0),
+ },
+ Ident {
+ ident: "for",
+ span: $DIR/attr-complex-fn.rs:21:1: 24:2 (#0),
+ },
+ Ident {
+ ident: "MyStruct",
+ span: $DIR/attr-complex-fn.rs:21:1: 24:2 (#0),
+ },
+ Punct {
+ ch: '<',
+ spacing: Alone,
+ span: $DIR/attr-complex-fn.rs:21:1: 24:2 (#0),
+ },
+ Group {
+ delimiter: Brace,
+ stream: TokenStream [
+ Ident {
+ ident: "true",
+ span: $DIR/attr-complex-fn.rs:21:1: 24:2 (#0),
+ },
+ ],
+ span: $DIR/attr-complex-fn.rs:21:1: 24:2 (#0),
+ },
+ Punct {
+ ch: '>',
+ spacing: Alone,
+ span: $DIR/attr-complex-fn.rs:21:1: 24:2 (#0),
+ },
+ Group {
+ delimiter: Brace,
+ stream: TokenStream [
+ Punct {
+ ch: '#',
+ spacing: Joint,
+ span: $DIR/attr-complex-fn.rs:21:1: 24:2 (#0),
+ },
+ Punct {
+ ch: '!',
+ spacing: Alone,
+ span: $DIR/attr-complex-fn.rs:21:1: 24:2 (#0),
+ },
+ Group {
+ delimiter: Bracket,
+ stream: TokenStream [
+ Ident {
+ ident: "rustc_dummy",
+ span: $DIR/attr-complex-fn.rs:21:1: 24:2 (#0),
+ },
+ ],
+ span: $DIR/attr-complex-fn.rs:21:1: 24:2 (#0),
+ },
+ ],
+ span: $DIR/attr-complex-fn.rs:21:1: 24:2 (#0),
+ },
+]
diff --git a/src/test/ui/proc-macro/auxiliary/test-macros.rs b/src/test/ui/proc-macro/auxiliary/test-macros.rs
index a7ed4bc..1a50036 100644
--- a/src/test/ui/proc-macro/auxiliary/test-macros.rs
+++ b/src/test/ui/proc-macro/auxiliary/test-macros.rs
@@ -128,6 +128,20 @@ pub fn print_attr_args(args: TokenStream, input: TokenStream) -> TokenStream {
input
}
+#[proc_macro_attribute]
+pub fn print_target_and_args(args: TokenStream, input: TokenStream) -> TokenStream {
+ print_helper(args, "ATTR_ARGS");
+ print_helper(input.clone(), "ATTR");
+ input
+}
+
+#[proc_macro_attribute]
+pub fn print_target_and_args_consume(args: TokenStream, input: TokenStream) -> TokenStream {
+ print_helper(args, "ATTR_ARGS");
+ print_helper(input.clone(), "ATTR");
+ TokenStream::new()
+}
+
#[proc_macro_derive(Print, attributes(print_helper))]
pub fn print_derive(input: TokenStream) -> TokenStream {
print_helper(input, "DERIVE");
diff --git a/src/test/ui/proc-macro/expand-to-derive.rs b/src/test/ui/proc-macro/expand-to-derive.rs
new file mode 100644
index 0000000..ff2876e
--- /dev/null
+++ b/src/test/ui/proc-macro/expand-to-derive.rs
@@ -0,0 +1,34 @@
+// check-pass
+// compile-flags: -Z span-debug --error-format human
+// aux-build:test-macros.rs
+
+#![feature(rustc_attrs)]
+
+#![no_std] // Don't load unnecessary hygiene information from std
+extern crate std;
+
+#[macro_use]
+extern crate test_macros;
+
+macro_rules! expand_to_derive {
+ ($item:item) => {
+ #[derive(Print)]
+ struct Foo {
+ #[cfg(FALSE)] removed: bool,
+ field: [bool; {
+ $item
+ 0
+ }]
+ }
+ };
+}
+
+expand_to_derive! {
+ #[cfg_attr(not(FALSE), rustc_dummy)]
+ struct Inner {
+ #[cfg(FALSE)] removed_inner_field: bool,
+ other_inner_field: u8,
+ }
+}
+
+fn main() {}
diff --git a/src/test/ui/proc-macro/expand-to-derive.stdout b/src/test/ui/proc-macro/expand-to-derive.stdout
new file mode 100644
index 0000000..7eb6864
--- /dev/null
+++ b/src/test/ui/proc-macro/expand-to-derive.stdout
@@ -0,0 +1,109 @@
+PRINT-DERIVE INPUT (DISPLAY): struct Foo
+{
+ field :
+ [bool ; { #[rustc_dummy] struct Inner { other_inner_field : u8, } 0 }],
+}
+PRINT-DERIVE INPUT (DEBUG): TokenStream [
+ Ident {
+ ident: "struct",
+ span: $DIR/expand-to-derive.rs:16:9: 22:10 (#4),
+ },
+ Ident {
+ ident: "Foo",
+ span: $DIR/expand-to-derive.rs:16:9: 22:10 (#4),
+ },
+ Group {
+ delimiter: Brace,
+ stream: TokenStream [
+ Ident {
+ ident: "field",
+ span: $DIR/expand-to-derive.rs:16:9: 22:10 (#4),
+ },
+ Punct {
+ ch: ':',
+ spacing: Alone,
+ span: $DIR/expand-to-derive.rs:16:9: 22:10 (#4),
+ },
+ Group {
+ delimiter: Bracket,
+ stream: TokenStream [
+ Ident {
+ ident: "bool",
+ span: $DIR/expand-to-derive.rs:16:9: 22:10 (#4),
+ },
+ Punct {
+ ch: ';',
+ spacing: Alone,
+ span: $DIR/expand-to-derive.rs:16:9: 22:10 (#4),
+ },
+ Group {
+ delimiter: Brace,
+ stream: TokenStream [
+ Punct {
+ ch: '#',
+ spacing: Alone,
+ span: $DIR/expand-to-derive.rs:16:9: 22:10 (#4),
+ },
+ Group {
+ delimiter: Bracket,
+ stream: TokenStream [
+ Ident {
+ ident: "rustc_dummy",
+ span: $DIR/expand-to-derive.rs:16:9: 22:10 (#4),
+ },
+ ],
+ span: $DIR/expand-to-derive.rs:16:9: 22:10 (#4),
+ },
+ Ident {
+ ident: "struct",
+ span: $DIR/expand-to-derive.rs:16:9: 22:10 (#4),
+ },
+ Ident {
+ ident: "Inner",
+ span: $DIR/expand-to-derive.rs:16:9: 22:10 (#4),
+ },
+ Group {
+ delimiter: Brace,
+ stream: TokenStream [
+ Ident {
+ ident: "other_inner_field",
+ span: $DIR/expand-to-derive.rs:16:9: 22:10 (#4),
+ },
+ Punct {
+ ch: ':',
+ spacing: Alone,
+ span: $DIR/expand-to-derive.rs:16:9: 22:10 (#4),
+ },
+ Ident {
+ ident: "u8",
+ span: $DIR/expand-to-derive.rs:16:9: 22:10 (#4),
+ },
+ Punct {
+ ch: ',',
+ spacing: Alone,
+ span: $DIR/expand-to-derive.rs:16:9: 22:10 (#4),
+ },
+ ],
+ span: $DIR/expand-to-derive.rs:16:9: 22:10 (#4),
+ },
+ Literal {
+ kind: Integer,
+ symbol: "0",
+ suffix: None,
+ span: $DIR/expand-to-derive.rs:16:9: 22:10 (#4),
+ },
+ ],
+ span: $DIR/expand-to-derive.rs:16:9: 22:10 (#4),
+ },
+ ],
+ span: $DIR/expand-to-derive.rs:16:9: 22:10 (#4),
+ },
+ Punct {
+ ch: ',',
+ spacing: Alone,
+ span: $DIR/expand-to-derive.rs:16:9: 22:10 (#4),
+ },
+ ],
+ span: $DIR/expand-to-derive.rs:16:9: 22:10 (#4),
+ },
+]
diff --git a/src/test/ui/proc-macro/inner-attrs.rs b/src/test/ui/proc-macro/inner-attrs.rs
new file mode 100644
index 0000000..6a353ca
--- /dev/null
+++ b/src/test/ui/proc-macro/inner-attrs.rs
@@ -0,0 +1,47 @@
+// check-pass
+// compile-flags: -Z span-debug --error-format human
+// aux-build:test-macros.rs
+
+#![feature(custom_inner_attributes)]
+#![feature(proc_macro_hygiene)]
+#![feature(stmt_expr_attributes)]
+
+#![no_std] // Don't load unnecessary hygiene information from std
+extern crate std;
+
+#[macro_use]
+extern crate test_macros;
+
+#[print_target_and_args(first)]
+#[print_target_and_args(second)]
+fn foo() {
+ #![print_target_and_args(third)]
+ #![print_target_and_args(fourth)]
+}
+
+struct MyStruct {
+ field: bool
+}
+
+fn bar() {
+ (#![print_target_and_args(fifth)] 1, 2);
+
+ [#![print_target_and_args(sixth)] 1 , 2];
+ [#![print_target_and_args(seventh)] true ; 5];
+
+
+ match 0 {
+ #![print_target_and_args(eighth)]
+ _ => {}
+ }
+
+ MyStruct { #![print_target_and_args(ninth)] field: true };
+}
+
+extern {
+ fn weird_extern() {
+ #![print_target_and_args_consume(tenth)]
+ }
+}
+
+fn main() {}
diff --git a/src/test/ui/proc-macro/inner-attrs.stdout b/src/test/ui/proc-macro/inner-attrs.stdout
new file mode 100644
index 0000000..2fd8d8a
--- /dev/null
+++ b/src/test/ui/proc-macro/inner-attrs.stdout
@@ -0,0 +1,520 @@
+PRINT-ATTR_ARGS INPUT (DISPLAY): first
+PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [
+ Ident {
+ ident: "first",
+ span: $DIR/inner-attrs.rs:15:25: 15:30 (#0),
+ },
+]
+PRINT-ATTR INPUT (DISPLAY): #[print_target_and_args(second)] fn foo()
+{ # ! [print_target_and_args(third)] # ! [print_target_and_args(fourth)] }
+PRINT-ATTR INPUT (DEBUG): TokenStream [
+ Punct {
+ ch: '#',
+ spacing: Alone,
+ span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
+ },
+ Group {
+ delimiter: Bracket,
+ stream: TokenStream [
+ Ident {
+ ident: "print_target_and_args",
+ span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
+ },
+ Group {
+ delimiter: Parenthesis,
+ stream: TokenStream [
+ Ident {
+ ident: "second",
+ span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
+ },
+ ],
+ span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
+ },
+ ],
+ span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
+ },
+ Ident {
+ ident: "fn",
+ span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
+ },
+ Ident {
+ ident: "foo",
+ span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
+ },
+ Group {
+ delimiter: Parenthesis,
+ stream: TokenStream [],
+ span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
+ },
+ Group {
+ delimiter: Brace,
+ stream: TokenStream [
+ Punct {
+ ch: '#',
+ spacing: Joint,
+ span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
+ },
+ Punct {
+ ch: '!',
+ spacing: Alone,
+ span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
+ },
+ Group {
+ delimiter: Bracket,
+ stream: TokenStream [
+ Ident {
+ ident: "print_target_and_args",
+ span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
+ },
+ Group {
+ delimiter: Parenthesis,
+ stream: TokenStream [
+ Ident {
+ ident: "third",
+ span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
+ },
+ ],
+ span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
+ },
+ ],
+ span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
+ },
+ Punct {
+ ch: '#',
+ spacing: Joint,
+ span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
+ },
+ Punct {
+ ch: '!',
+ spacing: Alone,
+ span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
+ },
+ Group {
+ delimiter: Bracket,
+ stream: TokenStream [
+ Ident {
+ ident: "print_target_and_args",
+ span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
+ },
+ Group {
+ delimiter: Parenthesis,
+ stream: TokenStream [
+ Ident {
+ ident: "fourth",
+ span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
+ },
+ ],
+ span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
+ },
+ ],
+ span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
+ },
+ ],
+ span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
+ },
+]
+PRINT-ATTR_ARGS INPUT (DISPLAY): second
+PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [
+ Ident {
+ ident: "second",
+ span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
+ },
+]
+PRINT-ATTR INPUT (DISPLAY): fn foo()
+{ # ! [print_target_and_args(third)] # ! [print_target_and_args(fourth)] }
+PRINT-ATTR INPUT (DEBUG): TokenStream [
+ Ident {
+ ident: "fn",
+ span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
+ },
+ Ident {
+ ident: "foo",
+ span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
+ },
+ Group {
+ delimiter: Parenthesis,
+ stream: TokenStream [],
+ span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
+ },
+ Group {
+ delimiter: Brace,
+ stream: TokenStream [
+ Punct {
+ ch: '#',
+ spacing: Joint,
+ span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
+ },
+ Punct {
+ ch: '!',
+ spacing: Alone,
+ span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
+ },
+ Group {
+ delimiter: Bracket,
+ stream: TokenStream [
+ Ident {
+ ident: "print_target_and_args",
+ span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
+ },
+ Group {
+ delimiter: Parenthesis,
+ stream: TokenStream [
+ Ident {
+ ident: "third",
+ span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
+ },
+ ],
+ span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
+ },
+ ],
+ span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
+ },
+ Punct {
+ ch: '#',
+ spacing: Joint,
+ span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
+ },
+ Punct {
+ ch: '!',
+ spacing: Alone,
+ span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
+ },
+ Group {
+ delimiter: Bracket,
+ stream: TokenStream [
+ Ident {
+ ident: "print_target_and_args",
+ span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
+ },
+ Group {
+ delimiter: Parenthesis,
+ stream: TokenStream [
+ Ident {
+ ident: "fourth",
+ span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
+ },
+ ],
+ span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
+ },
+ ],
+ span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
+ },
+ ],
+ span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
+ },
+]
+PRINT-ATTR_ARGS INPUT (DISPLAY): third
+PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [
+ Ident {
+ ident: "third",
+ span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
+ },
+]
+PRINT-ATTR INPUT (DISPLAY): fn foo() { # ! [print_target_and_args(fourth)] }
+PRINT-ATTR INPUT (DEBUG): TokenStream [
+ Ident {
+ ident: "fn",
+ span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
+ },
+ Ident {
+ ident: "foo",
+ span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
+ },
+ Group {
+ delimiter: Parenthesis,
+ stream: TokenStream [],
+ span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
+ },
+ Group {
+ delimiter: Brace,
+ stream: TokenStream [
+ Punct {
+ ch: '#',
+ spacing: Joint,
+ span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
+ },
+ Punct {
+ ch: '!',
+ spacing: Alone,
+ span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
+ },
+ Group {
+ delimiter: Bracket,
+ stream: TokenStream [
+ Ident {
+ ident: "print_target_and_args",
+ span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
+ },
+ Group {
+ delimiter: Parenthesis,
+ stream: TokenStream [
+ Ident {
+ ident: "fourth",
+ span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
+ },
+ ],
+ span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
+ },
+ ],
+ span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
+ },
+ ],
+ span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
+ },
+]
+PRINT-ATTR_ARGS INPUT (DISPLAY): fourth
+PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [
+ Ident {
+ ident: "fourth",
+ span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
+ },
+]
+PRINT-ATTR INPUT (DISPLAY): fn foo() { }
+PRINT-ATTR INPUT (DEBUG): TokenStream [
+ Ident {
+ ident: "fn",
+ span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
+ },
+ Ident {
+ ident: "foo",
+ span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
+ },
+ Group {
+ delimiter: Parenthesis,
+ stream: TokenStream [],
+ span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
+ },
+ Group {
+ delimiter: Brace,
+ stream: TokenStream [],
+ span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
+ },
+]
+PRINT-ATTR_ARGS INPUT (DISPLAY): fifth
+PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [
+ Ident {
+ ident: "fifth",
+ span: $DIR/inner-attrs.rs:27:31: 27:36 (#0),
+ },
+]
+PRINT-ATTR INPUT (DISPLAY): (1, 2) ;
+PRINT-ATTR INPUT (DEBUG): TokenStream [
+ Group {
+ delimiter: Parenthesis,
+ stream: TokenStream [
+ Literal {
+ kind: Integer,
+ symbol: "1",
+ suffix: None,
+ span: $DIR/inner-attrs.rs:27:5: 27:45 (#0),
+ },
+ Punct {
+ ch: ',',
+ spacing: Alone,
+ span: $DIR/inner-attrs.rs:27:5: 27:45 (#0),
+ },
+ Literal {
+ kind: Integer,
+ symbol: "2",
+ suffix: None,
+ span: $DIR/inner-attrs.rs:27:5: 27:45 (#0),
+ },
+ ],
+ span: $DIR/inner-attrs.rs:27:5: 27:45 (#0),
+ },
+ Punct {
+ ch: ';',
+ spacing: Alone,
+ span: $DIR/inner-attrs.rs:27:5: 27:45 (#0),
+ },
+]
+PRINT-ATTR_ARGS INPUT (DISPLAY): sixth
+PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [
+ Ident {
+ ident: "sixth",
+ span: $DIR/inner-attrs.rs:29:31: 29:36 (#0),
+ },
+]
+PRINT-ATTR INPUT (DISPLAY): [1, 2] ;
+PRINT-ATTR INPUT (DEBUG): TokenStream [
+ Group {
+ delimiter: Bracket,
+ stream: TokenStream [
+ Literal {
+ kind: Integer,
+ symbol: "1",
+ suffix: None,
+ span: $DIR/inner-attrs.rs:29:5: 29:46 (#0),
+ },
+ Punct {
+ ch: ',',
+ spacing: Alone,
+ span: $DIR/inner-attrs.rs:29:5: 29:46 (#0),
+ },
+ Literal {
+ kind: Integer,
+ symbol: "2",
+ suffix: None,
+ span: $DIR/inner-attrs.rs:29:5: 29:46 (#0),
+ },
+ ],
+ span: $DIR/inner-attrs.rs:29:5: 29:46 (#0),
+ },
+ Punct {
+ ch: ';',
+ spacing: Alone,
+ span: $DIR/inner-attrs.rs:29:5: 29:46 (#0),
+ },
+]
+PRINT-ATTR_ARGS INPUT (DISPLAY): seventh
+PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [
+ Ident {
+ ident: "seventh",
+ span: $DIR/inner-attrs.rs:30:31: 30:38 (#0),
+ },
+]
+PRINT-ATTR INPUT (DISPLAY): [true ; 5] ;
+PRINT-ATTR INPUT (DEBUG): TokenStream [
+ Group {
+ delimiter: Bracket,
+ stream: TokenStream [
+ Ident {
+ ident: "true",
+ span: $DIR/inner-attrs.rs:30:5: 30:51 (#0),
+ },
+ Punct {
+ ch: ';',
+ spacing: Alone,
+ span: $DIR/inner-attrs.rs:30:5: 30:51 (#0),
+ },
+ Literal {
+ kind: Integer,
+ symbol: "5",
+ suffix: None,
+ span: $DIR/inner-attrs.rs:30:5: 30:51 (#0),
+ },
+ ],
+ span: $DIR/inner-attrs.rs:30:5: 30:51 (#0),
+ },
+ Punct {
+ ch: ';',
+ spacing: Alone,
+ span: $DIR/inner-attrs.rs:30:5: 30:51 (#0),
+ },
+]
+PRINT-ATTR_ARGS INPUT (DISPLAY): eighth
+PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [
+ Ident {
+ ident: "eighth",
+ span: $DIR/inner-attrs.rs:34:34: 34:40 (#0),
+ },
+]
+PRINT-ATTR INPUT (DISPLAY): match 0 { _ => { } }
+PRINT-ATTR INPUT (DEBUG): TokenStream [
+ Ident {
+ ident: "match",
+ span: $DIR/inner-attrs.rs:33:5: 36:6 (#0),
+ },
+ Literal {
+ kind: Integer,
+ symbol: "0",
+ suffix: None,
+ span: $DIR/inner-attrs.rs:33:5: 36:6 (#0),
+ },
+ Group {
+ delimiter: Brace,
+ stream: TokenStream [
+ Ident {
+ ident: "_",
+ span: $DIR/inner-attrs.rs:33:5: 36:6 (#0),
+ },
+ Punct {
+ ch: '=',
+ spacing: Joint,
+ span: $DIR/inner-attrs.rs:33:5: 36:6 (#0),
+ },
+ Punct {
+ ch: '>',
+ spacing: Alone,
+ span: $DIR/inner-attrs.rs:33:5: 36:6 (#0),
+ },
+ Group {
+ delimiter: Brace,
+ stream: TokenStream [],
+ span: $DIR/inner-attrs.rs:33:5: 36:6 (#0),
+ },
+ ],
+ span: $DIR/inner-attrs.rs:33:5: 36:6 (#0),
+ },
+]
+PRINT-ATTR_ARGS INPUT (DISPLAY): ninth
+PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [
+ Ident {
+ ident: "ninth",
+ span: $DIR/inner-attrs.rs:38:41: 38:46 (#0),
+ },
+]
+PRINT-ATTR INPUT (DISPLAY): MyStruct { field : true, } ;
+PRINT-ATTR INPUT (DEBUG): TokenStream [
+ Ident {
+ ident: "MyStruct",
+ span: $DIR/inner-attrs.rs:38:5: 38:63 (#0),
+ },
+ Group {
+ delimiter: Brace,
+ stream: TokenStream [
+ Ident {
+ ident: "field",
+ span: $DIR/inner-attrs.rs:38:5: 38:63 (#0),
+ },
+ Punct {
+ ch: ':',
+ spacing: Alone,
+ span: $DIR/inner-attrs.rs:38:5: 38:63 (#0),
+ },
+ Ident {
+ ident: "true",
+ span: $DIR/inner-attrs.rs:38:5: 38:63 (#0),
+ },
+ Punct {
+ ch: ',',
+ spacing: Alone,
+ span: $DIR/inner-attrs.rs:38:5: 38:63 (#0),
+ },
+ ],
+ span: $DIR/inner-attrs.rs:38:5: 38:63 (#0),
+ },
+ Punct {
+ ch: ';',
+ spacing: Alone,
+ span: $DIR/inner-attrs.rs:38:5: 38:63 (#0),
+ },
+]
+PRINT-ATTR_ARGS INPUT (DISPLAY): tenth
+PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [
+ Ident {
+ ident: "tenth",
+ span: $DIR/inner-attrs.rs:43:42: 43:47 (#0),
+ },
+]
+PRINT-ATTR INPUT (DISPLAY): fn weird_extern() { }
+PRINT-ATTR INPUT (DEBUG): TokenStream [
+ Ident {
+ ident: "fn",
+ span: $DIR/inner-attrs.rs:42:5: 44:6 (#0),
+ },
+ Ident {
+ ident: "weird_extern",
+ span: $DIR/inner-attrs.rs:42:5: 44:6 (#0),
+ },
+ Group {
+ delimiter: Parenthesis,
+ stream: TokenStream [],
+ span: $DIR/inner-attrs.rs:42:5: 44:6 (#0),
+ },
+ Group {
+ delimiter: Brace,
+ stream: TokenStream [],
+ span: $DIR/inner-attrs.rs:42:5: 44:6 (#0),
+ },
+]
diff --git a/src/test/ui/proc-macro/issue-75930-derive-cfg.rs b/src/test/ui/proc-macro/issue-75930-derive-cfg.rs
index 649e731..ef56e8e 100644
--- a/src/test/ui/proc-macro/issue-75930-derive-cfg.rs
+++ b/src/test/ui/proc-macro/issue-75930-derive-cfg.rs
@@ -10,6 +10,9 @@
// (a pretty-printed struct may cause a line to start with '{' )
// FIXME: We currently lose spans here (see issue #43081)
+#![no_std] // Don't load unnecessary hygiene information from std
+extern crate std;
+
#[macro_use]
extern crate test_macros;
@@ -58,6 +61,10 @@ struct TupleStruct(
u8
);
+ fn plain_removed_fn() {
+ #![cfg_attr(not(FALSE), cfg(FALSE))]
+ }
+
0
}],
#[print_helper(d)]
diff --git a/src/test/ui/proc-macro/issue-75930-derive-cfg.stderr b/src/test/ui/proc-macro/issue-75930-derive-cfg.stderr
index 5227da7..25f3610 100644
--- a/src/test/ui/proc-macro/issue-75930-derive-cfg.stderr
+++ b/src/test/ui/proc-macro/issue-75930-derive-cfg.stderr
@@ -1,5 +1,5 @@
warning: derive helper attribute is used before it is introduced
- --> $DIR/issue-75930-derive-cfg.rs:16:3
+ --> $DIR/issue-75930-derive-cfg.rs:19:3
|
LL | #[print_helper(a)]
| ^^^^^^^^^^^^
diff --git a/src/test/ui/proc-macro/issue-75930-derive-cfg.stdout b/src/test/ui/proc-macro/issue-75930-derive-cfg.stdout
index 15e63c2..7cbc0c6 100644
--- a/src/test/ui/proc-macro/issue-75930-derive-cfg.stdout
+++ b/src/test/ui/proc-macro/issue-75930-derive-cfg.stdout
@@ -19,84 +19,35 @@
#[cfg(FALSE)] String, u8)
} struct
TupleStruct(#[cfg(FALSE)] String, #[cfg(not(FALSE))] i32,
- #[cfg(FALSE)] bool, u8) ; 0
+ #[cfg(FALSE)] bool, u8) ; fn plain_removed_fn()
+ { # ! [cfg_attr(not(FALSE), cfg(FALSE))] } 0
}], #[print_helper(d)] fourth : B
}
PRINT-ATTR INPUT (DEBUG): TokenStream [
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:16:1: 16:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:19:1: 19:2 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "print_helper",
- span: $DIR/issue-75930-derive-cfg.rs:16:3: 16:15 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:19:3: 19:15 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "a",
- span: $DIR/issue-75930-derive-cfg.rs:16:16: 16:17 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:19:16: 19:17 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:16:15: 16:18 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:19:15: 19:18 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:16:2: 16:19 (#0),
- },
- Punct {
- ch: '#',
- spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:18:1: 18:2 (#0),
- },
- Group {
- delimiter: Bracket,
- stream: TokenStream [
- Ident {
- ident: "allow",
- span: $DIR/issue-75930-derive-cfg.rs:18:24: 18:29 (#0),
- },
- Group {
- delimiter: Parenthesis,
- stream: TokenStream [
- Ident {
- ident: "dead_code",
- span: $DIR/issue-75930-derive-cfg.rs:18:30: 18:39 (#0),
- },
- ],
- span: $DIR/issue-75930-derive-cfg.rs:18:29: 18:40 (#0),
- },
- ],
- span: $DIR/issue-75930-derive-cfg.rs:18:1: 18:2 (#0),
- },
- Punct {
- ch: '#',
- spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:20:1: 20:2 (#0),
- },
- Group {
- delimiter: Bracket,
- stream: TokenStream [
- Ident {
- ident: "derive",
- span: $DIR/issue-75930-derive-cfg.rs:20:3: 20:9 (#0),
- },
- Group {
- delimiter: Parenthesis,
- stream: TokenStream [
- Ident {
- ident: "Print",
- span: $DIR/issue-75930-derive-cfg.rs:20:10: 20:15 (#0),
- },
- ],
- span: $DIR/issue-75930-derive-cfg.rs:20:9: 20:16 (#0),
- },
- ],
- span: $DIR/issue-75930-derive-cfg.rs:20:2: 20:17 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:19:2: 19:19 (#0),
},
Punct {
ch: '#',
@@ -107,77 +58,127 @@
delimiter: Bracket,
stream: TokenStream [
Ident {
+ ident: "allow",
+ span: $DIR/issue-75930-derive-cfg.rs:21:24: 21:29 (#0),
+ },
+ Group {
+ delimiter: Parenthesis,
+ stream: TokenStream [
+ Ident {
+ ident: "dead_code",
+ span: $DIR/issue-75930-derive-cfg.rs:21:30: 21:39 (#0),
+ },
+ ],
+ span: $DIR/issue-75930-derive-cfg.rs:21:29: 21:40 (#0),
+ },
+ ],
+ span: $DIR/issue-75930-derive-cfg.rs:21:1: 21:2 (#0),
+ },
+ Punct {
+ ch: '#',
+ spacing: Alone,
+ span: $DIR/issue-75930-derive-cfg.rs:23:1: 23:2 (#0),
+ },
+ Group {
+ delimiter: Bracket,
+ stream: TokenStream [
+ Ident {
+ ident: "derive",
+ span: $DIR/issue-75930-derive-cfg.rs:23:3: 23:9 (#0),
+ },
+ Group {
+ delimiter: Parenthesis,
+ stream: TokenStream [
+ Ident {
+ ident: "Print",
+ span: $DIR/issue-75930-derive-cfg.rs:23:10: 23:15 (#0),
+ },
+ ],
+ span: $DIR/issue-75930-derive-cfg.rs:23:9: 23:16 (#0),
+ },
+ ],
+ span: $DIR/issue-75930-derive-cfg.rs:23:2: 23:17 (#0),
+ },
+ Punct {
+ ch: '#',
+ spacing: Alone,
+ span: $DIR/issue-75930-derive-cfg.rs:24:1: 24:2 (#0),
+ },
+ Group {
+ delimiter: Bracket,
+ stream: TokenStream [
+ Ident {
ident: "print_helper",
- span: $DIR/issue-75930-derive-cfg.rs:21:3: 21:15 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:24:3: 24:15 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "b",
- span: $DIR/issue-75930-derive-cfg.rs:21:16: 21:17 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:24:16: 24:17 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:21:15: 21:18 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:24:15: 24:18 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:21:2: 21:19 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:24:2: 24:19 (#0),
},
Ident {
ident: "struct",
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 22:7 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 25:7 (#0),
},
Ident {
ident: "Foo",
- span: $DIR/issue-75930-derive-cfg.rs:22:8: 22:11 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:8: 25:11 (#0),
},
Punct {
ch: '<',
spacing: Joint,
- span: $DIR/issue-75930-derive-cfg.rs:22:11: 22:12 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:11: 25:12 (#0),
},
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:22:12: 22:13 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:12: 25:13 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg",
- span: $DIR/issue-75930-derive-cfg.rs:22:14: 22:17 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:14: 25:17 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:22:18: 22:23 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:18: 25:23 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:22:17: 22:24 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:17: 25:24 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:22:13: 22:25 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:13: 25:25 (#0),
},
Ident {
ident: "A",
- span: $DIR/issue-75930-derive-cfg.rs:22:26: 22:27 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:26: 25:27 (#0),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:22:27: 22:28 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:27: 25:28 (#0),
},
Ident {
ident: "B",
- span: $DIR/issue-75930-derive-cfg.rs:22:29: 22:30 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:29: 25:30 (#0),
},
Punct {
ch: '>',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:22:30: 22:31 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:30: 25:31 (#0),
},
Group {
delimiter: Brace,
@@ -185,128 +186,128 @@
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:23:5: 23:6 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:26:5: 26:6 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg",
- span: $DIR/issue-75930-derive-cfg.rs:23:7: 23:10 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:26:7: 26:10 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:23:11: 23:16 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:26:11: 26:16 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:23:10: 23:17 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:26:10: 26:17 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:23:6: 23:18 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:26:6: 26:18 (#0),
},
Ident {
ident: "first",
- span: $DIR/issue-75930-derive-cfg.rs:23:19: 23:24 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:26:19: 26:24 (#0),
},
Punct {
ch: ':',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:23:24: 23:25 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:26:24: 26:25 (#0),
},
Ident {
ident: "String",
- span: $DIR/issue-75930-derive-cfg.rs:23:26: 23:32 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:26:26: 26:32 (#0),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:23:32: 23:33 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:26:32: 26:33 (#0),
},
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:24:5: 24:6 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:27:5: 27:6 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg_attr",
- span: $DIR/issue-75930-derive-cfg.rs:24:7: 24:15 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:27:7: 27:15 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:24:16: 24:21 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:27:16: 27:21 (#0),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:24:21: 24:22 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:27:21: 27:22 (#0),
},
Ident {
ident: "deny",
- span: $DIR/issue-75930-derive-cfg.rs:24:23: 24:27 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:27:23: 27:27 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "warnings",
- span: $DIR/issue-75930-derive-cfg.rs:24:28: 24:36 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:27:28: 27:36 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:24:27: 24:37 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:27:27: 27:37 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:24:15: 24:38 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:27:15: 27:38 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:24:6: 24:39 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:27:6: 27:39 (#0),
},
Ident {
ident: "second",
- span: $DIR/issue-75930-derive-cfg.rs:24:40: 24:46 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:27:40: 27:46 (#0),
},
Punct {
ch: ':',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:24:46: 24:47 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:27:46: 27:47 (#0),
},
Ident {
ident: "bool",
- span: $DIR/issue-75930-derive-cfg.rs:24:48: 24:52 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:27:48: 27:52 (#0),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:24:52: 24:53 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:27:52: 27:53 (#0),
},
Ident {
ident: "third",
- span: $DIR/issue-75930-derive-cfg.rs:25:5: 25:10 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:28:5: 28:10 (#0),
},
Punct {
ch: ':',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:25:10: 25:11 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:28:10: 28:11 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "u8",
- span: $DIR/issue-75930-derive-cfg.rs:25:13: 25:15 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:28:13: 28:15 (#0),
},
Punct {
ch: ';',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:25:15: 25:16 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:28:15: 28:16 (#0),
},
Group {
delimiter: Brace,
@@ -314,159 +315,58 @@
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:26:9: 26:10 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:29:9: 29:10 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg",
- span: $DIR/issue-75930-derive-cfg.rs:26:11: 26:14 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:29:11: 29:14 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:26:15: 26:20 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:29:15: 29:20 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:26:14: 26:21 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:29:14: 29:21 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:26:10: 26:22 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:29:10: 29:22 (#0),
},
Ident {
ident: "struct",
- span: $DIR/issue-75930-derive-cfg.rs:26:23: 26:29 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:29:23: 29:29 (#0),
},
Ident {
ident: "Bar",
- span: $DIR/issue-75930-derive-cfg.rs:26:30: 26:33 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:29:30: 29:33 (#0),
},
Punct {
ch: ';',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:26:33: 26:34 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:29:33: 29:34 (#0),
},
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:27:9: 27:10 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:30:9: 30:10 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg",
- span: $DIR/issue-75930-derive-cfg.rs:27:11: 27:14 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:30:11: 30:14 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "not",
- span: $DIR/issue-75930-derive-cfg.rs:27:15: 27:18 (#0),
- },
- Group {
- delimiter: Parenthesis,
- stream: TokenStream [
- Ident {
- ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:27:19: 27:24 (#0),
- },
- ],
- span: $DIR/issue-75930-derive-cfg.rs:27:18: 27:25 (#0),
- },
- ],
- span: $DIR/issue-75930-derive-cfg.rs:27:14: 27:26 (#0),
- },
- ],
- span: $DIR/issue-75930-derive-cfg.rs:27:10: 27:27 (#0),
- },
- Ident {
- ident: "struct",
- span: $DIR/issue-75930-derive-cfg.rs:27:28: 27:34 (#0),
- },
- Ident {
- ident: "Inner",
- span: $DIR/issue-75930-derive-cfg.rs:27:35: 27:40 (#0),
- },
- Punct {
- ch: ';',
- spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:27:40: 27:41 (#0),
- },
- Punct {
- ch: '#',
- spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:28:9: 28:10 (#0),
- },
- Group {
- delimiter: Bracket,
- stream: TokenStream [
- Ident {
- ident: "cfg",
- span: $DIR/issue-75930-derive-cfg.rs:28:11: 28:14 (#0),
- },
- Group {
- delimiter: Parenthesis,
- stream: TokenStream [
- Ident {
- ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:28:15: 28:20 (#0),
- },
- ],
- span: $DIR/issue-75930-derive-cfg.rs:28:14: 28:21 (#0),
- },
- ],
- span: $DIR/issue-75930-derive-cfg.rs:28:10: 28:22 (#0),
- },
- Ident {
- ident: "let",
- span: $DIR/issue-75930-derive-cfg.rs:28:23: 28:26 (#0),
- },
- Ident {
- ident: "a",
- span: $DIR/issue-75930-derive-cfg.rs:28:27: 28:28 (#0),
- },
- Punct {
- ch: '=',
- spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:28:29: 28:30 (#0),
- },
- Literal {
- kind: Integer,
- symbol: "25",
- suffix: None,
- span: $DIR/issue-75930-derive-cfg.rs:28:31: 28:33 (#0),
- },
- Punct {
- ch: ';',
- spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:28:33: 28:34 (#0),
- },
- Ident {
- ident: "match",
- span: $DIR/issue-75930-derive-cfg.rs:29:9: 29:14 (#0),
- },
- Ident {
- ident: "true",
- span: $DIR/issue-75930-derive-cfg.rs:29:15: 29:19 (#0),
- },
- Group {
- delimiter: Brace,
- stream: TokenStream [
- Punct {
- ch: '#',
- spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:30:13: 30:14 (#0),
- },
- Group {
- delimiter: Bracket,
- stream: TokenStream [
- Ident {
- ident: "cfg",
span: $DIR/issue-75930-derive-cfg.rs:30:15: 30:18 (#0),
},
Group {
@@ -482,281 +382,273 @@
],
span: $DIR/issue-75930-derive-cfg.rs:30:14: 30:26 (#0),
},
- Ident {
- ident: "true",
- span: $DIR/issue-75930-derive-cfg.rs:30:27: 30:31 (#0),
- },
- Punct {
- ch: '=',
- spacing: Joint,
- span: $DIR/issue-75930-derive-cfg.rs:30:32: 30:34 (#0),
- },
- Punct {
- ch: '>',
- spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:30:32: 30:34 (#0),
- },
- Group {
- delimiter: Brace,
- stream: TokenStream [],
- span: $DIR/issue-75930-derive-cfg.rs:30:35: 30:37 (#0),
- },
- Punct {
- ch: ',',
- spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:30:37: 30:38 (#0),
- },
- Punct {
- ch: '#',
- spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:31:13: 31:14 (#0),
- },
- Group {
- delimiter: Bracket,
- stream: TokenStream [
- Ident {
- ident: "cfg_attr",
- span: $DIR/issue-75930-derive-cfg.rs:31:15: 31:23 (#0),
- },
- Group {
- delimiter: Parenthesis,
- stream: TokenStream [
- Ident {
- ident: "not",
- span: $DIR/issue-75930-derive-cfg.rs:31:24: 31:27 (#0),
- },
- Group {
- delimiter: Parenthesis,
- stream: TokenStream [
- Ident {
- ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:31:28: 31:33 (#0),
- },
- ],
- span: $DIR/issue-75930-derive-cfg.rs:31:27: 31:34 (#0),
- },
- Punct {
- ch: ',',
- spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:31:34: 31:35 (#0),
- },
- Ident {
- ident: "allow",
- span: $DIR/issue-75930-derive-cfg.rs:31:36: 31:41 (#0),
- },
- Group {
- delimiter: Parenthesis,
- stream: TokenStream [
- Ident {
- ident: "warnings",
- span: $DIR/issue-75930-derive-cfg.rs:31:42: 31:50 (#0),
- },
- ],
- span: $DIR/issue-75930-derive-cfg.rs:31:41: 31:51 (#0),
- },
- ],
- span: $DIR/issue-75930-derive-cfg.rs:31:23: 31:52 (#0),
- },
- ],
- span: $DIR/issue-75930-derive-cfg.rs:31:14: 31:53 (#0),
- },
- Ident {
- ident: "false",
- span: $DIR/issue-75930-derive-cfg.rs:31:54: 31:59 (#0),
- },
- Punct {
- ch: '=',
- spacing: Joint,
- span: $DIR/issue-75930-derive-cfg.rs:31:60: 31:62 (#0),
- },
- Punct {
- ch: '>',
- spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:31:60: 31:62 (#0),
- },
- Group {
- delimiter: Brace,
- stream: TokenStream [],
- span: $DIR/issue-75930-derive-cfg.rs:31:63: 31:65 (#0),
- },
- Punct {
- ch: ',',
- spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:31:65: 31:66 (#0),
- },
- Ident {
- ident: "_",
- span: $DIR/issue-75930-derive-cfg.rs:32:13: 32:14 (#0),
- },
- Punct {
- ch: '=',
- spacing: Joint,
- span: $DIR/issue-75930-derive-cfg.rs:32:15: 32:17 (#0),
- },
- Punct {
- ch: '>',
- spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:32:15: 32:17 (#0),
- },
- Group {
- delimiter: Brace,
- stream: TokenStream [],
- span: $DIR/issue-75930-derive-cfg.rs:32:18: 32:20 (#0),
- },
],
- span: $DIR/issue-75930-derive-cfg.rs:29:20: 33:10 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:30:10: 30:27 (#0),
+ },
+ Ident {
+ ident: "struct",
+ span: $DIR/issue-75930-derive-cfg.rs:30:28: 30:34 (#0),
+ },
+ Ident {
+ ident: "Inner",
+ span: $DIR/issue-75930-derive-cfg.rs:30:35: 30:40 (#0),
},
Punct {
ch: ';',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:33:10: 33:11 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:30:40: 30:41 (#0),
},
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:35:9: 35:10 (#0),
- },
- Group {
- delimiter: Bracket,
- stream: TokenStream [
- Ident {
- ident: "print_helper",
- span: $DIR/issue-75930-derive-cfg.rs:35:11: 35:23 (#0),
- },
- Group {
- delimiter: Parenthesis,
- stream: TokenStream [
- Ident {
- ident: "should_be_removed",
- span: $DIR/issue-75930-derive-cfg.rs:35:24: 35:41 (#0),
- },
- ],
- span: $DIR/issue-75930-derive-cfg.rs:35:23: 35:42 (#0),
- },
- ],
- span: $DIR/issue-75930-derive-cfg.rs:35:10: 35:43 (#0),
- },
- Ident {
- ident: "fn",
- span: $DIR/issue-75930-derive-cfg.rs:36:9: 36:11 (#0),
- },
- Ident {
- ident: "removed_fn",
- span: $DIR/issue-75930-derive-cfg.rs:36:12: 36:22 (#0),
- },
- Group {
- delimiter: Parenthesis,
- stream: TokenStream [],
- span: $DIR/issue-75930-derive-cfg.rs:36:22: 36:24 (#0),
- },
- Group {
- delimiter: Brace,
- stream: TokenStream [
- Punct {
- ch: '#',
- spacing: Joint,
- span: $DIR/issue-75930-derive-cfg.rs:37:13: 37:14 (#0),
- },
- Punct {
- ch: '!',
- spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:37:14: 37:15 (#0),
- },
- Group {
- delimiter: Bracket,
- stream: TokenStream [
- Ident {
- ident: "cfg",
- span: $DIR/issue-75930-derive-cfg.rs:37:16: 37:19 (#0),
- },
- Group {
- delimiter: Parenthesis,
- stream: TokenStream [
- Ident {
- ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:37:20: 37:25 (#0),
- },
- ],
- span: $DIR/issue-75930-derive-cfg.rs:37:19: 37:26 (#0),
- },
- ],
- span: $DIR/issue-75930-derive-cfg.rs:37:15: 37:27 (#0),
- },
- ],
- span: $DIR/issue-75930-derive-cfg.rs:36:25: 38:10 (#0),
- },
- Punct {
- ch: '#',
- spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:40:9: 40:10 (#0),
- },
- Group {
- delimiter: Bracket,
- stream: TokenStream [
- Ident {
- ident: "print_helper",
- span: $DIR/issue-75930-derive-cfg.rs:40:11: 40:23 (#0),
- },
- Group {
- delimiter: Parenthesis,
- stream: TokenStream [
- Ident {
- ident: "c",
- span: $DIR/issue-75930-derive-cfg.rs:40:24: 40:25 (#0),
- },
- ],
- span: $DIR/issue-75930-derive-cfg.rs:40:23: 40:26 (#0),
- },
- ],
- span: $DIR/issue-75930-derive-cfg.rs:40:10: 40:27 (#0),
- },
- Punct {
- ch: '#',
- spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:40:28: 40:29 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:31:9: 31:10 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg",
- span: $DIR/issue-75930-derive-cfg.rs:40:30: 40:33 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:31:11: 31:14 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
- ident: "not",
- span: $DIR/issue-75930-derive-cfg.rs:40:34: 40:37 (#0),
+ ident: "FALSE",
+ span: $DIR/issue-75930-derive-cfg.rs:31:15: 31:20 (#0),
+ },
+ ],
+ span: $DIR/issue-75930-derive-cfg.rs:31:14: 31:21 (#0),
+ },
+ ],
+ span: $DIR/issue-75930-derive-cfg.rs:31:10: 31:22 (#0),
+ },
+ Ident {
+ ident: "let",
+ span: $DIR/issue-75930-derive-cfg.rs:31:23: 31:26 (#0),
+ },
+ Ident {
+ ident: "a",
+ span: $DIR/issue-75930-derive-cfg.rs:31:27: 31:28 (#0),
+ },
+ Punct {
+ ch: '=',
+ spacing: Alone,
+ span: $DIR/issue-75930-derive-cfg.rs:31:29: 31:30 (#0),
+ },
+ Literal {
+ kind: Integer,
+ symbol: "25",
+ suffix: None,
+ span: $DIR/issue-75930-derive-cfg.rs:31:31: 31:33 (#0),
+ },
+ Punct {
+ ch: ';',
+ spacing: Alone,
+ span: $DIR/issue-75930-derive-cfg.rs:31:33: 31:34 (#0),
+ },
+ Ident {
+ ident: "match",
+ span: $DIR/issue-75930-derive-cfg.rs:32:9: 32:14 (#0),
+ },
+ Ident {
+ ident: "true",
+ span: $DIR/issue-75930-derive-cfg.rs:32:15: 32:19 (#0),
+ },
+ Group {
+ delimiter: Brace,
+ stream: TokenStream [
+ Punct {
+ ch: '#',
+ spacing: Alone,
+ span: $DIR/issue-75930-derive-cfg.rs:33:13: 33:14 (#0),
+ },
+ Group {
+ delimiter: Bracket,
+ stream: TokenStream [
+ Ident {
+ ident: "cfg",
+ span: $DIR/issue-75930-derive-cfg.rs:33:15: 33:18 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:40:38: 40:43 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:33:19: 33:24 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:40:37: 40:44 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:33:18: 33:25 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:40:33: 40:45 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:33:14: 33:26 (#0),
+ },
+ Ident {
+ ident: "true",
+ span: $DIR/issue-75930-derive-cfg.rs:33:27: 33:31 (#0),
+ },
+ Punct {
+ ch: '=',
+ spacing: Joint,
+ span: $DIR/issue-75930-derive-cfg.rs:33:32: 33:34 (#0),
+ },
+ Punct {
+ ch: '>',
+ spacing: Alone,
+ span: $DIR/issue-75930-derive-cfg.rs:33:32: 33:34 (#0),
+ },
+ Group {
+ delimiter: Brace,
+ stream: TokenStream [],
+ span: $DIR/issue-75930-derive-cfg.rs:33:35: 33:37 (#0),
+ },
+ Punct {
+ ch: ',',
+ spacing: Alone,
+ span: $DIR/issue-75930-derive-cfg.rs:33:37: 33:38 (#0),
+ },
+ Punct {
+ ch: '#',
+ spacing: Alone,
+ span: $DIR/issue-75930-derive-cfg.rs:34:13: 34:14 (#0),
+ },
+ Group {
+ delimiter: Bracket,
+ stream: TokenStream [
+ Ident {
+ ident: "cfg_attr",
+ span: $DIR/issue-75930-derive-cfg.rs:34:15: 34:23 (#0),
+ },
+ Group {
+ delimiter: Parenthesis,
+ stream: TokenStream [
+ Ident {
+ ident: "not",
+ span: $DIR/issue-75930-derive-cfg.rs:34:24: 34:27 (#0),
+ },
+ Group {
+ delimiter: Parenthesis,
+ stream: TokenStream [
+ Ident {
+ ident: "FALSE",
+ span: $DIR/issue-75930-derive-cfg.rs:34:28: 34:33 (#0),
+ },
+ ],
+ span: $DIR/issue-75930-derive-cfg.rs:34:27: 34:34 (#0),
+ },
+ Punct {
+ ch: ',',
+ spacing: Alone,
+ span: $DIR/issue-75930-derive-cfg.rs:34:34: 34:35 (#0),
+ },
+ Ident {
+ ident: "allow",
+ span: $DIR/issue-75930-derive-cfg.rs:34:36: 34:41 (#0),
+ },
+ Group {
+ delimiter: Parenthesis,
+ stream: TokenStream [
+ Ident {
+ ident: "warnings",
+ span: $DIR/issue-75930-derive-cfg.rs:34:42: 34:50 (#0),
+ },
+ ],
+ span: $DIR/issue-75930-derive-cfg.rs:34:41: 34:51 (#0),
+ },
+ ],
+ span: $DIR/issue-75930-derive-cfg.rs:34:23: 34:52 (#0),
+ },
+ ],
+ span: $DIR/issue-75930-derive-cfg.rs:34:14: 34:53 (#0),
+ },
+ Ident {
+ ident: "false",
+ span: $DIR/issue-75930-derive-cfg.rs:34:54: 34:59 (#0),
+ },
+ Punct {
+ ch: '=',
+ spacing: Joint,
+ span: $DIR/issue-75930-derive-cfg.rs:34:60: 34:62 (#0),
+ },
+ Punct {
+ ch: '>',
+ spacing: Alone,
+ span: $DIR/issue-75930-derive-cfg.rs:34:60: 34:62 (#0),
+ },
+ Group {
+ delimiter: Brace,
+ stream: TokenStream [],
+ span: $DIR/issue-75930-derive-cfg.rs:34:63: 34:65 (#0),
+ },
+ Punct {
+ ch: ',',
+ spacing: Alone,
+ span: $DIR/issue-75930-derive-cfg.rs:34:65: 34:66 (#0),
+ },
+ Ident {
+ ident: "_",
+ span: $DIR/issue-75930-derive-cfg.rs:35:13: 35:14 (#0),
+ },
+ Punct {
+ ch: '=',
+ spacing: Joint,
+ span: $DIR/issue-75930-derive-cfg.rs:35:15: 35:17 (#0),
+ },
+ Punct {
+ ch: '>',
+ spacing: Alone,
+ span: $DIR/issue-75930-derive-cfg.rs:35:15: 35:17 (#0),
+ },
+ Group {
+ delimiter: Brace,
+ stream: TokenStream [],
+ span: $DIR/issue-75930-derive-cfg.rs:35:18: 35:20 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:40:29: 40:46 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:32:20: 36:10 (#0),
+ },
+ Punct {
+ ch: ';',
+ spacing: Alone,
+ span: $DIR/issue-75930-derive-cfg.rs:36:10: 36:11 (#0),
+ },
+ Punct {
+ ch: '#',
+ spacing: Alone,
+ span: $DIR/issue-75930-derive-cfg.rs:38:9: 38:10 (#0),
+ },
+ Group {
+ delimiter: Bracket,
+ stream: TokenStream [
+ Ident {
+ ident: "print_helper",
+ span: $DIR/issue-75930-derive-cfg.rs:38:11: 38:23 (#0),
+ },
+ Group {
+ delimiter: Parenthesis,
+ stream: TokenStream [
+ Ident {
+ ident: "should_be_removed",
+ span: $DIR/issue-75930-derive-cfg.rs:38:24: 38:41 (#0),
+ },
+ ],
+ span: $DIR/issue-75930-derive-cfg.rs:38:23: 38:42 (#0),
+ },
+ ],
+ span: $DIR/issue-75930-derive-cfg.rs:38:10: 38:43 (#0),
},
Ident {
ident: "fn",
- span: $DIR/issue-75930-derive-cfg.rs:40:47: 40:49 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:39:9: 39:11 (#0),
},
Ident {
- ident: "kept_fn",
- span: $DIR/issue-75930-derive-cfg.rs:40:50: 40:57 (#0),
+ ident: "removed_fn",
+ span: $DIR/issue-75930-derive-cfg.rs:39:12: 39:22 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [],
- span: $DIR/issue-75930-derive-cfg.rs:40:57: 40:59 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:39:22: 39:24 (#0),
},
Group {
delimiter: Brace,
@@ -764,82 +656,191 @@
Punct {
ch: '#',
spacing: Joint,
- span: $DIR/issue-75930-derive-cfg.rs:41:13: 41:14 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:40:13: 40:14 (#0),
},
Punct {
ch: '!',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:41:14: 41:15 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:40:14: 40:15 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg",
- span: $DIR/issue-75930-derive-cfg.rs:41:16: 41:19 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:40:16: 40:19 (#0),
+ },
+ Group {
+ delimiter: Parenthesis,
+ stream: TokenStream [
+ Ident {
+ ident: "FALSE",
+ span: $DIR/issue-75930-derive-cfg.rs:40:20: 40:25 (#0),
+ },
+ ],
+ span: $DIR/issue-75930-derive-cfg.rs:40:19: 40:26 (#0),
+ },
+ ],
+ span: $DIR/issue-75930-derive-cfg.rs:40:15: 40:27 (#0),
+ },
+ ],
+ span: $DIR/issue-75930-derive-cfg.rs:39:25: 41:10 (#0),
+ },
+ Punct {
+ ch: '#',
+ spacing: Alone,
+ span: $DIR/issue-75930-derive-cfg.rs:43:9: 43:10 (#0),
+ },
+ Group {
+ delimiter: Bracket,
+ stream: TokenStream [
+ Ident {
+ ident: "print_helper",
+ span: $DIR/issue-75930-derive-cfg.rs:43:11: 43:23 (#0),
+ },
+ Group {
+ delimiter: Parenthesis,
+ stream: TokenStream [
+ Ident {
+ ident: "c",
+ span: $DIR/issue-75930-derive-cfg.rs:43:24: 43:25 (#0),
+ },
+ ],
+ span: $DIR/issue-75930-derive-cfg.rs:43:23: 43:26 (#0),
+ },
+ ],
+ span: $DIR/issue-75930-derive-cfg.rs:43:10: 43:27 (#0),
+ },
+ Punct {
+ ch: '#',
+ spacing: Alone,
+ span: $DIR/issue-75930-derive-cfg.rs:43:28: 43:29 (#0),
+ },
+ Group {
+ delimiter: Bracket,
+ stream: TokenStream [
+ Ident {
+ ident: "cfg",
+ span: $DIR/issue-75930-derive-cfg.rs:43:30: 43:33 (#0),
+ },
+ Group {
+ delimiter: Parenthesis,
+ stream: TokenStream [
+ Ident {
+ ident: "not",
+ span: $DIR/issue-75930-derive-cfg.rs:43:34: 43:37 (#0),
+ },
+ Group {
+ delimiter: Parenthesis,
+ stream: TokenStream [
+ Ident {
+ ident: "FALSE",
+ span: $DIR/issue-75930-derive-cfg.rs:43:38: 43:43 (#0),
+ },
+ ],
+ span: $DIR/issue-75930-derive-cfg.rs:43:37: 43:44 (#0),
+ },
+ ],
+ span: $DIR/issue-75930-derive-cfg.rs:43:33: 43:45 (#0),
+ },
+ ],
+ span: $DIR/issue-75930-derive-cfg.rs:43:29: 43:46 (#0),
+ },
+ Ident {
+ ident: "fn",
+ span: $DIR/issue-75930-derive-cfg.rs:43:47: 43:49 (#0),
+ },
+ Ident {
+ ident: "kept_fn",
+ span: $DIR/issue-75930-derive-cfg.rs:43:50: 43:57 (#0),
+ },
+ Group {
+ delimiter: Parenthesis,
+ stream: TokenStream [],
+ span: $DIR/issue-75930-derive-cfg.rs:43:57: 43:59 (#0),
+ },
+ Group {
+ delimiter: Brace,
+ stream: TokenStream [
+ Punct {
+ ch: '#',
+ spacing: Joint,
+ span: $DIR/issue-75930-derive-cfg.rs:44:13: 44:14 (#0),
+ },
+ Punct {
+ ch: '!',
+ spacing: Alone,
+ span: $DIR/issue-75930-derive-cfg.rs:44:14: 44:15 (#0),
+ },
+ Group {
+ delimiter: Bracket,
+ stream: TokenStream [
+ Ident {
+ ident: "cfg",
+ span: $DIR/issue-75930-derive-cfg.rs:44:16: 44:19 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "not",
- span: $DIR/issue-75930-derive-cfg.rs:41:20: 41:23 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:44:20: 44:23 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:41:24: 41:29 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:44:24: 44:29 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:41:23: 41:30 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:44:23: 44:30 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:41:19: 41:31 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:44:19: 44:31 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:41:15: 41:32 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:44:15: 44:32 (#0),
},
Ident {
ident: "let",
- span: $DIR/issue-75930-derive-cfg.rs:42:13: 42:16 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:45:13: 45:16 (#0),
},
Ident {
ident: "my_val",
- span: $DIR/issue-75930-derive-cfg.rs:42:17: 42:23 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:45:17: 45:23 (#0),
},
Punct {
ch: '=',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:42:24: 42:25 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:45:24: 45:25 (#0),
},
Ident {
ident: "true",
- span: $DIR/issue-75930-derive-cfg.rs:42:26: 42:30 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:45:26: 45:30 (#0),
},
Punct {
ch: ';',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:42:30: 42:31 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:45:30: 45:31 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:40:60: 43:10 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:43:60: 46:10 (#0),
},
Ident {
ident: "enum",
- span: $DIR/issue-75930-derive-cfg.rs:45:9: 45:13 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:48:9: 48:13 (#0),
},
Ident {
ident: "TupleEnum",
- span: $DIR/issue-75930-derive-cfg.rs:45:14: 45:23 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:48:14: 48:23 (#0),
},
Group {
delimiter: Brace,
stream: TokenStream [
Ident {
ident: "Foo",
- span: $DIR/issue-75930-derive-cfg.rs:46:13: 46:16 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:49:13: 49:16 (#0),
},
Group {
delimiter: Parenthesis,
@@ -847,118 +848,6 @@
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:47:17: 47:18 (#0),
- },
- Group {
- delimiter: Bracket,
- stream: TokenStream [
- Ident {
- ident: "cfg",
- span: $DIR/issue-75930-derive-cfg.rs:47:19: 47:22 (#0),
- },
- Group {
- delimiter: Parenthesis,
- stream: TokenStream [
- Ident {
- ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:47:23: 47:28 (#0),
- },
- ],
- span: $DIR/issue-75930-derive-cfg.rs:47:22: 47:29 (#0),
- },
- ],
- span: $DIR/issue-75930-derive-cfg.rs:47:18: 47:30 (#0),
- },
- Ident {
- ident: "u8",
- span: $DIR/issue-75930-derive-cfg.rs:47:31: 47:33 (#0),
- },
- Punct {
- ch: ',',
- spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:47:33: 47:34 (#0),
- },
- Punct {
- ch: '#',
- spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:48:17: 48:18 (#0),
- },
- Group {
- delimiter: Bracket,
- stream: TokenStream [
- Ident {
- ident: "cfg",
- span: $DIR/issue-75930-derive-cfg.rs:48:19: 48:22 (#0),
- },
- Group {
- delimiter: Parenthesis,
- stream: TokenStream [
- Ident {
- ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:48:23: 48:28 (#0),
- },
- ],
- span: $DIR/issue-75930-derive-cfg.rs:48:22: 48:29 (#0),
- },
- ],
- span: $DIR/issue-75930-derive-cfg.rs:48:18: 48:30 (#0),
- },
- Ident {
- ident: "bool",
- span: $DIR/issue-75930-derive-cfg.rs:48:31: 48:35 (#0),
- },
- Punct {
- ch: ',',
- spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:48:35: 48:36 (#0),
- },
- Punct {
- ch: '#',
- spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:49:17: 49:18 (#0),
- },
- Group {
- delimiter: Bracket,
- stream: TokenStream [
- Ident {
- ident: "cfg",
- span: $DIR/issue-75930-derive-cfg.rs:49:19: 49:22 (#0),
- },
- Group {
- delimiter: Parenthesis,
- stream: TokenStream [
- Ident {
- ident: "not",
- span: $DIR/issue-75930-derive-cfg.rs:49:23: 49:26 (#0),
- },
- Group {
- delimiter: Parenthesis,
- stream: TokenStream [
- Ident {
- ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:49:27: 49:32 (#0),
- },
- ],
- span: $DIR/issue-75930-derive-cfg.rs:49:26: 49:33 (#0),
- },
- ],
- span: $DIR/issue-75930-derive-cfg.rs:49:22: 49:34 (#0),
- },
- ],
- span: $DIR/issue-75930-derive-cfg.rs:49:18: 49:35 (#0),
- },
- Ident {
- ident: "i32",
- span: $DIR/issue-75930-derive-cfg.rs:49:36: 49:39 (#0),
- },
- Punct {
- ch: ',',
- spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:49:39: 49:40 (#0),
- },
- Punct {
- ch: '#',
- spacing: Alone,
span: $DIR/issue-75930-derive-cfg.rs:50:17: 50:18 (#0),
},
Group {
@@ -982,31 +871,143 @@
span: $DIR/issue-75930-derive-cfg.rs:50:18: 50:30 (#0),
},
Ident {
- ident: "String",
- span: $DIR/issue-75930-derive-cfg.rs:50:31: 50:37 (#0),
+ ident: "u8",
+ span: $DIR/issue-75930-derive-cfg.rs:50:31: 50:33 (#0),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:50:37: 50:38 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:50:33: 50:34 (#0),
+ },
+ Punct {
+ ch: '#',
+ spacing: Alone,
+ span: $DIR/issue-75930-derive-cfg.rs:51:17: 51:18 (#0),
+ },
+ Group {
+ delimiter: Bracket,
+ stream: TokenStream [
+ Ident {
+ ident: "cfg",
+ span: $DIR/issue-75930-derive-cfg.rs:51:19: 51:22 (#0),
+ },
+ Group {
+ delimiter: Parenthesis,
+ stream: TokenStream [
+ Ident {
+ ident: "FALSE",
+ span: $DIR/issue-75930-derive-cfg.rs:51:23: 51:28 (#0),
+ },
+ ],
+ span: $DIR/issue-75930-derive-cfg.rs:51:22: 51:29 (#0),
+ },
+ ],
+ span: $DIR/issue-75930-derive-cfg.rs:51:18: 51:30 (#0),
+ },
+ Ident {
+ ident: "bool",
+ span: $DIR/issue-75930-derive-cfg.rs:51:31: 51:35 (#0),
+ },
+ Punct {
+ ch: ',',
+ spacing: Alone,
+ span: $DIR/issue-75930-derive-cfg.rs:51:35: 51:36 (#0),
+ },
+ Punct {
+ ch: '#',
+ spacing: Alone,
+ span: $DIR/issue-75930-derive-cfg.rs:52:17: 52:18 (#0),
+ },
+ Group {
+ delimiter: Bracket,
+ stream: TokenStream [
+ Ident {
+ ident: "cfg",
+ span: $DIR/issue-75930-derive-cfg.rs:52:19: 52:22 (#0),
+ },
+ Group {
+ delimiter: Parenthesis,
+ stream: TokenStream [
+ Ident {
+ ident: "not",
+ span: $DIR/issue-75930-derive-cfg.rs:52:23: 52:26 (#0),
+ },
+ Group {
+ delimiter: Parenthesis,
+ stream: TokenStream [
+ Ident {
+ ident: "FALSE",
+ span: $DIR/issue-75930-derive-cfg.rs:52:27: 52:32 (#0),
+ },
+ ],
+ span: $DIR/issue-75930-derive-cfg.rs:52:26: 52:33 (#0),
+ },
+ ],
+ span: $DIR/issue-75930-derive-cfg.rs:52:22: 52:34 (#0),
+ },
+ ],
+ span: $DIR/issue-75930-derive-cfg.rs:52:18: 52:35 (#0),
+ },
+ Ident {
+ ident: "i32",
+ span: $DIR/issue-75930-derive-cfg.rs:52:36: 52:39 (#0),
+ },
+ Punct {
+ ch: ',',
+ spacing: Alone,
+ span: $DIR/issue-75930-derive-cfg.rs:52:39: 52:40 (#0),
+ },
+ Punct {
+ ch: '#',
+ spacing: Alone,
+ span: $DIR/issue-75930-derive-cfg.rs:53:17: 53:18 (#0),
+ },
+ Group {
+ delimiter: Bracket,
+ stream: TokenStream [
+ Ident {
+ ident: "cfg",
+ span: $DIR/issue-75930-derive-cfg.rs:53:19: 53:22 (#0),
+ },
+ Group {
+ delimiter: Parenthesis,
+ stream: TokenStream [
+ Ident {
+ ident: "FALSE",
+ span: $DIR/issue-75930-derive-cfg.rs:53:23: 53:28 (#0),
+ },
+ ],
+ span: $DIR/issue-75930-derive-cfg.rs:53:22: 53:29 (#0),
+ },
+ ],
+ span: $DIR/issue-75930-derive-cfg.rs:53:18: 53:30 (#0),
+ },
+ Ident {
+ ident: "String",
+ span: $DIR/issue-75930-derive-cfg.rs:53:31: 53:37 (#0),
+ },
+ Punct {
+ ch: ',',
+ spacing: Alone,
+ span: $DIR/issue-75930-derive-cfg.rs:53:37: 53:38 (#0),
},
Ident {
ident: "u8",
- span: $DIR/issue-75930-derive-cfg.rs:50:39: 50:41 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:53:39: 53:41 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:46:16: 51:14 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:49:16: 54:14 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:45:24: 52:10 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:48:24: 55:10 (#0),
},
Ident {
ident: "struct",
- span: $DIR/issue-75930-derive-cfg.rs:54:9: 54:15 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:57:9: 57:15 (#0),
},
Ident {
ident: "TupleStruct",
- span: $DIR/issue-75930-derive-cfg.rs:54:16: 54:27 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:57:16: 57:27 (#0),
},
Group {
delimiter: Parenthesis,
@@ -1014,184 +1015,262 @@
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:55:13: 55:14 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:58:13: 58:14 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg",
- span: $DIR/issue-75930-derive-cfg.rs:55:15: 55:18 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:58:15: 58:18 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:55:19: 55:24 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:58:19: 58:24 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:55:18: 55:25 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:58:18: 58:25 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:55:14: 55:26 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:58:14: 58:26 (#0),
},
Ident {
ident: "String",
- span: $DIR/issue-75930-derive-cfg.rs:55:27: 55:33 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:58:27: 58:33 (#0),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:55:33: 55:34 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:58:33: 58:34 (#0),
},
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:56:13: 56:14 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:59:13: 59:14 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg",
- span: $DIR/issue-75930-derive-cfg.rs:56:15: 56:18 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:59:15: 59:18 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "not",
- span: $DIR/issue-75930-derive-cfg.rs:56:19: 56:22 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:59:19: 59:22 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:56:23: 56:28 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:59:23: 59:28 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:56:22: 56:29 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:59:22: 59:29 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:56:18: 56:30 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:59:18: 59:30 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:56:14: 56:31 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:59:14: 59:31 (#0),
},
Ident {
ident: "i32",
- span: $DIR/issue-75930-derive-cfg.rs:56:32: 56:35 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:59:32: 59:35 (#0),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:56:35: 56:36 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:59:35: 59:36 (#0),
},
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:57:13: 57:14 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:60:13: 60:14 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg",
- span: $DIR/issue-75930-derive-cfg.rs:57:15: 57:18 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:60:15: 60:18 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:57:19: 57:24 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:60:19: 60:24 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:57:18: 57:25 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:60:18: 60:25 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:57:14: 57:26 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:60:14: 60:26 (#0),
},
Ident {
ident: "bool",
- span: $DIR/issue-75930-derive-cfg.rs:57:27: 57:31 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:60:27: 60:31 (#0),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:57:31: 57:32 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:60:31: 60:32 (#0),
},
Ident {
ident: "u8",
- span: $DIR/issue-75930-derive-cfg.rs:58:13: 58:15 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:61:13: 61:15 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:54:27: 59:10 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:57:27: 62:10 (#0),
},
Punct {
ch: ';',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:59:10: 59:11 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:62:10: 62:11 (#0),
+ },
+ Ident {
+ ident: "fn",
+ span: $DIR/issue-75930-derive-cfg.rs:64:9: 64:11 (#0),
+ },
+ Ident {
+ ident: "plain_removed_fn",
+ span: $DIR/issue-75930-derive-cfg.rs:64:12: 64:28 (#0),
+ },
+ Group {
+ delimiter: Parenthesis,
+ stream: TokenStream [],
+ span: $DIR/issue-75930-derive-cfg.rs:64:28: 64:30 (#0),
+ },
+ Group {
+ delimiter: Brace,
+ stream: TokenStream [
+ Punct {
+ ch: '#',
+ spacing: Joint,
+ span: $DIR/issue-75930-derive-cfg.rs:65:13: 65:14 (#0),
+ },
+ Punct {
+ ch: '!',
+ spacing: Alone,
+ span: $DIR/issue-75930-derive-cfg.rs:65:14: 65:15 (#0),
+ },
+ Group {
+ delimiter: Bracket,
+ stream: TokenStream [
+ Ident {
+ ident: "cfg_attr",
+ span: $DIR/issue-75930-derive-cfg.rs:65:16: 65:24 (#0),
+ },
+ Group {
+ delimiter: Parenthesis,
+ stream: TokenStream [
+ Ident {
+ ident: "not",
+ span: $DIR/issue-75930-derive-cfg.rs:65:25: 65:28 (#0),
+ },
+ Group {
+ delimiter: Parenthesis,
+ stream: TokenStream [
+ Ident {
+ ident: "FALSE",
+ span: $DIR/issue-75930-derive-cfg.rs:65:29: 65:34 (#0),
+ },
+ ],
+ span: $DIR/issue-75930-derive-cfg.rs:65:28: 65:35 (#0),
+ },
+ Punct {
+ ch: ',',
+ spacing: Alone,
+ span: $DIR/issue-75930-derive-cfg.rs:65:35: 65:36 (#0),
+ },
+ Ident {
+ ident: "cfg",
+ span: $DIR/issue-75930-derive-cfg.rs:65:37: 65:40 (#0),
+ },
+ Group {
+ delimiter: Parenthesis,
+ stream: TokenStream [
+ Ident {
+ ident: "FALSE",
+ span: $DIR/issue-75930-derive-cfg.rs:65:41: 65:46 (#0),
+ },
+ ],
+ span: $DIR/issue-75930-derive-cfg.rs:65:40: 65:47 (#0),
+ },
+ ],
+ span: $DIR/issue-75930-derive-cfg.rs:65:24: 65:48 (#0),
+ },
+ ],
+ span: $DIR/issue-75930-derive-cfg.rs:65:15: 65:49 (#0),
+ },
+ ],
+ span: $DIR/issue-75930-derive-cfg.rs:64:31: 66:10 (#0),
},
Literal {
kind: Integer,
symbol: "0",
suffix: None,
- span: $DIR/issue-75930-derive-cfg.rs:61:9: 61:10 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:68:9: 68:10 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:25:17: 62:6 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:28:17: 69:6 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:25:12: 62:7 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:28:12: 69:7 (#0),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:62:7: 62:8 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:69:7: 69:8 (#0),
},
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:63:5: 63:6 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:70:5: 70:6 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "print_helper",
- span: $DIR/issue-75930-derive-cfg.rs:63:7: 63:19 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:70:7: 70:19 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "d",
- span: $DIR/issue-75930-derive-cfg.rs:63:20: 63:21 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:70:20: 70:21 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:63:19: 63:22 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:70:19: 70:22 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:63:6: 63:23 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:70:6: 70:23 (#0),
},
Ident {
ident: "fourth",
- span: $DIR/issue-75930-derive-cfg.rs:64:5: 64:11 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:71:5: 71:11 (#0),
},
Punct {
ch: ':',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:64:11: 64:12 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:71:11: 71:12 (#0),
},
Ident {
ident: "B",
- span: $DIR/issue-75930-derive-cfg.rs:64:13: 64:14 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:71:13: 71:14 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:22:32: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:32: 72:2 (#0),
},
]
PRINT-DERIVE INPUT (DISPLAY): #[print_helper(a)] #[allow(dead_code)] #[print_helper(b)] struct Foo < B >
@@ -1211,141 +1290,141 @@
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "print_helper",
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "a",
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "allow",
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "dead_code",
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "print_helper",
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "b",
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Ident {
ident: "struct",
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Ident {
ident: "Foo",
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Punct {
ch: '<',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Ident {
ident: "B",
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Punct {
ch: '>',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Group {
delimiter: Brace,
stream: TokenStream [
Ident {
ident: "second",
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Punct {
ch: ':',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Ident {
ident: "bool",
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Ident {
ident: "third",
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Punct {
ch: ':',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "u8",
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Punct {
ch: ';',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Group {
delimiter: Brace,
@@ -1353,58 +1432,58 @@
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg",
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "not",
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Ident {
ident: "struct",
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Ident {
ident: "Inner",
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Punct {
ch: ';',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Ident {
ident: "match",
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Ident {
ident: "true",
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Group {
delimiter: Brace,
@@ -1412,146 +1491,146 @@
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "allow",
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "warnings",
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Ident {
ident: "false",
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Punct {
ch: '=',
spacing: Joint,
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Punct {
ch: '>',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Group {
delimiter: Brace,
stream: TokenStream [],
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Ident {
ident: "_",
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Punct {
ch: '=',
spacing: Joint,
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Punct {
ch: '>',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Group {
delimiter: Brace,
stream: TokenStream [],
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Punct {
ch: ';',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "print_helper",
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "c",
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg",
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "not",
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Ident {
ident: "fn",
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Ident {
ident: "kept_fn",
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [],
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Group {
delimiter: Brace,
@@ -1559,82 +1638,82 @@
Punct {
ch: '#',
spacing: Joint,
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Punct {
ch: '!',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg",
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "not",
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Ident {
ident: "let",
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Ident {
ident: "my_val",
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Punct {
ch: '=',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Ident {
ident: "true",
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Punct {
ch: ';',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Ident {
ident: "enum",
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Ident {
ident: "TupleEnum",
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Group {
delimiter: Brace,
stream: TokenStream [
Ident {
ident: "Foo",
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Group {
delimiter: Parenthesis,
@@ -1642,69 +1721,69 @@
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg",
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "not",
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Ident {
ident: "i32",
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Ident {
ident: "u8",
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Ident {
ident: "struct",
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Ident {
ident: "TupleStruct",
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Group {
delimiter: Parenthesis,
@@ -1712,120 +1791,120 @@
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg",
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "not",
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Ident {
ident: "i32",
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Ident {
ident: "u8",
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Punct {
ch: ';',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Literal {
kind: Integer,
symbol: "0",
suffix: None,
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "print_helper",
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "d",
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Ident {
ident: "fourth",
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Punct {
ch: ':',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Ident {
ident: "B",
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:22:1: 65:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:25:1: 72:2 (#0),
},
]
diff --git a/src/test/ui/proc-macro/macro-rules-derive-cfg.rs b/src/test/ui/proc-macro/macro-rules-derive-cfg.rs
new file mode 100644
index 0000000..a221b95
--- /dev/null
+++ b/src/test/ui/proc-macro/macro-rules-derive-cfg.rs
@@ -0,0 +1,31 @@
+// check-pass
+// compile-flags: -Z span-debug --error-format human
+// aux-build:test-macros.rs
+
+#![feature(rustc_attrs)]
+#![feature(stmt_expr_attributes)]
+
+#![no_std] // Don't load unnecessary hygiene information from std
+extern crate std;
+
+#[macro_use]
+extern crate test_macros;
+
+macro_rules! produce_it {
+ ($expr:expr) => {
+ #[derive(Print)]
+ struct Foo {
+ val: [bool; {
+ let a = #[cfg_attr(not(FALSE), rustc_dummy(first))] $expr;
+ 0
+ }]
+ }
+ }
+}
+
+produce_it!(#[cfg_attr(not(FALSE), rustc_dummy(second))] {
+ #![cfg_attr(not(FALSE), allow(unused))]
+ 30
+});
+
+fn main() {}
diff --git a/src/test/ui/proc-macro/macro-rules-derive-cfg.stdout b/src/test/ui/proc-macro/macro-rules-derive-cfg.stdout
new file mode 100644
index 0000000..5db1859
--- /dev/null
+++ b/src/test/ui/proc-macro/macro-rules-derive-cfg.stdout
@@ -0,0 +1,176 @@
+PRINT-DERIVE INPUT (DISPLAY): struct Foo
+{
+ val :
+ [bool ;
+ {
+ let a = #[rustc_dummy(first)] #[rustc_dummy(second)]
+ { # ! [allow(unused)] 30 } ; 0
+ }],
+}
+PRINT-DERIVE INPUT (DEBUG): TokenStream [
+ Ident {
+ ident: "struct",
+ span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
+ },
+ Ident {
+ ident: "Foo",
+ span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
+ },
+ Group {
+ delimiter: Brace,
+ stream: TokenStream [
+ Ident {
+ ident: "val",
+ span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
+ },
+ Punct {
+ ch: ':',
+ spacing: Alone,
+ span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
+ },
+ Group {
+ delimiter: Bracket,
+ stream: TokenStream [
+ Ident {
+ ident: "bool",
+ span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
+ },
+ Punct {
+ ch: ';',
+ spacing: Alone,
+ span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
+ },
+ Group {
+ delimiter: Brace,
+ stream: TokenStream [
+ Ident {
+ ident: "let",
+ span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
+ },
+ Ident {
+ ident: "a",
+ span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
+ },
+ Punct {
+ ch: '=',
+ spacing: Alone,
+ span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
+ },
+ Punct {
+ ch: '#',
+ spacing: Alone,
+ span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
+ },
+ Group {
+ delimiter: Bracket,
+ stream: TokenStream [
+ Ident {
+ ident: "rustc_dummy",
+ span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
+ },
+ Group {
+ delimiter: Parenthesis,
+ stream: TokenStream [
+ Ident {
+ ident: "first",
+ span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
+ },
+ ],
+ span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
+ },
+ ],
+ span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
+ },
+ Punct {
+ ch: '#',
+ spacing: Alone,
+ span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
+ },
+ Group {
+ delimiter: Bracket,
+ stream: TokenStream [
+ Ident {
+ ident: "rustc_dummy",
+ span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
+ },
+ Group {
+ delimiter: Parenthesis,
+ stream: TokenStream [
+ Ident {
+ ident: "second",
+ span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
+ },
+ ],
+ span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
+ },
+ ],
+ span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
+ },
+ Group {
+ delimiter: Brace,
+ stream: TokenStream [
+ Punct {
+ ch: '#',
+ spacing: Joint,
+ span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
+ },
+ Punct {
+ ch: '!',
+ spacing: Alone,
+ span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
+ },
+ Group {
+ delimiter: Bracket,
+ stream: TokenStream [
+ Ident {
+ ident: "allow",
+ span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
+ },
+ Group {
+ delimiter: Parenthesis,
+ stream: TokenStream [
+ Ident {
+ ident: "unused",
+ span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
+ },
+ ],
+ span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
+ },
+ ],
+ span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
+ },
+ Literal {
+ kind: Integer,
+ symbol: "30",
+ suffix: None,
+ span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
+ },
+ ],
+ span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
+ },
+ Punct {
+ ch: ';',
+ spacing: Alone,
+ span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
+ },
+ Literal {
+ kind: Integer,
+ symbol: "0",
+ suffix: None,
+ span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
+ },
+ ],
+ span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
+ },
+ ],
+ span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
+ },
+ Punct {
+ ch: ',',
+ spacing: Alone,
+ span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
+ },
+ ],
+ span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
+ },
+]
diff --git a/src/test/ui/proc-macro/nested-derive-cfg.rs b/src/test/ui/proc-macro/nested-derive-cfg.rs
new file mode 100644
index 0000000..53cfbb7
--- /dev/null
+++ b/src/test/ui/proc-macro/nested-derive-cfg.rs
@@ -0,0 +1,23 @@
+// compile-flags: -Z span-debug --error-format human
+// aux-build:test-macros.rs
+// check-pass
+
+#![no_std] // Don't load unnecessary hygiene information from std
+extern crate std;
+
+#[macro_use]
+extern crate test_macros;
+
+#[derive(Print)]
+struct Foo {
+ #[cfg(FALSE)] removed: bool,
+ my_array: [bool; {
+ struct Inner {
+ #[cfg(FALSE)] removed_inner_field: u8,
+ non_removed_inner_field: usize
+ }
+ 0
+ }]
+}
+
+fn main() {}
diff --git a/src/test/ui/proc-macro/nested-derive-cfg.stdout b/src/test/ui/proc-macro/nested-derive-cfg.stdout
new file mode 100644
index 0000000..cf4e5d9
--- /dev/null
+++ b/src/test/ui/proc-macro/nested-derive-cfg.stdout
@@ -0,0 +1,94 @@
+PRINT-DERIVE INPUT (DISPLAY): struct Foo
+{
+ my_array :
+ [bool ; { struct Inner { non_removed_inner_field : usize, } 0 }],
+}
+PRINT-DERIVE INPUT (DEBUG): TokenStream [
+ Ident {
+ ident: "struct",
+ span: $DIR/nested-derive-cfg.rs:12:1: 21:2 (#0),
+ },
+ Ident {
+ ident: "Foo",
+ span: $DIR/nested-derive-cfg.rs:12:1: 21:2 (#0),
+ },
+ Group {
+ delimiter: Brace,
+ stream: TokenStream [
+ Ident {
+ ident: "my_array",
+ span: $DIR/nested-derive-cfg.rs:12:1: 21:2 (#0),
+ },
+ Punct {
+ ch: ':',
+ spacing: Alone,
+ span: $DIR/nested-derive-cfg.rs:12:1: 21:2 (#0),
+ },
+ Group {
+ delimiter: Bracket,
+ stream: TokenStream [
+ Ident {
+ ident: "bool",
+ span: $DIR/nested-derive-cfg.rs:12:1: 21:2 (#0),
+ },
+ Punct {
+ ch: ';',
+ spacing: Alone,
+ span: $DIR/nested-derive-cfg.rs:12:1: 21:2 (#0),
+ },
+ Group {
+ delimiter: Brace,
+ stream: TokenStream [
+ Ident {
+ ident: "struct",
+ span: $DIR/nested-derive-cfg.rs:12:1: 21:2 (#0),
+ },
+ Ident {
+ ident: "Inner",
+ span: $DIR/nested-derive-cfg.rs:12:1: 21:2 (#0),
+ },
+ Group {
+ delimiter: Brace,
+ stream: TokenStream [
+ Ident {
+ ident: "non_removed_inner_field",
+ span: $DIR/nested-derive-cfg.rs:12:1: 21:2 (#0),
+ },
+ Punct {
+ ch: ':',
+ spacing: Alone,
+ span: $DIR/nested-derive-cfg.rs:12:1: 21:2 (#0),
+ },
+ Ident {
+ ident: "usize",
+ span: $DIR/nested-derive-cfg.rs:12:1: 21:2 (#0),
+ },
+ Punct {
+ ch: ',',
+ spacing: Alone,
+ span: $DIR/nested-derive-cfg.rs:12:1: 21:2 (#0),
+ },
+ ],
+ span: $DIR/nested-derive-cfg.rs:12:1: 21:2 (#0),
+ },
+ Literal {
+ kind: Integer,
+ symbol: "0",
+ suffix: None,
+ span: $DIR/nested-derive-cfg.rs:12:1: 21:2 (#0),
+ },
+ ],
+ span: $DIR/nested-derive-cfg.rs:12:1: 21:2 (#0),
+ },
+ ],
+ span: $DIR/nested-derive-cfg.rs:12:1: 21:2 (#0),
+ },
+ Punct {
+ ch: ',',
+ spacing: Alone,
+ span: $DIR/nested-derive-cfg.rs:12:1: 21:2 (#0),
+ },
+ ],
+ span: $DIR/nested-derive-cfg.rs:12:1: 21:2 (#0),
+ },
+]
diff --git a/src/test/ui/proc-macro/weird-braces.rs b/src/test/ui/proc-macro/weird-braces.rs
new file mode 100644
index 0000000..b9a7e08
--- /dev/null
+++ b/src/test/ui/proc-macro/weird-braces.rs
@@ -0,0 +1,23 @@
+// aux-build:test-macros.rs
+// check-pass
+// compile-flags: -Z span-debug
+
+#![feature(custom_inner_attributes)]
+
+#![no_std] // Don't load unnecessary hygiene information from std
+extern crate std;
+
+extern crate test_macros;
+use test_macros::{print_target_and_args};
+
+struct Foo<const V: bool>;
+trait Bar<const V: bool> {}
+
+#[print_target_and_args(first_outer)]
+#[print_target_and_args(second_outer)]
+impl Bar<{1 > 0}> for Foo<{true}> {
+ #![print_target_and_args(first_inner)]
+ #![print_target_and_args(second_inner)]
+}
+
+fn main() {}
diff --git a/src/test/ui/proc-macro/weird-braces.stdout b/src/test/ui/proc-macro/weird-braces.stdout
new file mode 100644
index 0000000..25f0eaf
--- /dev/null
+++ b/src/test/ui/proc-macro/weird-braces.stdout
@@ -0,0 +1,524 @@
+PRINT-ATTR_ARGS INPUT (DISPLAY): first_outer
+PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [
+ Ident {
+ ident: "first_outer",
+ span: $DIR/weird-braces.rs:16:25: 16:36 (#0),
+ },
+]
+PRINT-ATTR INPUT (DISPLAY): #[print_target_and_args(second_outer)] impl Bar < { 1 > 0 } > for Foo <
+{ true } >
+{
+ # ! [print_target_and_args(first_inner)] # !
+ [print_target_and_args(second_inner)]
+}
+PRINT-ATTR INPUT (DEBUG): TokenStream [
+ Punct {
+ ch: '#',
+ spacing: Alone,
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Group {
+ delimiter: Bracket,
+ stream: TokenStream [
+ Ident {
+ ident: "print_target_and_args",
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Group {
+ delimiter: Parenthesis,
+ stream: TokenStream [
+ Ident {
+ ident: "second_outer",
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ ],
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ ],
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Ident {
+ ident: "impl",
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Ident {
+ ident: "Bar",
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Punct {
+ ch: '<',
+ spacing: Alone,
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Group {
+ delimiter: Brace,
+ stream: TokenStream [
+ Literal {
+ kind: Integer,
+ symbol: "1",
+ suffix: None,
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Punct {
+ ch: '>',
+ spacing: Alone,
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Literal {
+ kind: Integer,
+ symbol: "0",
+ suffix: None,
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ ],
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Punct {
+ ch: '>',
+ spacing: Alone,
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Ident {
+ ident: "for",
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Ident {
+ ident: "Foo",
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Punct {
+ ch: '<',
+ spacing: Alone,
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Group {
+ delimiter: Brace,
+ stream: TokenStream [
+ Ident {
+ ident: "true",
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ ],
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Punct {
+ ch: '>',
+ spacing: Alone,
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Group {
+ delimiter: Brace,
+ stream: TokenStream [
+ Punct {
+ ch: '#',
+ spacing: Joint,
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Punct {
+ ch: '!',
+ spacing: Alone,
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Group {
+ delimiter: Bracket,
+ stream: TokenStream [
+ Ident {
+ ident: "print_target_and_args",
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Group {
+ delimiter: Parenthesis,
+ stream: TokenStream [
+ Ident {
+ ident: "first_inner",
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ ],
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ ],
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Punct {
+ ch: '#',
+ spacing: Joint,
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Punct {
+ ch: '!',
+ spacing: Alone,
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Group {
+ delimiter: Bracket,
+ stream: TokenStream [
+ Ident {
+ ident: "print_target_and_args",
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Group {
+ delimiter: Parenthesis,
+ stream: TokenStream [
+ Ident {
+ ident: "second_inner",
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ ],
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ ],
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ ],
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+]
+PRINT-ATTR_ARGS INPUT (DISPLAY): second_outer
+PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [
+ Ident {
+ ident: "second_outer",
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+]
+PRINT-ATTR INPUT (DISPLAY): impl Bar < { 1 > 0 } > for Foo < { true } >
+{
+ # ! [print_target_and_args(first_inner)] # !
+ [print_target_and_args(second_inner)]
+}
+PRINT-ATTR INPUT (DEBUG): TokenStream [
+ Ident {
+ ident: "impl",
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Ident {
+ ident: "Bar",
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Punct {
+ ch: '<',
+ spacing: Alone,
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Group {
+ delimiter: Brace,
+ stream: TokenStream [
+ Literal {
+ kind: Integer,
+ symbol: "1",
+ suffix: None,
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Punct {
+ ch: '>',
+ spacing: Alone,
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Literal {
+ kind: Integer,
+ symbol: "0",
+ suffix: None,
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ ],
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Punct {
+ ch: '>',
+ spacing: Alone,
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Ident {
+ ident: "for",
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Ident {
+ ident: "Foo",
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Punct {
+ ch: '<',
+ spacing: Alone,
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Group {
+ delimiter: Brace,
+ stream: TokenStream [
+ Ident {
+ ident: "true",
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ ],
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Punct {
+ ch: '>',
+ spacing: Alone,
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Group {
+ delimiter: Brace,
+ stream: TokenStream [
+ Punct {
+ ch: '#',
+ spacing: Joint,
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Punct {
+ ch: '!',
+ spacing: Alone,
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Group {
+ delimiter: Bracket,
+ stream: TokenStream [
+ Ident {
+ ident: "print_target_and_args",
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Group {
+ delimiter: Parenthesis,
+ stream: TokenStream [
+ Ident {
+ ident: "first_inner",
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ ],
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ ],
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Punct {
+ ch: '#',
+ spacing: Joint,
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Punct {
+ ch: '!',
+ spacing: Alone,
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Group {
+ delimiter: Bracket,
+ stream: TokenStream [
+ Ident {
+ ident: "print_target_and_args",
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Group {
+ delimiter: Parenthesis,
+ stream: TokenStream [
+ Ident {
+ ident: "second_inner",
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ ],
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ ],
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ ],
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+]
+PRINT-ATTR_ARGS INPUT (DISPLAY): first_inner
+PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [
+ Ident {
+ ident: "first_inner",
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+]
+PRINT-ATTR INPUT (DISPLAY): impl Bar < { 1 > 0 } > for Foo < { true } >
+{ # ! [print_target_and_args(second_inner)] }
+PRINT-ATTR INPUT (DEBUG): TokenStream [
+ Ident {
+ ident: "impl",
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Ident {
+ ident: "Bar",
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Punct {
+ ch: '<',
+ spacing: Alone,
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Group {
+ delimiter: Brace,
+ stream: TokenStream [
+ Literal {
+ kind: Integer,
+ symbol: "1",
+ suffix: None,
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Punct {
+ ch: '>',
+ spacing: Alone,
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Literal {
+ kind: Integer,
+ symbol: "0",
+ suffix: None,
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ ],
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Punct {
+ ch: '>',
+ spacing: Alone,
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Ident {
+ ident: "for",
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Ident {
+ ident: "Foo",
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Punct {
+ ch: '<',
+ spacing: Alone,
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Group {
+ delimiter: Brace,
+ stream: TokenStream [
+ Ident {
+ ident: "true",
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ ],
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Punct {
+ ch: '>',
+ spacing: Alone,
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Group {
+ delimiter: Brace,
+ stream: TokenStream [
+ Punct {
+ ch: '#',
+ spacing: Joint,
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Punct {
+ ch: '!',
+ spacing: Alone,
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Group {
+ delimiter: Bracket,
+ stream: TokenStream [
+ Ident {
+ ident: "print_target_and_args",
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Group {
+ delimiter: Parenthesis,
+ stream: TokenStream [
+ Ident {
+ ident: "second_inner",
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ ],
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ ],
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ ],
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+]
+PRINT-ATTR_ARGS INPUT (DISPLAY): second_inner
+PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [
+ Ident {
+ ident: "second_inner",
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+]
+PRINT-ATTR INPUT (DISPLAY): impl Bar < { 1 > 0 } > for Foo < { true } > { }
+PRINT-ATTR INPUT (DEBUG): TokenStream [
+ Ident {
+ ident: "impl",
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Ident {
+ ident: "Bar",
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Punct {
+ ch: '<',
+ spacing: Alone,
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Group {
+ delimiter: Brace,
+ stream: TokenStream [
+ Literal {
+ kind: Integer,
+ symbol: "1",
+ suffix: None,
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Punct {
+ ch: '>',
+ spacing: Alone,
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Literal {
+ kind: Integer,
+ symbol: "0",
+ suffix: None,
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ ],
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Punct {
+ ch: '>',
+ spacing: Alone,
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Ident {
+ ident: "for",
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Ident {
+ ident: "Foo",
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Punct {
+ ch: '<',
+ spacing: Alone,
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Group {
+ delimiter: Brace,
+ stream: TokenStream [
+ Ident {
+ ident: "true",
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ ],
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Punct {
+ ch: '>',
+ spacing: Alone,
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+ Group {
+ delimiter: Brace,
+ stream: TokenStream [],
+ span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
+ },
+]
diff --git a/src/tools/clippy/clippy_lints/src/entry.rs b/src/tools/clippy/clippy_lints/src/entry.rs
index 6b9f9a5..555759699 100644
--- a/src/tools/clippy/clippy_lints/src/entry.rs
+++ b/src/tools/clippy/clippy_lints/src/entry.rs
@@ -9,6 +9,7 @@
use rustc_middle::hir::map::Map;
use rustc_session::{declare_lint_pass, declare_tool_lint};
use rustc_span::source_map::Span;
+use rustc_span::sym;
declare_clippy_lint! {
/// **What it does:** Checks for uses of `contains_key` + `insert` on `HashMap`
@@ -111,7 +112,7 @@ fn check_cond<'a>(cx: &LateContext<'_>, check: &'a Expr<'a>) -> Option<(&'static
return if match_type(cx, obj_ty, &paths::BTREEMAP) {
Some(("BTreeMap", map, key))
}
- else if is_type_diagnostic_item(cx, obj_ty, sym!(hashmap_type)) {
+ else if is_type_diagnostic_item(cx, obj_ty, sym::hashmap_type) {
Some(("HashMap", map, key))
}
else {
diff --git a/src/tools/clippy/clippy_lints/src/loops.rs b/src/tools/clippy/clippy_lints/src/loops.rs
index 1c9373a..63d9b7f 100644
--- a/src/tools/clippy/clippy_lints/src/loops.rs
+++ b/src/tools/clippy/clippy_lints/src/loops.rs
@@ -1010,7 +1010,7 @@ fn is_slice_like<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'_>) -> bool {
_ => false,
};
- is_slice || is_type_diagnostic_item(cx, ty, sym::vec_type) || is_type_diagnostic_item(cx, ty, sym!(vecdeque_type))
+ is_slice || is_type_diagnostic_item(cx, ty, sym::vec_type) || is_type_diagnostic_item(cx, ty, sym::vecdeque_type)
}
fn fetch_cloned_expr<'tcx>(expr: &'tcx Expr<'tcx>) -> &'tcx Expr<'tcx> {
@@ -1908,7 +1908,7 @@ fn check_for_loop_over_map_kv<'tcx>(
_ => arg,
};
- if is_type_diagnostic_item(cx, ty, sym!(hashmap_type)) || match_type(cx, ty, &paths::BTREEMAP) {
+ if is_type_diagnostic_item(cx, ty, sym::hashmap_type) || match_type(cx, ty, &paths::BTREEMAP) {
span_lint_and_then(
cx,
FOR_KV_MAP,
@@ -2386,9 +2386,9 @@ fn is_ref_iterable_type(cx: &LateContext<'_>, e: &Expr<'_>) -> bool {
is_iterable_array(ty, cx) ||
is_type_diagnostic_item(cx, ty, sym::vec_type) ||
match_type(cx, ty, &paths::LINKED_LIST) ||
- is_type_diagnostic_item(cx, ty, sym!(hashmap_type)) ||
- is_type_diagnostic_item(cx, ty, sym!(hashset_type)) ||
- is_type_diagnostic_item(cx, ty, sym!(vecdeque_type)) ||
+ is_type_diagnostic_item(cx, ty, sym::hashmap_type) ||
+ is_type_diagnostic_item(cx, ty, sym::hashset_type) ||
+ is_type_diagnostic_item(cx, ty, sym::vecdeque_type) ||
match_type(cx, ty, &paths::BINARY_HEAP) ||
match_type(cx, ty, &paths::BTREEMAP) ||
match_type(cx, ty, &paths::BTREESET)
@@ -2922,9 +2922,9 @@ fn check_needless_collect_direct_usage<'tcx>(expr: &'tcx Expr<'_>, cx: &LateCont
then {
let ty = cx.typeck_results().node_type(ty.hir_id);
if is_type_diagnostic_item(cx, ty, sym::vec_type) ||
- is_type_diagnostic_item(cx, ty, sym!(vecdeque_type)) ||
+ is_type_diagnostic_item(cx, ty, sym::vecdeque_type) ||
match_type(cx, ty, &paths::BTREEMAP) ||
- is_type_diagnostic_item(cx, ty, sym!(hashmap_type)) {
+ is_type_diagnostic_item(cx, ty, sym::hashmap_type) {
if method.ident.name == sym!(len) {
let span = shorten_needless_collect_span(expr);
span_lint_and_sugg(
@@ -2992,7 +2992,7 @@ fn check_needless_collect_indirect_usage<'tcx>(expr: &'tcx Expr<'_>, cx: &LateCo
if let Some(GenericArg::Type(ref ty)) = generic_args.args.get(0);
if let ty = cx.typeck_results().node_type(ty.hir_id);
if is_type_diagnostic_item(cx, ty, sym::vec_type) ||
- is_type_diagnostic_item(cx, ty, sym!(vecdeque_type)) ||
+ is_type_diagnostic_item(cx, ty, sym::vecdeque_type) ||
match_type(cx, ty, &paths::LINKED_LIST);
if let Some(iter_calls) = detect_iter_and_into_iters(block, *ident);
if iter_calls.len() == 1;
diff --git a/src/tools/clippy/clippy_lints/src/methods/mod.rs b/src/tools/clippy/clippy_lints/src/methods/mod.rs
index ebd8af9..5163074 100644
--- a/src/tools/clippy/clippy_lints/src/methods/mod.rs
+++ b/src/tools/clippy/clippy_lints/src/methods/mod.rs
@@ -24,7 +24,7 @@
use rustc_semver::RustcVersion;
use rustc_session::{declare_tool_lint, impl_lint_pass};
use rustc_span::source_map::Span;
-use rustc_span::symbol::{sym, SymbolStr};
+use rustc_span::symbol::{sym, Symbol, SymbolStr};
use rustc_typeck::hir_ty_to_ty;
use crate::consts::{constant, Constant};
@@ -2598,7 +2598,7 @@ fn lint_iter_nth<'tcx>(
"slice"
} else if is_type_diagnostic_item(cx, cx.typeck_results().expr_ty(&iter_args[0]), sym::vec_type) {
"Vec"
- } else if is_type_diagnostic_item(cx, cx.typeck_results().expr_ty(&iter_args[0]), sym!(vecdeque_type)) {
+ } else if is_type_diagnostic_item(cx, cx.typeck_results().expr_ty(&iter_args[0]), sym::vecdeque_type) {
"VecDeque"
} else {
let nth_args = nth_and_iter_args[0];
@@ -2652,10 +2652,10 @@ fn lint_get_unwrap<'tcx>(cx: &LateContext<'tcx>, expr: &hir::Expr<'_>, get_args:
} else if is_type_diagnostic_item(cx, expr_ty, sym::vec_type) {
needs_ref = get_args_str.parse::<usize>().is_ok();
"Vec"
- } else if is_type_diagnostic_item(cx, expr_ty, sym!(vecdeque_type)) {
+ } else if is_type_diagnostic_item(cx, expr_ty, sym::vecdeque_type) {
needs_ref = get_args_str.parse::<usize>().is_ok();
"VecDeque"
- } else if !is_mut && is_type_diagnostic_item(cx, expr_ty, sym!(hashmap_type)) {
+ } else if !is_mut && is_type_diagnostic_item(cx, expr_ty, sym::hashmap_type) {
needs_ref = true;
"HashMap"
} else if !is_mut && match_type(cx, expr_ty, &paths::BTREEMAP) {
@@ -3619,7 +3619,7 @@ fn lint_asref(cx: &LateContext<'_>, expr: &hir::Expr<'_>, call_name: &str, as_re
}
}
-fn ty_has_iter_method(cx: &LateContext<'_>, self_ref_ty: Ty<'_>) -> Option<(&'static str, &'static str)> {
+fn ty_has_iter_method(cx: &LateContext<'_>, self_ref_ty: Ty<'_>) -> Option<(Symbol, &'static str)> {
has_iter_method(cx, self_ref_ty).map(|ty_name| {
let mutbl = match self_ref_ty.kind() {
ty::Ref(_, _, mutbl) => mutbl,
diff --git a/src/tools/clippy/clippy_lints/src/swap.rs b/src/tools/clippy/clippy_lints/src/swap.rs
index 699fd51..9d8a0c2 100644
--- a/src/tools/clippy/clippy_lints/src/swap.rs
+++ b/src/tools/clippy/clippy_lints/src/swap.rs
@@ -199,7 +199,7 @@ fn check_for_slice<'a>(cx: &LateContext<'_>, lhs1: &'a Expr<'_>, lhs2: &'a Expr<
if matches!(ty.kind(), ty::Slice(_))
|| matches!(ty.kind(), ty::Array(_, _))
|| is_type_diagnostic_item(cx, ty, sym::vec_type)
- || is_type_diagnostic_item(cx, ty, sym!(vecdeque_type))
+ || is_type_diagnostic_item(cx, ty, sym::vecdeque_type)
{
return Slice::Swappable(lhs1, idx1, idx2);
}
diff --git a/src/tools/clippy/clippy_lints/src/types.rs b/src/tools/clippy/clippy_lints/src/types.rs
index 0575450..eb2016d 100644
--- a/src/tools/clippy/clippy_lints/src/types.rs
+++ b/src/tools/clippy/clippy_lints/src/types.rs
@@ -2680,14 +2680,14 @@ fn new(cx: &LateContext<'tcx>, hir_ty: &hir::Ty<'_>) -> Option<Self> {
let ty = hir_ty_to_ty(cx.tcx, hir_ty);
- if is_type_diagnostic_item(cx, ty, sym!(hashmap_type)) && params_len == 2 {
+ if is_type_diagnostic_item(cx, ty, sym::hashmap_type) && params_len == 2 {
Some(ImplicitHasherType::HashMap(
hir_ty.span,
ty,
snippet(cx, params[0].span, "K"),
snippet(cx, params[1].span, "V"),
))
- } else if is_type_diagnostic_item(cx, ty, sym!(hashset_type)) && params_len == 1 {
+ } else if is_type_diagnostic_item(cx, ty, sym::hashset_type) && params_len == 1 {
Some(ImplicitHasherType::HashSet(
hir_ty.span,
ty,
diff --git a/src/tools/clippy/clippy_lints/src/zero_sized_map_values.rs b/src/tools/clippy/clippy_lints/src/zero_sized_map_values.rs
index 319b85a..316b8d8 100644
--- a/src/tools/clippy/clippy_lints/src/zero_sized_map_values.rs
+++ b/src/tools/clippy/clippy_lints/src/zero_sized_map_values.rs
@@ -5,6 +5,7 @@
use rustc_session::{declare_lint_pass, declare_tool_lint};
use rustc_target::abi::LayoutOf as _;
use rustc_typeck::hir_ty_to_ty;
+use rustc_span::sym;
use crate::utils::{is_normalizable, is_type_diagnostic_item, match_type, paths, span_lint_and_help};
@@ -47,7 +48,7 @@ fn check_ty(&mut self, cx: &LateContext<'_>, hir_ty: &hir::Ty<'_>) {
if !hir_ty.span.from_expansion();
if !in_trait_impl(cx, hir_ty.hir_id);
let ty = ty_from_hir_ty(cx, hir_ty);
- if is_type_diagnostic_item(cx, ty, sym!(hashmap_type)) || match_type(cx, ty, &paths::BTREEMAP);
+ if is_type_diagnostic_item(cx, ty, sym::hashmap_type) || match_type(cx, ty, &paths::BTREEMAP);
if let Adt(_, ref substs) = ty.kind();
let ty = substs.type_at(1);
// Do this to prevent `layout_of` crashing, being unable to fully normalize `ty`.
diff --git a/src/tools/clippy/clippy_utils/src/eager_or_lazy.rs b/src/tools/clippy/clippy_utils/src/eager_or_lazy.rs
index 52a33e9b..81cd99c 100644
--- a/src/tools/clippy/clippy_utils/src/eager_or_lazy.rs
+++ b/src/tools/clippy/clippy_utils/src/eager_or_lazy.rs
@@ -18,6 +18,7 @@
use rustc_hir::{Block, Expr, ExprKind, Path, QPath};
use rustc_lint::LateContext;
use rustc_middle::hir::map::Map;
+use rustc_span::sym;
/// Is the expr pure (is it free from side-effects)?
/// This function is named so to stress that it isn't exhaustive and returns FNs.
@@ -99,7 +100,7 @@ fn visit_expr(&mut self, expr: &'tcx Expr<'tcx>) {
ExprKind::Call(..) => !is_ctor_or_promotable_const_function(self.cx, expr),
ExprKind::Index(obj, _) => {
let ty = self.cx.typeck_results().expr_ty(obj);
- is_type_diagnostic_item(self.cx, ty, sym!(hashmap_type))
+ is_type_diagnostic_item(self.cx, ty, sym::hashmap_type)
|| match_type(self.cx, ty, &paths::BTREEMAP)
},
ExprKind::MethodCall(..) => true,
diff --git a/src/tools/clippy/clippy_utils/src/lib.rs b/src/tools/clippy/clippy_utils/src/lib.rs
index 94b7339..42512cad 100644
--- a/src/tools/clippy/clippy_utils/src/lib.rs
+++ b/src/tools/clippy/clippy_utils/src/lib.rs
@@ -1295,24 +1295,24 @@ pub fn any_parent_is_automatically_derived(tcx: TyCtxt<'_>, node: HirId) -> bool
}
/// Returns true if ty has `iter` or `iter_mut` methods
-pub fn has_iter_method(cx: &LateContext<'_>, probably_ref_ty: Ty<'_>) -> Option<&'static str> {
+pub fn has_iter_method(cx: &LateContext<'_>, probably_ref_ty: Ty<'_>) -> Option<Symbol> {
// FIXME: instead of this hard-coded list, we should check if `<adt>::iter`
// exists and has the desired signature. Unfortunately FnCtxt is not exported
// so we can't use its `lookup_method` method.
- let into_iter_collections: [&[&str]; 13] = [
- &paths::VEC,
- &paths::OPTION,
- &paths::RESULT,
- &paths::BTREESET,
- &paths::BTREEMAP,
- &paths::VEC_DEQUE,
- &paths::LINKED_LIST,
- &paths::BINARY_HEAP,
- &paths::HASHSET,
- &paths::HASHMAP,
- &paths::PATH_BUF,
- &paths::PATH,
- &paths::RECEIVER,
+ let into_iter_collections: &[Symbol] = &[
+ sym::vec_type,
+ sym::option_type,
+ sym::result_type,
+ sym::BTreeMap,
+ sym::BTreeSet,
+ sym::vecdeque_type,
+ sym::LinkedList,
+ sym::BinaryHeap,
+ sym::hashset_type,
+ sym::hashmap_type,
+ sym::PathBuf,
+ sym::Path,
+ sym::Receiver,
];
let ty_to_check = match probably_ref_ty.kind() {
@@ -1321,15 +1321,15 @@ pub fn has_iter_method(cx: &LateContext<'_>, probably_ref_ty: Ty<'_>) -> Option<
};
let def_id = match ty_to_check.kind() {
- ty::Array(..) => return Some("array"),
- ty::Slice(..) => return Some("slice"),
+ ty::Array(..) => return Some(sym::array),
+ ty::Slice(..) => return Some(sym::slice),
ty::Adt(adt, _) => adt.did,
_ => return None,
};
- for path in &into_iter_collections {
- if match_def_path(cx, def_id, path) {
- return Some(*path.last().unwrap());
+ for &name in into_iter_collections {
+ if cx.tcx.is_diagnostic_item(name, def_id) {
+ return Some(cx.tcx.item_name(def_id));
}
}
None
diff --git a/src/tools/clippy/clippy_utils/src/paths.rs b/src/tools/clippy/clippy_utils/src/paths.rs
index e617867..c2da1f9 100644
--- a/src/tools/clippy/clippy_utils/src/paths.rs
+++ b/src/tools/clippy/clippy_utils/src/paths.rs
@@ -99,7 +99,6 @@
pub const PARKING_LOT_MUTEX_GUARD: [&str; 2] = ["parking_lot", "MutexGuard"];
pub const PARKING_LOT_RWLOCK_READ_GUARD: [&str; 2] = ["parking_lot", "RwLockReadGuard"];
pub const PARKING_LOT_RWLOCK_WRITE_GUARD: [&str; 2] = ["parking_lot", "RwLockWriteGuard"];
-pub const PATH: [&str; 3] = ["std", "path", "Path"];
pub const PATH_BUF: [&str; 3] = ["std", "path", "PathBuf"];
pub const PATH_BUF_AS_PATH: [&str; 4] = ["std", "path", "PathBuf", "as_path"];
pub const PATH_TO_PATH_BUF: [&str; 4] = ["std", "path", "Path", "to_path_buf"];
@@ -116,7 +115,6 @@
pub const RANGE_ARGUMENT_TRAIT: [&str; 3] = ["core", "ops", "RangeBounds"];
pub const RC: [&str; 3] = ["alloc", "rc", "Rc"];
pub const RC_PTR_EQ: [&str; 4] = ["alloc", "rc", "Rc", "ptr_eq"];
-pub const RECEIVER: [&str; 4] = ["std", "sync", "mpsc", "Receiver"];
pub const REFCELL_REF: [&str; 3] = ["core", "cell", "Ref"];
pub const REFCELL_REFMUT: [&str; 3] = ["core", "cell", "RefMut"];
pub const REGEX_BUILDER_NEW: [&str; 5] = ["regex", "re_builder", "unicode", "RegexBuilder", "new"];
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index 61b21bc..723c7f8 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -1957,6 +1957,7 @@ fn make_compile_args(
}
MirOpt => {
rustc.args(&[
+ "-Copt-level=1",
"-Zdump-mir=all",
"-Zmir-opt-level=3",
"-Zvalidate-mir",
diff --git a/src/tools/tidy/Cargo.toml b/src/tools/tidy/Cargo.toml
index ccdb452..777d7be 100644
--- a/src/tools/tidy/Cargo.toml
+++ b/src/tools/tidy/Cargo.toml
@@ -3,9 +3,14 @@
version = "0.1.0"
authors = ["Alex Crichton <alex@alexcrichton.com>"]
edition = "2018"
+autobins = false
[dependencies]
cargo_metadata = "0.11"
regex = "1"
lazy_static = "1"
walkdir = "2"
+
+[[bin]]
+name = "rust-tidy"
+path = "src/main.rs"