- name: decide whether to skip this job
run: src/ci/scripts/should-skip-this.sh
if: success() && !env.SKIP_JOB
+ - name: ensure the channel matches the target branch
+ run: src/ci/scripts/verify-channel.sh
+ if: success() && !env.SKIP_JOB
- name: configure GitHub Actions to kill the build when outdated
uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
with:
- name: decide whether to skip this job
run: src/ci/scripts/should-skip-this.sh
if: success() && !env.SKIP_JOB
+ - name: ensure the channel matches the target branch
+ run: src/ci/scripts/verify-channel.sh
+ if: success() && !env.SKIP_JOB
- name: configure GitHub Actions to kill the build when outdated
uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
with:
- name: decide whether to skip this job
run: src/ci/scripts/should-skip-this.sh
if: success() && !env.SKIP_JOB
+ - name: ensure the channel matches the target branch
+ run: src/ci/scripts/verify-channel.sh
+ if: success() && !env.SKIP_JOB
- name: configure GitHub Actions to kill the build when outdated
uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
with:
[[package]]
name = "cc"
-version = "1.0.60"
+version = "1.0.67"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ef611cc68ff783f18535d77ddd080185275713d852c4f5cbb6122c462a7a825c"
+checksum = "e3c69b077ad434294d3ce9f1f6143a2a4b89a8a2d54ef813d85003a4fd1137fd"
dependencies = [
"jobserver",
]
[[package]]
name = "compiler_builtins"
-version = "0.1.39"
+version = "0.1.43"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3748f82c7d366a0b4950257d19db685d4958d2fa27c6d164a3f069fec42b748b"
+checksum = "65af2dcae4779003dfa91aedc6ade7bdc7ba685944e50a8b4f9380df376a4466"
dependencies = [
"cc",
"rustc-std-workspace-core",
"itertools 0.9.0",
"jobserver",
"libc",
+ "object",
"pathdiff",
"rustc_apfloat",
"rustc_ast",
.cloned()
.map(|input| AngleBracketedArg::Arg(GenericArg::Type(input)))
.collect();
- AngleBracketedArgs { span: self.span, args }
+ AngleBracketedArgs { span: self.inputs_span, args }
}
}
pub items: Vec<P<ForeignItem>>,
}
-/// Global inline assembly.
-///
-/// Also known as "module-level assembly" or "file-scoped assembly".
-#[derive(Clone, Encodable, Decodable, Debug, Copy)]
-pub struct GlobalAsm {
- pub asm: Symbol,
-}
-
#[derive(Clone, Encodable, Decodable, Debug)]
pub struct EnumDef {
pub variants: Vec<Variant>,
/// E.g., `extern {}` or `extern "C" {}`.
ForeignMod(ForeignMod),
/// Module-level inline assembly (from `global_asm!()`).
- GlobalAsm(GlobalAsm),
+ GlobalAsm(InlineAsm),
/// A type alias (`type`).
///
/// E.g., `type Foo = Bar<u8>;`.
ModKind::Unloaded => {}
},
ItemKind::ForeignMod(nm) => vis.visit_foreign_mod(nm),
- ItemKind::GlobalAsm(_ga) => {}
+ ItemKind::GlobalAsm(asm) => noop_visit_inline_asm(asm, vis),
ItemKind::TyAlias(box TyAliasKind(_, generics, bounds, ty)) => {
vis.visit_generics(generics);
visit_bounds(bounds, vis);
vis.visit_expr(value);
}
+fn noop_visit_inline_asm<T: MutVisitor>(asm: &mut InlineAsm, vis: &mut T) {
+ for (op, _) in &mut asm.operands {
+ match op {
+ InlineAsmOperand::In { expr, .. }
+ | InlineAsmOperand::InOut { expr, .. }
+ | InlineAsmOperand::Sym { expr, .. } => vis.visit_expr(expr),
+ InlineAsmOperand::Out { expr, .. } => {
+ if let Some(expr) = expr {
+ vis.visit_expr(expr);
+ }
+ }
+ InlineAsmOperand::SplitInOut { in_expr, out_expr, .. } => {
+ vis.visit_expr(in_expr);
+ if let Some(out_expr) = out_expr {
+ vis.visit_expr(out_expr);
+ }
+ }
+ InlineAsmOperand::Const { anon_const, .. } => vis.visit_anon_const(anon_const),
+ }
+ }
+}
+
pub fn noop_visit_expr<T: MutVisitor>(
Expr { kind, id, span, attrs, tokens }: &mut Expr,
vis: &mut T,
ExprKind::Ret(expr) => {
visit_opt(expr, |expr| vis.visit_expr(expr));
}
- ExprKind::InlineAsm(asm) => {
- for (op, _) in &mut asm.operands {
- match op {
- InlineAsmOperand::In { expr, .. }
- | InlineAsmOperand::InOut { expr, .. }
- | InlineAsmOperand::Sym { expr, .. } => vis.visit_expr(expr),
- InlineAsmOperand::Out { expr, .. } => {
- if let Some(expr) = expr {
- vis.visit_expr(expr);
- }
- }
- InlineAsmOperand::SplitInOut { in_expr, out_expr, .. } => {
- vis.visit_expr(in_expr);
- if let Some(out_expr) = out_expr {
- vis.visit_expr(out_expr);
- }
- }
- InlineAsmOperand::Const { anon_const, .. } => vis.visit_anon_const(anon_const),
- }
- }
- }
+ ExprKind::InlineAsm(asm) => noop_visit_inline_asm(asm, vis),
ExprKind::LlvmInlineAsm(asm) => {
let LlvmInlineAsm {
asm: _,
fn visit_foreign_item(&mut self, i: &'ast ForeignItem) {
walk_foreign_item(self, i)
}
- fn visit_global_asm(&mut self, ga: &'ast GlobalAsm) {
- walk_global_asm(self, ga)
- }
fn visit_item(&mut self, i: &'ast Item) {
walk_item(self, i)
}
ItemKind::ForeignMod(ref foreign_module) => {
walk_list!(visitor, visit_foreign_item, &foreign_module.items);
}
- ItemKind::GlobalAsm(ref ga) => visitor.visit_global_asm(ga),
+ ItemKind::GlobalAsm(ref asm) => walk_inline_asm(visitor, asm),
ItemKind::TyAlias(box TyAliasKind(_, ref generics, ref bounds, ref ty)) => {
visitor.visit_generics(generics);
walk_list!(visitor, visit_param_bound, bounds);
}
}
-pub fn walk_global_asm<'a, V: Visitor<'a>>(_: &mut V, _: &'a GlobalAsm) {
- // Empty!
-}
-
pub fn walk_param_bound<'a, V: Visitor<'a>>(visitor: &mut V, bound: &'a GenericBound) {
match *bound {
GenericBound::Trait(ref typ, ref modifier) => visitor.visit_poly_trait_ref(typ, modifier),
visitor.visit_expr(&constant.value);
}
+fn walk_inline_asm<'a, V: Visitor<'a>>(visitor: &mut V, asm: &'a InlineAsm) {
+ for (op, _) in &asm.operands {
+ match op {
+ InlineAsmOperand::In { expr, .. }
+ | InlineAsmOperand::InOut { expr, .. }
+ | InlineAsmOperand::Sym { expr, .. } => visitor.visit_expr(expr),
+ InlineAsmOperand::Out { expr, .. } => {
+ if let Some(expr) = expr {
+ visitor.visit_expr(expr);
+ }
+ }
+ InlineAsmOperand::SplitInOut { in_expr, out_expr, .. } => {
+ visitor.visit_expr(in_expr);
+ if let Some(out_expr) = out_expr {
+ visitor.visit_expr(out_expr);
+ }
+ }
+ InlineAsmOperand::Const { anon_const, .. } => visitor.visit_anon_const(anon_const),
+ }
+ }
+}
+
pub fn walk_expr<'a, V: Visitor<'a>>(visitor: &mut V, expression: &'a Expr) {
walk_list!(visitor, visit_attribute, expression.attrs.iter());
}
ExprKind::MacCall(ref mac) => visitor.visit_mac_call(mac),
ExprKind::Paren(ref subexpression) => visitor.visit_expr(subexpression),
- ExprKind::InlineAsm(ref ia) => {
- for (op, _) in &ia.operands {
- match op {
- InlineAsmOperand::In { expr, .. }
- | InlineAsmOperand::InOut { expr, .. }
- | InlineAsmOperand::Sym { expr, .. } => visitor.visit_expr(expr),
- InlineAsmOperand::Out { expr, .. } => {
- if let Some(expr) = expr {
- visitor.visit_expr(expr);
- }
- }
- InlineAsmOperand::SplitInOut { in_expr, out_expr, .. } => {
- visitor.visit_expr(in_expr);
- if let Some(out_expr) = out_expr {
- visitor.visit_expr(out_expr);
- }
- }
- InlineAsmOperand::Const { anon_const, .. } => {
- visitor.visit_anon_const(anon_const)
- }
- }
- }
- }
+ ExprKind::InlineAsm(ref asm) => walk_inline_asm(visitor, asm),
ExprKind::LlvmInlineAsm(ref ia) => {
for &(_, ref input) in &ia.inputs {
visitor.visit_expr(input)
--- /dev/null
+use super::LoweringContext;
+
+use rustc_ast::*;
+use rustc_data_structures::fx::FxHashMap;
+use rustc_errors::struct_span_err;
+use rustc_hir as hir;
+use rustc_span::{Span, Symbol};
+use rustc_target::asm;
+use std::collections::hash_map::Entry;
+use std::fmt::Write;
+
+impl<'a, 'hir> LoweringContext<'a, 'hir> {
+ crate fn lower_inline_asm(&mut self, sp: Span, asm: &InlineAsm) -> &'hir hir::InlineAsm<'hir> {
+ // Rustdoc needs to support asm! from foriegn architectures: don't try
+ // lowering the register contraints in this case.
+ let asm_arch = if self.sess.opts.actually_rustdoc { None } else { self.sess.asm_arch };
+ if asm_arch.is_none() && !self.sess.opts.actually_rustdoc {
+ struct_span_err!(self.sess, sp, E0472, "inline assembly is unsupported on this target")
+ .emit();
+ }
+ if asm.options.contains(InlineAsmOptions::ATT_SYNTAX)
+ && !matches!(asm_arch, Some(asm::InlineAsmArch::X86 | asm::InlineAsmArch::X86_64))
+ && !self.sess.opts.actually_rustdoc
+ {
+ self.sess
+ .struct_span_err(sp, "the `att_syntax` option is only supported on x86")
+ .emit();
+ }
+
+ // Lower operands to HIR. We use dummy register classes if an error
+ // occurs during lowering because we still need to be able to produce a
+ // valid HIR.
+ let sess = self.sess;
+ let operands: Vec<_> = asm
+ .operands
+ .iter()
+ .map(|(op, op_sp)| {
+ let lower_reg = |reg| match reg {
+ InlineAsmRegOrRegClass::Reg(s) => {
+ asm::InlineAsmRegOrRegClass::Reg(if let Some(asm_arch) = asm_arch {
+ asm::InlineAsmReg::parse(
+ asm_arch,
+ |feature| sess.target_features.contains(&Symbol::intern(feature)),
+ &sess.target,
+ s,
+ )
+ .unwrap_or_else(|e| {
+ let msg = format!("invalid register `{}`: {}", s.as_str(), e);
+ sess.struct_span_err(*op_sp, &msg).emit();
+ asm::InlineAsmReg::Err
+ })
+ } else {
+ asm::InlineAsmReg::Err
+ })
+ }
+ InlineAsmRegOrRegClass::RegClass(s) => {
+ asm::InlineAsmRegOrRegClass::RegClass(if let Some(asm_arch) = asm_arch {
+ asm::InlineAsmRegClass::parse(asm_arch, s).unwrap_or_else(|e| {
+ let msg = format!("invalid register class `{}`: {}", s.as_str(), e);
+ sess.struct_span_err(*op_sp, &msg).emit();
+ asm::InlineAsmRegClass::Err
+ })
+ } else {
+ asm::InlineAsmRegClass::Err
+ })
+ }
+ };
+
+ let op = match *op {
+ InlineAsmOperand::In { reg, ref expr } => hir::InlineAsmOperand::In {
+ reg: lower_reg(reg),
+ expr: self.lower_expr_mut(expr),
+ },
+ InlineAsmOperand::Out { reg, late, ref expr } => hir::InlineAsmOperand::Out {
+ reg: lower_reg(reg),
+ late,
+ expr: expr.as_ref().map(|expr| self.lower_expr_mut(expr)),
+ },
+ InlineAsmOperand::InOut { reg, late, ref expr } => {
+ hir::InlineAsmOperand::InOut {
+ reg: lower_reg(reg),
+ late,
+ expr: self.lower_expr_mut(expr),
+ }
+ }
+ InlineAsmOperand::SplitInOut { reg, late, ref in_expr, ref out_expr } => {
+ hir::InlineAsmOperand::SplitInOut {
+ reg: lower_reg(reg),
+ late,
+ in_expr: self.lower_expr_mut(in_expr),
+ out_expr: out_expr.as_ref().map(|expr| self.lower_expr_mut(expr)),
+ }
+ }
+ InlineAsmOperand::Const { ref anon_const } => hir::InlineAsmOperand::Const {
+ anon_const: self.lower_anon_const(anon_const),
+ },
+ InlineAsmOperand::Sym { ref expr } => {
+ hir::InlineAsmOperand::Sym { expr: self.lower_expr_mut(expr) }
+ }
+ };
+ (op, *op_sp)
+ })
+ .collect();
+
+ // Validate template modifiers against the register classes for the operands
+ for p in &asm.template {
+ if let InlineAsmTemplatePiece::Placeholder {
+ operand_idx,
+ modifier: Some(modifier),
+ span: placeholder_span,
+ } = *p
+ {
+ let op_sp = asm.operands[operand_idx].1;
+ match &operands[operand_idx].0 {
+ hir::InlineAsmOperand::In { reg, .. }
+ | hir::InlineAsmOperand::Out { reg, .. }
+ | hir::InlineAsmOperand::InOut { reg, .. }
+ | hir::InlineAsmOperand::SplitInOut { reg, .. } => {
+ let class = reg.reg_class();
+ if class == asm::InlineAsmRegClass::Err {
+ continue;
+ }
+ let valid_modifiers = class.valid_modifiers(asm_arch.unwrap());
+ if !valid_modifiers.contains(&modifier) {
+ let mut err = sess.struct_span_err(
+ placeholder_span,
+ "invalid asm template modifier for this register class",
+ );
+ err.span_label(placeholder_span, "template modifier");
+ err.span_label(op_sp, "argument");
+ if !valid_modifiers.is_empty() {
+ let mut mods = format!("`{}`", valid_modifiers[0]);
+ for m in &valid_modifiers[1..] {
+ let _ = write!(mods, ", `{}`", m);
+ }
+ err.note(&format!(
+ "the `{}` register class supports \
+ the following template modifiers: {}",
+ class.name(),
+ mods
+ ));
+ } else {
+ err.note(&format!(
+ "the `{}` register class does not support template modifiers",
+ class.name()
+ ));
+ }
+ err.emit();
+ }
+ }
+ hir::InlineAsmOperand::Const { .. } => {
+ let mut err = sess.struct_span_err(
+ placeholder_span,
+ "asm template modifiers are not allowed for `const` arguments",
+ );
+ err.span_label(placeholder_span, "template modifier");
+ err.span_label(op_sp, "argument");
+ err.emit();
+ }
+ hir::InlineAsmOperand::Sym { .. } => {
+ let mut err = sess.struct_span_err(
+ placeholder_span,
+ "asm template modifiers are not allowed for `sym` arguments",
+ );
+ err.span_label(placeholder_span, "template modifier");
+ err.span_label(op_sp, "argument");
+ err.emit();
+ }
+ }
+ }
+ }
+
+ let mut used_input_regs = FxHashMap::default();
+ let mut used_output_regs = FxHashMap::default();
+ let mut required_features: Vec<&str> = vec![];
+ for (idx, &(ref op, op_sp)) in operands.iter().enumerate() {
+ if let Some(reg) = op.reg() {
+ // Make sure we don't accidentally carry features from the
+ // previous iteration.
+ required_features.clear();
+
+ let reg_class = reg.reg_class();
+ if reg_class == asm::InlineAsmRegClass::Err {
+ continue;
+ }
+
+ // We ignore target feature requirements for clobbers: if the
+ // feature is disabled then the compiler doesn't care what we
+ // do with the registers.
+ //
+ // Note that this is only possible for explicit register
+ // operands, which cannot be used in the asm string.
+ let is_clobber = matches!(
+ op,
+ hir::InlineAsmOperand::Out {
+ reg: asm::InlineAsmRegOrRegClass::Reg(_),
+ late: _,
+ expr: None
+ }
+ );
+
+ if !is_clobber {
+ // Validate register classes against currently enabled target
+ // features. We check that at least one type is available for
+ // the current target.
+ for &(_, feature) in reg_class.supported_types(asm_arch.unwrap()) {
+ if let Some(feature) = feature {
+ if self.sess.target_features.contains(&Symbol::intern(feature)) {
+ required_features.clear();
+ break;
+ } else {
+ required_features.push(feature);
+ }
+ } else {
+ required_features.clear();
+ break;
+ }
+ }
+ // We are sorting primitive strs here and can use unstable sort here
+ required_features.sort_unstable();
+ required_features.dedup();
+ match &required_features[..] {
+ [] => {}
+ [feature] => {
+ let msg = format!(
+ "register class `{}` requires the `{}` target feature",
+ reg_class.name(),
+ feature
+ );
+ sess.struct_span_err(op_sp, &msg).emit();
+ }
+ features => {
+ let msg = format!(
+ "register class `{}` requires at least one target feature: {}",
+ reg_class.name(),
+ features.join(", ")
+ );
+ sess.struct_span_err(op_sp, &msg).emit();
+ }
+ }
+ }
+
+ // Check for conflicts between explicit register operands.
+ if let asm::InlineAsmRegOrRegClass::Reg(reg) = reg {
+ let (input, output) = match op {
+ hir::InlineAsmOperand::In { .. } => (true, false),
+
+ // Late output do not conflict with inputs, but normal outputs do
+ hir::InlineAsmOperand::Out { late, .. } => (!late, true),
+
+ hir::InlineAsmOperand::InOut { .. }
+ | hir::InlineAsmOperand::SplitInOut { .. } => (true, true),
+
+ hir::InlineAsmOperand::Const { .. } | hir::InlineAsmOperand::Sym { .. } => {
+ unreachable!()
+ }
+ };
+
+ // Flag to output the error only once per operand
+ let mut skip = false;
+ reg.overlapping_regs(|r| {
+ let mut check = |used_regs: &mut FxHashMap<asm::InlineAsmReg, usize>,
+ input| {
+ match used_regs.entry(r) {
+ Entry::Occupied(o) => {
+ if skip {
+ return;
+ }
+ skip = true;
+
+ let idx2 = *o.get();
+ let &(ref op2, op_sp2) = &operands[idx2];
+ let reg2 = match op2.reg() {
+ Some(asm::InlineAsmRegOrRegClass::Reg(r)) => r,
+ _ => unreachable!(),
+ };
+
+ let msg = format!(
+ "register `{}` conflicts with register `{}`",
+ reg.name(),
+ reg2.name()
+ );
+ let mut err = sess.struct_span_err(op_sp, &msg);
+ err.span_label(op_sp, &format!("register `{}`", reg.name()));
+ err.span_label(op_sp2, &format!("register `{}`", reg2.name()));
+
+ match (op, op2) {
+ (
+ hir::InlineAsmOperand::In { .. },
+ hir::InlineAsmOperand::Out { late, .. },
+ )
+ | (
+ hir::InlineAsmOperand::Out { late, .. },
+ hir::InlineAsmOperand::In { .. },
+ ) => {
+ assert!(!*late);
+ let out_op_sp = if input { op_sp2 } else { op_sp };
+ let msg = "use `lateout` instead of \
+ `out` to avoid conflict";
+ err.span_help(out_op_sp, msg);
+ }
+ _ => {}
+ }
+
+ err.emit();
+ }
+ Entry::Vacant(v) => {
+ v.insert(idx);
+ }
+ }
+ };
+ if input {
+ check(&mut used_input_regs, true);
+ }
+ if output {
+ check(&mut used_output_regs, false);
+ }
+ });
+ }
+ }
+ }
+
+ let operands = self.arena.alloc_from_iter(operands);
+ let template = self.arena.alloc_from_iter(asm.template.iter().cloned());
+ let line_spans = self.arena.alloc_slice(&asm.line_spans[..]);
+ let hir_asm = hir::InlineAsm { template, operands, options: asm.options, line_spans };
+ self.arena.alloc(hir_asm)
+ }
+}
use rustc_ast::attr;
use rustc_ast::ptr::P as AstP;
use rustc_ast::*;
-use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::stack::ensure_sufficient_stack;
use rustc_data_structures::thin_vec::ThinVec;
use rustc_errors::struct_span_err;
use rustc_span::source_map::{respan, DesugaringKind, Span, Spanned};
use rustc_span::symbol::{sym, Ident, Symbol};
use rustc_span::{hygiene::ForLoopLoc, DUMMY_SP};
-use rustc_target::asm;
-use std::collections::hash_map::Entry;
-use std::fmt::Write;
impl<'hir> LoweringContext<'_, 'hir> {
fn lower_exprs(&mut self, exprs: &[AstP<Expr>]) -> &'hir [hir::Expr<'hir>] {
let e = e.as_ref().map(|x| self.lower_expr(x));
hir::ExprKind::Ret(e)
}
- ExprKind::InlineAsm(ref asm) => self.lower_expr_asm(e.span, asm),
+ ExprKind::InlineAsm(ref asm) => {
+ hir::ExprKind::InlineAsm(self.lower_inline_asm(e.span, asm))
+ }
ExprKind::LlvmInlineAsm(ref asm) => self.lower_expr_llvm_asm(asm),
ExprKind::Struct(ref se) => {
let rest = match &se.rest {
result
}
- fn lower_expr_asm(&mut self, sp: Span, asm: &InlineAsm) -> hir::ExprKind<'hir> {
- // Rustdoc needs to support asm! from foriegn architectures: don't try
- // lowering the register contraints in this case.
- let asm_arch = if self.sess.opts.actually_rustdoc { None } else { self.sess.asm_arch };
- if asm_arch.is_none() && !self.sess.opts.actually_rustdoc {
- struct_span_err!(self.sess, sp, E0472, "asm! is unsupported on this target").emit();
- }
- if asm.options.contains(InlineAsmOptions::ATT_SYNTAX)
- && !matches!(asm_arch, Some(asm::InlineAsmArch::X86 | asm::InlineAsmArch::X86_64))
- && !self.sess.opts.actually_rustdoc
- {
- self.sess
- .struct_span_err(sp, "the `att_syntax` option is only supported on x86")
- .emit();
- }
-
- // Lower operands to HIR. We use dummy register classes if an error
- // occurs during lowering because we still need to be able to produce a
- // valid HIR.
- let sess = self.sess;
- let operands: Vec<_> = asm
- .operands
- .iter()
- .map(|(op, op_sp)| {
- let lower_reg = |reg| match reg {
- InlineAsmRegOrRegClass::Reg(s) => {
- asm::InlineAsmRegOrRegClass::Reg(if let Some(asm_arch) = asm_arch {
- asm::InlineAsmReg::parse(
- asm_arch,
- |feature| sess.target_features.contains(&Symbol::intern(feature)),
- &sess.target,
- s,
- )
- .unwrap_or_else(|e| {
- let msg = format!("invalid register `{}`: {}", s.as_str(), e);
- sess.struct_span_err(*op_sp, &msg).emit();
- asm::InlineAsmReg::Err
- })
- } else {
- asm::InlineAsmReg::Err
- })
- }
- InlineAsmRegOrRegClass::RegClass(s) => {
- asm::InlineAsmRegOrRegClass::RegClass(if let Some(asm_arch) = asm_arch {
- asm::InlineAsmRegClass::parse(asm_arch, s).unwrap_or_else(|e| {
- let msg = format!("invalid register class `{}`: {}", s.as_str(), e);
- sess.struct_span_err(*op_sp, &msg).emit();
- asm::InlineAsmRegClass::Err
- })
- } else {
- asm::InlineAsmRegClass::Err
- })
- }
- };
-
- let op = match *op {
- InlineAsmOperand::In { reg, ref expr } => hir::InlineAsmOperand::In {
- reg: lower_reg(reg),
- expr: self.lower_expr_mut(expr),
- },
- InlineAsmOperand::Out { reg, late, ref expr } => hir::InlineAsmOperand::Out {
- reg: lower_reg(reg),
- late,
- expr: expr.as_ref().map(|expr| self.lower_expr_mut(expr)),
- },
- InlineAsmOperand::InOut { reg, late, ref expr } => {
- hir::InlineAsmOperand::InOut {
- reg: lower_reg(reg),
- late,
- expr: self.lower_expr_mut(expr),
- }
- }
- InlineAsmOperand::SplitInOut { reg, late, ref in_expr, ref out_expr } => {
- hir::InlineAsmOperand::SplitInOut {
- reg: lower_reg(reg),
- late,
- in_expr: self.lower_expr_mut(in_expr),
- out_expr: out_expr.as_ref().map(|expr| self.lower_expr_mut(expr)),
- }
- }
- InlineAsmOperand::Const { ref anon_const } => hir::InlineAsmOperand::Const {
- anon_const: self.lower_anon_const(anon_const),
- },
- InlineAsmOperand::Sym { ref expr } => {
- hir::InlineAsmOperand::Sym { expr: self.lower_expr_mut(expr) }
- }
- };
- (op, *op_sp)
- })
- .collect();
-
- // Validate template modifiers against the register classes for the operands
- for p in &asm.template {
- if let InlineAsmTemplatePiece::Placeholder {
- operand_idx,
- modifier: Some(modifier),
- span: placeholder_span,
- } = *p
- {
- let op_sp = asm.operands[operand_idx].1;
- match &operands[operand_idx].0 {
- hir::InlineAsmOperand::In { reg, .. }
- | hir::InlineAsmOperand::Out { reg, .. }
- | hir::InlineAsmOperand::InOut { reg, .. }
- | hir::InlineAsmOperand::SplitInOut { reg, .. } => {
- let class = reg.reg_class();
- if class == asm::InlineAsmRegClass::Err {
- continue;
- }
- let valid_modifiers = class.valid_modifiers(asm_arch.unwrap());
- if !valid_modifiers.contains(&modifier) {
- let mut err = sess.struct_span_err(
- placeholder_span,
- "invalid asm template modifier for this register class",
- );
- err.span_label(placeholder_span, "template modifier");
- err.span_label(op_sp, "argument");
- if !valid_modifiers.is_empty() {
- let mut mods = format!("`{}`", valid_modifiers[0]);
- for m in &valid_modifiers[1..] {
- let _ = write!(mods, ", `{}`", m);
- }
- err.note(&format!(
- "the `{}` register class supports \
- the following template modifiers: {}",
- class.name(),
- mods
- ));
- } else {
- err.note(&format!(
- "the `{}` register class does not support template modifiers",
- class.name()
- ));
- }
- err.emit();
- }
- }
- hir::InlineAsmOperand::Const { .. } => {
- let mut err = sess.struct_span_err(
- placeholder_span,
- "asm template modifiers are not allowed for `const` arguments",
- );
- err.span_label(placeholder_span, "template modifier");
- err.span_label(op_sp, "argument");
- err.emit();
- }
- hir::InlineAsmOperand::Sym { .. } => {
- let mut err = sess.struct_span_err(
- placeholder_span,
- "asm template modifiers are not allowed for `sym` arguments",
- );
- err.span_label(placeholder_span, "template modifier");
- err.span_label(op_sp, "argument");
- err.emit();
- }
- }
- }
- }
-
- let mut used_input_regs = FxHashMap::default();
- let mut used_output_regs = FxHashMap::default();
- let mut required_features: Vec<&str> = vec![];
- for (idx, &(ref op, op_sp)) in operands.iter().enumerate() {
- if let Some(reg) = op.reg() {
- // Make sure we don't accidentally carry features from the
- // previous iteration.
- required_features.clear();
-
- let reg_class = reg.reg_class();
- if reg_class == asm::InlineAsmRegClass::Err {
- continue;
- }
-
- // We ignore target feature requirements for clobbers: if the
- // feature is disabled then the compiler doesn't care what we
- // do with the registers.
- //
- // Note that this is only possible for explicit register
- // operands, which cannot be used in the asm string.
- let is_clobber = matches!(
- op,
- hir::InlineAsmOperand::Out {
- reg: asm::InlineAsmRegOrRegClass::Reg(_),
- late: _,
- expr: None
- }
- );
-
- if !is_clobber {
- // Validate register classes against currently enabled target
- // features. We check that at least one type is available for
- // the current target.
- for &(_, feature) in reg_class.supported_types(asm_arch.unwrap()) {
- if let Some(feature) = feature {
- if self.sess.target_features.contains(&Symbol::intern(feature)) {
- required_features.clear();
- break;
- } else {
- required_features.push(feature);
- }
- } else {
- required_features.clear();
- break;
- }
- }
- // We are sorting primitive strs here and can use unstable sort here
- required_features.sort_unstable();
- required_features.dedup();
- match &required_features[..] {
- [] => {}
- [feature] => {
- let msg = format!(
- "register class `{}` requires the `{}` target feature",
- reg_class.name(),
- feature
- );
- sess.struct_span_err(op_sp, &msg).emit();
- }
- features => {
- let msg = format!(
- "register class `{}` requires at least one target feature: {}",
- reg_class.name(),
- features.join(", ")
- );
- sess.struct_span_err(op_sp, &msg).emit();
- }
- }
- }
-
- // Check for conflicts between explicit register operands.
- if let asm::InlineAsmRegOrRegClass::Reg(reg) = reg {
- let (input, output) = match op {
- hir::InlineAsmOperand::In { .. } => (true, false),
- // Late output do not conflict with inputs, but normal outputs do
- hir::InlineAsmOperand::Out { late, .. } => (!late, true),
- hir::InlineAsmOperand::InOut { .. }
- | hir::InlineAsmOperand::SplitInOut { .. } => (true, true),
- hir::InlineAsmOperand::Const { .. } | hir::InlineAsmOperand::Sym { .. } => {
- unreachable!()
- }
- };
-
- // Flag to output the error only once per operand
- let mut skip = false;
- reg.overlapping_regs(|r| {
- let mut check = |used_regs: &mut FxHashMap<asm::InlineAsmReg, usize>,
- input| {
- match used_regs.entry(r) {
- Entry::Occupied(o) => {
- if skip {
- return;
- }
- skip = true;
-
- let idx2 = *o.get();
- let &(ref op2, op_sp2) = &operands[idx2];
- let reg2 = match op2.reg() {
- Some(asm::InlineAsmRegOrRegClass::Reg(r)) => r,
- _ => unreachable!(),
- };
-
- let msg = format!(
- "register `{}` conflicts with register `{}`",
- reg.name(),
- reg2.name()
- );
- let mut err = sess.struct_span_err(op_sp, &msg);
- err.span_label(op_sp, &format!("register `{}`", reg.name()));
- err.span_label(op_sp2, &format!("register `{}`", reg2.name()));
-
- match (op, op2) {
- (
- hir::InlineAsmOperand::In { .. },
- hir::InlineAsmOperand::Out { late, .. },
- )
- | (
- hir::InlineAsmOperand::Out { late, .. },
- hir::InlineAsmOperand::In { .. },
- ) => {
- assert!(!*late);
- let out_op_sp = if input { op_sp2 } else { op_sp };
- let msg = "use `lateout` instead of \
- `out` to avoid conflict";
- err.span_help(out_op_sp, msg);
- }
- _ => {}
- }
-
- err.emit();
- }
- Entry::Vacant(v) => {
- v.insert(idx);
- }
- }
- };
- if input {
- check(&mut used_input_regs, true);
- }
- if output {
- check(&mut used_output_regs, false);
- }
- });
- }
- }
- }
-
- let operands = self.arena.alloc_from_iter(operands);
- let template = self.arena.alloc_from_iter(asm.template.iter().cloned());
- let line_spans = self.arena.alloc_slice(&asm.line_spans[..]);
- let hir_asm = hir::InlineAsm { template, operands, options: asm.options, line_spans };
- hir::ExprKind::InlineAsm(self.arena.alloc(hir_asm))
- }
-
fn lower_expr_llvm_asm(&mut self, asm: &LlvmInlineAsm) -> hir::ExprKind<'hir> {
let inner = hir::LlvmInlineAsmInner {
inputs: asm.inputs.iter().map(|&(c, _)| c).collect(),
.alloc_from_iter(fm.items.iter().map(|x| self.lower_foreign_item_ref(x))),
}
}
- ItemKind::GlobalAsm(ref ga) => hir::ItemKind::GlobalAsm(self.lower_global_asm(ga)),
+ ItemKind::GlobalAsm(ref asm) => {
+ hir::ItemKind::GlobalAsm(self.lower_inline_asm(span, asm))
+ }
ItemKind::TyAlias(box TyAliasKind(_, ref gen, _, Some(ref ty))) => {
// We lower
//
}
}
- fn lower_global_asm(&mut self, ga: &GlobalAsm) -> &'hir hir::GlobalAsm {
- self.arena.alloc(hir::GlobalAsm { asm: ga.asm })
- }
-
fn lower_variant(&mut self, v: &Variant) -> hir::Variant<'hir> {
let id = self.lower_node_id(v.id);
self.lower_attrs(id, &v.attrs);
use rustc_span::hygiene::ExpnId;
use rustc_span::source_map::{respan, DesugaringKind};
use rustc_span::symbol::{kw, sym, Ident, Symbol};
-use rustc_span::Span;
+use rustc_span::{Span, DUMMY_SP};
use rustc_target::spec::abi::Abi;
use smallvec::{smallvec, SmallVec};
});
}
+mod asm;
mod expr;
mod item;
mod pat;
args: &[],
bindings: arena_vec![self; self.output_ty_binding(span, output_ty)],
parenthesized: false,
+ span_ext: DUMMY_SP,
});
hir::GenericBound::LangItemTrait(
args: SmallVec<[hir::GenericArg<'hir>; 4]>,
bindings: &'hir [hir::TypeBinding<'hir>],
parenthesized: bool,
+ span: Span,
}
impl<'hir> GenericArgsCtor<'hir> {
args: arena.alloc_from_iter(self.args),
bindings: self.bindings,
parenthesized: self.parenthesized,
+ span_ext: self.span,
}
}
}
use rustc_session::lint::builtin::ELIDED_LIFETIMES_IN_PATHS;
use rustc_session::lint::BuiltinLintDiagnostics;
use rustc_span::symbol::Ident;
-use rustc_span::Span;
+use rustc_span::{BytePos, Span, DUMMY_SP};
use smallvec::smallvec;
use tracing::debug;
},
}
} else {
- self.lower_angle_bracketed_parameter_data(&Default::default(), param_mode, itctx)
+ (
+ GenericArgsCtor {
+ args: Default::default(),
+ bindings: &[],
+ parenthesized: false,
+ span: path_span.shrink_to_hi(),
+ },
+ param_mode == ParamMode::Optional,
+ )
};
let has_lifetimes =
generic_args.args.iter().any(|arg| matches!(arg, GenericArg::Lifetime(_)));
- let first_generic_span = generic_args
- .args
- .iter()
- .map(|a| a.span())
- .chain(generic_args.bindings.iter().map(|b| b.span))
- .next();
if !generic_args.parenthesized && !has_lifetimes {
+ // Note: these spans are used for diagnostics when they can't be inferred.
+ // See rustc_resolve::late::lifetimes::LifetimeContext::add_missing_lifetime_specifiers_label
+ let elided_lifetime_span = if generic_args.span.is_empty() {
+ // If there are no brackets, use the identifier span.
+ segment.ident.span
+ } else if generic_args.is_empty() {
+ // If there are brackets, but not generic arguments, then use the opening bracket
+ generic_args.span.with_hi(generic_args.span.lo() + BytePos(1))
+ } else {
+ // Else use an empty span right after the opening bracket.
+ generic_args.span.with_lo(generic_args.span.lo() + BytePos(1)).shrink_to_lo()
+ };
generic_args.args = self
- .elided_path_lifetimes(
- first_generic_span.map_or(segment.ident.span, |s| s.shrink_to_lo()),
- expected_lifetimes,
- )
+ .elided_path_lifetimes(elided_lifetime_span, expected_lifetimes)
.map(GenericArg::Lifetime)
.chain(generic_args.args.into_iter())
.collect();
let no_non_lt_args = generic_args.args.len() == expected_lifetimes;
let no_bindings = generic_args.bindings.is_empty();
let (incl_angl_brckt, insertion_sp, suggestion) = if no_non_lt_args && no_bindings {
- // If there are no (non-implicit) generic args or associated type
- // bindings, our suggestion includes the angle brackets.
+ // If there are no generic args, our suggestion can include the angle brackets.
(true, path_span.shrink_to_hi(), format!("<{}>", anon_lt_suggestion))
} else {
- // Otherwise (sorry, this is kind of gross) we need to infer the
- // place to splice in the `'_, ` from the generics that do exist.
- let first_generic_span = first_generic_span
- .expect("already checked that non-lifetime args or bindings exist");
- (false, first_generic_span.shrink_to_lo(), format!("{}, ", anon_lt_suggestion))
+ // Otherwise we'll insert a `'_, ` right after the opening bracket.
+ let span = generic_args
+ .span
+ .with_lo(generic_args.span.lo() + BytePos(1))
+ .shrink_to_lo();
+ (false, span, format!("{}, ", anon_lt_suggestion))
};
match self.anonymous_lifetime_mode {
// In create-parameter mode we error here because we don't want to support
hir_id: Some(id),
res: Some(self.lower_res(res)),
infer_args,
- args: if generic_args.is_empty() {
+ args: if generic_args.is_empty() && generic_args.span.is_empty() {
None
} else {
Some(self.arena.alloc(generic_args.into_generic_args(self.arena)))
}
AngleBracketedArg::Arg(_) => None,
}));
- let ctor = GenericArgsCtor { args, bindings, parenthesized: false };
+ let ctor = GenericArgsCtor { args, bindings, parenthesized: false, span: data.span };
(ctor, !has_non_lt_args && param_mode == ParamMode::Optional)
}
let args = smallvec![GenericArg::Type(this.ty_tup(*inputs_span, inputs))];
let binding = this.output_ty_binding(output_ty.span, output_ty);
(
- GenericArgsCtor { args, bindings: arena_vec![this; binding], parenthesized: true },
+ GenericArgsCtor {
+ args,
+ bindings: arena_vec![this; binding],
+ parenthesized: true,
+ span: data.inputs_span,
+ },
false,
)
})
let kind = hir::TypeBindingKind::Equality { ty };
let args = arena_vec![self;];
let bindings = arena_vec![self;];
- let gen_args = self.arena.alloc(hir::GenericArgs { args, bindings, parenthesized: false });
+ let gen_args = self.arena.alloc(hir::GenericArgs {
+ args,
+ bindings,
+ parenthesized: false,
+ span_ext: DUMMY_SP,
+ });
hir::TypeBinding { hir_id: self.next_id(), gen_args, span, ident, kind }
}
}
self.print_foreign_mod(nmod, &item.attrs);
self.bclose(item.span);
}
- ast::ItemKind::GlobalAsm(ref ga) => {
+ ast::ItemKind::GlobalAsm(ref asm) => {
self.head(visibility_qualified(&item.vis, "global_asm!"));
- self.s.word(ga.asm.to_string());
+ self.print_inline_asm(asm);
self.end();
}
ast::ItemKind::TyAlias(box ast::TyAliasKind(def, ref generics, ref bounds, ref ty)) => {
}
}
ast::ExprKind::InlineAsm(ref a) => {
- enum AsmArg<'a> {
- Template(String),
- Operand(&'a InlineAsmOperand),
- Options(InlineAsmOptions),
- }
-
- let mut args = vec![];
- args.push(AsmArg::Template(InlineAsmTemplatePiece::to_string(&a.template)));
- args.extend(a.operands.iter().map(|(o, _)| AsmArg::Operand(o)));
- if !a.options.is_empty() {
- args.push(AsmArg::Options(a.options));
- }
-
self.word("asm!");
- self.popen();
- self.commasep(Consistent, &args, |s, arg| match arg {
- AsmArg::Template(template) => s.print_string(&template, ast::StrStyle::Cooked),
- AsmArg::Operand(op) => {
- let print_reg_or_class = |s: &mut Self, r: &InlineAsmRegOrRegClass| match r
- {
- InlineAsmRegOrRegClass::Reg(r) => {
- s.print_symbol(*r, ast::StrStyle::Cooked)
- }
- InlineAsmRegOrRegClass::RegClass(r) => s.word(r.to_string()),
- };
- match op {
- InlineAsmOperand::In { reg, expr } => {
- s.word("in");
- s.popen();
- print_reg_or_class(s, reg);
- s.pclose();
- s.space();
- s.print_expr(expr);
- }
- InlineAsmOperand::Out { reg, late, expr } => {
- s.word(if *late { "lateout" } else { "out" });
- s.popen();
- print_reg_or_class(s, reg);
- s.pclose();
- s.space();
- match expr {
- Some(expr) => s.print_expr(expr),
- None => s.word("_"),
- }
- }
- InlineAsmOperand::InOut { reg, late, expr } => {
- s.word(if *late { "inlateout" } else { "inout" });
- s.popen();
- print_reg_or_class(s, reg);
- s.pclose();
- s.space();
- s.print_expr(expr);
- }
- InlineAsmOperand::SplitInOut { reg, late, in_expr, out_expr } => {
- s.word(if *late { "inlateout" } else { "inout" });
- s.popen();
- print_reg_or_class(s, reg);
- s.pclose();
- s.space();
- s.print_expr(in_expr);
- s.space();
- s.word_space("=>");
- match out_expr {
- Some(out_expr) => s.print_expr(out_expr),
- None => s.word("_"),
- }
- }
- InlineAsmOperand::Const { anon_const } => {
- s.word("const");
- s.space();
- s.print_expr(&anon_const.value);
- }
- InlineAsmOperand::Sym { expr } => {
- s.word("sym");
- s.space();
- s.print_expr(expr);
- }
- }
- }
- AsmArg::Options(opts) => {
- s.word("options");
- s.popen();
- let mut options = vec![];
- if opts.contains(InlineAsmOptions::PURE) {
- options.push("pure");
- }
- if opts.contains(InlineAsmOptions::NOMEM) {
- options.push("nomem");
- }
- if opts.contains(InlineAsmOptions::READONLY) {
- options.push("readonly");
- }
- if opts.contains(InlineAsmOptions::PRESERVES_FLAGS) {
- options.push("preserves_flags");
- }
- if opts.contains(InlineAsmOptions::NORETURN) {
- options.push("noreturn");
- }
- if opts.contains(InlineAsmOptions::NOSTACK) {
- options.push("nostack");
- }
- if opts.contains(InlineAsmOptions::ATT_SYNTAX) {
- options.push("att_syntax");
- }
- s.commasep(Inconsistent, &options, |s, &opt| {
- s.word(opt);
- });
- s.pclose();
- }
- });
- self.pclose();
+ self.print_inline_asm(a);
}
ast::ExprKind::LlvmInlineAsm(ref a) => {
self.s.word("llvm_asm!");
self.end();
}
+ fn print_inline_asm(&mut self, asm: &ast::InlineAsm) {
+ enum AsmArg<'a> {
+ Template(String),
+ Operand(&'a InlineAsmOperand),
+ Options(InlineAsmOptions),
+ }
+
+ let mut args = vec![];
+ args.push(AsmArg::Template(InlineAsmTemplatePiece::to_string(&asm.template)));
+ args.extend(asm.operands.iter().map(|(o, _)| AsmArg::Operand(o)));
+ if !asm.options.is_empty() {
+ args.push(AsmArg::Options(asm.options));
+ }
+
+ self.popen();
+ self.commasep(Consistent, &args, |s, arg| match arg {
+ AsmArg::Template(template) => s.print_string(&template, ast::StrStyle::Cooked),
+ AsmArg::Operand(op) => {
+ let print_reg_or_class = |s: &mut Self, r: &InlineAsmRegOrRegClass| match r {
+ InlineAsmRegOrRegClass::Reg(r) => s.print_symbol(*r, ast::StrStyle::Cooked),
+ InlineAsmRegOrRegClass::RegClass(r) => s.word(r.to_string()),
+ };
+ match op {
+ InlineAsmOperand::In { reg, expr } => {
+ s.word("in");
+ s.popen();
+ print_reg_or_class(s, reg);
+ s.pclose();
+ s.space();
+ s.print_expr(expr);
+ }
+ InlineAsmOperand::Out { reg, late, expr } => {
+ s.word(if *late { "lateout" } else { "out" });
+ s.popen();
+ print_reg_or_class(s, reg);
+ s.pclose();
+ s.space();
+ match expr {
+ Some(expr) => s.print_expr(expr),
+ None => s.word("_"),
+ }
+ }
+ InlineAsmOperand::InOut { reg, late, expr } => {
+ s.word(if *late { "inlateout" } else { "inout" });
+ s.popen();
+ print_reg_or_class(s, reg);
+ s.pclose();
+ s.space();
+ s.print_expr(expr);
+ }
+ InlineAsmOperand::SplitInOut { reg, late, in_expr, out_expr } => {
+ s.word(if *late { "inlateout" } else { "inout" });
+ s.popen();
+ print_reg_or_class(s, reg);
+ s.pclose();
+ s.space();
+ s.print_expr(in_expr);
+ s.space();
+ s.word_space("=>");
+ match out_expr {
+ Some(out_expr) => s.print_expr(out_expr),
+ None => s.word("_"),
+ }
+ }
+ InlineAsmOperand::Const { anon_const } => {
+ s.word("const");
+ s.space();
+ s.print_expr(&anon_const.value);
+ }
+ InlineAsmOperand::Sym { expr } => {
+ s.word("sym");
+ s.space();
+ s.print_expr(expr);
+ }
+ }
+ }
+ AsmArg::Options(opts) => {
+ s.word("options");
+ s.popen();
+ let mut options = vec![];
+ if opts.contains(InlineAsmOptions::PURE) {
+ options.push("pure");
+ }
+ if opts.contains(InlineAsmOptions::NOMEM) {
+ options.push("nomem");
+ }
+ if opts.contains(InlineAsmOptions::READONLY) {
+ options.push("readonly");
+ }
+ if opts.contains(InlineAsmOptions::PRESERVES_FLAGS) {
+ options.push("preserves_flags");
+ }
+ if opts.contains(InlineAsmOptions::NORETURN) {
+ options.push("noreturn");
+ }
+ if opts.contains(InlineAsmOptions::NOSTACK) {
+ options.push("nostack");
+ }
+ if opts.contains(InlineAsmOptions::ATT_SYNTAX) {
+ options.push("att_syntax");
+ }
+ s.commasep(Inconsistent, &options, |s, &opt| {
+ s.word(opt);
+ });
+ s.pclose();
+ }
+ });
+ self.pclose();
+ }
+
crate fn print_local_decl(&mut self, loc: &ast::Local) {
self.print_pat(&loc.pat);
if let Some(ref ty) = loc.ty {
use rustc_parse::parser::Parser;
use rustc_parse_format as parse;
use rustc_session::lint;
+use rustc_span::symbol::Ident;
use rustc_span::symbol::{kw, sym, Symbol};
use rustc_span::{InnerSpan, Span};
use rustc_target::asm::InlineAsmArch;
+use smallvec::smallvec;
struct AsmArgs {
templates: Vec<P<ast::Expr>>,
ecx: &mut ExtCtxt<'a>,
sp: Span,
tts: TokenStream,
+ is_global_asm: bool,
) -> Result<AsmArgs, DiagnosticBuilder<'a>> {
let mut p = ecx.new_parser_from_tts(tts);
}
// Detect use of the legacy llvm_asm! syntax (which used to be called asm!)
- if p.look_ahead(1, |t| *t == token::Colon || *t == token::ModSep) {
+ if !is_global_asm && p.look_ahead(1, |t| *t == token::Colon || *t == token::ModSep) {
let mut err =
ecx.struct_span_err(sp, "the legacy LLVM-style asm! syntax is no longer supported");
err.note("consider migrating to the new asm! syntax specified in RFC 2873");
// Parse options
if p.eat_keyword(sym::options) {
- parse_options(&mut p, &mut args)?;
+ parse_options(&mut p, &mut args, is_global_asm)?;
allow_templates = false;
continue;
}
};
let mut explicit_reg = false;
- let op = if p.eat_keyword(kw::In) {
+ let op = if !is_global_asm && p.eat_keyword(kw::In) {
let reg = parse_reg(&mut p, &mut explicit_reg)?;
let expr = p.parse_expr()?;
ast::InlineAsmOperand::In { reg, expr }
- } else if p.eat_keyword(sym::out) {
+ } else if !is_global_asm && p.eat_keyword(sym::out) {
let reg = parse_reg(&mut p, &mut explicit_reg)?;
let expr = if p.eat_keyword(kw::Underscore) { None } else { Some(p.parse_expr()?) };
ast::InlineAsmOperand::Out { reg, expr, late: false }
- } else if p.eat_keyword(sym::lateout) {
+ } else if !is_global_asm && p.eat_keyword(sym::lateout) {
let reg = parse_reg(&mut p, &mut explicit_reg)?;
let expr = if p.eat_keyword(kw::Underscore) { None } else { Some(p.parse_expr()?) };
ast::InlineAsmOperand::Out { reg, expr, late: true }
- } else if p.eat_keyword(sym::inout) {
+ } else if !is_global_asm && p.eat_keyword(sym::inout) {
let reg = parse_reg(&mut p, &mut explicit_reg)?;
let expr = p.parse_expr()?;
if p.eat(&token::FatArrow) {
} else {
ast::InlineAsmOperand::InOut { reg, expr, late: false }
}
- } else if p.eat_keyword(sym::inlateout) {
+ } else if !is_global_asm && p.eat_keyword(sym::inlateout) {
let reg = parse_reg(&mut p, &mut explicit_reg)?;
let expr = p.parse_expr()?;
if p.eat(&token::FatArrow) {
} else if p.eat_keyword(kw::Const) {
let anon_const = p.parse_anon_const_expr()?;
ast::InlineAsmOperand::Const { anon_const }
- } else if p.eat_keyword(sym::sym) {
+ } else if !is_global_asm && p.eat_keyword(sym::sym) {
let expr = p.parse_expr()?;
match expr.kind {
ast::ExprKind::Path(..) => {}
}
}
-fn parse_options<'a>(p: &mut Parser<'a>, args: &mut AsmArgs) -> Result<(), DiagnosticBuilder<'a>> {
+fn parse_options<'a>(
+ p: &mut Parser<'a>,
+ args: &mut AsmArgs,
+ is_global_asm: bool,
+) -> Result<(), DiagnosticBuilder<'a>> {
let span_start = p.prev_token.span;
p.expect(&token::OpenDelim(token::DelimToken::Paren))?;
while !p.eat(&token::CloseDelim(token::DelimToken::Paren)) {
- if p.eat_keyword(sym::pure) {
+ if !is_global_asm && p.eat_keyword(sym::pure) {
try_set_option(p, args, sym::pure, ast::InlineAsmOptions::PURE);
- } else if p.eat_keyword(sym::nomem) {
+ } else if !is_global_asm && p.eat_keyword(sym::nomem) {
try_set_option(p, args, sym::nomem, ast::InlineAsmOptions::NOMEM);
- } else if p.eat_keyword(sym::readonly) {
+ } else if !is_global_asm && p.eat_keyword(sym::readonly) {
try_set_option(p, args, sym::readonly, ast::InlineAsmOptions::READONLY);
- } else if p.eat_keyword(sym::preserves_flags) {
+ } else if !is_global_asm && p.eat_keyword(sym::preserves_flags) {
try_set_option(p, args, sym::preserves_flags, ast::InlineAsmOptions::PRESERVES_FLAGS);
- } else if p.eat_keyword(sym::noreturn) {
+ } else if !is_global_asm && p.eat_keyword(sym::noreturn) {
try_set_option(p, args, sym::noreturn, ast::InlineAsmOptions::NORETURN);
- } else if p.eat_keyword(sym::nostack) {
+ } else if !is_global_asm && p.eat_keyword(sym::nostack) {
try_set_option(p, args, sym::nostack, ast::InlineAsmOptions::NOSTACK);
} else if p.eat_keyword(sym::att_syntax) {
try_set_option(p, args, sym::att_syntax, ast::InlineAsmOptions::ATT_SYNTAX);
Ok(result)
}
-fn expand_preparsed_asm(ecx: &mut ExtCtxt<'_>, sp: Span, args: AsmArgs) -> P<ast::Expr> {
+fn expand_preparsed_asm(ecx: &mut ExtCtxt<'_>, args: AsmArgs) -> Option<ast::InlineAsm> {
let mut template = vec![];
// Register operands are implicitly used since they are not allowed to be
// referenced in the template string.
if let Some(mut err) = err {
err.emit();
}
- return DummyResult::raw_expr(sp, true);
+ return None;
}
};
e.span_label(err_sp, label);
}
e.emit();
- return DummyResult::raw_expr(sp, true);
+ return None;
}
curarg = parser.curarg;
}
}
- let inline_asm =
- ast::InlineAsm { template, operands: args.operands, options: args.options, line_spans };
- P(ast::Expr {
- id: ast::DUMMY_NODE_ID,
- kind: ast::ExprKind::InlineAsm(P(inline_asm)),
- span: sp,
- attrs: ast::AttrVec::new(),
- tokens: None,
- })
+ Some(ast::InlineAsm { template, operands: args.operands, options: args.options, line_spans })
}
pub fn expand_asm<'cx>(
sp: Span,
tts: TokenStream,
) -> Box<dyn base::MacResult + 'cx> {
- match parse_args(ecx, sp, tts) {
- Ok(args) => MacEager::expr(expand_preparsed_asm(ecx, sp, args)),
+ match parse_args(ecx, sp, tts, false) {
+ Ok(args) => {
+ let expr = if let Some(inline_asm) = expand_preparsed_asm(ecx, args) {
+ P(ast::Expr {
+ id: ast::DUMMY_NODE_ID,
+ kind: ast::ExprKind::InlineAsm(P(inline_asm)),
+ span: sp,
+ attrs: ast::AttrVec::new(),
+ tokens: None,
+ })
+ } else {
+ DummyResult::raw_expr(sp, true)
+ };
+ MacEager::expr(expr)
+ }
+ Err(mut err) => {
+ err.emit();
+ DummyResult::any(sp)
+ }
+ }
+}
+
+pub fn expand_global_asm<'cx>(
+ ecx: &'cx mut ExtCtxt<'_>,
+ sp: Span,
+ tts: TokenStream,
+) -> Box<dyn base::MacResult + 'cx> {
+ match parse_args(ecx, sp, tts, true) {
+ Ok(args) => {
+ if let Some(inline_asm) = expand_preparsed_asm(ecx, args) {
+ MacEager::items(smallvec![P(ast::Item {
+ ident: Ident::invalid(),
+ attrs: Vec::new(),
+ id: ast::DUMMY_NODE_ID,
+ kind: ast::ItemKind::GlobalAsm(inline_asm),
+ vis: ast::Visibility {
+ span: sp.shrink_to_lo(),
+ kind: ast::VisibilityKind::Inherited,
+ tokens: None,
+ },
+ span: ecx.with_def_site_ctxt(sp),
+ tokens: None,
+ })])
+ } else {
+ DummyResult::any(sp)
+ }
+ }
Err(mut err) => {
err.emit();
DummyResult::any(sp)
+++ /dev/null
-//! Module-level assembly support.
-//!
-//! The macro defined here allows you to specify "top-level",
-//! "file-scoped", or "module-level" assembly. These synonyms
-//! all correspond to LLVM's module-level inline assembly instruction.
-//!
-//! For example, `global_asm!("some assembly here")` codegens to
-//! LLVM's `module asm "some assembly here"`. All of LLVM's caveats
-//! therefore apply.
-
-use rustc_ast as ast;
-use rustc_ast::ptr::P;
-use rustc_ast::token;
-use rustc_ast::tokenstream::TokenStream;
-use rustc_errors::DiagnosticBuilder;
-use rustc_expand::base::{self, *};
-use rustc_span::symbol::Ident;
-use rustc_span::Span;
-use smallvec::smallvec;
-
-pub fn expand_global_asm<'cx>(
- cx: &'cx mut ExtCtxt<'_>,
- sp: Span,
- tts: TokenStream,
-) -> Box<dyn base::MacResult + 'cx> {
- match parse_global_asm(cx, sp, tts) {
- Ok(Some(global_asm)) => MacEager::items(smallvec![P(ast::Item {
- ident: Ident::invalid(),
- attrs: Vec::new(),
- id: ast::DUMMY_NODE_ID,
- kind: ast::ItemKind::GlobalAsm(global_asm),
- vis: ast::Visibility {
- span: sp.shrink_to_lo(),
- kind: ast::VisibilityKind::Inherited,
- tokens: None,
- },
- span: cx.with_def_site_ctxt(sp),
- tokens: None,
- })]),
- Ok(None) => DummyResult::any(sp),
- Err(mut err) => {
- err.emit();
- DummyResult::any(sp)
- }
- }
-}
-
-fn parse_global_asm<'a>(
- cx: &mut ExtCtxt<'a>,
- sp: Span,
- tts: TokenStream,
-) -> Result<Option<ast::GlobalAsm>, DiagnosticBuilder<'a>> {
- let mut p = cx.new_parser_from_tts(tts);
-
- if p.token == token::Eof {
- let mut err = cx.struct_span_err(sp, "macro requires a string literal as an argument");
- err.span_label(sp, "string literal required");
- return Err(err);
- }
-
- let expr = p.parse_expr()?;
- let (asm, _) = match expr_to_string(cx, expr, "inline assembly must be a string literal") {
- Some((s, st)) => (s, st),
- None => return Ok(None),
- };
-
- Ok(Some(ast::GlobalAsm { asm }))
-}
mod format;
mod format_foreign;
mod global_allocator;
-mod global_asm;
mod llvm_asm;
mod log_syntax;
mod panic;
file: source_util::expand_file,
format_args_nl: format::expand_format_args_nl,
format_args: format::expand_format_args,
- global_asm: global_asm::expand_global_asm,
+ global_asm: asm::expand_global_asm,
include_bytes: source_util::expand_include_bytes,
include_str: source_util::expand_include_str,
include: source_util::expand_include,
use std::path::PathBuf;
+use rustc_ast::{InlineAsmOptions, InlineAsmTemplatePiece};
use rustc_codegen_ssa::back::linker::LinkerInfo;
use rustc_codegen_ssa::{CodegenResults, CompiledModule, CrateInfo, ModuleKind};
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
MonoItem::Static(def_id) => crate::constant::codegen_static(tcx, &mut module, def_id),
MonoItem::GlobalAsm(item_id) => {
let item = cx.tcx.hir().item(item_id);
- if let rustc_hir::ItemKind::GlobalAsm(rustc_hir::GlobalAsm { asm }) = item.kind {
- cx.global_asm.push_str(&*asm.as_str());
- cx.global_asm.push_str("\n\n");
+ if let rustc_hir::ItemKind::GlobalAsm(asm) = item.kind {
+ if !asm.options.contains(InlineAsmOptions::ATT_SYNTAX) {
+ cx.global_asm.push_str("\n.intel_syntax noprefix\n");
+ } else {
+ cx.global_asm.push_str("\n.att_syntax\n");
+ }
+ for piece in asm.template {
+ match *piece {
+ InlineAsmTemplatePiece::String(ref s) => cx.global_asm.push_str(s),
+ InlineAsmTemplatePiece::Placeholder { .. } => todo!(),
+ }
+ }
+ cx.global_asm.push_str("\n.att_syntax\n\n");
} else {
bug!("Expected GlobalAsm found {:?}", item);
}
}
fn metadata_loader(&self) -> Box<dyn MetadataLoader + Sync> {
- Box::new(crate::metadata::CraneliftMetadataLoader)
+ Box::new(rustc_codegen_ssa::back::metadata::DefaultMetadataLoader)
}
fn provide(&self, _providers: &mut Providers) {}
-//! Reading and writing of the rustc metadata for rlibs and dylibs
+//! Writing of the rustc metadata for dylibs
-use std::fs::File;
-use std::path::Path;
-
-use rustc_codegen_ssa::METADATA_FILENAME;
-use rustc_data_structures::memmap::Mmap;
-use rustc_data_structures::owning_ref::OwningRef;
-use rustc_data_structures::rustc_erase_owner;
-use rustc_data_structures::sync::MetadataRef;
-use rustc_middle::middle::cstore::MetadataLoader;
use rustc_middle::ty::TyCtxt;
-use rustc_target::spec::Target;
use crate::backend::WriteMetadata;
-/// The metadata loader used by cg_clif.
-///
-/// The metadata is stored in the same format as cg_llvm.
-///
-/// # Metadata location
-///
-/// <dl>
-/// <dt>rlib</dt>
-/// <dd>The metadata can be found in the `lib.rmeta` file inside of the ar archive.</dd>
-/// <dt>dylib</dt>
-/// <dd>The metadata can be found in the `.rustc` section of the shared library.</dd>
-/// </dl>
-pub(crate) struct CraneliftMetadataLoader;
-
-fn load_metadata_with(
- path: &Path,
- f: impl for<'a> FnOnce(&'a [u8]) -> Result<&'a [u8], String>,
-) -> Result<MetadataRef, String> {
- let file = File::open(path).map_err(|e| format!("{:?}", e))?;
- let data = unsafe { Mmap::map(file) }.map_err(|e| format!("{:?}", e))?;
- let metadata = OwningRef::new(data).try_map(f)?;
- return Ok(rustc_erase_owner!(metadata.map_owner_box()));
-}
-
-impl MetadataLoader for CraneliftMetadataLoader {
- fn get_rlib_metadata(&self, _target: &Target, path: &Path) -> Result<MetadataRef, String> {
- load_metadata_with(path, |data| {
- let archive = object::read::archive::ArchiveFile::parse(&*data)
- .map_err(|e| format!("{:?}", e))?;
-
- for entry_result in archive.members() {
- let entry = entry_result.map_err(|e| format!("{:?}", e))?;
- if entry.name() == METADATA_FILENAME.as_bytes() {
- return Ok(entry.data());
- }
- }
-
- Err("couldn't find metadata entry".to_string())
- })
- }
-
- fn get_dylib_metadata(&self, _target: &Target, path: &Path) -> Result<MetadataRef, String> {
- use object::{Object, ObjectSection};
-
- load_metadata_with(path, |data| {
- let file = object::File::parse(&data).map_err(|e| format!("parse: {:?}", e))?;
- file.section_by_name(".rustc")
- .ok_or("no .rustc section")?
- .data()
- .map_err(|e| format!("failed to read .rustc section: {:?}", e))
- })
- }
-}
-
// Adapted from https://github.com/rust-lang/rust/blob/da573206f87b5510de4b0ee1a9c044127e409bd3/src/librustc_codegen_llvm/base.rs#L47-L112
pub(crate) fn write_metadata<O: WriteMetadata>(tcx: TyCtxt<'_>, object: &mut O) {
use snap::write::FrameEncoder;
}
InlineAsmArch::RiscV32 | InlineAsmArch::RiscV64 => {}
InlineAsmArch::Nvptx64 => {}
+ InlineAsmArch::PowerPC => {}
InlineAsmArch::Hexagon => {}
InlineAsmArch::Mips | InlineAsmArch::Mips64 => {}
InlineAsmArch::SpirV => {}
}
impl AsmMethods for CodegenCx<'ll, 'tcx> {
- fn codegen_global_asm(&self, ga: &hir::GlobalAsm) {
- let asm = ga.asm.as_str();
+ fn codegen_global_asm(
+ &self,
+ template: &[InlineAsmTemplatePiece],
+ operands: &[GlobalAsmOperandRef],
+ options: InlineAsmOptions,
+ _line_spans: &[Span],
+ ) {
+ let asm_arch = self.tcx.sess.asm_arch.unwrap();
+
+ // Default to Intel syntax on x86
+ let intel_syntax = matches!(asm_arch, InlineAsmArch::X86 | InlineAsmArch::X86_64)
+ && !options.contains(InlineAsmOptions::ATT_SYNTAX);
+
+ // Build the template string
+ let mut template_str = String::new();
+ if intel_syntax {
+ template_str.push_str(".intel_syntax\n");
+ }
+ for piece in template {
+ match *piece {
+ InlineAsmTemplatePiece::String(ref s) => template_str.push_str(s),
+ InlineAsmTemplatePiece::Placeholder { operand_idx, modifier: _, span: _ } => {
+ match operands[operand_idx] {
+ GlobalAsmOperandRef::Const { ref string } => {
+ // Const operands get injected directly into the
+ // template. Note that we don't need to escape $
+ // here unlike normal inline assembly.
+ template_str.push_str(string);
+ }
+ }
+ }
+ }
+ }
+ if intel_syntax {
+ template_str.push_str("\n.att_syntax\n");
+ }
+
unsafe {
- llvm::LLVMRustAppendModuleInlineAsm(self.llmod, asm.as_ptr().cast(), asm.len());
+ llvm::LLVMRustAppendModuleInlineAsm(
+ self.llmod,
+ template_str.as_ptr().cast(),
+ template_str.len(),
+ );
}
}
}
InlineAsmRegClass::Nvptx(NvptxInlineAsmRegClass::reg16) => "h",
InlineAsmRegClass::Nvptx(NvptxInlineAsmRegClass::reg32) => "r",
InlineAsmRegClass::Nvptx(NvptxInlineAsmRegClass::reg64) => "l",
+ InlineAsmRegClass::PowerPC(PowerPCInlineAsmRegClass::reg) => "r",
+ InlineAsmRegClass::PowerPC(PowerPCInlineAsmRegClass::reg_nonzero) => "b",
+ InlineAsmRegClass::PowerPC(PowerPCInlineAsmRegClass::freg) => "f",
InlineAsmRegClass::RiscV(RiscVInlineAsmRegClass::reg) => "r",
InlineAsmRegClass::RiscV(RiscVInlineAsmRegClass::freg) => "f",
InlineAsmRegClass::X86(X86InlineAsmRegClass::reg) => "r",
InlineAsmRegClass::Hexagon(_) => None,
InlineAsmRegClass::Mips(_) => None,
InlineAsmRegClass::Nvptx(_) => None,
+ InlineAsmRegClass::PowerPC(_) => None,
InlineAsmRegClass::RiscV(RiscVInlineAsmRegClass::reg)
| InlineAsmRegClass::RiscV(RiscVInlineAsmRegClass::freg) => None,
InlineAsmRegClass::X86(X86InlineAsmRegClass::reg)
InlineAsmRegClass::Nvptx(NvptxInlineAsmRegClass::reg16) => cx.type_i16(),
InlineAsmRegClass::Nvptx(NvptxInlineAsmRegClass::reg32) => cx.type_i32(),
InlineAsmRegClass::Nvptx(NvptxInlineAsmRegClass::reg64) => cx.type_i64(),
+ InlineAsmRegClass::PowerPC(PowerPCInlineAsmRegClass::reg) => cx.type_i32(),
+ InlineAsmRegClass::PowerPC(PowerPCInlineAsmRegClass::reg_nonzero) => cx.type_i32(),
+ InlineAsmRegClass::PowerPC(PowerPCInlineAsmRegClass::freg) => cx.type_f64(),
InlineAsmRegClass::RiscV(RiscVInlineAsmRegClass::reg) => cx.type_i32(),
InlineAsmRegClass::RiscV(RiscVInlineAsmRegClass::freg) => cx.type_f32(),
InlineAsmRegClass::X86(X86InlineAsmRegClass::reg)
use crate::common;
use crate::context::CodegenCx;
use crate::llvm;
-use crate::metadata;
use crate::value::Value;
use rustc_codegen_ssa::base::maybe_create_entry_wrapper;
use snap::write::FrameEncoder;
use std::io::Write;
+ // Historical note:
+ //
+ // When using link.exe it was seen that the section name `.note.rustc`
+ // was getting shortened to `.note.ru`, and according to the PE and COFF
+ // specification:
+ //
+ // > Executable images do not use a string table and do not support
+ // > section names longer than 8Â characters
+ //
+ // https://docs.microsoft.com/en-us/windows/win32/debug/pe-format
+ //
+ // As a result, we choose a slightly shorter name! As to why
+ // `.note.rustc` works on MinGW, see
+ // https://github.com/llvm/llvm-project/blob/llvmorg-12.0.0/lld/COFF/Writer.cpp#L1190-L1197
+ let section_name = if tcx.sess.target.is_like_osx { "__DATA,.rustc" } else { ".rustc" };
+
let (metadata_llcx, metadata_llmod) = (&*llvm_module.llcx, llvm_module.llmod());
let mut compressed = tcx.metadata_encoding_version();
FrameEncoder::new(&mut compressed).write_all(&metadata.raw_data).unwrap();
unsafe { llvm::LLVMAddGlobal(metadata_llmod, common::val_ty(llconst), buf.as_ptr()) };
unsafe {
llvm::LLVMSetInitializer(llglobal, llconst);
- let section_name = metadata::metadata_section_name(&tcx.sess.target);
let name = SmallCStr::new(section_name);
llvm::LLVMSetSection(llglobal, name.as_ptr());
}
mod llvm_util;
-mod metadata;
mod mono_item;
mod type_;
mod type_of;
}
fn metadata_loader(&self) -> Box<MetadataLoaderDyn> {
- Box::new(metadata::LlvmMetadataLoader)
+ Box::new(rustc_codegen_ssa::back::metadata::DefaultMetadataLoader)
}
fn provide(&self, _providers: &mut ty::query::Providers) {}
+++ /dev/null
-use crate::llvm;
-use crate::llvm::archive_ro::ArchiveRO;
-use crate::llvm::{mk_section_iter, False, ObjectFile};
-use rustc_middle::middle::cstore::MetadataLoader;
-use rustc_target::spec::Target;
-
-use rustc_codegen_ssa::METADATA_FILENAME;
-use rustc_data_structures::owning_ref::OwningRef;
-use rustc_data_structures::rustc_erase_owner;
-use tracing::debug;
-
-use rustc_fs_util::path_to_c_string;
-use std::path::Path;
-use std::slice;
-
-pub use rustc_data_structures::sync::MetadataRef;
-
-pub struct LlvmMetadataLoader;
-
-impl MetadataLoader for LlvmMetadataLoader {
- fn get_rlib_metadata(&self, _: &Target, filename: &Path) -> Result<MetadataRef, String> {
- // Use ArchiveRO for speed here, it's backed by LLVM and uses mmap
- // internally to read the file. We also avoid even using a memcpy by
- // just keeping the archive along while the metadata is in use.
- let archive =
- ArchiveRO::open(filename).map(|ar| OwningRef::new(Box::new(ar))).map_err(|e| {
- debug!("llvm didn't like `{}`: {}", filename.display(), e);
- format!("failed to read rlib metadata in '{}': {}", filename.display(), e)
- })?;
- let buf: OwningRef<_, [u8]> = archive.try_map(|ar| {
- ar.iter()
- .filter_map(|s| s.ok())
- .find(|sect| sect.name() == Some(METADATA_FILENAME))
- .map(|s| s.data())
- .ok_or_else(|| {
- debug!("didn't find '{}' in the archive", METADATA_FILENAME);
- format!("failed to read rlib metadata: '{}'", filename.display())
- })
- })?;
- Ok(rustc_erase_owner!(buf))
- }
-
- fn get_dylib_metadata(&self, target: &Target, filename: &Path) -> Result<MetadataRef, String> {
- unsafe {
- let buf = path_to_c_string(filename);
- let mb = llvm::LLVMRustCreateMemoryBufferWithContentsOfFile(buf.as_ptr())
- .ok_or_else(|| format!("error reading library: '{}'", filename.display()))?;
- let of =
- ObjectFile::new(mb).map(|of| OwningRef::new(Box::new(of))).ok_or_else(|| {
- format!("provided path not an object file: '{}'", filename.display())
- })?;
- let buf = of.try_map(|of| search_meta_section(of, target, filename))?;
- Ok(rustc_erase_owner!(buf))
- }
- }
-}
-
-fn search_meta_section<'a>(
- of: &'a ObjectFile,
- target: &Target,
- filename: &Path,
-) -> Result<&'a [u8], String> {
- unsafe {
- let si = mk_section_iter(of.llof);
- while llvm::LLVMIsSectionIteratorAtEnd(of.llof, si.llsi) == False {
- let mut name_buf = None;
- let name_len = llvm::LLVMRustGetSectionName(si.llsi, &mut name_buf);
- let name = name_buf.map_or_else(
- String::new, // We got a null ptr, ignore `name_len`.
- |buf| {
- String::from_utf8(
- slice::from_raw_parts(buf.as_ptr() as *const u8, name_len as usize)
- .to_vec(),
- )
- .unwrap()
- },
- );
- debug!("get_metadata_section: name {}", name);
- if read_metadata_section_name(target) == name {
- let cbuf = llvm::LLVMGetSectionContents(si.llsi);
- let csz = llvm::LLVMGetSectionSize(si.llsi) as usize;
- // The buffer is valid while the object file is around
- let buf: &'a [u8] = slice::from_raw_parts(cbuf as *const u8, csz);
- return Ok(buf);
- }
- llvm::LLVMMoveToNextSection(si.llsi);
- }
- }
- Err(format!("metadata not found: '{}'", filename.display()))
-}
-
-pub fn metadata_section_name(target: &Target) -> &'static str {
- // Historical note:
- //
- // When using link.exe it was seen that the section name `.note.rustc`
- // was getting shortened to `.note.ru`, and according to the PE and COFF
- // specification:
- //
- // > Executable images do not use a string table and do not support
- // > section names longer than 8Â characters
- //
- // https://docs.microsoft.com/en-us/windows/win32/debug/pe-format
- //
- // As a result, we choose a slightly shorter name! As to why
- // `.note.rustc` works on MinGW, that's another good question...
-
- if target.is_like_osx { "__DATA,.rustc" } else { ".rustc" }
-}
-
-fn read_metadata_section_name(_target: &Target) -> &'static str {
- ".rustc"
-}
[dependencies]
bitflags = "1.2.1"
-cc = "1.0.1"
+cc = "1.0.67"
itertools = "0.9"
tracing = "0.1"
libc = "0.2.50"
rustc_macros = { path = "../rustc_macros" }
rustc_target = { path = "../rustc_target" }
rustc_session = { path = "../rustc_session" }
+
+[dependencies.object]
+version = "0.22.0"
+default-features = false
+features = ["read_core", "elf", "macho", "pe", "unaligned", "archive"]
--- /dev/null
+//! Reading of the rustc metadata for rlibs and dylibs
+
+use std::fs::File;
+use std::path::Path;
+
+use rustc_data_structures::memmap::Mmap;
+use rustc_data_structures::owning_ref::OwningRef;
+use rustc_data_structures::rustc_erase_owner;
+use rustc_data_structures::sync::MetadataRef;
+use rustc_middle::middle::cstore::MetadataLoader;
+use rustc_target::spec::Target;
+
+use crate::METADATA_FILENAME;
+
+/// The default metadata loader. This is used by cg_llvm and cg_clif.
+///
+/// # Metadata location
+///
+/// <dl>
+/// <dt>rlib</dt>
+/// <dd>The metadata can be found in the `lib.rmeta` file inside of the ar archive.</dd>
+/// <dt>dylib</dt>
+/// <dd>The metadata can be found in the `.rustc` section of the shared library.</dd>
+/// </dl>
+pub struct DefaultMetadataLoader;
+
+fn load_metadata_with(
+ path: &Path,
+ f: impl for<'a> FnOnce(&'a [u8]) -> Result<&'a [u8], String>,
+) -> Result<MetadataRef, String> {
+ let file =
+ File::open(path).map_err(|e| format!("failed to open file '{}': {}", path.display(), e))?;
+ let data = unsafe { Mmap::map(file) }
+ .map_err(|e| format!("failed to mmap file '{}': {}", path.display(), e))?;
+ let metadata = OwningRef::new(data).try_map(f)?;
+ return Ok(rustc_erase_owner!(metadata.map_owner_box()));
+}
+
+impl MetadataLoader for DefaultMetadataLoader {
+ fn get_rlib_metadata(&self, _target: &Target, path: &Path) -> Result<MetadataRef, String> {
+ load_metadata_with(path, |data| {
+ let archive = object::read::archive::ArchiveFile::parse(&*data)
+ .map_err(|e| format!("failed to parse rlib '{}': {}", path.display(), e))?;
+
+ for entry_result in archive.members() {
+ let entry = entry_result
+ .map_err(|e| format!("failed to parse rlib '{}': {}", path.display(), e))?;
+ if entry.name() == METADATA_FILENAME.as_bytes() {
+ return Ok(entry.data());
+ }
+ }
+
+ Err(format!("metadata not found in rlib '{}'", path.display()))
+ })
+ }
+
+ fn get_dylib_metadata(&self, _target: &Target, path: &Path) -> Result<MetadataRef, String> {
+ use object::{Object, ObjectSection};
+
+ load_metadata_with(path, |data| {
+ let file = object::File::parse(&data)
+ .map_err(|e| format!("failed to parse dylib '{}': {}", path.display(), e))?;
+ file.section_by_name(".rustc")
+ .ok_or_else(|| format!("no .rustc section in '{}'", path.display()))?
+ .data()
+ .map_err(|e| {
+ format!("failed to read .rustc section in '{}': {}", path.display(), e)
+ })
+ })
+ }
+}
pub mod link;
pub mod linker;
pub mod lto;
+pub mod metadata;
pub mod rpath;
pub mod symbol_export;
pub mod write;
use rustc_hir as hir;
use rustc_hir::def_id::DefId;
use rustc_hir::LangItem;
-use rustc_middle::ty::{Ty, TyCtxt};
+use rustc_middle::mir::interpret::ConstValue;
+use rustc_middle::ty::{self, layout::TyAndLayout, Ty, TyCtxt};
use rustc_session::Session;
use rustc_span::Span;
pub fn span_invalid_monomorphization_error(a: &Session, b: Span, c: &str) {
struct_span_err!(a, b, E0511, "{}", c).emit();
}
+
+pub fn asm_const_to_str<'tcx>(
+ tcx: TyCtxt<'tcx>,
+ sp: Span,
+ const_value: ConstValue<'tcx>,
+ ty_and_layout: TyAndLayout<'tcx>,
+) -> String {
+ let scalar = match const_value {
+ ConstValue::Scalar(s) => s,
+ _ => {
+ span_bug!(sp, "expected Scalar for promoted asm const, but got {:#?}", const_value)
+ }
+ };
+ let value = scalar.assert_bits(ty_and_layout.size);
+ match ty_and_layout.ty.kind() {
+ ty::Uint(_) => value.to_string(),
+ ty::Int(int_ty) => match int_ty.normalize(tcx.sess.target.pointer_width) {
+ ty::IntTy::I8 => (value as i8).to_string(),
+ ty::IntTy::I16 => (value as i16).to_string(),
+ ty::IntTy::I32 => (value as i32).to_string(),
+ ty::IntTy::I64 => (value as i64).to_string(),
+ ty::IntTy::I128 => (value as i128).to_string(),
+ ty::IntTy::Isize => unreachable!(),
+ },
+ ty::Float(ty::FloatTy::F32) => f32::from_bits(value as u32).to_string(),
+ ty::Float(ty::FloatTy::F64) => f64::from_bits(value as u64).to_string(),
+ _ => span_bug!(sp, "asm const has bad type {}", ty_and_layout.ty),
+ }
+}
}
fn create(tcx: TyCtxt<'tcx>, instance: Instance<'tcx>, is_used: bool) -> Self {
- let coverageinfo = tcx.coverageinfo(instance.def_id());
+ let coverageinfo = tcx.coverageinfo(instance.def);
debug!(
- "FunctionCoverage::new(instance={:?}) has coverageinfo={:?}. is_used={}",
+ "FunctionCoverage::create(instance={:?}) has coverageinfo={:?}. is_used={}",
instance, coverageinfo, is_used
);
Self {
use rustc_ast as ast;
use rustc_hir::lang_items::LangItem;
use rustc_index::vec::Idx;
-use rustc_middle::mir::interpret::ConstValue;
use rustc_middle::mir::AssertKind;
use rustc_middle::mir::{self, SwitchTargets};
use rustc_middle::ty::layout::{FnAbiExt, HasTyCtxt};
let const_value = self
.eval_mir_constant(value)
.unwrap_or_else(|_| span_bug!(span, "asm const cannot be resolved"));
- let ty = value.ty();
- let size = bx.layout_of(ty).size;
- let scalar = match const_value {
- ConstValue::Scalar(s) => s,
- _ => span_bug!(
- span,
- "expected Scalar for promoted asm const, but got {:#?}",
- const_value
- ),
- };
- let value = scalar.assert_bits(size);
- let string = match ty.kind() {
- ty::Uint(_) => value.to_string(),
- ty::Int(int_ty) => {
- match int_ty.normalize(bx.tcx().sess.target.pointer_width) {
- ty::IntTy::I8 => (value as i8).to_string(),
- ty::IntTy::I16 => (value as i16).to_string(),
- ty::IntTy::I32 => (value as i32).to_string(),
- ty::IntTy::I64 => (value as i64).to_string(),
- ty::IntTy::I128 => (value as i128).to_string(),
- ty::IntTy::Isize => unreachable!(),
- }
- }
- ty::Float(ty::FloatTy::F32) => f32::from_bits(value as u32).to_string(),
- ty::Float(ty::FloatTy::F64) => f64::from_bits(value as u64).to_string(),
- _ => span_bug!(span, "asm const has bad type {}", ty),
- };
+ let string = common::asm_const_to_str(
+ bx.tcx(),
+ span,
+ const_value,
+ bx.layout_of(value.ty()),
+ );
InlineAsmOperandRef::Const { string }
}
mir::InlineAsmOperand::SymFn { ref value } => {
bx.add_coverage_counter(instance, id, code_region);
}
- let coverageinfo = bx.tcx().coverageinfo(instance.def_id());
+ let coverageinfo = bx.tcx().coverageinfo(instance.def);
let fn_name = bx.get_pgo_func_name_var(instance);
let hash = bx.const_u64(function_source_hash);
use rustc_middle::ty::layout::HasTyCtxt;
use rustc_middle::ty::{self, adjustment::PointerCast, Instance, Ty, TyCtxt};
use rustc_span::source_map::{Span, DUMMY_SP};
-use rustc_span::symbol::sym;
use rustc_target::abi::{Abi, Int, LayoutOf, Variants};
impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
mir::CastKind::Pointer(PointerCast::ReifyFnPointer) => {
match *operand.layout.ty.kind() {
ty::FnDef(def_id, substs) => {
- if bx.cx().tcx().has_attr(def_id, sym::rustc_args_required_const) {
- bug!("reifying a fn ptr that requires const arguments");
- }
let instance = ty::Instance::resolve_for_fn_ptr(
bx.tcx(),
ty::ParamEnv::reveal_all(),
use crate::base;
+use crate::common;
use crate::traits::*;
use rustc_hir as hir;
+use rustc_middle::mir::mono::MonoItem;
use rustc_middle::mir::mono::{Linkage, Visibility};
use rustc_middle::ty::layout::HasTyCtxt;
-
-use rustc_middle::mir::mono::MonoItem;
+use rustc_target::abi::LayoutOf;
pub trait MonoItemExt<'a, 'tcx> {
fn define<Bx: BuilderMethods<'a, 'tcx>>(&self, cx: &'a Bx::CodegenCx);
}
MonoItem::GlobalAsm(item_id) => {
let item = cx.tcx().hir().item(item_id);
- if let hir::ItemKind::GlobalAsm(ref ga) = item.kind {
- cx.codegen_global_asm(ga);
+ if let hir::ItemKind::GlobalAsm(ref asm) = item.kind {
+ let operands: Vec<_> = asm
+ .operands
+ .iter()
+ .map(|(op, op_sp)| match *op {
+ hir::InlineAsmOperand::Const { ref anon_const } => {
+ let anon_const_def_id =
+ cx.tcx().hir().local_def_id(anon_const.hir_id).to_def_id();
+ let const_value =
+ cx.tcx().const_eval_poly(anon_const_def_id).unwrap_or_else(
+ |_| span_bug!(*op_sp, "asm const cannot be resolved"),
+ );
+ let ty = cx
+ .tcx()
+ .typeck_body(anon_const.body)
+ .node_type(anon_const.hir_id);
+ let string = common::asm_const_to_str(
+ cx.tcx(),
+ *op_sp,
+ const_value,
+ cx.layout_of(ty),
+ );
+ GlobalAsmOperandRef::Const { string }
+ }
+ _ => span_bug!(*op_sp, "invalid operand type for global_asm!"),
+ })
+ .collect();
+
+ cx.codegen_global_asm(asm.template, &operands, asm.options, asm.line_spans);
} else {
span_bug!(item.span, "Mismatch between hir::Item type and MonoItem type")
}
use crate::mir::place::PlaceRef;
use rustc_ast::{InlineAsmOptions, InlineAsmTemplatePiece};
use rustc_hir::def_id::DefId;
-use rustc_hir::{GlobalAsm, LlvmInlineAsmInner};
+use rustc_hir::LlvmInlineAsmInner;
use rustc_middle::ty::Instance;
use rustc_span::Span;
use rustc_target::asm::InlineAsmRegOrRegClass;
},
}
+#[derive(Debug)]
+pub enum GlobalAsmOperandRef {
+ Const { string: String },
+}
+
pub trait AsmBuilderMethods<'tcx>: BackendTypes {
/// Take an inline assembly expression and splat it out via LLVM
fn codegen_llvm_inline_asm(
}
pub trait AsmMethods {
- fn codegen_global_asm(&self, ga: &GlobalAsm);
+ fn codegen_global_asm(
+ &self,
+ template: &[InlineAsmTemplatePiece],
+ operands: &[GlobalAsmOperandRef],
+ options: InlineAsmOptions,
+ line_spans: &[Span],
+ );
}
mod write;
pub use self::abi::AbiBuilderMethods;
-pub use self::asm::{AsmBuilderMethods, AsmMethods, InlineAsmOperandRef};
+pub use self::asm::{AsmBuilderMethods, AsmMethods, GlobalAsmOperandRef, InlineAsmOperandRef};
pub use self::backend::{Backend, BackendTypes, CodegenBackend, ExtraBackendMethods};
pub use self::builder::{BuilderMethods, OverflowOp};
pub use self::consts::ConstMethods;
fn bar(&self);
}
-fn some_func<T: Foo>(foo: T) {
- foo.bar(); // we can now use this method since i32 implements the
- // Foo trait
-}
-
// we implement the trait on the i32 type
impl Foo for i32 {
fn bar(&self) {}
}
+fn some_func<T: Foo>(foo: T) {
+ foo.bar(); // we can now use this method since i32 implements the
+ // Foo trait
+}
+
fn main() {
some_func(5i32); // ok!
}
// are some which do actually involve macros.
ExpnKind::Inlined | ExpnKind::Desugaring(..) | ExpnKind::AstPass(..) => None,
- ExpnKind::Macro { kind: macro_kind, name: _, proc_macro: _ } => {
- Some(macro_kind)
+ ExpnKind::Macro { kind: macro_kind, name, proc_macro: _ } => {
+ Some((macro_kind, name))
}
}
});
self.render_multispans_macro_backtrace(span, children, backtrace);
if !backtrace {
- if let Some(macro_kind) = has_macro_spans {
+ if let Some((macro_kind, name)) = has_macro_spans {
+ let descr = macro_kind.descr();
+
let msg = format!(
- "this {} originates in {} {} \
+ "this {level} originates in the {descr} `{name}` \
(in Nightly builds, run with -Z macro-backtrace for more info)",
- level,
- macro_kind.article(),
- macro_kind.descr(),
);
children.push(SubDiagnostic {
#![feature(crate_visibility_modifier)]
#![feature(backtrace)]
#![feature(extended_key_value_attributes)]
+#![feature(format_args_capture)]
#![feature(iter_zip)]
#![feature(nll)]
// ==========================================================================
rustc_attr!(rustc_promotable, AssumedUsed, template!(Word), IMPL_DETAIL),
- rustc_attr!(rustc_args_required_const, AssumedUsed, template!(List: "N"), INTERNAL_UNSTABLE),
rustc_attr!(rustc_legacy_const_generics, AssumedUsed, template!(List: "N"), INTERNAL_UNSTABLE),
// ==========================================================================
template!(Word, List: "delay_span_bug_from_inside_query")
),
rustc_attr!(TEST, rustc_dump_user_substs, AssumedUsed, template!(Word)),
+ rustc_attr!(TEST, rustc_evaluate_where_clauses, AssumedUsed, template!(Word)),
rustc_attr!(TEST, rustc_if_this_changed, AssumedUsed, template!(Word, List: "DepNode")),
rustc_attr!(TEST, rustc_then_this_would_need, AssumedUsed, template!(List: "DepNode")),
rustc_attr!(
[] attribute: rustc_ast::Attribute,
[] block: rustc_hir::Block<$tcx>,
[] bare_fn_ty: rustc_hir::BareFnTy<$tcx>,
- [few] global_asm: rustc_hir::GlobalAsm,
[] generic_arg: rustc_hir::GenericArg<$tcx>,
[] generic_args: rustc_hir::GenericArgs<$tcx>,
[] generic_bound: rustc_hir::GenericBound<$tcx>,
use rustc_ast::{InlineAsmOptions, InlineAsmTemplatePiece};
use rustc_data_structures::sync::{par_for_each_in, Send, Sync};
use rustc_macros::HashStable_Generic;
-use rustc_span::source_map::{SourceMap, Spanned};
+use rustc_span::source_map::Spanned;
use rustc_span::symbol::{kw, sym, Ident, Symbol};
use rustc_span::{def_id::LocalDefId, BytePos};
use rustc_span::{MultiSpan, Span, DUMMY_SP};
/// This is required mostly for pretty-printing and diagnostics,
/// but also for changing lifetime elision rules to be "function-like".
pub parenthesized: bool,
+ /// The span encompassing arguments and the surrounding brackets `<>` or `()`
+ /// Foo<A, B, AssocTy = D> Fn(T, U, V) -> W
+ /// ^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^
+ /// Note that this may be:
+ /// - empty, if there are no generic brackets (but there may be hidden lifetimes)
+ /// - dummy, if this was generated while desugaring
+ pub span_ext: Span,
}
impl GenericArgs<'_> {
pub const fn none() -> Self {
- Self { args: &[], bindings: &[], parenthesized: false }
+ Self { args: &[], bindings: &[], parenthesized: false, span_ext: DUMMY_SP }
}
pub fn inputs(&self) -> &[Ty<'_>] {
own_counts
}
+ /// The span encompassing the text inside the surrounding brackets.
+ /// It will also include bindings if they aren't in the form `-> Ret`
+ /// Returns `None` if the span is empty (e.g. no brackets) or dummy
pub fn span(&self) -> Option<Span> {
- self.args
- .iter()
- .filter(|arg| !arg.is_synthetic())
- .map(|arg| arg.span())
- .reduce(|span1, span2| span1.to(span2))
+ let span_ext = self.span_ext()?;
+ Some(span_ext.with_lo(span_ext.lo() + BytePos(1)).with_hi(span_ext.hi() - BytePos(1)))
}
/// Returns span encompassing arguments and their surrounding `<>` or `()`
- pub fn span_ext(&self, sm: &SourceMap) -> Option<Span> {
- let mut span = self.span()?;
-
- let (o, c) = if self.parenthesized { ('(', ')') } else { ('<', '>') };
-
- if let Ok(snippet) = sm.span_to_snippet(span) {
- let snippet = snippet.as_bytes();
-
- if snippet[0] != (o as u8) || snippet[snippet.len() - 1] != (c as u8) {
- span = sm.span_extend_to_prev_char(span, o, true);
- span = span.with_lo(span.lo() - BytePos(1));
-
- span = sm.span_extend_to_next_char(span, c, true);
- span = span.with_hi(span.hi() + BytePos(1));
- }
- }
-
- Some(span)
+ pub fn span_ext(&self) -> Option<Span> {
+ Some(self.span_ext).filter(|span| !span.is_empty())
}
pub fn is_empty(&self) -> bool {
pub item_ids: &'hir [ItemId],
}
-#[derive(Encodable, Debug, HashStable_Generic)]
-pub struct GlobalAsm {
- pub asm: Symbol,
-}
-
#[derive(Debug, HashStable_Generic)]
pub struct EnumDef<'hir> {
pub variants: &'hir [Variant<'hir>],
/// An external module, e.g. `extern { .. }`.
ForeignMod { abi: Abi, items: &'hir [ForeignItemRef<'hir>] },
/// Module-level inline assembly (from `global_asm!`).
- GlobalAsm(&'hir GlobalAsm),
+ GlobalAsm(&'hir InlineAsm<'hir>),
/// A type alias, e.g., `type Foo = Bar<u8>`.
TyAlias(&'hir Ty<'hir>, Generics<'hir>),
/// An opaque `impl Trait` type alias, e.g., `type Foo = impl Bar;`.
visitor.visit_id(item.hir_id());
walk_list!(visitor, visit_foreign_item_ref, items);
}
- ItemKind::GlobalAsm(_) => {
+ ItemKind::GlobalAsm(asm) => {
visitor.visit_id(item.hir_id());
+ walk_inline_asm(visitor, asm);
}
ItemKind::TyAlias(ref ty, ref generics) => {
visitor.visit_id(item.hir_id());
}
}
+fn walk_inline_asm<'v, V: Visitor<'v>>(visitor: &mut V, asm: &'v InlineAsm<'v>) {
+ for (op, _op_sp) in asm.operands {
+ match op {
+ InlineAsmOperand::In { expr, .. }
+ | InlineAsmOperand::InOut { expr, .. }
+ | InlineAsmOperand::Sym { expr, .. } => visitor.visit_expr(expr),
+ InlineAsmOperand::Out { expr, .. } => {
+ if let Some(expr) = expr {
+ visitor.visit_expr(expr);
+ }
+ }
+ InlineAsmOperand::SplitInOut { in_expr, out_expr, .. } => {
+ visitor.visit_expr(in_expr);
+ if let Some(out_expr) = out_expr {
+ visitor.visit_expr(out_expr);
+ }
+ }
+ InlineAsmOperand::Const { anon_const } => visitor.visit_anon_const(anon_const),
+ }
+ }
+}
+
pub fn walk_use<'v, V: Visitor<'v>>(visitor: &mut V, path: &'v Path<'v>, hir_id: HirId) {
visitor.visit_id(hir_id);
visitor.visit_path(path, hir_id);
walk_list!(visitor, visit_expr, optional_expression);
}
ExprKind::InlineAsm(ref asm) => {
- for (op, _op_sp) in asm.operands {
- match op {
- InlineAsmOperand::In { expr, .. }
- | InlineAsmOperand::InOut { expr, .. }
- | InlineAsmOperand::Sym { expr, .. } => visitor.visit_expr(expr),
- InlineAsmOperand::Out { expr, .. } => {
- if let Some(expr) = expr {
- visitor.visit_expr(expr);
- }
- }
- InlineAsmOperand::SplitInOut { in_expr, out_expr, .. } => {
- visitor.visit_expr(in_expr);
- if let Some(out_expr) = out_expr {
- visitor.visit_expr(out_expr);
- }
- }
- InlineAsmOperand::Const { anon_const, .. } => {
- visitor.visit_anon_const(anon_const)
- }
- }
- }
+ walk_inline_asm(visitor, asm);
}
ExprKind::LlvmInlineAsm(ref asm) => {
walk_list!(visitor, visit_expr, asm.outputs_exprs);
Range, sym::Range, range_struct, Target::Struct;
RangeToInclusive, sym::RangeToInclusive, range_to_inclusive_struct, Target::Struct;
RangeTo, sym::RangeTo, range_to_struct, Target::Struct;
+ Send, sym::send, send_trait, Target::Trait;
+ UnwindSafe, sym::unwind_safe, unwind_safe_trait, Target::Trait;
+ RefUnwindSafe, sym::ref_unwind_safe, ref_unwind_safe_trait, Target::Trait;
}
}
self.bclose(item.span);
}
- hir::ItemKind::GlobalAsm(ref ga) => {
- self.head(visibility_qualified(&item.vis, "global asm"));
- self.s.word(ga.asm.to_string());
+ hir::ItemKind::GlobalAsm(ref asm) => {
+ self.head(visibility_qualified(&item.vis, "global_asm!"));
+ self.print_inline_asm(asm);
self.end()
}
hir::ItemKind::TyAlias(ref ty, ref generics) => {
self.word(lit.node.to_lit_token().to_string())
}
+ fn print_inline_asm(&mut self, asm: &hir::InlineAsm<'_>) {
+ enum AsmArg<'a> {
+ Template(String),
+ Operand(&'a hir::InlineAsmOperand<'a>),
+ Options(ast::InlineAsmOptions),
+ }
+
+ let mut args = vec![];
+ args.push(AsmArg::Template(ast::InlineAsmTemplatePiece::to_string(&asm.template)));
+ args.extend(asm.operands.iter().map(|(o, _)| AsmArg::Operand(o)));
+ if !asm.options.is_empty() {
+ args.push(AsmArg::Options(asm.options));
+ }
+
+ self.popen();
+ self.commasep(Consistent, &args, |s, arg| match arg {
+ AsmArg::Template(template) => s.print_string(&template, ast::StrStyle::Cooked),
+ AsmArg::Operand(op) => match op {
+ hir::InlineAsmOperand::In { reg, expr } => {
+ s.word("in");
+ s.popen();
+ s.word(format!("{}", reg));
+ s.pclose();
+ s.space();
+ s.print_expr(expr);
+ }
+ hir::InlineAsmOperand::Out { reg, late, expr } => {
+ s.word(if *late { "lateout" } else { "out" });
+ s.popen();
+ s.word(format!("{}", reg));
+ s.pclose();
+ s.space();
+ match expr {
+ Some(expr) => s.print_expr(expr),
+ None => s.word("_"),
+ }
+ }
+ hir::InlineAsmOperand::InOut { reg, late, expr } => {
+ s.word(if *late { "inlateout" } else { "inout" });
+ s.popen();
+ s.word(format!("{}", reg));
+ s.pclose();
+ s.space();
+ s.print_expr(expr);
+ }
+ hir::InlineAsmOperand::SplitInOut { reg, late, in_expr, out_expr } => {
+ s.word(if *late { "inlateout" } else { "inout" });
+ s.popen();
+ s.word(format!("{}", reg));
+ s.pclose();
+ s.space();
+ s.print_expr(in_expr);
+ s.space();
+ s.word_space("=>");
+ match out_expr {
+ Some(out_expr) => s.print_expr(out_expr),
+ None => s.word("_"),
+ }
+ }
+ hir::InlineAsmOperand::Const { anon_const } => {
+ s.word("const");
+ s.space();
+ s.print_anon_const(anon_const);
+ }
+ hir::InlineAsmOperand::Sym { expr } => {
+ s.word("sym");
+ s.space();
+ s.print_expr(expr);
+ }
+ },
+ AsmArg::Options(opts) => {
+ s.word("options");
+ s.popen();
+ let mut options = vec![];
+ if opts.contains(ast::InlineAsmOptions::PURE) {
+ options.push("pure");
+ }
+ if opts.contains(ast::InlineAsmOptions::NOMEM) {
+ options.push("nomem");
+ }
+ if opts.contains(ast::InlineAsmOptions::READONLY) {
+ options.push("readonly");
+ }
+ if opts.contains(ast::InlineAsmOptions::PRESERVES_FLAGS) {
+ options.push("preserves_flags");
+ }
+ if opts.contains(ast::InlineAsmOptions::NORETURN) {
+ options.push("noreturn");
+ }
+ if opts.contains(ast::InlineAsmOptions::NOSTACK) {
+ options.push("nostack");
+ }
+ if opts.contains(ast::InlineAsmOptions::ATT_SYNTAX) {
+ options.push("att_syntax");
+ }
+ s.commasep(Inconsistent, &options, |s, &opt| {
+ s.word(opt);
+ });
+ s.pclose();
+ }
+ });
+ self.pclose();
+ }
+
pub fn print_expr(&mut self, expr: &hir::Expr<'_>) {
self.maybe_print_comment(expr.span.lo());
self.print_outer_attributes(self.attrs(expr.hir_id));
self.print_expr_maybe_paren(&expr, parser::PREC_JUMP);
}
}
- hir::ExprKind::InlineAsm(ref a) => {
- enum AsmArg<'a> {
- Template(String),
- Operand(&'a hir::InlineAsmOperand<'a>),
- Options(ast::InlineAsmOptions),
- }
-
- let mut args = vec![];
- args.push(AsmArg::Template(ast::InlineAsmTemplatePiece::to_string(&a.template)));
- args.extend(a.operands.iter().map(|(o, _)| AsmArg::Operand(o)));
- if !a.options.is_empty() {
- args.push(AsmArg::Options(a.options));
- }
-
+ hir::ExprKind::InlineAsm(ref asm) => {
self.word("asm!");
- self.popen();
- self.commasep(Consistent, &args, |s, arg| match arg {
- AsmArg::Template(template) => s.print_string(&template, ast::StrStyle::Cooked),
- AsmArg::Operand(op) => match op {
- hir::InlineAsmOperand::In { reg, expr } => {
- s.word("in");
- s.popen();
- s.word(format!("{}", reg));
- s.pclose();
- s.space();
- s.print_expr(expr);
- }
- hir::InlineAsmOperand::Out { reg, late, expr } => {
- s.word(if *late { "lateout" } else { "out" });
- s.popen();
- s.word(format!("{}", reg));
- s.pclose();
- s.space();
- match expr {
- Some(expr) => s.print_expr(expr),
- None => s.word("_"),
- }
- }
- hir::InlineAsmOperand::InOut { reg, late, expr } => {
- s.word(if *late { "inlateout" } else { "inout" });
- s.popen();
- s.word(format!("{}", reg));
- s.pclose();
- s.space();
- s.print_expr(expr);
- }
- hir::InlineAsmOperand::SplitInOut { reg, late, in_expr, out_expr } => {
- s.word(if *late { "inlateout" } else { "inout" });
- s.popen();
- s.word(format!("{}", reg));
- s.pclose();
- s.space();
- s.print_expr(in_expr);
- s.space();
- s.word_space("=>");
- match out_expr {
- Some(out_expr) => s.print_expr(out_expr),
- None => s.word("_"),
- }
- }
- hir::InlineAsmOperand::Const { anon_const } => {
- s.word("const");
- s.space();
- s.print_anon_const(anon_const);
- }
- hir::InlineAsmOperand::Sym { expr } => {
- s.word("sym");
- s.space();
- s.print_expr(expr);
- }
- },
- AsmArg::Options(opts) => {
- s.word("options");
- s.popen();
- let mut options = vec![];
- if opts.contains(ast::InlineAsmOptions::PURE) {
- options.push("pure");
- }
- if opts.contains(ast::InlineAsmOptions::NOMEM) {
- options.push("nomem");
- }
- if opts.contains(ast::InlineAsmOptions::READONLY) {
- options.push("readonly");
- }
- if opts.contains(ast::InlineAsmOptions::PRESERVES_FLAGS) {
- options.push("preserves_flags");
- }
- if opts.contains(ast::InlineAsmOptions::NORETURN) {
- options.push("noreturn");
- }
- if opts.contains(ast::InlineAsmOptions::NOSTACK) {
- options.push("nostack");
- }
- if opts.contains(ast::InlineAsmOptions::ATT_SYNTAX) {
- options.push("att_syntax");
- }
- s.commasep(Inconsistent, &options, |s, &opt| {
- s.word(opt);
- });
- s.pclose();
- }
- });
- self.pclose();
+ self.print_inline_asm(asm);
}
hir::ExprKind::LlvmInlineAsm(ref a) => {
let i = &a.inner;
);
diag.span_label(span, format!("lifetime `{}` required", named));
- diag.span_suggestion(
- new_ty_span,
- &format!("add explicit lifetime `{}` to {}", named, span_label_var),
- new_ty.to_string(),
- Applicability::Unspecified,
- );
+ // Suggesting `'static` is nearly always incorrect, and can steer users
+ // down the wrong path.
+ if *named != ty::ReStatic {
+ diag.span_suggestion(
+ new_ty_span,
+ &format!("add explicit lifetime `{}` to {}", named, span_label_var),
+ new_ty.to_string(),
+ Applicability::Unspecified,
+ );
+ }
Some(diag)
}
sess.time("MIR_effect_checking", || {
for def_id in tcx.body_owners() {
- mir::transform::check_unsafety::check_unsafety(tcx, def_id);
+ if tcx.sess.opts.debugging_opts.thir_unsafeck {
+ tcx.ensure().thir_check_unsafety(def_id);
+ } else {
+ mir::transform::check_unsafety::check_unsafety(tcx, def_id);
+ }
if tcx.hir().body_const_context(def_id).is_some() {
tcx.ensure()
tracked!(symbol_mangling_version, Some(SymbolManglingVersion::V0));
tracked!(teach, true);
tracked!(thinlto, Some(true));
+ tracked!(thir_unsafeck, true);
tracked!(tune_cpu, Some(String::from("abc")));
tracked!(tls_model, Some(TlsModel::GeneralDynamic));
tracked!(trap_unreachable, Some(false));
UNSUPPORTED_NAKED_FUNCTIONS,
MISSING_ABI,
SEMICOLON_IN_EXPRESSIONS_FROM_MACROS,
- DISJOINT_CAPTURE_DROP_REORDER,
+ DISJOINT_CAPTURE_MIGRATION,
LEGACY_DERIVE_HELPERS,
PROC_MACRO_BACK_COMPAT,
OR_PATTERNS_BACK_COMPAT,
}
declare_lint! {
- /// The `disjoint_capture_drop_reorder` lint detects variables that aren't completely
+ /// The `disjoint_capture_migration` lint detects variables that aren't completely
/// captured when the feature `capture_disjoint_fields` is enabled and it affects the Drop
/// order of at least one path starting at this variable.
+ /// It can also detect when a variable implements a trait, but one of its field does not and
+ /// the field is captured by a closure and used with the assumption that said field implements
+ /// the same trait as the root variable.
///
- /// ### Example
+ /// ### Example of drop reorder
///
/// ```rust,compile_fail
- /// # #![deny(disjoint_capture_drop_reorder)]
+ /// # #![deny(disjoint_capture_migration)]
/// # #![allow(unused)]
/// struct FancyInteger(i32);
///
///
/// In the above example `p.y` will be dropped at the end of `f` instead of with `c` if
/// the feature `capture_disjoint_fields` is enabled.
- pub DISJOINT_CAPTURE_DROP_REORDER,
+ ///
+ /// ### Example of auto-trait
+ ///
+ /// ```rust,compile_fail
+ /// #![deny(disjoint_capture_migration)]
+ /// use std::thread;
+ ///
+ /// struct Pointer (*mut i32);
+ /// unsafe impl Send for Pointer {}
+ ///
+ /// fn main() {
+ /// let mut f = 10;
+ /// let fptr = Pointer(&mut f as *mut i32);
+ /// thread::spawn(move || unsafe {
+ /// *fptr.0 = 20;
+ /// });
+ /// }
+ /// ```
+ ///
+ /// {{produces}}
+ ///
+ /// ### Explanation
+ ///
+ /// In the above example `fptr.0` is captured when feature `capture_disjoint_fields` is enabled.
+ /// The field is of type *mut i32 which doesn't implement Send, making the code invalid as the
+ /// field cannot be sent between thread safely.
+ pub DISJOINT_CAPTURE_MIGRATION,
Allow,
- "Drop reorder because of `capture_disjoint_fields`"
-
+ "Drop reorder and auto traits error because of `capture_disjoint_fields`"
}
declare_lint_pass!(UnusedDocComment => [UNUSED_DOC_COMMENTS]);
[build-dependencies]
build_helper = { path = "../../src/build_helper" }
-cc = "1.0.60"
+cc = "1.0.67"
use rustc_middle::mir::interpret::{AllocDecodingSession, AllocDecodingState};
use rustc_middle::mir::{self, Body, Promoted};
use rustc_middle::ty::codec::TyDecoder;
-use rustc_middle::ty::{self, Ty, TyCtxt};
+use rustc_middle::ty::{self, Ty, TyCtxt, Visibility};
use rustc_serialize::{opaque, Decodable, Decoder};
use rustc_session::Session;
use rustc_span::hygiene::ExpnDataDecodeMode;
impl<'a, 'tcx> Decodable<DecodeContext<'a, 'tcx>> for Span {
fn decode(decoder: &mut DecodeContext<'a, 'tcx>) -> Result<Span, String> {
+ let ctxt = SyntaxContext::decode(decoder)?;
let tag = u8::decode(decoder)?;
- if tag == TAG_INVALID_SPAN {
- return Ok(DUMMY_SP);
+ if tag == TAG_PARTIAL_SPAN {
+ return Ok(DUMMY_SP.with_ctxt(ctxt));
}
debug_assert!(tag == TAG_VALID_SPAN_LOCAL || tag == TAG_VALID_SPAN_FOREIGN);
let lo = BytePos::decode(decoder)?;
let len = BytePos::decode(decoder)?;
- let ctxt = SyntaxContext::decode(decoder)?;
let hi = lo + len;
let sess = if let Some(sess) = decoder.sess {
.collect()
}
+ fn get_struct_field_visibilities(&self, id: DefIndex) -> Vec<Visibility> {
+ self.root
+ .tables
+ .children
+ .get(self, id)
+ .unwrap_or_else(Lazy::empty)
+ .decode(self)
+ .map(|field_index| self.get_visibility(field_index))
+ .collect()
+ }
+
fn get_inherent_implementations_for_type(
&self,
tcx: TyCtxt<'tcx>,
use rustc_data_structures::stable_map::FxHashMap;
use rustc_data_structures::svh::Svh;
use rustc_hir as hir;
-use rustc_hir::def::DefKind;
+use rustc_hir::def::{CtorKind, DefKind};
use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, CRATE_DEF_INDEX, LOCAL_CRATE};
use rustc_hir::definitions::{DefKey, DefPath, DefPathHash};
use rustc_middle::hir::exports::Export;
use rustc_middle::middle::exported_symbols::ExportedSymbol;
use rustc_middle::middle::stability::DeprecationEntry;
use rustc_middle::ty::query::Providers;
-use rustc_middle::ty::{self, TyCtxt};
+use rustc_middle::ty::{self, TyCtxt, Visibility};
use rustc_session::utils::NativeLibKind;
use rustc_session::{CrateDisambiguator, Session};
use rustc_span::source_map::{Span, Spanned};
self.get_crate_data(def.krate).get_struct_field_names(def.index, sess)
}
+ pub fn struct_field_visibilities_untracked(&self, def: DefId) -> Vec<Visibility> {
+ self.get_crate_data(def.krate).get_struct_field_visibilities(def.index)
+ }
+
+ pub fn ctor_def_id_and_kind_untracked(&self, def: DefId) -> Option<(DefId, CtorKind)> {
+ self.get_crate_data(def.krate).get_ctor_def_id(def.index).map(|ctor_def_id| {
+ (ctor_def_id, self.get_crate_data(def.krate).get_ctor_kind(def.index))
+ })
+ }
+
+ pub fn visibility_untracked(&self, def: DefId) -> Visibility {
+ self.get_crate_data(def.krate).get_visibility(def.index)
+ }
+
pub fn item_children_untracked(
&self,
def_id: DefId,
impl<'a, 'tcx> Encodable<EncodeContext<'a, 'tcx>> for Span {
fn encode(&self, s: &mut EncodeContext<'a, 'tcx>) -> opaque::EncodeResult {
- if *self == rustc_span::DUMMY_SP {
- return TAG_INVALID_SPAN.encode(s);
+ let span = self.data();
+
+ // Don't serialize any `SyntaxContext`s from a proc-macro crate,
+ // since we don't load proc-macro dependencies during serialization.
+ // This means that any hygiene information from macros used *within*
+ // a proc-macro crate (e.g. invoking a macro that expands to a proc-macro
+ // definition) will be lost.
+ //
+ // This can show up in two ways:
+ //
+ // 1. Any hygiene information associated with identifier of
+ // a proc macro (e.g. `#[proc_macro] pub fn $name`) will be lost.
+ // Since proc-macros can only be invoked from a different crate,
+ // real code should never need to care about this.
+ //
+ // 2. Using `Span::def_site` or `Span::mixed_site` will not
+ // include any hygiene information associated with the definition
+ // site. This means that a proc-macro cannot emit a `$crate`
+ // identifier which resolves to one of its dependencies,
+ // which also should never come up in practice.
+ //
+ // Additionally, this affects `Span::parent`, and any other
+ // span inspection APIs that would otherwise allow traversing
+ // the `SyntaxContexts` associated with a span.
+ //
+ // None of these user-visible effects should result in any
+ // cross-crate inconsistencies (getting one behavior in the same
+ // crate, and a different behavior in another crate) due to the
+ // limited surface that proc-macros can expose.
+ //
+ // IMPORTANT: If this is ever changed, be sure to update
+ // `rustc_span::hygiene::raw_encode_expn_id` to handle
+ // encoding `ExpnData` for proc-macro crates.
+ if s.is_proc_macro {
+ SyntaxContext::root().encode(s)?;
+ } else {
+ span.ctxt.encode(s)?;
}
- let span = self.data();
+ if self.is_dummy() {
+ return TAG_PARTIAL_SPAN.encode(s);
+ }
// The Span infrastructure should make sure that this invariant holds:
debug_assert!(span.lo <= span.hi);
if !s.source_file_cache.0.contains(span.hi) {
// Unfortunately, macro expansion still sometimes generates Spans
// that malformed in this way.
- return TAG_INVALID_SPAN.encode(s);
+ return TAG_PARTIAL_SPAN.encode(s);
}
let source_files = s.required_source_files.as_mut().expect("Already encoded SourceMap!");
let len = hi - lo;
len.encode(s)?;
- // Don't serialize any `SyntaxContext`s from a proc-macro crate,
- // since we don't load proc-macro dependencies during serialization.
- // This means that any hygiene information from macros used *within*
- // a proc-macro crate (e.g. invoking a macro that expands to a proc-macro
- // definition) will be lost.
- //
- // This can show up in two ways:
- //
- // 1. Any hygiene information associated with identifier of
- // a proc macro (e.g. `#[proc_macro] pub fn $name`) will be lost.
- // Since proc-macros can only be invoked from a different crate,
- // real code should never need to care about this.
- //
- // 2. Using `Span::def_site` or `Span::mixed_site` will not
- // include any hygiene information associated with the definition
- // site. This means that a proc-macro cannot emit a `$crate`
- // identifier which resolves to one of its dependencies,
- // which also should never come up in practice.
- //
- // Additionally, this affects `Span::parent`, and any other
- // span inspection APIs that would otherwise allow traversing
- // the `SyntaxContexts` associated with a span.
- //
- // None of these user-visible effects should result in any
- // cross-crate inconsistencies (getting one behavior in the same
- // crate, and a different behavior in another crate) due to the
- // limited surface that proc-macros can expose.
- //
- // IMPORTANT: If this is ever changed, be sure to update
- // `rustc_span::hygiene::raw_encode_expn_id` to handle
- // encoding `ExpnData` for proc-macro crates.
- if s.is_proc_macro {
- SyntaxContext::root().encode(s)?;
- } else {
- span.ctxt.encode(s)?;
- }
-
if tag == TAG_VALID_SPAN_FOREIGN {
// This needs to be two lines to avoid holding the `s.source_file_cache`
// while calling `cnum.encode(s)`
// Tags used for encoding Spans:
const TAG_VALID_SPAN_LOCAL: u8 = 0;
const TAG_VALID_SPAN_FOREIGN: u8 = 1;
-const TAG_INVALID_SPAN: u8 = 2;
+const TAG_PARTIAL_SPAN: u8 = 2;
/// Returns coverage summary info for a function, after executing the `InstrumentCoverage`
/// MIR pass (assuming the -Zinstrument-coverage option is enabled).
- query coverageinfo(key: DefId) -> mir::CoverageInfo {
- desc { |tcx| "retrieving coverage info from MIR for `{}`", tcx.def_path_str(key) }
+ query coverageinfo(key: ty::InstanceDef<'tcx>) -> mir::CoverageInfo {
+ desc { |tcx| "retrieving coverage info from MIR for `{}`", tcx.def_path_str(key.def_id()) }
storage(ArenaCacheSelector<'tcx>)
- cache_on_disk_if { key.is_local() }
}
/// Returns the name of the file that contains the function body, if instrumented for coverage.
}
}
+ /// Unsafety-check this `LocalDefId` with THIR unsafeck. This should be
+ /// used with `-Zthir-unsafeck`.
+ query thir_check_unsafety(key: LocalDefId) {
+ desc { |tcx| "unsafety-checking `{}`", tcx.def_path_str(key.to_def_id()) }
+ cache_on_disk_if { true }
+ }
+ query thir_check_unsafety_for_const_arg(key: (LocalDefId, DefId)) {
+ desc {
+ |tcx| "unsafety-checking the const argument `{}`",
+ tcx.def_path_str(key.0.to_def_id())
+ }
+ }
+
/// HACK: when evaluated, this reports a "unsafe derive on repr(packed)" error.
///
/// Unsafety checking is executed for each method separately, but we only want
self.loc,
InteriorOfSliceOrArray {
ty: place_ty,
- is_index: match elem {
- ProjectionElem::Index(..) => true,
- _ => false,
- },
+ is_index: matches!(elem, ProjectionElem::Index(..)),
},
));
}
use rustc_middle::ty::adjustment::PointerCast;
use rustc_middle::ty::layout::{IntegerExt, TyAndLayout};
use rustc_middle::ty::{self, FloatTy, Ty, TypeAndMut};
-use rustc_span::symbol::sym;
use rustc_target::abi::{Integer, LayoutOf, Variants};
use super::{
// All reifications must be monomorphic, bail out otherwise.
ensure_monomorphic_enough(*self.tcx, src.layout.ty)?;
- if self.tcx.has_attr(def_id, sym::rustc_args_required_const) {
- span_bug!(
- self.cur_span(),
- "reifying a fn ptr that requires const arguments"
- );
- }
-
let instance = ty::Instance::resolve_for_fn_ptr(
*self.tcx,
self.param_env,
let base_intern_mode = match intern_kind {
InternKind::Static(mutbl) => InternMode::Static(mutbl),
// `Constant` includes array lengths.
- // `Promoted` includes non-`Copy` array initializers and `rustc_args_required_const` arguments.
InternKind::Constant | InternKind::Promoted => InternMode::Const,
};
collect_neighbours(tcx, instance, &mut neighbors);
});
}
- MonoItem::GlobalAsm(..) => {
+ MonoItem::GlobalAsm(item_id) => {
recursion_depth_reset = None;
+
+ let item = tcx.hir().item(item_id);
+ if let hir::ItemKind::GlobalAsm(asm) = item.kind {
+ for (op, op_sp) in asm.operands {
+ match op {
+ hir::InlineAsmOperand::Const { .. } => {
+ // Only constants which resolve to a plain integer
+ // are supported. Therefore the value should not
+ // depend on any other items.
+ }
+ _ => span_bug!(*op_sp, "invalid operand type for global_asm!"),
+ }
+ }
+ } else {
+ span_bug!(item.span, "Mismatch between hir::Item type and MonoItem type")
+ }
}
}
use rustc_middle::mir::coverage::*;
use rustc_middle::mir::{self, BasicBlock, TerminatorKind};
use rustc_middle::ty::TyCtxt;
+use rustc_span::Span;
use std::iter;
use std::lazy::SyncOnceCell;
mir_body: &mir::Body<'tcx>,
basic_coverage_blocks: &CoverageGraph,
pass_name: &str,
+ body_span: Span,
coverage_spans: &Vec<CoverageSpan>,
) {
let mir_source = mir_body.source;
let crate_name = tcx.crate_name(def_id.krate);
let item_name = tcx.def_path(def_id).to_filename_friendly_no_crate();
let title = format!("{}.{} - Coverage Spans", crate_name, item_name);
- spanview::write_document(tcx, def_id, span_viewables, &title, &mut file)
+ spanview::write_document(tcx, body_span, span_viewables, &title, &mut file)
.expect("Unexpected IO error dumping coverage spans as HTML");
}
trace!("InstrumentCoverage starting for {:?}", mir_source.def_id());
Instrumentor::new(&self.name(), tcx, mir_body).inject_counters();
- trace!("InstrumentCoverage starting for {:?}", mir_source.def_id());
+ trace!("InstrumentCoverage done for {:?}", mir_source.def_id());
}
}
let def_id = mir_body.source.def_id();
let (some_fn_sig, hir_body) = fn_sig_and_body(tcx, def_id);
- let mut body_span = hir_body.value.span;
-
- if tcx.is_closure(def_id) {
- // If the MIR function is a closure, and if the closure body span
- // starts from a macro, but it's content is not in that macro, try
- // to find a non-macro callsite, and instrument the spans there
- // instead.
- loop {
- let expn_data = body_span.ctxt().outer_expn_data();
- if expn_data.is_root() {
- break;
- }
- if let ExpnKind::Macro { .. } = expn_data.kind {
- body_span = expn_data.call_site;
- } else {
- break;
- }
- }
- }
+ let body_span = get_body_span(tcx, hir_body, mir_body);
let source_file = source_map.lookup_source_file(body_span.lo());
let fn_sig_span = match some_fn_sig.filter(|fn_sig| {
Some(fn_sig) => fn_sig.span.with_hi(body_span.lo()),
None => body_span.shrink_to_lo(),
};
+
+ debug!(
+ "instrumenting {}: {:?}, fn sig span: {:?}, body span: {:?}",
+ if tcx.is_closure(def_id) { "closure" } else { "function" },
+ def_id,
+ fn_sig_span,
+ body_span
+ );
+
let function_source_hash = hash_mir_source(tcx, hir_body);
let basic_coverage_blocks = CoverageGraph::from_mir(mir_body);
Self {
fn inject_counters(&'a mut self) {
let tcx = self.tcx;
- let source_map = tcx.sess.source_map();
let mir_source = self.mir_body.source;
let def_id = mir_source.def_id();
let fn_sig_span = self.fn_sig_span;
let body_span = self.body_span;
- debug!(
- "instrumenting {:?}, fn sig span: {}, body span: {}",
- def_id,
- source_map.span_to_diagnostic_string(fn_sig_span),
- source_map.span_to_diagnostic_string(body_span)
- );
-
let mut graphviz_data = debug::GraphvizData::new();
let mut debug_used_expressions = debug::UsedExpressions::new();
self.mir_body,
&self.basic_coverage_blocks,
self.pass_name,
+ body_span,
&coverage_spans,
);
}
(hir::map::fn_sig(hir_node), tcx.hir().body(fn_body_id))
}
+fn get_body_span<'tcx>(
+ tcx: TyCtxt<'tcx>,
+ hir_body: &rustc_hir::Body<'tcx>,
+ mir_body: &mut mir::Body<'tcx>,
+) -> Span {
+ let mut body_span = hir_body.value.span;
+ let def_id = mir_body.source.def_id();
+
+ if tcx.is_closure(def_id) {
+ // If the MIR function is a closure, and if the closure body span
+ // starts from a macro, but it's content is not in that macro, try
+ // to find a non-macro callsite, and instrument the spans there
+ // instead.
+ loop {
+ let expn_data = body_span.ctxt().outer_expn_data();
+ if expn_data.is_root() {
+ break;
+ }
+ if let ExpnKind::Macro { .. } = expn_data.kind {
+ body_span = expn_data.call_site;
+ } else {
+ break;
+ }
+ }
+ }
+
+ body_span
+}
+
fn hash_mir_source<'tcx>(tcx: TyCtxt<'tcx>, hir_body: &'tcx rustc_hir::Body<'tcx>) -> u64 {
let mut hcx = tcx.create_no_span_stable_hashing_context();
hash(&mut hcx, &hir_body.value).to_smaller_hash()
}
}
-fn coverageinfo<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> CoverageInfo {
- let mir_body = mir_body(tcx, def_id);
+fn coverageinfo<'tcx>(tcx: TyCtxt<'tcx>, instance_def: ty::InstanceDef<'tcx>) -> CoverageInfo {
+ let mir_body = tcx.instance_mir(instance_def);
let mut coverage_visitor = CoverageVisitor {
// num_counters always has at least the `ZERO` counter.
.iter()
.enumerate()
.filter_map(move |(index, statement)| {
- filtered_statement_span(statement, self.body_span).map(
- |(span, expn_span)| {
- CoverageSpan::for_statement(
- statement, span, expn_span, bcb, bb, index,
- )
- },
- )
+ filtered_statement_span(statement).map(|span| {
+ CoverageSpan::for_statement(
+ statement,
+ function_source_span(span, self.body_span),
+ span,
+ bcb,
+ bb,
+ index,
+ )
+ })
})
- .chain(filtered_terminator_span(data.terminator(), self.body_span).map(
- |(span, expn_span)| CoverageSpan::for_terminator(span, expn_span, bcb, bb),
- ))
+ .chain(filtered_terminator_span(data.terminator()).map(|span| {
+ CoverageSpan::for_terminator(
+ function_source_span(span, self.body_span),
+ span,
+ bcb,
+ bb,
+ )
+ }))
})
.collect()
}
}
}
-/// See `function_source_span()` for a description of the two returned spans.
-/// If the MIR `Statement` is not contributive to computing coverage spans,
-/// returns `None`.
-pub(super) fn filtered_statement_span(
- statement: &'a Statement<'tcx>,
- body_span: Span,
-) -> Option<(Span, Span)> {
+/// If the MIR `Statement` has a span contributive to computing coverage spans,
+/// return it; otherwise return `None`.
+pub(super) fn filtered_statement_span(statement: &'a Statement<'tcx>) -> Option<Span> {
match statement.kind {
// These statements have spans that are often outside the scope of the executed source code
// for their parent `BasicBlock`.
| StatementKind::LlvmInlineAsm(_)
| StatementKind::Retag(_, _)
| StatementKind::AscribeUserType(_, _) => {
- Some(function_source_span(statement.source_info.span, body_span))
+ Some(statement.source_info.span)
}
}
}
-/// See `function_source_span()` for a description of the two returned spans.
-/// If the MIR `Terminator` is not contributive to computing coverage spans,
-/// returns `None`.
-pub(super) fn filtered_terminator_span(
- terminator: &'a Terminator<'tcx>,
- body_span: Span,
-) -> Option<(Span, Span)> {
+/// If the MIR `Terminator` has a span contributive to computing coverage spans,
+/// return it; otherwise return `None`.
+pub(super) fn filtered_terminator_span(terminator: &'a Terminator<'tcx>) -> Option<Span> {
match terminator.kind {
// These terminators have spans that don't positively contribute to computing a reasonable
// span of actually executed source code. (For example, SwitchInt terminators extracted from
span = span.with_lo(constant.span.lo());
}
}
- Some(function_source_span(span, body_span))
+ Some(span)
}
// Retain spans from all other terminators
| TerminatorKind::GeneratorDrop
| TerminatorKind::FalseUnwind { .. }
| TerminatorKind::InlineAsm { .. } => {
- Some(function_source_span(terminator.source_info.span, body_span))
+ Some(terminator.source_info.span)
}
}
}
-/// Returns two spans from the given span (the span associated with a
-/// `Statement` or `Terminator`):
-///
-/// 1. An extrapolated span (pre-expansion[^1]) corresponding to a range within
-/// the function's body source. This span is guaranteed to be contained
-/// within, or equal to, the `body_span`. If the extrapolated span is not
-/// contained within the `body_span`, the `body_span` is returned.
-/// 2. The actual `span` value from the `Statement`, before expansion.
-///
-/// Only the first span is used when computing coverage code regions. The second
-/// span is useful if additional expansion data is needed (such as to look up
-/// the macro name for a composed span within that macro).)
+/// Returns an extrapolated span (pre-expansion[^1]) corresponding to a range
+/// within the function's body source. This span is guaranteed to be contained
+/// within, or equal to, the `body_span`. If the extrapolated span is not
+/// contained within the `body_span`, the `body_span` is returned.
///
-/// [^1]Expansions result from Rust syntax including macros, syntactic
-/// sugar, etc.).
+/// [^1]Expansions result from Rust syntax including macros, syntactic sugar,
+/// etc.).
#[inline]
-fn function_source_span(span: Span, body_span: Span) -> (Span, Span) {
+pub(super) fn function_source_span(span: Span, body_span: Span) -> Span {
let original_span = original_sp(span, body_span).with_ctxt(body_span.ctxt());
- (if body_span.contains(original_span) { original_span } else { body_span }, span)
+ if body_span.contains(original_span) { original_span } else { body_span }
}
let mut basic_coverage_blocks = graph::CoverageGraph::from_mir(&mir_body);
let mut coverage_spans = Vec::new();
for (bcb, data) in basic_coverage_blocks.iter_enumerated() {
- if let Some((span, expn_span)) =
- spans::filtered_terminator_span(data.terminator(&mir_body), body_span)
- {
+ if let Some(span) = spans::filtered_terminator_span(data.terminator(&mir_body)) {
coverage_spans.push(spans::CoverageSpan::for_terminator(
+ spans::function_source_span(span, body_span),
span,
- expn_span,
bcb,
data.last_bb(),
));
use rustc_middle::ty::subst::SubstsRef;
use rustc_middle::ty::{self, Ty, TyCtxt};
use rustc_span::symbol::{sym, Symbol};
+use rustc_span::Span;
use rustc_target::spec::abi::Abi;
pub struct LowerIntrinsics;
terminator.kind = TerminatorKind::Goto { target };
}
}
+ _ if intrinsic_name.as_str().starts_with("simd_shuffle") => {
+ validate_simd_shuffle(tcx, args, terminator.source_info.span);
+ }
_ => {}
}
}
) -> Option<(Symbol, SubstsRef<'tcx>)> {
if let ty::FnDef(def_id, substs) = *func_ty.kind() {
let fn_sig = func_ty.fn_sig(tcx);
- if fn_sig.abi() == Abi::RustIntrinsic {
+ if let Abi::RustIntrinsic | Abi::PlatformIntrinsic = fn_sig.abi() {
return Some((tcx.item_name(def_id), substs));
}
}
None
}
+
+fn validate_simd_shuffle(tcx: TyCtxt<'tcx>, args: &[Operand<'tcx>], span: Span) {
+ match &args[2] {
+ Operand::Constant(_) => {} // all good
+ _ => {
+ let msg = format!("last argument of `simd_shuffle` is required to be a `const` item");
+ tcx.sess.span_err(span, &msg);
+ }
+ }
+}
//! initialization and can otherwise silence errors, if
//! move analysis runs after promotion on broken MIR.
-use rustc_ast::LitKind;
use rustc_hir as hir;
-use rustc_hir::def_id::DefId;
use rustc_middle::mir::traversal::ReversePostorder;
use rustc_middle::mir::visit::{MutVisitor, MutatingUseContext, PlaceContext, Visitor};
use rustc_middle::mir::*;
use rustc_middle::ty::cast::CastTy;
use rustc_middle::ty::subst::InternalSubsts;
use rustc_middle::ty::{self, List, TyCtxt, TypeFoldable};
-use rustc_span::symbol::sym;
use rustc_span::Span;
use rustc_index::vec::{Idx, IndexVec};
-use rustc_target::spec::abi::Abi;
use std::cell::Cell;
use std::{cmp, iter, mem};
/// A `MirPass` for promotion.
///
-/// Promotion is the extraction of promotable temps into separate MIR bodies. This pass also emits
-/// errors when promotion of `#[rustc_args_required_const]` arguments fails.
+/// Promotion is the extraction of promotable temps into separate MIR bodies so they can have
+/// `'static` lifetime.
///
/// After this pass is run, `promoted_fragments` will hold the MIR body corresponding to each
/// newly created `Constant`.
pub enum Candidate {
/// Borrow of a constant temporary, candidate for lifetime extension.
Ref(Location),
-
- /// Currently applied to function calls where the callee has the unstable
- /// `#[rustc_args_required_const]` attribute as well as the SIMD shuffle
- /// intrinsic. The intrinsic requires the arguments are indeed constant and
- /// the attribute currently provides the semantic requirement that arguments
- /// must be constant.
- Argument { bb: BasicBlock, index: usize },
}
impl Candidate {
- /// Returns `true` if we should use the "explicit" rules for promotability for this `Candidate`.
- fn forces_explicit_promotion(&self) -> bool {
- match self {
- Candidate::Ref(_) => false,
- Candidate::Argument { .. } => true,
- }
- }
-
fn source_info(&self, body: &Body<'_>) -> SourceInfo {
match self {
Candidate::Ref(location) => *body.source_info(*location),
- Candidate::Argument { bb, .. } => *body.source_info(body.terminator_loc(*bb)),
}
}
}
-fn args_required_const(tcx: TyCtxt<'_>, def_id: DefId) -> Option<Vec<usize>> {
- let attrs = tcx.get_attrs(def_id);
- let attr = attrs.iter().find(|a| tcx.sess.check_name(a, sym::rustc_args_required_const))?;
- let mut ret = vec![];
- for meta in attr.meta_item_list()? {
- match meta.literal()?.kind {
- LitKind::Int(a, _) => {
- ret.push(a as usize);
- }
- _ => bug!("invalid arg index"),
- }
- }
- Some(ret)
-}
-
struct Collector<'a, 'tcx> {
ccx: &'a ConstCx<'a, 'tcx>,
temps: IndexVec<Local, TempState>,
_ => {}
}
}
-
- fn visit_terminator(&mut self, terminator: &Terminator<'tcx>, location: Location) {
- self.super_terminator(terminator, location);
-
- if let TerminatorKind::Call { ref func, .. } = terminator.kind {
- if let ty::FnDef(def_id, _) = *func.ty(self.ccx.body, self.ccx.tcx).kind() {
- let fn_sig = self.ccx.tcx.fn_sig(def_id);
- if let Abi::RustIntrinsic | Abi::PlatformIntrinsic = fn_sig.abi() {
- let name = self.ccx.tcx.item_name(def_id);
- // FIXME(eddyb) use `#[rustc_args_required_const(2)]` for shuffles.
- if name.as_str().starts_with("simd_shuffle") {
- self.candidates.push(Candidate::Argument { bb: location.block, index: 2 });
-
- return; // Don't double count `simd_shuffle` candidates
- }
- }
-
- if let Some(constant_args) = args_required_const(self.ccx.tcx, def_id) {
- for index in constant_args {
- self.candidates.push(Candidate::Argument { bb: location.block, index });
- }
- }
- }
- }
- }
}
pub fn collect_temps_and_candidates(
struct Validator<'a, 'tcx> {
ccx: &'a ConstCx<'a, 'tcx>,
temps: &'a IndexVec<Local, TempState>,
-
- /// Explicit promotion happens e.g. for constant arguments declared via
- /// `rustc_args_required_const`.
- /// Implicit promotion has almost the same rules, except that disallows `const fn`
- /// except for those marked `#[rustc_promotable]`. This is to avoid changing
- /// a legitimate run-time operation into a failing compile-time operation
- /// e.g. due to addresses being compared inside the function.
- explicit: bool,
}
impl std::ops::Deref for Validator<'a, 'tcx> {
fn validate_candidate(&self, candidate: Candidate) -> Result<(), Unpromotable> {
match candidate {
Candidate::Ref(loc) => {
- assert!(!self.explicit);
-
let statement = &self.body[loc.block].statements[loc.statement_index];
match &statement.kind {
StatementKind::Assign(box (_, Rvalue::Ref(_, kind, place))) => {
_ => bug!(),
}
}
- Candidate::Argument { bb, index } => {
- assert!(self.explicit);
-
- let terminator = self.body[bb].terminator();
- match &terminator.kind {
- TerminatorKind::Call { args, .. } => self.validate_operand(&args[index]),
- _ => bug!(),
- }
- }
}
}
ProjectionElem::ConstantIndex { .. } | ProjectionElem::Subslice { .. } => {}
ProjectionElem::Index(local) => {
- if !self.explicit {
- let mut promotable = false;
- // Only accept if we can predict the index and are indexing an array.
- let val = if let TempState::Defined { location: loc, .. } =
- self.temps[local]
- {
+ let mut promotable = false;
+ // Only accept if we can predict the index and are indexing an array.
+ let val =
+ if let TempState::Defined { location: loc, .. } = self.temps[local] {
let block = &self.body[loc.block];
if loc.statement_index < block.statements.len() {
let statement = &block.statements[loc.statement_index];
} else {
None
};
- if let Some(idx) = val {
- // Determine the type of the thing we are indexing.
- let ty = place_base.ty(self.body, self.tcx).ty;
- match ty.kind() {
- ty::Array(_, len) => {
- // It's an array; determine its length.
- if let Some(len) =
- len.try_eval_usize(self.tcx, self.param_env)
- {
- // If the index is in-bounds, go ahead.
- if idx < len {
- promotable = true;
- }
+ if let Some(idx) = val {
+ // Determine the type of the thing we are indexing.
+ let ty = place_base.ty(self.body, self.tcx).ty;
+ match ty.kind() {
+ ty::Array(_, len) => {
+ // It's an array; determine its length.
+ if let Some(len) = len.try_eval_usize(self.tcx, self.param_env)
+ {
+ // If the index is in-bounds, go ahead.
+ if idx < len {
+ promotable = true;
}
}
- _ => {}
}
+ _ => {}
}
- if !promotable {
- return Err(Unpromotable);
- }
}
+ if !promotable {
+ return Err(Unpromotable);
+ }
+
self.validate_local(local)?;
}
match op {
BinOp::Div | BinOp::Rem => {
- if !self.explicit && lhs_ty.is_integral() {
+ if lhs_ty.is_integral() {
// Integer division: the RHS must be a non-zero const.
let const_val = match rhs {
Operand::Constant(c) => {
) -> Result<(), Unpromotable> {
let fn_ty = callee.ty(self.body, self.tcx);
- // When doing explicit promotion and inside const/static items, we promote all (eligible) function calls.
+ // Inside const/static items, we promote all (eligible) function calls.
// Everywhere else, we require `#[rustc_promotable]` on the callee.
- let promote_all_const_fn = self.explicit
- || matches!(
- self.const_kind,
- Some(hir::ConstContext::Static(_) | hir::ConstContext::Const)
- );
+ let promote_all_const_fn = matches!(
+ self.const_kind,
+ Some(hir::ConstContext::Static(_) | hir::ConstContext::Const)
+ );
if !promote_all_const_fn {
if let ty::FnDef(def_id, _) = *fn_ty.kind() {
// Never promote runtime `const fn` calls of
temps: &IndexVec<Local, TempState>,
candidates: &[Candidate],
) -> Vec<Candidate> {
- let mut validator = Validator { ccx, temps, explicit: false };
+ let validator = Validator { ccx, temps };
candidates
.iter()
.copied()
- .filter(|&candidate| {
- validator.explicit = candidate.forces_explicit_promotion();
-
- // FIXME(eddyb) also emit the errors for shuffle indices
- // and `#[rustc_args_required_const]` arguments here.
-
- let is_promotable = validator.validate_candidate(candidate).is_ok();
-
- // If we use explicit validation, we carry the risk of turning a legitimate run-time
- // operation into a failing compile-time operation. Make sure that does not happen
- // by asserting that there is no possible run-time behavior here in case promotion
- // fails.
- if validator.explicit && !is_promotable {
- ccx.tcx.sess.delay_span_bug(
- ccx.body.span,
- "Explicit promotion requested, but failed to promote",
- );
- }
-
- match candidate {
- Candidate::Argument { bb, index } if !is_promotable => {
- let span = ccx.body[bb].terminator().source_info.span;
- let msg = format!("argument {} is required to be a constant", index + 1);
- ccx.tcx.sess.span_err(span, &msg);
- }
- _ => (),
- }
-
- is_promotable
- })
+ .filter(|&candidate| validator.validate_candidate(candidate).is_ok())
.collect()
}
_ => bug!(),
}
}
- Candidate::Argument { bb, index } => {
- let terminator = blocks[bb].terminator_mut();
- match terminator.kind {
- TerminatorKind::Call { ref mut args, .. } => {
- let ty = args[index].ty(local_decls, self.tcx);
- let span = terminator.source_info.span;
-
- Rvalue::Use(mem::replace(&mut args[index], promoted_operand(ty, span)))
- }
- // We expected a `TerminatorKind::Call` for which we'd like to promote an
- // argument. `qualify_consts` saw a `TerminatorKind::Call` here, but
- // we are seeing a `Goto`. That means that the `promote_temps` method
- // already promoted this call away entirely. This case occurs when calling
- // a function requiring a constant argument and as that constant value
- // providing a value whose computation contains another call to a function
- // requiring a constant argument.
- TerminatorKind::Goto { .. } => return None,
- _ => bug!(),
- }
- }
}
};
}
}
}
- Candidate::Argument { .. } => {}
}
// Declare return place local so that `mir::Body::new` doesn't complain.
}
}
}
- write_document(tcx, def_id, span_viewables, title, w)?;
+ write_document(tcx, fn_span(tcx, def_id), span_viewables, title, w)?;
Ok(())
}
/// list `SpanViewable`s.
pub fn write_document<'tcx, W>(
tcx: TyCtxt<'tcx>,
- def_id: DefId,
+ spanview_span: Span,
mut span_viewables: Vec<SpanViewable>,
title: &str,
w: &mut W,
where
W: Write,
{
- let fn_span = fn_span(tcx, def_id);
- let mut from_pos = fn_span.lo();
- let end_pos = fn_span.hi();
+ let mut from_pos = spanview_span.lo();
+ let end_pos = spanview_span.hi();
let source_map = tcx.sess.source_map();
let start = source_map.lookup_char_pos(from_pos);
let indent_to_initial_start_col = " ".repeat(start.col.to_usize());
debug!(
- "fn_span source is:\n{}{}",
+ "spanview_span={:?}; source is:\n{}{}",
+ spanview_span,
indent_to_initial_start_col,
- source_map.span_to_snippet(fn_span).expect("function should have printable source")
+ source_map.span_to_snippet(spanview_span).expect("function should have printable source")
);
writeln!(w, "{}", HEADER)?;
writeln!(w, "<title>{}</title>", title)?;
--- /dev/null
+use crate::thir::visit::{self, Visitor};
+use crate::thir::*;
+
+use rustc_errors::struct_span_err;
+use rustc_hir as hir;
+use rustc_middle::ty::{self, TyCtxt};
+use rustc_session::lint::builtin::{UNSAFE_OP_IN_UNSAFE_FN, UNUSED_UNSAFE};
+use rustc_session::lint::Level;
+use rustc_span::def_id::{DefId, LocalDefId};
+use rustc_span::Span;
+
+struct UnsafetyVisitor<'tcx> {
+ tcx: TyCtxt<'tcx>,
+ /// The `HirId` of the current scope, which would be the `HirId`
+ /// of the current HIR node, modulo adjustments. Used for lint levels.
+ hir_context: hir::HirId,
+ /// The current "safety context". This notably tracks whether we are in an
+ /// `unsafe` block, and whether it has been used.
+ safety_context: SafetyContext,
+ body_unsafety: BodyUnsafety,
+}
+
+impl<'tcx> UnsafetyVisitor<'tcx> {
+ fn in_safety_context<R>(
+ &mut self,
+ safety_context: SafetyContext,
+ f: impl FnOnce(&mut Self) -> R,
+ ) {
+ if let (
+ SafetyContext::UnsafeBlock { span: enclosing_span, .. },
+ SafetyContext::UnsafeBlock { span: block_span, hir_id, .. },
+ ) = (self.safety_context, safety_context)
+ {
+ self.warn_unused_unsafe(
+ hir_id,
+ block_span,
+ Some(self.tcx.sess.source_map().guess_head_span(enclosing_span)),
+ );
+ f(self);
+ } else {
+ let prev_context = self.safety_context;
+ self.safety_context = safety_context;
+
+ f(self);
+
+ if let SafetyContext::UnsafeBlock { used: false, span, hir_id } = self.safety_context {
+ self.warn_unused_unsafe(hir_id, span, self.body_unsafety.unsafe_fn_sig_span());
+ }
+ self.safety_context = prev_context;
+ return;
+ }
+ }
+
+ fn requires_unsafe(&mut self, span: Span, kind: UnsafeOpKind) {
+ let (description, note) = kind.description_and_note();
+ let unsafe_op_in_unsafe_fn_allowed = self.unsafe_op_in_unsafe_fn_allowed();
+ match self.safety_context {
+ SafetyContext::UnsafeBlock { ref mut used, .. } => {
+ if !self.body_unsafety.is_unsafe() || !unsafe_op_in_unsafe_fn_allowed {
+ // Mark this block as useful
+ *used = true;
+ }
+ }
+ SafetyContext::UnsafeFn if unsafe_op_in_unsafe_fn_allowed => {}
+ SafetyContext::UnsafeFn => {
+ // unsafe_op_in_unsafe_fn is disallowed
+ if kind == BorrowOfPackedField {
+ // FIXME handle borrows of packed fields
+ } else {
+ struct_span_err!(
+ self.tcx.sess,
+ span,
+ E0133,
+ "{} is unsafe and requires unsafe block",
+ description,
+ )
+ .span_label(span, description)
+ .note(note)
+ .emit();
+ }
+ }
+ SafetyContext::Safe => {
+ if kind == BorrowOfPackedField {
+ // FIXME handle borrows of packed fields
+ } else {
+ let fn_sugg = if unsafe_op_in_unsafe_fn_allowed { " function or" } else { "" };
+ struct_span_err!(
+ self.tcx.sess,
+ span,
+ E0133,
+ "{} is unsafe and requires unsafe{} block",
+ description,
+ fn_sugg,
+ )
+ .span_label(span, description)
+ .note(note)
+ .emit();
+ }
+ }
+ }
+ }
+
+ fn warn_unused_unsafe(
+ &self,
+ hir_id: hir::HirId,
+ block_span: Span,
+ enclosing_span: Option<Span>,
+ ) {
+ let block_span = self.tcx.sess.source_map().guess_head_span(block_span);
+ self.tcx.struct_span_lint_hir(UNUSED_UNSAFE, hir_id, block_span, |lint| {
+ let msg = "unnecessary `unsafe` block";
+ let mut db = lint.build(msg);
+ db.span_label(block_span, msg);
+ if let Some(enclosing_span) = enclosing_span {
+ db.span_label(
+ enclosing_span,
+ format!("because it's nested under this `unsafe` block"),
+ );
+ }
+ db.emit();
+ });
+ }
+
+ /// Whether the `unsafe_op_in_unsafe_fn` lint is `allow`ed at the current HIR node.
+ fn unsafe_op_in_unsafe_fn_allowed(&self) -> bool {
+ self.tcx.lint_level_at_node(UNSAFE_OP_IN_UNSAFE_FN, self.hir_context).0 == Level::Allow
+ }
+}
+
+impl<'thir, 'tcx> Visitor<'thir, 'tcx> for UnsafetyVisitor<'tcx> {
+ fn visit_block(&mut self, block: &Block<'thir, 'tcx>) {
+ if let BlockSafety::ExplicitUnsafe(hir_id) = block.safety_mode {
+ self.in_safety_context(
+ SafetyContext::UnsafeBlock { span: block.span, hir_id, used: false },
+ |this| visit::walk_block(this, block),
+ );
+ } else {
+ visit::walk_block(self, block);
+ }
+ }
+
+ fn visit_expr(&mut self, expr: &'thir Expr<'thir, 'tcx>) {
+ match expr.kind {
+ ExprKind::Scope { value, lint_level: LintLevel::Explicit(hir_id), region_scope: _ } => {
+ let prev_id = self.hir_context;
+ self.hir_context = hir_id;
+ self.visit_expr(value);
+ self.hir_context = prev_id;
+ return;
+ }
+ ExprKind::Call { fun, ty: _, args: _, from_hir_call: _, fn_span: _ } => {
+ if fun.ty.fn_sig(self.tcx).unsafety() == hir::Unsafety::Unsafe {
+ self.requires_unsafe(expr.span, CallToUnsafeFunction);
+ }
+ }
+ _ => {}
+ }
+
+ visit::walk_expr(self, expr);
+ }
+}
+
+#[derive(Clone, Copy)]
+enum SafetyContext {
+ Safe,
+ UnsafeFn,
+ UnsafeBlock { span: Span, hir_id: hir::HirId, used: bool },
+}
+
+#[derive(Clone, Copy)]
+enum BodyUnsafety {
+ /// The body is not unsafe.
+ Safe,
+ /// The body is an unsafe function. The span points to
+ /// the signature of the function.
+ Unsafe(Span),
+}
+
+impl BodyUnsafety {
+ /// Returns whether the body is unsafe.
+ fn is_unsafe(&self) -> bool {
+ matches!(self, BodyUnsafety::Unsafe(_))
+ }
+
+ /// If the body is unsafe, returns the `Span` of its signature.
+ fn unsafe_fn_sig_span(self) -> Option<Span> {
+ match self {
+ BodyUnsafety::Unsafe(span) => Some(span),
+ BodyUnsafety::Safe => None,
+ }
+ }
+}
+
+#[derive(Clone, Copy, PartialEq)]
+enum UnsafeOpKind {
+ CallToUnsafeFunction,
+ #[allow(dead_code)] // FIXME
+ UseOfInlineAssembly,
+ #[allow(dead_code)] // FIXME
+ InitializingTypeWith,
+ #[allow(dead_code)] // FIXME
+ CastOfPointerToInt,
+ #[allow(dead_code)] // FIXME
+ BorrowOfPackedField,
+ #[allow(dead_code)] // FIXME
+ UseOfMutableStatic,
+ #[allow(dead_code)] // FIXME
+ UseOfExternStatic,
+ #[allow(dead_code)] // FIXME
+ DerefOfRawPointer,
+ #[allow(dead_code)] // FIXME
+ AssignToDroppingUnionField,
+ #[allow(dead_code)] // FIXME
+ AccessToUnionField,
+ #[allow(dead_code)] // FIXME
+ MutationOfLayoutConstrainedField,
+ #[allow(dead_code)] // FIXME
+ BorrowOfLayoutConstrainedField,
+ #[allow(dead_code)] // FIXME
+ CallToFunctionWith,
+}
+
+use UnsafeOpKind::*;
+
+impl UnsafeOpKind {
+ pub fn description_and_note(&self) -> (&'static str, &'static str) {
+ match self {
+ CallToUnsafeFunction => (
+ "call to unsafe function",
+ "consult the function's documentation for information on how to avoid undefined \
+ behavior",
+ ),
+ UseOfInlineAssembly => (
+ "use of inline assembly",
+ "inline assembly is entirely unchecked and can cause undefined behavior",
+ ),
+ InitializingTypeWith => (
+ "initializing type with `rustc_layout_scalar_valid_range` attr",
+ "initializing a layout restricted type's field with a value outside the valid \
+ range is undefined behavior",
+ ),
+ CastOfPointerToInt => {
+ ("cast of pointer to int", "casting pointers to integers in constants")
+ }
+ BorrowOfPackedField => (
+ "borrow of packed field",
+ "fields of packed structs might be misaligned: dereferencing a misaligned pointer \
+ or even just creating a misaligned reference is undefined behavior",
+ ),
+ UseOfMutableStatic => (
+ "use of mutable static",
+ "mutable statics can be mutated by multiple threads: aliasing violations or data \
+ races will cause undefined behavior",
+ ),
+ UseOfExternStatic => (
+ "use of extern static",
+ "extern statics are not controlled by the Rust type system: invalid data, \
+ aliasing violations or data races will cause undefined behavior",
+ ),
+ DerefOfRawPointer => (
+ "dereference of raw pointer",
+ "raw pointers may be NULL, dangling or unaligned; they can violate aliasing rules \
+ and cause data races: all of these are undefined behavior",
+ ),
+ AssignToDroppingUnionField => (
+ "assignment to union field that might need dropping",
+ "the previous content of the field will be dropped, which causes undefined \
+ behavior if the field was not properly initialized",
+ ),
+ AccessToUnionField => (
+ "access to union field",
+ "the field may not be properly initialized: using uninitialized data will cause \
+ undefined behavior",
+ ),
+ MutationOfLayoutConstrainedField => (
+ "mutation of layout constrained field",
+ "mutating layout constrained fields cannot statically be checked for valid values",
+ ),
+ BorrowOfLayoutConstrainedField => (
+ "borrow of layout constrained field with interior mutability",
+ "references to fields of layout constrained fields lose the constraints. Coupled \
+ with interior mutability, the field can be changed to invalid values",
+ ),
+ CallToFunctionWith => (
+ "call to function with `#[target_feature]`",
+ "can only be called if the required target features are available",
+ ),
+ }
+ }
+}
+
+// FIXME: checking unsafety for closures should be handled by their parent body,
+// as they inherit their "safety context" from their declaration site.
+pub fn check_unsafety<'tcx>(tcx: TyCtxt<'tcx>, thir: &Expr<'_, 'tcx>, hir_id: hir::HirId) {
+ let body_unsafety = tcx.hir().fn_sig_by_hir_id(hir_id).map_or(BodyUnsafety::Safe, |fn_sig| {
+ if fn_sig.header.unsafety == hir::Unsafety::Unsafe {
+ BodyUnsafety::Unsafe(fn_sig.span)
+ } else {
+ BodyUnsafety::Safe
+ }
+ });
+ let safety_context =
+ if body_unsafety.is_unsafe() { SafetyContext::UnsafeFn } else { SafetyContext::Safe };
+ let mut visitor = UnsafetyVisitor { tcx, safety_context, hir_context: hir_id, body_unsafety };
+ visitor.visit_expr(thir);
+}
+
+crate fn thir_check_unsafety_inner<'tcx>(
+ tcx: TyCtxt<'tcx>,
+ def: ty::WithOptConstParam<LocalDefId>,
+) {
+ let hir_id = tcx.hir().local_def_id_to_hir_id(def.did);
+ let body_id = tcx.hir().body_owned_by(hir_id);
+ let body = tcx.hir().body(body_id);
+
+ let arena = Arena::default();
+ let thir = cx::build_thir(tcx, def, &arena, &body.value);
+ check_unsafety(tcx, thir, hir_id);
+}
+
+crate fn thir_check_unsafety<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) {
+ if let Some(def) = ty::WithOptConstParam::try_lookup(def_id, tcx) {
+ tcx.thir_check_unsafety_for_const_arg(def)
+ } else {
+ thir_check_unsafety_inner(tcx, ty::WithOptConstParam::unknown(def_id))
+ }
+}
+
+crate fn thir_check_unsafety_for_const_arg<'tcx>(
+ tcx: TyCtxt<'tcx>,
+ (did, param_did): (LocalDefId, DefId),
+) {
+ thir_check_unsafety_inner(tcx, ty::WithOptConstParam { did, const_param_did: Some(param_did) })
+}
extern crate rustc_middle;
mod build;
+mod check_unsafety;
mod lints;
pub mod thir;
providers.check_match = thir::pattern::check_match;
providers.lit_to_const = thir::constant::lit_to_const;
providers.mir_built = build::mir_built;
+ providers.thir_check_unsafety = check_unsafety::thir_check_unsafety;
+ providers.thir_check_unsafety_for_const_arg = check_unsafety::thir_check_unsafety_for_const_arg;
}
pub use arena::Arena;
mod util;
+pub mod visit;
#[derive(Copy, Clone, Debug)]
pub enum LintLevel {
err.span_label(sp, pattern_not_covered_label(&witnesses, &joined_patterns));
};
+ let is_variant_list_non_exhaustive = match scrut_ty.kind() {
+ ty::Adt(def, _) if def.is_variant_list_non_exhaustive() && !def.did.is_local() => true,
+ _ => false,
+ };
+
adt_defined_here(cx, &mut err, scrut_ty, &witnesses);
err.help(
"ensure that all possible cases are being handled, \
possibly by adding wildcards or more match arms",
);
- err.note(&format!("the matched value is of type `{}`", scrut_ty));
+ err.note(&format!(
+ "the matched value is of type `{}`{}",
+ scrut_ty,
+ if is_variant_list_non_exhaustive { ", which is marked as non-exhaustive" } else { "" }
+ ));
if (scrut_ty == cx.tcx.types.usize || scrut_ty == cx.tcx.types.isize)
&& !is_empty_match
&& witnesses.len() == 1
use rustc_data_structures::captures::Captures;
use rustc_index::vec::Idx;
-use rustc_hir::def_id::DefId;
use rustc_hir::{HirId, RangeEnd};
use rustc_middle::mir::interpret::ConstValue;
use rustc_middle::mir::Field;
/// and fixed-length arrays.
Single,
/// Enum variants.
- Variant(DefId),
+ Variant(VariantIdx),
/// Ranges of integer literal values (`2`, `2..=5` or `2..5`).
IntRange(IntRange),
/// Ranges of floating-point literal values (`2.0..=5.2`).
fn variant_index_for_adt(&self, adt: &'tcx ty::AdtDef) -> VariantIdx {
match *self {
- Variant(id) => adt.variant_index_with_id(id),
+ Variant(idx) => idx,
Single => {
assert!(!adt.is_enum());
VariantIdx::new(0)
PatKind::AscribeUserType { .. } => bug!(), // Handled by `expand_pattern`
PatKind::Binding { .. } | PatKind::Wild => Wildcard,
PatKind::Leaf { .. } | PatKind::Deref { .. } => Single,
- &PatKind::Variant { adt_def, variant_index, .. } => {
- Variant(adt_def.variants[variant_index].def_id)
- }
+ &PatKind::Variant { variant_index, .. } => Variant(variant_index),
PatKind::Constant { value } => {
if let Some(int_range) = IntRange::from_const(cx.tcx, cx.param_env, value) {
IntRange(int_range)
// If `exhaustive_patterns` is enabled, we exclude variants known to be
// uninhabited.
def.variants
- .iter()
- .filter(|v| {
+ .iter_enumerated()
+ .filter(|(_, v)| {
!v.uninhabited_from(cx.tcx, substs, def.adt_kind(), cx.param_env)
.contains(cx.tcx, cx.module)
})
- .map(|v| Variant(v.def_id))
+ .map(|(idx, _)| Variant(idx))
.collect()
} else {
- def.variants.iter().map(|v| Variant(v.def_id)).collect()
+ def.variants.indices().map(|idx| Variant(idx)).collect()
}
}
ty::Char => {
--- /dev/null
+use crate::thir::*;
+
+pub trait Visitor<'thir, 'tcx>: Sized {
+ fn visit_expr(&mut self, expr: &'thir Expr<'thir, 'tcx>) {
+ walk_expr(self, expr);
+ }
+
+ fn visit_stmt(&mut self, stmt: &'thir Stmt<'thir, 'tcx>) {
+ walk_stmt(self, stmt);
+ }
+
+ fn visit_block(&mut self, block: &Block<'thir, 'tcx>) {
+ walk_block(self, block);
+ }
+
+ fn visit_arm(&mut self, arm: &'thir Arm<'thir, 'tcx>) {
+ walk_arm(self, arm);
+ }
+
+ fn visit_const(&mut self, _cnst: &'tcx Const<'tcx>) {}
+}
+
+pub fn walk_expr<'thir, 'tcx, V: Visitor<'thir, 'tcx>>(
+ visitor: &mut V,
+ expr: &'thir Expr<'thir, 'tcx>,
+) {
+ use ExprKind::*;
+ match expr.kind {
+ Scope { value, region_scope: _, lint_level: _ } => visitor.visit_expr(value),
+ Box { value } => visitor.visit_expr(value),
+ If { cond, then, else_opt } => {
+ visitor.visit_expr(cond);
+ visitor.visit_expr(then);
+ if let Some(else_expr) = else_opt {
+ visitor.visit_expr(else_expr);
+ }
+ }
+ Call { fun, args, ty: _, from_hir_call: _, fn_span: _ } => {
+ visitor.visit_expr(fun);
+ for arg in args {
+ visitor.visit_expr(arg);
+ }
+ }
+ Deref { arg } => visitor.visit_expr(arg),
+ Binary { lhs, rhs, op: _ } | LogicalOp { lhs, rhs, op: _ } => {
+ visitor.visit_expr(lhs);
+ visitor.visit_expr(rhs);
+ }
+ Unary { arg, op: _ } => visitor.visit_expr(arg),
+ Cast { source } => visitor.visit_expr(source),
+ Use { source } => visitor.visit_expr(source),
+ NeverToAny { source } => visitor.visit_expr(source),
+ Pointer { source, cast: _ } => visitor.visit_expr(source),
+ Loop { body } => visitor.visit_expr(body),
+ Match { scrutinee, arms } => {
+ visitor.visit_expr(scrutinee);
+ for arm in arms {
+ visitor.visit_arm(arm);
+ }
+ }
+ Block { ref body } => visitor.visit_block(body),
+ Assign { lhs, rhs } | AssignOp { lhs, rhs, op: _ } => {
+ visitor.visit_expr(lhs);
+ visitor.visit_expr(rhs);
+ }
+ Field { lhs, name: _ } => visitor.visit_expr(lhs),
+ Index { lhs, index } => {
+ visitor.visit_expr(lhs);
+ visitor.visit_expr(index);
+ }
+ VarRef { id: _ } | UpvarRef { closure_def_id: _, var_hir_id: _ } => {}
+ Borrow { arg, borrow_kind: _ } => visitor.visit_expr(arg),
+ AddressOf { arg, mutability: _ } => visitor.visit_expr(arg),
+ Break { value, label: _ } => {
+ if let Some(value) = value {
+ visitor.visit_expr(value)
+ }
+ }
+ Continue { label: _ } => {}
+ Return { value } => {
+ if let Some(value) = value {
+ visitor.visit_expr(value)
+ }
+ }
+ ConstBlock { value } => visitor.visit_const(value),
+ Repeat { value, count } => {
+ visitor.visit_expr(value);
+ visitor.visit_const(count);
+ }
+ Array { fields } | Tuple { fields } => {
+ for field in fields {
+ visitor.visit_expr(field);
+ }
+ }
+ Adt { fields, ref base, adt_def: _, variant_index: _, substs: _, user_ty: _ } => {
+ for field in fields {
+ visitor.visit_expr(field.expr);
+ }
+ if let Some(base) = base {
+ visitor.visit_expr(base.base);
+ }
+ }
+ PlaceTypeAscription { source, user_ty: _ } | ValueTypeAscription { source, user_ty: _ } => {
+ visitor.visit_expr(source)
+ }
+ Closure { closure_id: _, substs: _, upvars: _, movability: _, fake_reads: _ } => {}
+ Literal { literal, user_ty: _, const_id: _ } => visitor.visit_const(literal),
+ StaticRef { literal, def_id: _ } => visitor.visit_const(literal),
+ InlineAsm { operands, template: _, options: _, line_spans: _ } => {
+ for op in operands {
+ use InlineAsmOperand::*;
+ match op {
+ In { expr, reg: _ }
+ | Out { expr: Some(expr), reg: _, late: _ }
+ | InOut { expr, reg: _, late: _ }
+ | SymFn { expr } => visitor.visit_expr(expr),
+ SplitInOut { in_expr, out_expr, reg: _, late: _ } => {
+ visitor.visit_expr(in_expr);
+ if let Some(out_expr) = out_expr {
+ visitor.visit_expr(out_expr);
+ }
+ }
+ Out { expr: None, reg: _, late: _ }
+ | Const { value: _, span: _ }
+ | SymStatic { def_id: _ } => {}
+ }
+ }
+ }
+ ThreadLocalRef(_) => {}
+ LlvmInlineAsm { outputs, inputs, asm: _ } => {
+ for out_expr in outputs {
+ visitor.visit_expr(out_expr);
+ }
+ for in_expr in inputs {
+ visitor.visit_expr(in_expr);
+ }
+ }
+ Yield { value } => visitor.visit_expr(value),
+ }
+}
+
+pub fn walk_stmt<'thir, 'tcx, V: Visitor<'thir, 'tcx>>(
+ visitor: &mut V,
+ stmt: &'thir Stmt<'thir, 'tcx>,
+) {
+ match stmt.kind {
+ StmtKind::Expr { expr, scope: _ } => visitor.visit_expr(expr),
+ StmtKind::Let {
+ initializer,
+ remainder_scope: _,
+ init_scope: _,
+ pattern: _,
+ lint_level: _,
+ } => {
+ if let Some(init) = initializer {
+ visitor.visit_expr(init);
+ }
+ }
+ }
+}
+
+pub fn walk_block<'thir, 'tcx, V: Visitor<'thir, 'tcx>>(
+ visitor: &mut V,
+ block: &Block<'thir, 'tcx>,
+) {
+ for stmt in block.stmts {
+ visitor.visit_stmt(stmt);
+ }
+ if let Some(expr) = block.expr {
+ visitor.visit_expr(expr);
+ }
+}
+
+pub fn walk_arm<'thir, 'tcx, V: Visitor<'thir, 'tcx>>(
+ visitor: &mut V,
+ arm: &'thir Arm<'thir, 'tcx>,
+) {
+ match arm.guard {
+ Some(Guard::If(expr)) => visitor.visit_expr(expr),
+ Some(Guard::IfLet(ref _pat, expr)) => {
+ visitor.visit_expr(expr);
+ }
+ None => {}
+ }
+ visitor.visit_expr(arm.body);
+}
Ok(a_var)
}
+ fn expect_field_ty_separator(&mut self) -> PResult<'a, ()> {
+ if let Err(mut err) = self.expect(&token::Colon) {
+ let sm = self.sess.source_map();
+ let eq_typo = self.token.kind == token::Eq && self.look_ahead(1, |t| t.is_path_start());
+ let semi_typo = self.token.kind == token::Semi
+ && self.look_ahead(1, |t| {
+ t.is_path_start()
+ // We check that we are in a situation like `foo; bar` to avoid bad suggestions
+ // when there's no type and `;` was used instead of a comma.
+ && match (sm.lookup_line(self.token.span.hi()), sm.lookup_line(t.span.lo())) {
+ (Ok(l), Ok(r)) => l.line == r.line,
+ _ => true,
+ }
+ });
+ if eq_typo || semi_typo {
+ self.bump();
+ // Gracefully handle small typos.
+ err.span_suggestion_short(
+ self.prev_token.span,
+ "field names and their types are separated with `:`",
+ ":".to_string(),
+ Applicability::MachineApplicable,
+ );
+ err.emit();
+ } else {
+ return Err(err);
+ }
+ }
+ Ok(())
+ }
+
/// Parses a structure field.
fn parse_name_and_ty(
&mut self,
attrs: Vec<Attribute>,
) -> PResult<'a, FieldDef> {
let name = self.parse_field_ident(adt_ty, lo)?;
- self.expect(&token::Colon)?;
+ self.expect_field_ty_separator()?;
let ty = self.parse_ty()?;
+ if self.token.kind == token::Eq {
+ self.bump();
+ let const_expr = self.parse_anon_const_expr()?;
+ let sp = ty.span.shrink_to_hi().to(const_expr.value.span);
+ self.struct_span_err(sp, "default values on `struct` fields aren't supported")
+ .span_suggestion(
+ sp,
+ "remove this unsupported default value",
+ String::new(),
+ Applicability::MachineApplicable,
+ )
+ .emit();
+ }
Ok(FieldDef {
span: lo.to(self.prev_token.span),
ident: Some(name),
use rustc_hir as hir;
use rustc_hir::def_id::LocalDefId;
use rustc_hir::intravisit::{self, NestedVisitorMap, Visitor};
-use rustc_hir::{
- self, FnSig, ForeignItem, ForeignItemKind, HirId, Item, ItemKind, TraitItem, CRATE_HIR_ID,
-};
+use rustc_hir::{self, FnSig, ForeignItem, HirId, Item, ItemKind, TraitItem, CRATE_HIR_ID};
use rustc_hir::{MethodKind, Target};
use rustc_session::lint::builtin::{
CONFLICTING_REPR_HINTS, INVALID_DOC_ATTRIBUTES, UNUSED_ATTRIBUTES,
sym::doc => self.check_doc_attrs(attr, hir_id, target, &mut specified_inline),
sym::no_link => self.check_no_link(hir_id, &attr, span, target),
sym::export_name => self.check_export_name(hir_id, &attr, span, target),
- sym::rustc_args_required_const => {
- self.check_rustc_args_required_const(&attr, span, target, item)
- }
sym::rustc_layout_scalar_valid_range_start
| sym::rustc_layout_scalar_valid_range_end => {
self.check_rustc_layout_scalar_valid_range(&attr, span, target)
}
}
- /// Checks if `#[rustc_args_required_const]` is applied to a function and has a valid argument.
- fn check_rustc_args_required_const(
- &self,
- attr: &Attribute,
- span: &Span,
- target: Target,
- item: Option<ItemLike<'_>>,
- ) -> bool {
- let is_function = matches!(target, Target::Fn | Target::Method(..) | Target::ForeignFn);
- if !is_function {
- self.tcx
- .sess
- .struct_span_err(attr.span, "attribute should be applied to a function")
- .span_label(*span, "not a function")
- .emit();
- return false;
- }
-
- let list = match attr.meta_item_list() {
- // The attribute form is validated on AST.
- None => return false,
- Some(it) => it,
- };
-
- let mut invalid_args = vec![];
- for meta in list {
- if let Some(LitKind::Int(val, _)) = meta.literal().map(|lit| &lit.kind) {
- if let Some(ItemLike::Item(Item {
- kind: ItemKind::Fn(FnSig { decl, .. }, ..),
- ..
- }))
- | Some(ItemLike::ForeignItem(ForeignItem {
- kind: ForeignItemKind::Fn(decl, ..),
- ..
- })) = item
- {
- let arg_count = decl.inputs.len() as u128;
- if *val >= arg_count {
- let span = meta.span();
- self.tcx
- .sess
- .struct_span_err(span, "index exceeds number of arguments")
- .span_label(
- span,
- format!(
- "there {} only {} argument{}",
- if arg_count != 1 { "are" } else { "is" },
- arg_count,
- pluralize!(arg_count)
- ),
- )
- .emit();
- return false;
- }
- } else {
- bug!("should be a function item");
- }
- } else {
- invalid_args.push(meta.span());
- }
- }
-
- if !invalid_args.is_empty() {
- self.tcx
- .sess
- .struct_span_err(invalid_args, "arguments should be non-negative integers")
- .emit();
- false
- } else {
- true
- }
- }
-
fn check_rustc_layout_scalar_valid_range(
&self,
attr: &Attribute,
ExprVisitor { tcx: self.tcx, param_env, typeck_results }.visit_body(body);
self.visit_body(body);
}
+
+ fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) {
+ if let hir::ItemKind::GlobalAsm(asm) = item.kind {
+ for (op, op_sp) in asm.operands {
+ match *op {
+ hir::InlineAsmOperand::Const { ref anon_const } => {
+ let anon_const_def_id = self.tcx.hir().local_def_id(anon_const.hir_id);
+ let value = ty::Const::from_anon_const(self.tcx, anon_const_def_id);
+ match value.ty.kind() {
+ ty::Int(_) | ty::Uint(_) | ty::Float(_) => {}
+ _ => {
+ let msg = "asm `const` arguments must be integer or floating-point values";
+ self.tcx.sess.span_err(*op_sp, msg);
+ }
+ }
+ }
+ hir::InlineAsmOperand::In { .. }
+ | hir::InlineAsmOperand::Out { .. }
+ | hir::InlineAsmOperand::InOut { .. }
+ | hir::InlineAsmOperand::SplitInOut { .. }
+ | hir::InlineAsmOperand::Sym { .. } => unreachable!(),
+ }
+ }
+ }
+
+ intravisit::walk_item(self, item);
+ }
}
impl Visitor<'tcx> for ExprVisitor<'tcx> {
// Record some extra data for better diagnostics.
let cstore = self.r.cstore();
match res {
- Res::Def(DefKind::Struct | DefKind::Union, def_id) => {
+ Res::Def(DefKind::Struct, def_id) => {
+ let field_names = cstore.struct_field_names_untracked(def_id, self.r.session);
+ let ctor = cstore.ctor_def_id_and_kind_untracked(def_id);
+ if let Some((ctor_def_id, ctor_kind)) = ctor {
+ let ctor_res = Res::Def(DefKind::Ctor(CtorOf::Struct, ctor_kind), ctor_def_id);
+ let ctor_vis = cstore.visibility_untracked(ctor_def_id);
+ let field_visibilities = cstore.struct_field_visibilities_untracked(def_id);
+ self.r
+ .struct_constructors
+ .insert(def_id, (ctor_res, ctor_vis, field_visibilities));
+ }
+ self.insert_field_names(def_id, field_names);
+ }
+ Res::Def(DefKind::Union, def_id) => {
let field_names = cstore.struct_field_names_untracked(def_id, self.r.session);
self.insert_field_names(def_id, field_names);
}
self.r.has_self.insert(def_id);
}
}
- Res::Def(DefKind::Ctor(CtorOf::Struct, ..), def_id) => {
- let parent = cstore.def_key(def_id).parent;
- if let Some(struct_def_id) = parent.map(|index| DefId { index, ..def_id }) {
- self.r.struct_constructors.insert(struct_def_id, (res, vis, vec![]));
- }
- }
_ => {}
}
}
self.future_proof_import(use_tree);
}
- ItemKind::ExternCrate(..) | ItemKind::MacroDef(..) | ItemKind::GlobalAsm(..) => {
+ ItemKind::ExternCrate(..) | ItemKind::MacroDef(..) => {
// do nothing, these are just around to be encoded
}
+ ItemKind::GlobalAsm(_) => {
+ visit::walk_item(self, item);
+ }
+
ItemKind::MacCall(_) => panic!("unexpanded macro in resolve!"),
}
}
use crate::{PathResult, PathSource, Segment};
use rustc_ast::visit::FnKind;
-use rustc_ast::{self as ast, Expr, ExprKind, Item, ItemKind, NodeId, Path, Ty, TyKind};
+use rustc_ast::{
+ self as ast, Expr, ExprKind, GenericParam, GenericParamKind, Item, ItemKind, NodeId, Path, Ty,
+ TyKind,
+};
use rustc_ast_pretty::pprust::path_segment_to_string;
use rustc_data_structures::fx::FxHashSet;
use rustc_errors::{pluralize, struct_span_err, Applicability, DiagnosticBuilder, SuggestionStyle};
if !self.diagnostic_metadata.currently_processing_generics && !single_uppercase_char {
return None;
}
- match (self.diagnostic_metadata.current_item, single_uppercase_char) {
- (Some(Item { kind: ItemKind::Fn(..), ident, .. }), _) if ident.name == sym::main => {
+ match (self.diagnostic_metadata.current_item, single_uppercase_char, self.diagnostic_metadata.currently_processing_generics) {
+ (Some(Item { kind: ItemKind::Fn(..), ident, .. }), _, _) if ident.name == sym::main => {
// Ignore `fn main()` as we don't want to suggest `fn main<T>()`
}
(
| kind @ ItemKind::Union(..),
..
}),
- true,
+ true, _
)
- | (Some(Item { kind, .. }), false) => {
+ // Without the 2nd `true`, we'd suggest `impl <T>` for `impl T` when a type `T` isn't found
+ | (Some(Item { kind: kind @ ItemKind::Impl(..), .. }), true, true)
+ | (Some(Item { kind, .. }), false, _) => {
// Likely missing type parameter.
if let Some(generics) = kind.generics() {
if span.overlaps(generics.span) {
let (span, sugg) = if let [.., param] = &generics.params[..] {
let span = if let [.., bound] = ¶m.bounds[..] {
bound.span()
+ } else if let GenericParam {
+ kind: GenericParamKind::Const { ty, kw_span: _, default }, ..
+ } = param {
+ default.as_ref().map(|def| def.value.span).unwrap_or(ty.span)
} else {
param.ident.span
};
crate fn add_missing_lifetime_specifiers_label(
&self,
err: &mut DiagnosticBuilder<'_>,
- spans_with_counts: Vec<(Span, usize)>,
+ mut spans_with_counts: Vec<(Span, usize)>,
lifetime_names: &FxHashSet<Symbol>,
lifetime_spans: Vec<Span>,
params: &[ElisionFailureInfo],
.map(|(span, _)| self.tcx.sess.source_map().span_to_snippet(*span).ok())
.collect();
- for (span, count) in &spans_with_counts {
+ // Empty generics are marked with a span of "<", but since from now on
+ // that information is in the snippets it can be removed from the spans.
+ for ((span, _), snippet) in spans_with_counts.iter_mut().zip(&snippets) {
+ if snippet.as_deref() == Some("<") {
+ *span = span.shrink_to_hi();
+ }
+ }
+
+ for &(span, count) in &spans_with_counts {
err.span_label(
- *span,
+ span,
format!(
"expected {} lifetime parameter{}",
- if *count == 1 { "named".to_string() } else { count.to_string() },
- pluralize!(*count),
+ if count == 1 { "named".to_string() } else { count.to_string() },
+ pluralize!(count),
),
);
}
.collect::<Vec<_>>()
.join(", "),
)
+ } else if snippet == "<" || snippet == "(" {
+ (
+ span.shrink_to_hi(),
+ std::iter::repeat("'static")
+ .take(count)
+ .collect::<Vec<_>>()
+ .join(", "),
+ )
} else {
(
span.shrink_to_hi(),
std::iter::repeat("'static")
.take(count)
.collect::<Vec<_>>()
- .join(", ")
+ .join(", "),
),
)
}
Some("&") => Some(Box::new(|name| format!("&{} ", name))),
Some("'_") => Some(Box::new(|n| n.to_string())),
Some("") => Some(Box::new(move |n| format!("{}, ", n).repeat(count))),
+ Some("<") => Some(Box::new(move |n| {
+ std::iter::repeat(n).take(count).collect::<Vec<_>>().join(", ")
+ })),
Some(snippet) if !snippet.ends_with('>') => Some(Box::new(move |name| {
format!(
"{}<{}>",
Some("") => {
Some(std::iter::repeat("'a, ").take(count).collect::<Vec<_>>().join(""))
}
+ Some("<") => {
+ Some(std::iter::repeat("'a").take(count).collect::<Vec<_>>().join(", "))
+ }
Some(snippet) => Some(format!(
"{}<{}>",
snippet,
"select processor to schedule for (`rustc --print target-cpus` for details)"),
thinlto: Option<bool> = (None, parse_opt_bool, [TRACKED],
"enable ThinLTO when possible"),
+ thir_unsafeck: bool = (false, parse_bool, [TRACKED],
+ "use the work-in-progress THIR unsafety checker. NOTE: this is unsound (default: no)"),
/// We default to 1 here since we want to behave like
/// a sequential compiler for now. This'll likely be adjusted
/// in the future. Note that -Zthreads=0 is the way to get
receiver,
recursion_limit,
reexport_test_harness_main,
+ ref_unwind_safe,
reference,
reflect,
reg,
reg64,
reg_abcd,
reg_byte,
+ reg_nonzero,
reg_thumb,
register_attr,
register_tool,
rustc_allocator,
rustc_allocator_nounwind,
rustc_allow_const_fn_unstable,
- rustc_args_required_const,
rustc_attrs,
rustc_builtin_macro,
rustc_capture_analysis,
rustc_dump_program_clauses,
rustc_dump_user_substs,
rustc_error,
+ rustc_evaluate_where_clauses,
rustc_expected_cgu_reuse,
rustc_if_this_changed,
rustc_inherit_overflow_checks,
self_in_typedefs,
self_struct_ctor,
semitransparent,
+ send,
send_trait,
shl,
shl_assign,
unused_qualifications,
unwind,
unwind_attributes,
+ unwind_safe,
unwrap,
unwrap_or,
use_extern_macros,
mod hexagon;
mod mips;
mod nvptx;
+mod powerpc;
mod riscv;
mod spirv;
mod wasm;
pub use hexagon::{HexagonInlineAsmReg, HexagonInlineAsmRegClass};
pub use mips::{MipsInlineAsmReg, MipsInlineAsmRegClass};
pub use nvptx::{NvptxInlineAsmReg, NvptxInlineAsmRegClass};
+pub use powerpc::{PowerPCInlineAsmReg, PowerPCInlineAsmRegClass};
pub use riscv::{RiscVInlineAsmReg, RiscVInlineAsmRegClass};
pub use spirv::{SpirVInlineAsmReg, SpirVInlineAsmRegClass};
pub use wasm::{WasmInlineAsmReg, WasmInlineAsmRegClass};
Hexagon,
Mips,
Mips64,
+ PowerPC,
SpirV,
Wasm32,
}
"riscv32" => Ok(Self::RiscV32),
"riscv64" => Ok(Self::RiscV64),
"nvptx64" => Ok(Self::Nvptx64),
+ "powerpc" => Ok(Self::PowerPC),
"hexagon" => Ok(Self::Hexagon),
"mips" => Ok(Self::Mips),
"mips64" => Ok(Self::Mips64),
AArch64(AArch64InlineAsmReg),
RiscV(RiscVInlineAsmReg),
Nvptx(NvptxInlineAsmReg),
+ PowerPC(PowerPCInlineAsmReg),
Hexagon(HexagonInlineAsmReg),
Mips(MipsInlineAsmReg),
SpirV(SpirVInlineAsmReg),
Self::Arm(r) => r.name(),
Self::AArch64(r) => r.name(),
Self::RiscV(r) => r.name(),
+ Self::PowerPC(r) => r.name(),
Self::Hexagon(r) => r.name(),
Self::Mips(r) => r.name(),
Self::Err => "<reg>",
Self::Arm(r) => InlineAsmRegClass::Arm(r.reg_class()),
Self::AArch64(r) => InlineAsmRegClass::AArch64(r.reg_class()),
Self::RiscV(r) => InlineAsmRegClass::RiscV(r.reg_class()),
+ Self::PowerPC(r) => InlineAsmRegClass::PowerPC(r.reg_class()),
Self::Hexagon(r) => InlineAsmRegClass::Hexagon(r.reg_class()),
Self::Mips(r) => InlineAsmRegClass::Mips(r.reg_class()),
Self::Err => InlineAsmRegClass::Err,
InlineAsmArch::Nvptx64 => {
Self::Nvptx(NvptxInlineAsmReg::parse(arch, has_feature, target, &name)?)
}
+ InlineAsmArch::PowerPC => {
+ Self::PowerPC(PowerPCInlineAsmReg::parse(arch, has_feature, target, &name)?)
+ }
InlineAsmArch::Hexagon => {
Self::Hexagon(HexagonInlineAsmReg::parse(arch, has_feature, target, &name)?)
}
Self::Arm(r) => r.emit(out, arch, modifier),
Self::AArch64(r) => r.emit(out, arch, modifier),
Self::RiscV(r) => r.emit(out, arch, modifier),
+ Self::PowerPC(r) => r.emit(out, arch, modifier),
Self::Hexagon(r) => r.emit(out, arch, modifier),
Self::Mips(r) => r.emit(out, arch, modifier),
Self::Err => unreachable!("Use of InlineAsmReg::Err"),
Self::Arm(r) => r.overlapping_regs(|r| cb(Self::Arm(r))),
Self::AArch64(_) => cb(self),
Self::RiscV(_) => cb(self),
+ Self::PowerPC(_) => cb(self),
Self::Hexagon(r) => r.overlapping_regs(|r| cb(Self::Hexagon(r))),
Self::Mips(_) => cb(self),
Self::Err => unreachable!("Use of InlineAsmReg::Err"),
AArch64(AArch64InlineAsmRegClass),
RiscV(RiscVInlineAsmRegClass),
Nvptx(NvptxInlineAsmRegClass),
+ PowerPC(PowerPCInlineAsmRegClass),
Hexagon(HexagonInlineAsmRegClass),
Mips(MipsInlineAsmRegClass),
SpirV(SpirVInlineAsmRegClass),
Self::AArch64(r) => r.name(),
Self::RiscV(r) => r.name(),
Self::Nvptx(r) => r.name(),
+ Self::PowerPC(r) => r.name(),
Self::Hexagon(r) => r.name(),
Self::Mips(r) => r.name(),
Self::SpirV(r) => r.name(),
Self::AArch64(r) => r.suggest_class(arch, ty).map(InlineAsmRegClass::AArch64),
Self::RiscV(r) => r.suggest_class(arch, ty).map(InlineAsmRegClass::RiscV),
Self::Nvptx(r) => r.suggest_class(arch, ty).map(InlineAsmRegClass::Nvptx),
+ Self::PowerPC(r) => r.suggest_class(arch, ty).map(InlineAsmRegClass::PowerPC),
Self::Hexagon(r) => r.suggest_class(arch, ty).map(InlineAsmRegClass::Hexagon),
Self::Mips(r) => r.suggest_class(arch, ty).map(InlineAsmRegClass::Mips),
Self::SpirV(r) => r.suggest_class(arch, ty).map(InlineAsmRegClass::SpirV),
Self::AArch64(r) => r.suggest_modifier(arch, ty),
Self::RiscV(r) => r.suggest_modifier(arch, ty),
Self::Nvptx(r) => r.suggest_modifier(arch, ty),
+ Self::PowerPC(r) => r.suggest_modifier(arch, ty),
Self::Hexagon(r) => r.suggest_modifier(arch, ty),
Self::Mips(r) => r.suggest_modifier(arch, ty),
Self::SpirV(r) => r.suggest_modifier(arch, ty),
Self::AArch64(r) => r.default_modifier(arch),
Self::RiscV(r) => r.default_modifier(arch),
Self::Nvptx(r) => r.default_modifier(arch),
+ Self::PowerPC(r) => r.default_modifier(arch),
Self::Hexagon(r) => r.default_modifier(arch),
Self::Mips(r) => r.default_modifier(arch),
Self::SpirV(r) => r.default_modifier(arch),
Self::AArch64(r) => r.supported_types(arch),
Self::RiscV(r) => r.supported_types(arch),
Self::Nvptx(r) => r.supported_types(arch),
+ Self::PowerPC(r) => r.supported_types(arch),
Self::Hexagon(r) => r.supported_types(arch),
Self::Mips(r) => r.supported_types(arch),
Self::SpirV(r) => r.supported_types(arch),
Self::RiscV(RiscVInlineAsmRegClass::parse(arch, name)?)
}
InlineAsmArch::Nvptx64 => Self::Nvptx(NvptxInlineAsmRegClass::parse(arch, name)?),
+ InlineAsmArch::PowerPC => Self::PowerPC(PowerPCInlineAsmRegClass::parse(arch, name)?),
InlineAsmArch::Hexagon => Self::Hexagon(HexagonInlineAsmRegClass::parse(arch, name)?),
InlineAsmArch::Mips | InlineAsmArch::Mips64 => {
Self::Mips(MipsInlineAsmRegClass::parse(arch, name)?)
Self::AArch64(r) => r.valid_modifiers(arch),
Self::RiscV(r) => r.valid_modifiers(arch),
Self::Nvptx(r) => r.valid_modifiers(arch),
+ Self::PowerPC(r) => r.valid_modifiers(arch),
Self::Hexagon(r) => r.valid_modifiers(arch),
Self::Mips(r) => r.valid_modifiers(arch),
Self::SpirV(r) => r.valid_modifiers(arch),
nvptx::fill_reg_map(arch, has_feature, target, &mut map);
map
}
+ InlineAsmArch::PowerPC => {
+ let mut map = powerpc::regclass_map();
+ powerpc::fill_reg_map(arch, has_feature, target, &mut map);
+ map
+ }
InlineAsmArch::Hexagon => {
let mut map = hexagon::regclass_map();
hexagon::fill_reg_map(arch, has_feature, target, &mut map);
--- /dev/null
+use super::{InlineAsmArch, InlineAsmType};
+use rustc_macros::HashStable_Generic;
+use std::fmt;
+
+def_reg_class! {
+ PowerPC PowerPCInlineAsmRegClass {
+ reg,
+ reg_nonzero,
+ freg,
+ }
+}
+
+impl PowerPCInlineAsmRegClass {
+ pub fn valid_modifiers(self, _arch: super::InlineAsmArch) -> &'static [char] {
+ &[]
+ }
+
+ pub fn suggest_class(self, _arch: InlineAsmArch, _ty: InlineAsmType) -> Option<Self> {
+ None
+ }
+
+ pub fn suggest_modifier(
+ self,
+ _arch: InlineAsmArch,
+ _ty: InlineAsmType,
+ ) -> Option<(char, &'static str)> {
+ None
+ }
+
+ pub fn default_modifier(self, _arch: InlineAsmArch) -> Option<(char, &'static str)> {
+ None
+ }
+
+ pub fn supported_types(
+ self,
+ _arch: InlineAsmArch,
+ ) -> &'static [(InlineAsmType, Option<&'static str>)] {
+ match self {
+ Self::reg | Self::reg_nonzero => types! { _: I8, I16, I32; },
+ Self::freg => types! { _: F32, F64; },
+ }
+ }
+}
+
+def_regs! {
+ PowerPC PowerPCInlineAsmReg PowerPCInlineAsmRegClass {
+ r0: reg = ["r0", "0"],
+ r3: reg, reg_nonzero = ["r3", "3"],
+ r4: reg, reg_nonzero = ["r4", "4"],
+ r5: reg, reg_nonzero = ["r5", "5"],
+ r6: reg, reg_nonzero = ["r6", "6"],
+ r7: reg, reg_nonzero = ["r7", "7"],
+ r8: reg, reg_nonzero = ["r8", "8"],
+ r9: reg, reg_nonzero = ["r9", "9"],
+ r10: reg, reg_nonzero = ["r10", "10"],
+ r11: reg, reg_nonzero = ["r11", "11"],
+ r12: reg, reg_nonzero = ["r12", "12"],
+ r14: reg, reg_nonzero = ["r14", "14"],
+ r15: reg, reg_nonzero = ["r15", "15"],
+ r16: reg, reg_nonzero = ["r16", "16"],
+ r17: reg, reg_nonzero = ["r17", "17"],
+ r18: reg, reg_nonzero = ["r18", "18"],
+ r19: reg, reg_nonzero = ["r19", "19"],
+ r20: reg, reg_nonzero = ["r20", "20"],
+ r21: reg, reg_nonzero = ["r21", "21"],
+ r22: reg, reg_nonzero = ["r22", "22"],
+ r23: reg, reg_nonzero = ["r23", "23"],
+ r24: reg, reg_nonzero = ["r24", "24"],
+ r25: reg, reg_nonzero = ["r25", "25"],
+ r26: reg, reg_nonzero = ["r26", "26"],
+ r27: reg, reg_nonzero = ["r27", "27"],
+ r28: reg, reg_nonzero = ["r28", "28"],
+ f0: freg = ["f0", "fr0"],
+ f1: freg = ["f1", "fr1"],
+ f2: freg = ["f2", "fr2"],
+ f3: freg = ["f3", "fr3"],
+ f4: freg = ["f4", "fr4"],
+ f5: freg = ["f5", "fr5"],
+ f6: freg = ["f6", "fr6"],
+ f7: freg = ["f7", "fr7"],
+ f8: freg = ["f8", "fr8"],
+ f9: freg = ["f9", "fr9"],
+ f10: freg = ["f10", "fr10"],
+ f11: freg = ["f11", "fr11"],
+ f12: freg = ["f12", "fr12"],
+ f13: freg = ["f13", "fr13"],
+ f14: freg = ["f14", "fr14"],
+ f15: freg = ["f15", "fr15"],
+ f16: freg = ["f16", "fr16"],
+ f17: freg = ["f17", "fr17"],
+ f18: freg = ["f18", "fr18"],
+ f19: freg = ["f19", "fr19"],
+ f20: freg = ["f20", "fr20"],
+ f21: freg = ["f21", "fr21"],
+ f22: freg = ["f22", "fr22"],
+ f23: freg = ["f23", "fr23"],
+ f24: freg = ["f24", "fr24"],
+ f25: freg = ["f25", "fr25"],
+ f26: freg = ["f26", "fr26"],
+ f27: freg = ["f27", "fr27"],
+ f28: freg = ["f28", "fr28"],
+ f29: freg = ["f29", "fr29"],
+ f30: freg = ["f30", "fr30"],
+ f31: freg = ["f31", "fr31"],
+ #error = ["r1", "1", "sp"] =>
+ "the stack pointer cannot be used as an operand for inline asm",
+ #error = ["r2", "2"] =>
+ "r2 is a system reserved register and cannot be used as an operand for inline asm",
+ #error = ["r13", "13"] =>
+ "r13 is a system reserved register and cannot be used as an operand for inline asm",
+ #error = ["r29", "29"] =>
+ "r29 is used internally by LLVM and cannot be used as an operand for inline asm",
+ #error = ["r30", "30"] =>
+ "r30 is used internally by LLVM and cannot be used as an operand for inline asm",
+ #error = ["r31", "31", "fp"] =>
+ "the frame pointer cannot be used as an operand for inline asm",
+ #error = ["lr"] =>
+ "the link register cannot be used as an operand for inline asm",
+ #error = ["ctr"] =>
+ "the counter register cannot be used as an operand for inline asm",
+ #error = ["vrsave"] =>
+ "the vrsave register cannot be used as an operand for inline asm",
+ }
+}
+
+impl PowerPCInlineAsmReg {
+ pub fn emit(
+ self,
+ out: &mut dyn fmt::Write,
+ _arch: InlineAsmArch,
+ _modifier: Option<char>,
+ ) -> fmt::Result {
+ // Strip off the leading prefix.
+ if self as u32 <= Self::r28 as u32 {
+ let index = self as u32 - Self::r28 as u32;
+ write!(out, "{}", index)
+ } else if self as u32 >= Self::f0 as u32 && self as u32 <= Self::f31 as u32 {
+ let index = self as u32 - Self::f31 as u32;
+ write!(out, "{}", index)
+ } else {
+ unreachable!()
+ }
+ }
+
+ pub fn overlapping_regs(self, mut _cb: impl FnMut(PowerPCInlineAsmReg)) {}
+}
#![feature(bool_to_option)]
#![feature(box_patterns)]
#![feature(drain_filter)]
+#![feature(hash_drain_filter)]
#![feature(in_band_lifetimes)]
#![feature(iter_zip)]
#![feature(never_type)]
if let Some(result) = stack.cache().get_provisional(fresh_trait_ref) {
debug!(?result, "PROVISIONAL CACHE HIT");
- stack.update_reached_depth(stack.cache().current_reached_depth());
- return Ok(result);
+ stack.update_reached_depth(result.reached_depth);
+ return Ok(result.result);
}
// Check if this is a match for something already on the
debug!(?result, "CACHE MISS");
self.insert_evaluation_cache(obligation.param_env, fresh_trait_ref, dep_node, result);
- stack.cache().on_completion(stack.depth, |fresh_trait_ref, provisional_result| {
+ stack.cache().on_completion(stack.dfn, |fresh_trait_ref, provisional_result| {
self.insert_evaluation_cache(
obligation.param_env,
fresh_trait_ref,
/// required accessing something from the stack at depth `reached_depth`.
fn update_reached_depth(&self, reached_depth: usize) {
assert!(
- self.depth > reached_depth,
+ self.depth >= reached_depth,
"invoked `update_reached_depth` with something under this stack: \
self.depth={} reached_depth={}",
self.depth,
/// next "depth first number" to issue -- just a counter
dfn: Cell<usize>,
- /// Stores the "coldest" depth (bottom of stack) reached by any of
- /// the evaluation entries. The idea here is that all things in the provisional
- /// cache are always dependent on *something* that is colder in the stack:
- /// therefore, if we add a new entry that is dependent on something *colder still*,
- /// we have to modify the depth for all entries at once.
- ///
- /// Example:
- ///
- /// Imagine we have a stack `A B C D E` (with `E` being the top of
- /// the stack). We cache something with depth 2, which means that
- /// it was dependent on C. Then we pop E but go on and process a
- /// new node F: A B C D F. Now F adds something to the cache with
- /// depth 1, meaning it is dependent on B. Our original cache
- /// entry is also dependent on B, because there is a path from E
- /// to C and then from C to F and from F to B.
- reached_depth: Cell<usize>,
-
/// Map from cache key to the provisionally evaluated thing.
/// The cache entries contain the result but also the DFN in which they
/// were added. The DFN is used to clear out values on failure.
#[derive(Copy, Clone, Debug)]
struct ProvisionalEvaluation {
from_dfn: usize,
+ reached_depth: usize,
result: EvaluationResult,
}
impl<'tcx> Default for ProvisionalEvaluationCache<'tcx> {
fn default() -> Self {
- Self { dfn: Cell::new(0), reached_depth: Cell::new(usize::MAX), map: Default::default() }
+ Self { dfn: Cell::new(0), map: Default::default() }
}
}
/// Check the provisional cache for any result for
/// `fresh_trait_ref`. If there is a hit, then you must consider
/// it an access to the stack slots at depth
- /// `self.current_reached_depth()` and above.
- fn get_provisional(&self, fresh_trait_ref: ty::PolyTraitRef<'tcx>) -> Option<EvaluationResult> {
+ /// `reached_depth` (from the returned value).
+ fn get_provisional(
+ &self,
+ fresh_trait_ref: ty::PolyTraitRef<'tcx>,
+ ) -> Option<ProvisionalEvaluation> {
debug!(
?fresh_trait_ref,
- reached_depth = ?self.reached_depth.get(),
"get_provisional = {:#?}",
self.map.borrow().get(&fresh_trait_ref),
);
- Some(self.map.borrow().get(&fresh_trait_ref)?.result)
- }
-
- /// Current value of the `reached_depth` counter -- all the
- /// provisional cache entries are dependent on the item at this
- /// depth.
- fn current_reached_depth(&self) -> usize {
- self.reached_depth.get()
+ Some(self.map.borrow().get(&fresh_trait_ref)?.clone())
}
/// Insert a provisional result into the cache. The result came
fresh_trait_ref: ty::PolyTraitRef<'tcx>,
result: EvaluationResult,
) {
- debug!(?from_dfn, ?reached_depth, ?fresh_trait_ref, ?result, "insert_provisional");
- let r_d = self.reached_depth.get();
- self.reached_depth.set(r_d.min(reached_depth));
+ debug!(?from_dfn, ?fresh_trait_ref, ?result, "insert_provisional");
- debug!(reached_depth = self.reached_depth.get());
+ let mut map = self.map.borrow_mut();
+
+ // Subtle: when we complete working on the DFN `from_dfn`, anything
+ // that remains in the provisional cache must be dependent on some older
+ // stack entry than `from_dfn`. We have to update their depth with our transitive
+ // depth in that case or else it would be referring to some popped note.
+ //
+ // Example:
+ // A (reached depth 0)
+ // ...
+ // B // depth 1 -- reached depth = 0
+ // C // depth 2 -- reached depth = 1 (should be 0)
+ // B
+ // A // depth 0
+ // D (reached depth 1)
+ // C (cache -- reached depth = 2)
+ for (_k, v) in &mut *map {
+ if v.from_dfn >= from_dfn {
+ v.reached_depth = reached_depth.min(v.reached_depth);
+ }
+ }
- self.map.borrow_mut().insert(fresh_trait_ref, ProvisionalEvaluation { from_dfn, result });
+ map.insert(fresh_trait_ref, ProvisionalEvaluation { from_dfn, reached_depth, result });
}
/// Invoked when the node with dfn `dfn` does not get a successful
/// was a failure, then `on_failure` should have been invoked
/// already). The callback `op` will be invoked for each
/// provisional entry that we can now confirm.
+ ///
+ /// Note that we may still have provisional cache items remaining
+ /// in the cache when this is done. For example, if there is a
+ /// cycle:
+ ///
+ /// * A depends on...
+ /// * B depends on A
+ /// * C depends on...
+ /// * D depends on C
+ /// * ...
+ ///
+ /// Then as we complete the C node we will have a provisional cache
+ /// with results for A, B, C, and D. This method would clear out
+ /// the C and D results, but leave A and B provisional.
+ ///
+ /// This is determined based on the DFN: we remove any provisional
+ /// results created since `dfn` started (e.g., in our example, dfn
+ /// would be 2, representing the C node, and hence we would
+ /// remove the result for D, which has DFN 3, but not the results for
+ /// A and B, which have DFNs 0 and 1 respectively).
fn on_completion(
&self,
- depth: usize,
+ dfn: usize,
mut op: impl FnMut(ty::PolyTraitRef<'tcx>, EvaluationResult),
) {
- debug!(?depth, reached_depth = ?self.reached_depth.get(), "on_completion");
+ debug!(?dfn, "on_completion");
- if self.reached_depth.get() < depth {
- debug!("on_completion: did not yet reach depth to complete");
- return;
- }
-
- for (fresh_trait_ref, eval) in self.map.borrow_mut().drain() {
+ for (fresh_trait_ref, eval) in
+ self.map.borrow_mut().drain_filter(|_k, eval| eval.from_dfn >= dfn)
+ {
debug!(?fresh_trait_ref, ?eval, "on_completion");
op(fresh_trait_ref, eval.result);
}
-
- self.reached_depth.set(usize::MAX);
}
}
use rustc_hir as hir;
use rustc_hir::def::{Namespace, Res};
use rustc_hir::def_id::{DefId, LOCAL_CRATE};
-use rustc_infer::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind};
-use rustc_infer::{infer, traits};
+use rustc_infer::{
+ infer,
+ traits::{self, Obligation},
+};
+use rustc_infer::{
+ infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind},
+ traits::ObligationCause,
+};
use rustc_middle::ty::adjustment::{
Adjust, Adjustment, AllowTwoPhase, AutoBorrow, AutoBorrowMutability,
};
use rustc_span::Span;
use rustc_target::spec::abi;
use rustc_trait_selection::autoderef::Autoderef;
+use rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt;
use std::iter;
/// Checks that it is legal to call methods of the trait corresponding
expected: Expectation<'tcx>,
) -> Ty<'tcx> {
let (fn_sig, def_id) = match *callee_ty.kind() {
- ty::FnDef(def_id, _) => (callee_ty.fn_sig(self.tcx), Some(def_id)),
+ ty::FnDef(def_id, subst) => {
+ // Unit testing: function items annotated with
+ // `#[rustc_evaluate_where_clauses]` trigger special output
+ // to let us test the trait evaluation system.
+ if self.tcx.has_attr(def_id, sym::rustc_evaluate_where_clauses) {
+ let predicates = self.tcx.predicates_of(def_id);
+ let predicates = predicates.instantiate(self.tcx, subst);
+ for (predicate, predicate_span) in
+ predicates.predicates.iter().zip(&predicates.spans)
+ {
+ let obligation = Obligation::new(
+ ObligationCause::dummy_with_span(callee_expr.span),
+ self.param_env,
+ predicate.clone(),
+ );
+ let result = self.infcx.evaluate_obligation(&obligation);
+ self.tcx
+ .sess
+ .struct_span_err(
+ callee_expr.span,
+ &format!("evaluate({:?}) = {:?}", predicate, result),
+ )
+ .span_label(*predicate_span, "predicate")
+ .emit();
+ }
+ }
+ (callee_ty.fn_sig(self.tcx), Some(def_id))
+ }
ty::FnPtr(sig) => (sig, None),
ref t => {
let mut unit_variant = None;
}
}
- self.check_rustc_args_require_const(def_id, hir_id, span);
-
debug!("instantiate_value_path: type of {:?} is {:?}", hir_id, ty_substituted);
self.write_substs(hir_id, substs);
use rustc_middle::ty::fold::TypeFoldable;
use rustc_middle::ty::{self, Ty};
use rustc_session::Session;
-use rustc_span::symbol::{sym, Ident};
+use rustc_span::symbol::Ident;
use rustc_span::{self, MultiSpan, Span};
use rustc_trait_selection::traits::{self, ObligationCauseCode, StatementAsExpression};
ty
}
- pub(in super::super) fn check_rustc_args_require_const(
- &self,
- def_id: DefId,
- hir_id: hir::HirId,
- span: Span,
- ) {
- // We're only interested in functions tagged with
- // #[rustc_args_required_const], so ignore anything that's not.
- if !self.tcx.has_attr(def_id, sym::rustc_args_required_const) {
- return;
- }
-
- // If our calling expression is indeed the function itself, we're good!
- // If not, generate an error that this can only be called directly.
- if let Node::Expr(expr) = self.tcx.hir().get(self.tcx.hir().get_parent_node(hir_id)) {
- if let ExprKind::Call(ref callee, ..) = expr.kind {
- if callee.hir_id == hir_id {
- return;
- }
- }
- }
-
- self.tcx.sess.span_err(
- span,
- "this function can only be invoked directly, not through a function pointer",
- );
- }
-
/// A common error is to add an extra semicolon:
///
/// ```
kind: TypeVariableOriginKind::TypeInference,
span,
}),
- Node::Expr(&hir::Expr { kind: hir::ExprKind::InlineAsm(ia), .. })
- if ia.operands.iter().any(|(op, _op_sp)| match op {
+ Node::Expr(&hir::Expr { kind: hir::ExprKind::InlineAsm(asm), .. })
+ | Node::Item(&hir::Item { kind: hir::ItemKind::GlobalAsm(asm), .. })
+ if asm.operands.iter().any(|(op, _op_sp)| match op {
hir::InlineAsmOperand::Const { anon_const } => {
anon_const.hir_id == id
}
use rustc_infer::infer::UpvarRegion;
use rustc_middle::hir::place::{Place, PlaceBase, PlaceWithHirId, Projection, ProjectionKind};
use rustc_middle::mir::FakeReadCause;
-use rustc_middle::ty::{self, Ty, TyCtxt, TypeckResults, UpvarSubsts};
+use rustc_middle::ty::{self, TraitRef, Ty, TyCtxt, TypeckResults, UpvarSubsts};
use rustc_session::lint;
use rustc_span::sym;
use rustc_span::{MultiSpan, Span, Symbol};
+use rustc_trait_selection::traits::{Obligation, ObligationCause};
+use rustc_data_structures::stable_set::FxHashSet;
use rustc_index::vec::Idx;
use rustc_target::abi::VariantIdx;
self.compute_min_captures(closure_def_id, delegate.capture_information);
let closure_hir_id = self.tcx.hir().local_def_id_to_hir_id(local_def_id);
- if should_do_migration_analysis(self.tcx, closure_hir_id) {
+
+ if should_do_disjoint_capture_migration_analysis(self.tcx, closure_hir_id) {
self.perform_2229_migration_anaysis(closure_def_id, body_id, capture_clause, span);
}
capture_clause: hir::CaptureBy,
span: Span,
) {
- let need_migrations = self.compute_2229_migrations(
+ let (need_migrations, reasons) = self.compute_2229_migrations(
closure_def_id,
span,
capture_clause,
let local_def_id = closure_def_id.expect_local();
let closure_hir_id = self.tcx.hir().local_def_id_to_hir_id(local_def_id);
self.tcx.struct_span_lint_hir(
- lint::builtin::DISJOINT_CAPTURE_DROP_REORDER,
+ lint::builtin::DISJOINT_CAPTURE_MIGRATION,
closure_hir_id,
span,
|lint| {
let mut diagnostics_builder = lint.build(
- "drop order affected for closure because of `capture_disjoint_fields`",
+ format!(
+ "{} affected for closure because of `capture_disjoint_fields`",
+ reasons
+ )
+ .as_str(),
);
let closure_body_span = self.tcx.hir().span(body_id.hir_id);
let (sugg, app) =
}
}
+ /// Combines all the reasons for 2229 migrations
+ fn compute_2229_migrations_reasons(
+ &self,
+ auto_trait_reasons: FxHashSet<&str>,
+ drop_reason: bool,
+ ) -> String {
+ let mut reasons = String::new();
+
+ if auto_trait_reasons.len() > 0 {
+ reasons = format!(
+ "{} trait implementation",
+ auto_trait_reasons.clone().into_iter().collect::<Vec<&str>>().join(", ")
+ );
+ }
+
+ if auto_trait_reasons.len() > 0 && drop_reason {
+ reasons = format!("{}, and ", reasons);
+ }
+
+ if drop_reason {
+ reasons = format!("{}drop order", reasons);
+ }
+
+ reasons
+ }
+
+ /// Returns true if `ty` may implement `trait_def_id`
+ fn ty_impls_trait(
+ &self,
+ ty: Ty<'tcx>,
+ cause: &ObligationCause<'tcx>,
+ trait_def_id: DefId,
+ ) -> bool {
+ use crate::rustc_middle::ty::ToPredicate;
+ use crate::rustc_middle::ty::WithConstness;
+ use rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt;
+ let tcx = self.infcx.tcx;
+
+ let trait_ref = TraitRef { def_id: trait_def_id, substs: tcx.mk_substs_trait(ty, &[]) };
+
+ let obligation = Obligation::new(
+ cause.clone(),
+ self.param_env,
+ trait_ref.without_const().to_predicate(tcx),
+ );
+
+ self.infcx.predicate_may_hold(&obligation)
+ }
+
+ /// Returns true if migration is needed for trait for the provided var_hir_id
+ fn need_2229_migrations_for_trait(
+ &self,
+ min_captures: Option<&ty::RootVariableMinCaptureList<'tcx>>,
+ var_hir_id: hir::HirId,
+ check_trait: Option<DefId>,
+ ) -> bool {
+ let root_var_min_capture_list = if let Some(root_var_min_capture_list) =
+ min_captures.and_then(|m| m.get(&var_hir_id))
+ {
+ root_var_min_capture_list
+ } else {
+ return false;
+ };
+
+ let ty = self.infcx.resolve_vars_if_possible(self.node_ty(var_hir_id));
+
+ let cause = ObligationCause::misc(self.tcx.hir().span(var_hir_id), self.body_id);
+
+ let obligation_should_hold = check_trait
+ .map(|check_trait| self.ty_impls_trait(ty, &cause, check_trait))
+ .unwrap_or(false);
+
+ // Check whether catpured fields also implement the trait
+
+ for capture in root_var_min_capture_list.iter() {
+ let ty = capture.place.ty();
+
+ let obligation_holds_for_capture = check_trait
+ .map(|check_trait| self.ty_impls_trait(ty, &cause, check_trait))
+ .unwrap_or(false);
+
+ if !obligation_holds_for_capture && obligation_should_hold {
+ return true;
+ }
+ }
+ false
+ }
+
+ /// Figures out the list of root variables (and their types) that aren't completely
+ /// captured by the closure when `capture_disjoint_fields` is enabled and auto-traits
+ /// differ between the root variable and the captured paths.
+ ///
+ /// The output list would include a root variable if:
+ /// - It would have been captured into the closure when `capture_disjoint_fields` wasn't
+ /// enabled, **and**
+ /// - It wasn't completely captured by the closure, **and**
+ /// - One of the paths captured does not implement all the auto-traits its root variable
+ /// implements.
+ fn compute_2229_migrations_for_trait(
+ &self,
+ min_captures: Option<&ty::RootVariableMinCaptureList<'tcx>>,
+ var_hir_id: hir::HirId,
+ ) -> Option<FxHashSet<&str>> {
+ let tcx = self.infcx.tcx;
+
+ // Check whether catpured fields also implement the trait
+ let mut auto_trait_reasons = FxHashSet::default();
+
+ if self.need_2229_migrations_for_trait(
+ min_captures,
+ var_hir_id,
+ tcx.lang_items().clone_trait(),
+ ) {
+ auto_trait_reasons.insert("`Clone`");
+ }
+
+ if self.need_2229_migrations_for_trait(
+ min_captures,
+ var_hir_id,
+ tcx.lang_items().sync_trait(),
+ ) {
+ auto_trait_reasons.insert("`Sync`");
+ }
+
+ if self.need_2229_migrations_for_trait(
+ min_captures,
+ var_hir_id,
+ tcx.lang_items().send_trait(),
+ ) {
+ auto_trait_reasons.insert("`Send`");
+ }
+
+ if self.need_2229_migrations_for_trait(
+ min_captures,
+ var_hir_id,
+ tcx.lang_items().unpin_trait(),
+ ) {
+ auto_trait_reasons.insert("`Unpin`");
+ }
+
+ if self.need_2229_migrations_for_trait(
+ min_captures,
+ var_hir_id,
+ tcx.lang_items().unwind_safe_trait(),
+ ) {
+ auto_trait_reasons.insert("`UnwindSafe`");
+ }
+
+ if self.need_2229_migrations_for_trait(
+ min_captures,
+ var_hir_id,
+ tcx.lang_items().ref_unwind_safe_trait(),
+ ) {
+ auto_trait_reasons.insert("`RefUnwindSafe`");
+ }
+
+ if auto_trait_reasons.len() > 0 {
+ return Some(auto_trait_reasons);
+ }
+
+ return None;
+ }
+
/// Figures out the list of root variables (and their types) that aren't completely
/// captured by the closure when `capture_disjoint_fields` is enabled and drop order of
/// some path starting at that root variable **might** be affected.
/// enabled, **and**
/// - It wasn't completely captured by the closure, **and**
/// - One of the paths starting at this root variable, that is not captured needs Drop.
- fn compute_2229_migrations(
+ fn compute_2229_migrations_for_drop(
&self,
closure_def_id: DefId,
closure_span: Span,
- closure_clause: hir::CaptureBy,
min_captures: Option<&ty::RootVariableMinCaptureList<'tcx>>,
- ) -> Vec<hir::HirId> {
- let upvars = if let Some(upvars) = self.tcx.upvars_mentioned(closure_def_id) {
- upvars
- } else {
- return vec![];
- };
+ closure_clause: hir::CaptureBy,
+ var_hir_id: hir::HirId,
+ ) -> bool {
+ let ty = self.infcx.resolve_vars_if_possible(self.node_ty(var_hir_id));
- let mut need_migrations = Vec::new();
+ if !ty.needs_drop(self.tcx, self.tcx.param_env(closure_def_id.expect_local())) {
+ return false;
+ }
- for (&var_hir_id, _) in upvars.iter() {
- let ty = self.infcx.resolve_vars_if_possible(self.node_ty(var_hir_id));
+ let root_var_min_capture_list = if let Some(root_var_min_capture_list) =
+ min_captures.and_then(|m| m.get(&var_hir_id))
+ {
+ root_var_min_capture_list
+ } else {
+ // The upvar is mentioned within the closure but no path starting from it is
+ // used.
- if !ty.needs_drop(self.tcx, self.tcx.param_env(closure_def_id.expect_local())) {
- continue;
+ match closure_clause {
+ // Only migrate if closure is a move closure
+ hir::CaptureBy::Value => return true,
+ hir::CaptureBy::Ref => {}
}
- let root_var_min_capture_list = if let Some(root_var_min_capture_list) =
- min_captures.and_then(|m| m.get(&var_hir_id))
- {
- root_var_min_capture_list
- } else {
- // The upvar is mentioned within the closure but no path starting from it is
- // used.
+ return false;
+ };
- match closure_clause {
- // Only migrate if closure is a move closure
- hir::CaptureBy::Value => need_migrations.push(var_hir_id),
+ let projections_list = root_var_min_capture_list
+ .iter()
+ .filter_map(|captured_place| match captured_place.info.capture_kind {
+ // Only care about captures that are moved into the closure
+ ty::UpvarCapture::ByValue(..) => Some(captured_place.place.projections.as_slice()),
+ ty::UpvarCapture::ByRef(..) => None,
+ })
+ .collect::<Vec<_>>();
- hir::CaptureBy::Ref => {}
- }
+ let is_moved = !projections_list.is_empty();
- continue;
- };
+ let is_not_completely_captured =
+ root_var_min_capture_list.iter().any(|capture| capture.place.projections.len() > 0);
- let projections_list = root_var_min_capture_list
- .iter()
- .filter_map(|captured_place| match captured_place.info.capture_kind {
- // Only care about captures that are moved into the closure
- ty::UpvarCapture::ByValue(..) => {
- Some(captured_place.place.projections.as_slice())
- }
- ty::UpvarCapture::ByRef(..) => None,
- })
- .collect::<Vec<_>>();
+ if is_moved
+ && is_not_completely_captured
+ && self.has_significant_drop_outside_of_captures(
+ closure_def_id,
+ closure_span,
+ ty,
+ projections_list,
+ )
+ {
+ return true;
+ }
+
+ return false;
+ }
- let is_moved = !projections_list.is_empty();
+ /// Figures out the list of root variables (and their types) that aren't completely
+ /// captured by the closure when `capture_disjoint_fields` is enabled and either drop
+ /// order of some path starting at that root variable **might** be affected or auto-traits
+ /// differ between the root variable and the captured paths.
+ ///
+ /// The output list would include a root variable if:
+ /// - It would have been moved into the closure when `capture_disjoint_fields` wasn't
+ /// enabled, **and**
+ /// - It wasn't completely captured by the closure, **and**
+ /// - One of the paths starting at this root variable, that is not captured needs Drop **or**
+ /// - One of the paths captured does not implement all the auto-traits its root variable
+ /// implements.
+ ///
+ /// Returns a tuple containing a vector of HirIds as well as a String containing the reason
+ /// why root variables whose HirId is contained in the vector should be fully captured.
+ fn compute_2229_migrations(
+ &self,
+ closure_def_id: DefId,
+ closure_span: Span,
+ closure_clause: hir::CaptureBy,
+ min_captures: Option<&ty::RootVariableMinCaptureList<'tcx>>,
+ ) -> (Vec<hir::HirId>, String) {
+ let upvars = if let Some(upvars) = self.tcx.upvars_mentioned(closure_def_id) {
+ upvars
+ } else {
+ return (Vec::new(), format!(""));
+ };
- let is_not_completely_captured =
- root_var_min_capture_list.iter().any(|capture| capture.place.projections.len() > 0);
+ let mut need_migrations = Vec::new();
+ let mut auto_trait_reasons = FxHashSet::default();
+ let mut drop_reorder_reason = false;
- if is_moved
- && is_not_completely_captured
- && self.has_significant_drop_outside_of_captures(
- closure_def_id,
- closure_span,
- ty,
- projections_list,
- )
+ // Perform auto-trait analysis
+ for (&var_hir_id, _) in upvars.iter() {
+ let mut need_migration = false;
+ if let Some(trait_migration_cause) =
+ self.compute_2229_migrations_for_trait(min_captures, var_hir_id)
{
+ need_migration = true;
+ auto_trait_reasons.extend(trait_migration_cause);
+ }
+
+ if self.compute_2229_migrations_for_drop(
+ closure_def_id,
+ closure_span,
+ min_captures,
+ closure_clause,
+ var_hir_id,
+ ) {
+ need_migration = true;
+ drop_reorder_reason = true;
+ }
+
+ if need_migration {
need_migrations.push(var_hir_id);
}
}
- need_migrations
+ (
+ need_migrations,
+ self.compute_2229_migrations_reasons(auto_trait_reasons, drop_reorder_reason),
+ )
}
/// This is a helper function to `compute_2229_migrations_precise_pass`. Provided the type
tcx.hir().name(var_hir_id)
}
-fn should_do_migration_analysis(tcx: TyCtxt<'_>, closure_id: hir::HirId) -> bool {
- let (level, _) =
- tcx.lint_level_at_node(lint::builtin::DISJOINT_CAPTURE_DROP_REORDER, closure_id);
+fn should_do_disjoint_capture_migration_analysis(tcx: TyCtxt<'_>, closure_id: hir::HirId) -> bool {
+ let (level, _) = tcx.lint_level_at_node(lint::builtin::DISJOINT_CAPTURE_MIGRATION, closure_id);
!matches!(level, lint::Level::Allow)
}
tcx.typeck(def_id).node_type(anon_const.hir_id)
}
- Node::Expr(&Expr { kind: ExprKind::InlineAsm(ia), .. })
- if ia.operands.iter().any(|(op, _op_sp)| match op {
+ Node::Expr(&Expr { kind: ExprKind::InlineAsm(asm), .. })
+ | Node::Item(&Item { kind: ItemKind::GlobalAsm(asm), .. })
+ if asm.operands.iter().any(|(op, _op_sp)| match op {
hir::InlineAsmOperand::Const { anon_const } => anon_const.hir_id == hir_id,
_ => false,
}) =>
gen_args: &'a hir::GenericArgs<'a>,
def_id: DefId,
) -> Self {
- let angle_brackets = if gen_args.is_empty() {
- AngleBrackets::Missing
+ let angle_brackets = if gen_args.span_ext().is_none() {
+ if gen_args.is_empty() { AngleBrackets::Missing } else { AngleBrackets::Implied }
} else {
- if gen_args.span().is_none() {
- AngleBrackets::Implied
- } else {
- AngleBrackets::Available
- }
+ AngleBrackets::Available
};
Self {
),
};
- if self.gen_args.span().is_some() {
+ if self.gen_args.span_ext().is_some() {
format!(
"this {} takes {}{} {} argument{} but {} {} supplied",
def_kind,
err.span_suggestion_verbose(span, &msg, sugg, Applicability::HasPlaceholders);
}
AngleBrackets::Available => {
- // angle brackets exist, so we just insert missing arguments after the existing
- // type or const args
-
- let index_last_provided_arg =
- self.get_lifetime_args_offset() + self.num_provided_type_or_const_args() - 1;
- if index_last_provided_arg < self.gen_args.args.len() {
- let first_arg_span =
- self.gen_args.args[index_last_provided_arg].span().shrink_to_hi();
- let source_map = self.tcx.sess.source_map();
- if let Ok(first_gen_arg) = source_map.span_to_snippet(first_arg_span) {
- let sugg = format!("{}, {}", first_gen_arg, suggested_args);
- debug!("sugg: {:?}", sugg);
+ let gen_args_span = self.gen_args.span().unwrap();
+ let sugg_offset =
+ self.get_lifetime_args_offset() + self.num_provided_type_or_const_args();
- err.span_suggestion_verbose(
- first_arg_span,
- &msg,
- sugg,
- Applicability::HasPlaceholders,
- );
- }
- }
+ let (sugg_span, is_first) = if sugg_offset == 0 {
+ (gen_args_span.shrink_to_lo(), true)
+ } else {
+ let arg_span = self.gen_args.args[sugg_offset - 1].span();
+ // If we came here then inferred lifetimes's spans can only point
+ // to either the opening bracket or to the space right after.
+ // Both of these spans have an `hi` lower than or equal to the span
+ // of the generics excluding the brackets.
+ // This allows us to check if `arg_span` is the artificial span of
+ // an inferred lifetime, in which case the generic we're suggesting to
+ // add will be the first visible, even if it isn't the actual first generic.
+ (arg_span.shrink_to_hi(), arg_span.hi() <= gen_args_span.lo())
+ };
+
+ let sugg_prefix = if is_first { "" } else { ", " };
+ let sugg_suffix =
+ if is_first && !self.gen_args.bindings.is_empty() { ", " } else { "" };
+
+ let sugg = format!("{}{}{}", sugg_prefix, suggested_args, sugg_suffix);
+ debug!("sugg: {:?}", sugg);
+
+ err.span_suggestion_verbose(sugg_span, &msg, sugg, Applicability::HasPlaceholders);
}
}
}
};
if remove_entire_generics {
- let sm = self.tcx.sess.source_map();
-
let span = self
.path_segment
.args
.unwrap()
- .span_ext(sm)
+ .span_ext()
.unwrap()
.with_lo(self.path_segment.ident.span.hi());
[dependencies]
core = { path = "../core" }
-compiler_builtins = { version = "0.1.39", features = ['rustc-dep-of-std'] }
+compiler_builtins = { version = "0.1.40", features = ['rustc-dep-of-std'] }
[dev-dependencies]
rand = "0.7"
#[rustc_builtin_macro]
#[macro_export]
macro_rules! global_asm {
- ("assembly") => {
+ ("assembly template",
+ $(operands,)*
+ $(options($(option),*))?
+ ) => {
/* compiler built-in */
};
}
/// [ub]: ../../reference/behavior-considered-undefined.html
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "send_trait")]
+#[cfg_attr(not(bootstrap), lang = "send")]
#[rustc_on_unimplemented(
message = "`{Self}` cannot be sent between threads safely",
label = "`{Self}` cannot be sent between threads safely"
#[unstable(feature = "wrapping_int_impl", issue = "32463")]
pub const MAX: Self = Self(<$t>::MAX);
+ /// Returns the size of this integer type in bits.
+ ///
+ /// # Examples
+ ///
+ /// Basic usage:
+ ///
+ /// ```
+ /// #![feature(wrapping_int_impl)]
+ /// use std::num::Wrapping;
+ ///
+ #[doc = concat!("assert_eq!(<Wrapping<", stringify!($t), ">>::BITS, ", stringify!($t), "::BITS);")]
+ /// ```
+ #[unstable(feature = "wrapping_int_impl", issue = "32463")]
+ pub const BITS: u32 = <$t>::BITS;
+
/// Returns the number of ones in the binary representation of `self`.
///
/// # Examples
/// Casts to a pointer of another type.
#[stable(feature = "ptr_cast", since = "1.38.0")]
#[rustc_const_stable(feature = "const_ptr_cast", since = "1.38.0")]
- #[inline]
+ #[inline(always)]
pub const fn cast<U>(self) -> *mut U {
self as _
}
/// ```
#[stable(feature = "ptr_offset_from", since = "1.47.0")]
#[rustc_const_unstable(feature = "const_ptr_offset_from", issue = "41079")]
- #[inline]
+ #[inline(always)]
pub const unsafe fn offset_from(self, origin: *const T) -> isize
where
T: Sized,
/// [`ptr::read`]: crate::ptr::read()
#[stable(feature = "pointer_methods", since = "1.26.0")]
#[rustc_const_unstable(feature = "const_ptr_read", issue = "80377")]
- #[inline]
+ #[inline(always)]
pub const unsafe fn read(self) -> T
where
T: Sized,
///
/// [`ptr::read_volatile`]: crate::ptr::read_volatile()
#[stable(feature = "pointer_methods", since = "1.26.0")]
- #[inline]
+ #[inline(always)]
pub unsafe fn read_volatile(self) -> T
where
T: Sized,
/// [`ptr::read_unaligned`]: crate::ptr::read_unaligned()
#[stable(feature = "pointer_methods", since = "1.26.0")]
#[rustc_const_unstable(feature = "const_ptr_read", issue = "80377")]
- #[inline]
+ #[inline(always)]
pub const unsafe fn read_unaligned(self) -> T
where
T: Sized,
/// [`ptr::copy`]: crate::ptr::copy()
#[rustc_const_unstable(feature = "const_intrinsic_copy", issue = "80697")]
#[stable(feature = "pointer_methods", since = "1.26.0")]
- #[inline]
+ #[inline(always)]
pub const unsafe fn copy_to(self, dest: *mut T, count: usize)
where
T: Sized,
/// [`ptr::copy_nonoverlapping`]: crate::ptr::copy_nonoverlapping()
#[rustc_const_unstable(feature = "const_intrinsic_copy", issue = "80697")]
#[stable(feature = "pointer_methods", since = "1.26.0")]
- #[inline]
+ #[inline(always)]
pub const unsafe fn copy_to_nonoverlapping(self, dest: *mut T, count: usize)
where
T: Sized,
/// [`ptr::copy`]: crate::ptr::copy()
#[rustc_const_unstable(feature = "const_intrinsic_copy", issue = "80697")]
#[stable(feature = "pointer_methods", since = "1.26.0")]
- #[inline]
+ #[inline(always)]
pub const unsafe fn copy_from(self, src: *const T, count: usize)
where
T: Sized,
/// [`ptr::copy_nonoverlapping`]: crate::ptr::copy_nonoverlapping()
#[rustc_const_unstable(feature = "const_intrinsic_copy", issue = "80697")]
#[stable(feature = "pointer_methods", since = "1.26.0")]
- #[inline]
+ #[inline(always)]
pub const unsafe fn copy_from_nonoverlapping(self, src: *const T, count: usize)
where
T: Sized,
///
/// [`ptr::drop_in_place`]: crate::ptr::drop_in_place()
#[stable(feature = "pointer_methods", since = "1.26.0")]
- #[inline]
+ #[inline(always)]
pub unsafe fn drop_in_place(self) {
// SAFETY: the caller must uphold the safety contract for `drop_in_place`.
unsafe { drop_in_place(self) }
/// [`ptr::write`]: crate::ptr::write()
#[stable(feature = "pointer_methods", since = "1.26.0")]
#[rustc_const_unstable(feature = "const_ptr_write", issue = "none")]
- #[inline]
+ #[inline(always)]
pub const unsafe fn write(self, val: T)
where
T: Sized,
///
/// [`ptr::write_bytes`]: crate::ptr::write_bytes()
#[stable(feature = "pointer_methods", since = "1.26.0")]
- #[inline]
+ #[inline(always)]
pub unsafe fn write_bytes(self, val: u8, count: usize)
where
T: Sized,
///
/// [`ptr::write_volatile`]: crate::ptr::write_volatile()
#[stable(feature = "pointer_methods", since = "1.26.0")]
- #[inline]
+ #[inline(always)]
pub unsafe fn write_volatile(self, val: T)
where
T: Sized,
/// [`ptr::write_unaligned`]: crate::ptr::write_unaligned()
#[stable(feature = "pointer_methods", since = "1.26.0")]
#[rustc_const_unstable(feature = "const_ptr_write", issue = "none")]
- #[inline]
+ #[inline(always)]
pub const unsafe fn write_unaligned(self, val: T)
where
T: Sized,
///
/// [`ptr::replace`]: crate::ptr::replace()
#[stable(feature = "pointer_methods", since = "1.26.0")]
- #[inline]
+ #[inline(always)]
pub unsafe fn replace(self, src: T) -> T
where
T: Sized,
///
/// [`ptr::swap`]: crate::ptr::swap()
#[stable(feature = "pointer_methods", since = "1.26.0")]
- #[inline]
+ #[inline(always)]
pub unsafe fn swap(self, with: *mut T)
where
T: Sized,
/// let slice: *mut [i8] = ptr::slice_from_raw_parts_mut(ptr::null_mut(), 3);
/// assert_eq!(slice.len(), 3);
/// ```
- #[inline]
+ #[inline(always)]
#[unstable(feature = "slice_ptr_len", issue = "71146")]
#[rustc_const_unstable(feature = "const_slice_ptr_len", issue = "71146")]
pub const fn len(self) -> usize {
/// let slice: *mut [i8] = ptr::slice_from_raw_parts_mut(ptr::null_mut(), 3);
/// assert_eq!(slice.as_mut_ptr(), 0 as *mut i8);
/// ```
- #[inline]
+ #[inline(always)]
#[unstable(feature = "slice_ptr_get", issue = "74265")]
#[rustc_const_unstable(feature = "slice_ptr_get", issue = "74265")]
pub const fn as_mut_ptr(self) -> *mut T {
/// }
/// ```
#[unstable(feature = "slice_ptr_get", issue = "74265")]
- #[inline]
+ #[inline(always)]
pub unsafe fn get_unchecked_mut<I>(self, index: I) -> *mut I::Output
where
I: SliceIndex<[T]>,
// Equality for pointers
#[stable(feature = "rust1", since = "1.0.0")]
impl<T: ?Sized> PartialEq for *mut T {
- #[inline]
+ #[inline(always)]
fn eq(&self, other: &*mut T) -> bool {
*self == *other
}
#[stable(feature = "rust1", since = "1.0.0")]
impl<T: ?Sized> PartialOrd for *mut T {
- #[inline]
+ #[inline(always)]
fn partial_cmp(&self, other: &*mut T) -> Option<Ordering> {
Some(self.cmp(other))
}
- #[inline]
+ #[inline(always)]
fn lt(&self, other: &*mut T) -> bool {
*self < *other
}
- #[inline]
+ #[inline(always)]
fn le(&self, other: &*mut T) -> bool {
*self <= *other
}
- #[inline]
+ #[inline(always)]
fn gt(&self, other: &*mut T) -> bool {
*self > *other
}
- #[inline]
+ #[inline(always)]
fn ge(&self, other: &*mut T) -> bool {
*self >= *other
}
compiler_builtins = { version = "0.1.0", features = ['rustc-dep-of-std'] }
[build-dependencies]
-cc = "1.0.1"
+cc = "1.0.67"
panic_abort = { path = "../panic_abort" }
core = { path = "../core" }
libc = { version = "0.2.93", default-features = false, features = ['rustc-dep-of-std'] }
-compiler_builtins = { version = "0.1.39" }
+compiler_builtins = { version = "0.1.43" }
profiler_builtins = { path = "../profiler_builtins", optional = true }
unwind = { path = "../unwind" }
hashbrown = { version = "0.11", default-features = false, features = ['rustc-dep-of-std'] }
/// builds or when debugging in release mode is significantly faster.
///
/// Note that the macro is intended as a debugging tool and therefore you
-/// should avoid having uses of it in version control for long periods.
-/// Use cases involving debug output that should be added to version control
-/// are better served by macros such as [`debug!`] from the [`log`] crate.
+/// should avoid having uses of it in version control for long periods
+/// (other than in tests and similar).
+/// Debug output from production code is better done with other facilities
+/// such as the [`debug!`] macro from the [`log`] crate.
///
/// # Stability
///
/// [`AssertUnwindSafe`] wrapper struct can be used to force this trait to be
/// implemented for any closed over variables passed to `catch_unwind`.
#[stable(feature = "catch_unwind", since = "1.9.0")]
+#[cfg_attr(all(not(bootstrap), not(test)), lang = "unwind_safe")]
#[rustc_on_unimplemented(
message = "the type `{Self}` may not be safely transferred across an unwind boundary",
label = "`{Self}` may not be safely transferred across an unwind boundary"
/// This is a "helper marker trait" used to provide impl blocks for the
/// [`UnwindSafe`] trait, for more information see that documentation.
#[stable(feature = "catch_unwind", since = "1.9.0")]
+#[cfg_attr(all(not(bootstrap), not(test)), lang = "ref_unwind_safe")]
#[rustc_on_unimplemented(
message = "the type `{Self}` may contain interior mutability and a reference may not be safely \
transferrable across a catch_unwind boundary",
prefix: Option<Prefix<'a>>,
// true if path *physically* has a root separator; for most Windows
- // prefixes, it may have a "logical" rootseparator for the purposes of
+ // prefixes, it may have a "logical" root separator for the purposes of
// normalization, e.g., \\server\share == \\server\share\.
has_physical_root: bool,
pub mod usercalls;
#[cfg(not(test))]
-global_asm!(include_str!("entry.S"));
+global_asm!(include_str!("entry.S"), options(att_syntax));
#[repr(C)]
struct EntryReturn(u64, u64);
-Subproject commit 6c4f4e1990b76be8a07bde1956d2e3452fd55ee4
+Subproject commit c14e98417feb406df66e821ccd81e1293b4baa6f
cfg-if = "0.1.8"
[build-dependencies]
-cc = { version = "1.0.1" }
+cc = "1.0.67"
[features]
llvm-libunwind = []
filetime = "0.2"
num_cpus = "1.0"
getopts = "0.2.19"
-cc = "1.0.35"
+cc = "1.0.67"
libc = "0.2"
serde = { version = "1.0.8", features = ["derive"] }
serde_json = "1.0.2"
run: src/ci/scripts/should-skip-this.sh
<<: *step
+ - name: ensure the channel matches the target branch
+ run: src/ci/scripts/verify-channel.sh
+ <<: *step
+
- name: configure GitHub Actions to kill the build when outdated
uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
with:
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --disable-dist-src"
fi
-# If we're deploying artifacts then we set the release channel, otherwise if
-# we're not deploying then we want to be sure to enable all assertions because
-# we'll be running tests
-#
-# FIXME: need a scheme for changing this `nightly` value to `beta` and `stable`
-# either automatically or manually.
-export RUST_RELEASE_CHANNEL=nightly
-
# Always set the release channel for bootstrap; this is normally not important (i.e., only dist
# builds would seem to matter) but in practice bootstrap wants to know whether we're targeting
# master, beta, or stable with a build to determine whether to run some checks (notably toolstate).
+export RUST_RELEASE_CHANNEL="$(cat "${ci_dir}/channel")"
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --release-channel=$RUST_RELEASE_CHANNEL"
if [ "$DEPLOY$DEPLOY_ALT" = "1" ]; then
--- /dev/null
+#!/bin/bash
+# We want to make sure all PRs are targeting the right branch when they're
+# opened, otherwise we risk (for example) to land a beta-specific change to the
+# master branch. This script ensures the branch of the PR matches the channel.
+
+set -euo pipefail
+IFS=$'\n\t'
+
+source "$(cd "$(dirname "$0")" && pwd)/../shared.sh"
+
+if isCiBranch auto || isCiBranch try; then
+ echo "channel verification is only executed on PR builds"
+ exit
+fi
+
+channel=$(cat "$(ciCheckoutPath)/src/ci/channel")
+case "${channel}" in
+ nightly)
+ channel_branch="master"
+ ;;
+ beta)
+ channel_branch="beta"
+ ;;
+ stable)
+ channel_branch="stable"
+ ;;
+ *)
+ echo "error: unknown channel defined in src/ci/channel: ${channel}"
+ exit 1
+esac
+
+branch="$(ciBaseBranch)"
+if [[ "${branch}" != "${channel_branch}" ]]; then
+ echo "error: PRs changing the \`${channel}\` channel should be sent to the \
+\`${channel_branch}\` branch!"
+
+ exit 1
+fi
fi
}
+function ciBaseBranch {
+ if isAzurePipelines; then
+ echo "unsupported on Azure Pipelines"
+ exit 1
+ elif isGitHubActions; then
+ echo "${GITHUB_BASE_REF#refs/heads/}"
+ else
+ echo "ciBaseBranch only works inside CI!"
+ exit 1
+ fi
+}
+
function ciCommit {
if isAzurePipelines; then
echo "${BUILD_SOURCEVERSION}"
-Subproject commit 50dd06cb71beb27fdc0eebade5509cdcc1f821ed
+Subproject commit 55a26488ddefc8433e73a2e8352d70f7a5c7fc2b
-Subproject commit 8551afbb2ca6f5ea37fe58380318b209785e4e02
+Subproject commit 55de6fa3c1f331774da19472c9ee57d2ae9eb039
-Subproject commit d23f9da8469617e6c81121d9fd123443df70595d
+Subproject commit 5aa457bf1b54bd2cd5d4cf49797f29299bdf89a7
-Subproject commit e0a721f5202e6d9bec0aff99f10e44480c0da9e7
+Subproject commit 5f8c6da200ada77760a2fe1096938ef58151c9a6
-Subproject commit e72b43a64925ce053dc7830e21c1a57ba00499bd
+Subproject commit 1e6c7fbda4c45e85adf63ff3f82fa9c870b1447f
- AArch64
- RISC-V
- NVPTX
+- PowerPC
- Hexagon
- MIPS32r2 and MIPS64r2
- wasm32
asm := "asm!(" format_string *("," format_string) *("," [ident "="] operand) ["," options] [","] ")"
```
-The macro will initially be supported only on ARM, AArch64, Hexagon, x86, x86-64 and RISC-V targets. Support for more targets may be added in the future. The compiler will emit an error if `asm!` is used on an unsupported target.
+The macro will initially be supported only on ARM, AArch64, Hexagon, PowerPC, x86, x86-64 and RISC-V targets. Support for more targets may be added in the future. The compiler will emit an error if `asm!` is used on an unsupported target.
[format-syntax]: https://doc.rust-lang.org/std/fmt/#syntax
| RISC-V | `reg` | `x1`, `x[5-7]`, `x[9-15]`, `x[16-31]` (non-RV32E) | `r` |
| RISC-V | `freg` | `f[0-31]` | `f` |
| Hexagon | `reg` | `r[0-28]` | `r` |
+| PowerPC | `reg` | `r[0-31]` | `r` |
+| PowerPC | `reg_nonzero` | | `r[1-31]` | `b` |
+| PowerPC | `freg` | `f[0-31]` | `f` |
| wasm32 | `local` | None\* | `r` |
> **Note**: On x86 we treat `reg_byte` differently from `reg` because the compiler can allocate `al` and `ah` separately whereas `reg` reserves the whole register.
| RISC-V | `freg` | `f` | `f32` |
| RISC-V | `freg` | `d` | `f64` |
| Hexagon | `reg` | None | `i8`, `i16`, `i32`, `f32` |
+| PowerPC | `reg` | None | `i8`, `i16`, `i32` |
+| PowerPC | `reg_nonzero` | None | `i8`, `i16`, `i32` |
+| PowerPC | `freg` | None | `f32`, `f64` |
| wasm32 | `local` | None | `i8` `i16` `i32` `i64` `f32` `f64` |
> **Note**: For the purposes of the above table pointers, function pointers and `isize`/`usize` are treated as the equivalent integer type (`i16`/`i32`/`i64` depending on the target).
| RISC-V | `reg` | None | `x1` | None |
| RISC-V | `freg` | None | `f0` | None |
| Hexagon | `reg` | None | `r0` | None |
+| PowerPC | `reg` | None | `0` | None |
+| PowerPC | `reg_nonzero` | None | `3` | `b` |
+| PowerPC | `freg` | None | `0` | None |
> Notes:
> - on ARM `e` / `f`: this prints the low or high doubleword register name of a NEON quad (128-bit) register.
The `global_asm!` macro allows the programmer to write arbitrary
assembly outside the scope of a function body, passing it through
-`rustc` and `llvm` to the assembler. The macro is a no-frills
-interface to LLVM's concept of [module-level inline assembly]. That is,
-all caveats applicable to LLVM's module-level inline assembly apply
-to `global_asm!`.
-
-[module-level inline assembly]: http://llvm.org/docs/LangRef.html#module-level-inline-assembly
+`rustc` and `llvm` to the assembler. That is to say, `global_asm!` is
+equivalent to assembling the asm with an external assembler and then
+linking the resulting object file with the current crate.
`global_asm!` fills a role not currently satisfied by either `asm!`
or `#[naked]` functions. The programmer has _all_ features of the
# mod x86 {
pub mod sally {
- global_asm!(r#"
- .global foo
- foo:
- jmp baz
- "#);
+ global_asm!(
+ ".global foo",
+ "foo:",
+ "jmp baz",
+ );
#[no_mangle]
pub unsafe extern "C" fn baz() {}
}
pub mod harry {
- global_asm!(r#"
- .global bar
- bar:
- jmp quux
- "#);
+ global_asm!(
+ ".global bar",
+ "bar:",
+ "jmp quux",
+ );
#[no_mangle]
pub unsafe extern "C" fn quux() {}
```
You may use `global_asm!` multiple times, anywhere in your crate, in
-whatever way suits you. The effect is as if you concatenated all
-usages and placed the larger, single usage in the crate root.
+whatever way suits you. However, you should not rely on assembler state
+(e.g. assembler macros) defined in one `global_asm!` to be available in
+another one. It is implementation-defined whether the multiple usages
+are concatenated into one or assembled separately.
+
+`global_asm!` also supports `const` operands like `asm!`, which allows
+constants defined in Rust to be used in assembly code:
+
+```rust,no_run
+#![feature(global_asm)]
+# #[cfg(any(target_arch="x86", target_arch="x86_64"))]
+# mod x86 {
+const C: i32 = 1234;
+global_asm!(
+ ".global bar",
+ "bar: .word {c}",
+ c = const C,
+);
+# }
+```
+
+The syntax for passing operands is the same as `asm!` except that only
+`const` operands are allowed. Refer to the [asm](asm.md) documentation
+for more details.
+
+On x86, the assembly code will use intel syntax by default. You can
+override this by adding `options(att_syntax)` at the end of the macro
+arguments list:
+
+```rust,no_run
+#![feature(global_asm)]
+# #[cfg(any(target_arch="x86", target_arch="x86_64"))]
+# mod x86 {
+global_asm!("movl ${}, %ecx", const 5, options(att_syntax));
+// is equivalent to
+global_asm!("mov ecx, {}", const 5);
+# }
+```
------------------------
.clean(self.cx),
negative_polarity: false,
synthetic: false,
- blanket_impl: Some(trait_ref.self_ty().clean(self.cx)),
+ blanket_impl: Some(box trait_ref.self_ty().clean(self.cx)),
}),
cfg: None,
});
match param.kind {
GenericParamDefKind::Lifetime => unreachable!(),
GenericParamDefKind::Type { did, ref bounds, .. } => {
- cx.impl_trait_bounds
- .insert(FakeDefId::new_real(did).into(), bounds.clone());
+ cx.impl_trait_bounds.insert(did.into(), bounds.clone());
}
GenericParamDefKind::Const { .. } => unreachable!(),
}
.collect::<Vec<GenericParamDef>>();
// param index -> [(DefId of trait, associated type name, type)]
- let mut impl_trait_proj = FxHashMap::<u32, Vec<(FakeDefId, Symbol, Ty<'tcx>)>>::default();
+ let mut impl_trait_proj = FxHashMap::<u32, Vec<(DefId, Symbol, Ty<'tcx>)>>::default();
let where_predicates = preds
.predicates
if let Some(proj) = impl_trait_proj.remove(&idx) {
for (trait_did, name, rhs) in proj {
let rhs = rhs.clean(cx);
- simplify::merge_bounds(
- cx,
- &mut bounds,
- trait_did.expect_real(),
- name,
- &rhs,
- );
+ simplify::merge_bounds(cx, &mut bounds, trait_did, name, &rhs);
}
}
} else {
if let Some(new_ty) = cx.ty_substs.get(&did).cloned() {
return new_ty;
}
- if let Some(bounds) = cx.impl_trait_bounds.remove(&FakeDefId::new_real(did).into())
- {
+ if let Some(bounds) = cx.impl_trait_bounds.remove(&did.into()) {
return ImplTrait(bounds);
}
}
Self::Fake(DefIndex::from(id), krate)
}
- crate fn new_real(id: DefId) -> Self {
- Self::Real(id)
- }
-
#[inline]
crate fn is_local(self) -> bool {
match self {
.filter_map(|ItemLink { link: s, link_text, did, ref fragment }| {
match did {
Some(did) => {
- if let Some((mut href, ..)) = href(did.expect_real(), cx) {
+ if let Some((mut href, ..)) = href(did.clone(), cx) {
if let Some(ref fragment) = *fragment {
href.push('#');
href.push_str(fragment);
/// This may not be the same as `link` if there was a disambiguator
/// in an intra-doc link (e.g. \[`fn@f`\])
pub(crate) link_text: String,
- pub(crate) did: Option<FakeDefId>,
+ pub(crate) did: Option<DefId>,
/// The url fragment to append to the link
pub(crate) fragment: Option<String>,
}
crate items: Vec<Item>,
crate negative_polarity: bool,
crate synthetic: bool,
- crate blanket_impl: Option<Type>,
+ crate blanket_impl: Option<Box<Type>>,
}
impl Impl {
/// for `impl Trait` in argument position.
#[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
crate enum ImplTraitParam {
- DefId(FakeDefId),
+ DefId(DefId),
ParamIndex(u32),
}
-impl From<FakeDefId> for ImplTraitParam {
- fn from(did: FakeDefId) -> Self {
+impl From<DefId> for ImplTraitParam {
+ fn from(did: DefId) -> Self {
ImplTraitParam::DefId(did)
}
}
use crate::clean::*;
-crate struct StripItem(pub Item);
-
-impl StripItem {
- crate fn strip(self) -> Item {
- match self.0 {
- Item { kind: box StrippedItem(..), .. } => self.0,
- mut i => {
- i.kind = box StrippedItem(i.kind);
- i
- }
- }
+crate fn strip_item(mut item: Item) -> Item {
+ if !matches!(*item.kind, StrippedItem(..)) {
+ item.kind = box StrippedItem(item.kind);
}
+ item
}
crate trait DocFolder: Sized {
/// When rendering traits, it's often useful to be able to list all
/// implementors of the trait, and this mapping is exactly, that: a mapping
/// of trait ids to the list of known implementors of the trait
- crate implementors: FxHashMap<FakeDefId, Vec<Impl>>,
+ crate implementors: FxHashMap<DefId, Vec<Impl>>,
/// Cache of where external crate documentation can be found.
crate extern_locations: FxHashMap<CrateNum, ExternalLocation>,
desc: item
.doc_value()
.map_or_else(String::new, |x| short_markdown_summary(&x.as_str())),
- parent: parent.map(FakeDefId::new_real),
+ parent,
parent_idx: None,
search_type: get_index_search_type(&item, &self.empty_cache, self.tcx),
aliases: item.attrs.get_doc_aliases(),
placeholder=\"Click or press ‘S’ to search, ‘?’ for more options…\" \
type=\"search\">\
</div>\
- <button type=\"button\" class=\"help-button\">?</button>
+ <button type=\"button\" id=\"help-button\">?</button>
<a id=\"settings-menu\" href=\"{root_path}settings.html\">\
<img src=\"{static_root_path}wheel{suffix}.svg\" \
width=\"18\" height=\"18\" \
map.insert("theme-picker".to_owned(), 1);
map.insert("theme-choices".to_owned(), 1);
map.insert("settings-menu".to_owned(), 1);
+ map.insert("help-button".to_owned(), 1);
map.insert("main".to_owned(), 1);
map.insert("search".to_owned(), 1);
map.insert("crate-search".to_owned(), 1);
use crate::clean;
use crate::clean::types::{
- FakeDefId, FnDecl, FnRetTy, GenericBound, Generics, GetDefId, Type, WherePredicate,
+ FnDecl, FnRetTy, GenericBound, Generics, GetDefId, Type, WherePredicate,
};
use crate::formats::cache::Cache;
use crate::formats::item_type::ItemType;
defid_to_pathid.insert(defid, pathid);
lastpathid += 1;
- if let Some(&(ref fqp, short)) = paths.get(&defid.expect_real()) {
+ if let Some(&(ref fqp, short)) = paths.get(&defid) {
crate_paths.push((short, fqp.last().unwrap().clone()));
Some(pathid)
} else {
fn get_index_type(clean_type: &clean::Type, cache: &Cache) -> RenderType {
RenderType {
- ty: clean_type.def_id_full(cache).map(FakeDefId::new_real),
+ ty: clean_type.def_id_full(cache),
idx: None,
name: get_index_type_name(clean_type, true).map(|s| s.as_str().to_ascii_lowercase()),
generics: get_generics(clean_type, cache),
.filter_map(|t| {
get_index_type_name(t, false).map(|name| Generic {
name: name.as_str().to_ascii_lowercase(),
- defid: t.def_id_full(cache).map(FakeDefId::new_real),
+ defid: t.def_id_full(cache),
idx: None,
})
})
Ok(())
}
- /// Based on whether the `collapse-docs` pass was run, return either the `doc_value` or the
- /// `collapsed_doc_value` of the given item.
+ /// Returns the `collapsed_doc_value` of the given item if this is the main crate, otherwise
+ /// returns the `doc_value`.
crate fn maybe_collapsed_doc_value<'a>(&self, item: &'a clean::Item) -> Option<String> {
if self.collapsed { item.collapsed_doc_value() } else { item.doc_value() }
}
crate name: String,
crate path: String,
crate desc: String,
- crate parent: Option<FakeDefId>,
+ crate parent: Option<DefId>,
crate parent_idx: Option<usize>,
crate search_type: Option<IndexItemFunctionType>,
crate aliases: Box<[String]>,
/// A type used for the search index.
#[derive(Debug)]
crate struct RenderType {
- ty: Option<FakeDefId>,
+ ty: Option<DefId>,
idx: Option<usize>,
name: Option<String>,
generics: Option<Vec<Generic>>,
#[derive(Debug)]
crate struct Generic {
name: String,
- defid: Option<FakeDefId>,
+ defid: Option<DefId>,
idx: Option<usize>,
}
"</div>",
);
- if let Some(implementors) = cx.cache.implementors.get(&it.def_id) {
+ if let Some(implementors) = cx.cache.implementors.get(&it.def_id.expect_real()) {
let cache = cx.cache();
let mut res = implementors
.iter()
)
}
- fn write_loading_content(w: &mut Buffer, extra_content: &str) {
- write!(w, "{}<span class=\"loading-content\">Loading content...</span>", extra_content)
- }
-
fn trait_item(w: &mut Buffer, cx: &Context<'_>, m: &clean::Item, t: &clean::Item) {
let name = m.name.as_ref().unwrap();
info!("Documenting {} on {:?}", name, t.name);
for t in types {
trait_item(w, cx, t, it);
}
- write_loading_content(w, "</div>");
+ w.write_str("</div>");
}
if !consts.is_empty() {
for t in consts {
trait_item(w, cx, t, it);
}
- write_loading_content(w, "</div>");
+ w.write_str("</div>");
}
// Output the documentation for each function individually
for m in required {
trait_item(w, cx, m, it);
}
- write_loading_content(w, "</div>");
+ w.write_str("</div>");
}
if !provided.is_empty() {
write_small_section_header(
for m in provided {
trait_item(w, cx, m, it);
}
- write_loading_content(w, "</div>");
+ w.write_str("</div>");
}
// If there are methods directly on this trait object, render them here.
render_assoc_items(w, cx, it, it.def_id.expect_real(), AssocItemRender::All);
- if let Some(implementors) = cx.cache.implementors.get(&it.def_id) {
+ if let Some(implementors) = cx.cache.implementors.get(&it.def_id.expect_real()) {
// The DefId is for the first Type found with that name. The bool is
// if any Types with the same name but different DefId have been found.
let mut implementor_dups: FxHashMap<Symbol, (DefId, bool)> = FxHashMap::default();
&[],
);
}
- write_loading_content(w, "");
}
write_small_section_header(
for implementor in concrete {
render_implementor(cx, implementor, it, w, &implementor_dups, &[]);
}
- write_loading_content(w, "</div>");
+ w.write_str("</div>");
if t.is_auto {
write_small_section_header(
&collect_paths_for_type(implementor.inner_impl().for_.clone(), &cx.cache),
);
}
- write_loading_content(w, "</div>");
+ w.write_str("</div>");
}
} else {
// even without any implementations to write in, we still want the heading and list, so the
w,
"implementors",
"Implementors",
- "<div class=\"item-list\" id=\"implementors-list\">",
+ "<div class=\"item-list\" id=\"implementors-list\"></div>",
);
- write_loading_content(w, "</div>");
if t.is_auto {
write_small_section_header(
w,
"synthetic-implementors",
"Auto implementors",
- "<div class=\"item-list\" id=\"synthetic-implementors-list\">",
+ "<div class=\"item-list\" id=\"synthetic-implementors-list\"></div>",
);
- write_loading_content(w, "</div>");
}
}
// Update the list of all implementors for traits
let dst = cx.dst.join("implementors");
for (&did, imps) in &cx.cache.implementors {
- let did = did.expect_real();
-
// Private modules can leak through to this phase of rustdoc, which
// could contain implementations for otherwise private types. In some
// rare cases we could find an implementation for an item which wasn't
"use strict";
window.searchState = {
- loadingText: "Loading search results...",
- input: document.getElementsByClassName("search-input")[0],
- outputElement: function() {
- return document.getElementById("search");
- },
- title: null,
- titleBeforeSearch: document.title,
- timeout: null,
- // On the search screen, so you remain on the last tab you opened.
- //
- // 0 for "In Names"
- // 1 for "In Parameters"
- // 2 for "In Return Types"
- currentTab: 0,
- mouseMovedAfterSearch: true,
- clearInputTimeout: function() {
- if (searchState.timeout !== null) {
- clearTimeout(searchState.timeout);
- searchState.timeout = null;
- }
- },
- // Sets the focus on the search bar at the top of the page
- focus: function() {
- searchState.input.focus();
- },
- // Removes the focus from the search bar.
- defocus: function() {
- searchState.input.blur();
- },
- showResults: function(search) {
- if (search === null || typeof search === 'undefined') {
- search = searchState.outputElement();
- }
- addClass(main, "hidden");
- removeClass(search, "hidden");
- searchState.mouseMovedAfterSearch = false;
- document.title = searchState.title;
- },
- hideResults: function(search) {
- if (search === null || typeof search === 'undefined') {
- search = searchState.outputElement();
- }
- addClass(search, "hidden");
- removeClass(main, "hidden");
- document.title = searchState.titleBeforeSearch;
- // We also remove the query parameter from the URL.
- if (searchState.browserSupportsHistoryApi()) {
- history.replaceState("", window.currentCrate + " - Rust",
- getNakedUrl() + window.location.hash);
- }
- },
- getQueryStringParams: function() {
- var params = {};
- window.location.search.substring(1).split("&").
- map(function(s) {
- var pair = s.split("=");
- params[decodeURIComponent(pair[0])] =
- typeof pair[1] === "undefined" ? null : decodeURIComponent(pair[1]);
- });
- return params;
- },
- putBackSearch: function(search_input) {
- var search = searchState.outputElement();
- if (search_input.value !== "" && hasClass(search, "hidden")) {
- searchState.showResults(search);
- if (searchState.browserSupportsHistoryApi()) {
- var extra = "?search=" + encodeURIComponent(search_input.value);
- history.replaceState(search_input.value, "",
- getNakedUrl() + extra + window.location.hash);
+ loadingText: "Loading search results...",
+ input: document.getElementsByClassName("search-input")[0],
+ outputElement: function() {
+ return document.getElementById("search");
+ },
+ title: null,
+ titleBeforeSearch: document.title,
+ timeout: null,
+ // On the search screen, so you remain on the last tab you opened.
+ //
+ // 0 for "In Names"
+ // 1 for "In Parameters"
+ // 2 for "In Return Types"
+ currentTab: 0,
+ mouseMovedAfterSearch: true,
+ clearInputTimeout: function() {
+ if (searchState.timeout !== null) {
+ clearTimeout(searchState.timeout);
+ searchState.timeout = null;
}
+ },
+ // Sets the focus on the search bar at the top of the page
+ focus: function() {
+ searchState.input.focus();
+ },
+ // Removes the focus from the search bar.
+ defocus: function() {
+ searchState.input.blur();
+ },
+ showResults: function(search) {
+ if (search === null || typeof search === 'undefined') {
+ search = searchState.outputElement();
+ }
+ addClass(main, "hidden");
+ removeClass(search, "hidden");
+ searchState.mouseMovedAfterSearch = false;
document.title = searchState.title;
- }
- },
- browserSupportsHistoryApi: function() {
- return window.history && typeof window.history.pushState === "function";
- },
- setup: function() {
- var search_input = searchState.input;
- if (!searchState.input) {
- return;
- }
- function loadScript(url) {
- var script = document.createElement('script');
- script.src = url;
- document.head.append(script);
- }
-
- var searchLoaded = false;
- function loadSearch() {
- if (!searchLoaded) {
- searchLoaded = true;
- loadScript(window.searchJS);
- loadScript(window.searchIndexJS);
+ },
+ hideResults: function(search) {
+ if (search === null || typeof search === 'undefined') {
+ search = searchState.outputElement();
+ }
+ addClass(search, "hidden");
+ removeClass(main, "hidden");
+ document.title = searchState.titleBeforeSearch;
+ // We also remove the query parameter from the URL.
+ if (searchState.browserSupportsHistoryApi()) {
+ history.replaceState("", window.currentCrate + " - Rust",
+ getNakedUrl() + window.location.hash);
+ }
+ },
+ getQueryStringParams: function() {
+ var params = {};
+ window.location.search.substring(1).split("&").
+ map(function(s) {
+ var pair = s.split("=");
+ params[decodeURIComponent(pair[0])] =
+ typeof pair[1] === "undefined" ? null : decodeURIComponent(pair[1]);
+ });
+ return params;
+ },
+ putBackSearch: function(search_input) {
+ var search = searchState.outputElement();
+ if (search_input.value !== "" && hasClass(search, "hidden")) {
+ searchState.showResults(search);
+ if (searchState.browserSupportsHistoryApi()) {
+ var extra = "?search=" + encodeURIComponent(search_input.value);
+ history.replaceState(search_input.value, "",
+ getNakedUrl() + extra + window.location.hash);
+ }
+ document.title = searchState.title;
+ }
+ },
+ browserSupportsHistoryApi: function() {
+ return window.history && typeof window.history.pushState === "function";
+ },
+ setup: function() {
+ var search_input = searchState.input;
+ if (!searchState.input) {
+ return;
+ }
+ function loadScript(url) {
+ var script = document.createElement('script');
+ script.src = url;
+ document.head.append(script);
}
- }
- search_input.addEventListener("focus", function() {
- searchState.putBackSearch(this);
- search_input.origPlaceholder = searchState.input.placeholder;
- search_input.placeholder = "Type your search here.";
- loadSearch();
- });
- search_input.addEventListener("blur", function() {
- search_input.placeholder = searchState.input.origPlaceholder;
- });
+ var searchLoaded = false;
+ function loadSearch() {
+ if (!searchLoaded) {
+ searchLoaded = true;
+ loadScript(window.searchJS);
+ loadScript(window.searchIndexJS);
+ }
+ }
- document.addEventListener("mousemove", function() {
- searchState.mouseMovedAfterSearch = true;
- });
+ search_input.addEventListener("focus", function() {
+ searchState.putBackSearch(this);
+ search_input.origPlaceholder = searchState.input.placeholder;
+ search_input.placeholder = "Type your search here.";
+ loadSearch();
+ });
+ search_input.addEventListener("blur", function() {
+ search_input.placeholder = searchState.input.origPlaceholder;
+ });
- search_input.removeAttribute('disabled');
+ document.addEventListener("mousemove", function() {
+ searchState.mouseMovedAfterSearch = true;
+ });
- // `crates{version}.js` should always be loaded before this script, so we can use it safely.
- searchState.addCrateDropdown(window.ALL_CRATES);
- var params = searchState.getQueryStringParams();
- if (params.search !== undefined) {
- var search = searchState.outputElement();
- search.innerHTML = "<h3 style=\"text-align: center;\">" +
- searchState.loadingText + "</h3>";
- searchState.showResults(search);
- loadSearch();
- }
- },
- addCrateDropdown: function(crates) {
- var elem = document.getElementById("crate-search");
+ search_input.removeAttribute('disabled');
+
+ // `crates{version}.js` should always be loaded before this script, so we can use it
+ // safely.
+ searchState.addCrateDropdown(window.ALL_CRATES);
+ var params = searchState.getQueryStringParams();
+ if (params.search !== undefined) {
+ var search = searchState.outputElement();
+ search.innerHTML = "<h3 style=\"text-align: center;\">" +
+ searchState.loadingText + "</h3>";
+ searchState.showResults(search);
+ loadSearch();
+ }
+ },
+ addCrateDropdown: function(crates) {
+ var elem = document.getElementById("crate-search");
- if (!elem) {
- return;
- }
- var savedCrate = getSettingValue("saved-filter-crate");
- for (var i = 0, len = crates.length; i < len; ++i) {
- var option = document.createElement("option");
- option.value = crates[i];
- option.innerText = crates[i];
- elem.appendChild(option);
- // Set the crate filter from saved storage, if the current page has the saved crate
- // filter.
- //
- // If not, ignore the crate filter -- we want to support filtering for crates on sites
- // like doc.rust-lang.org where the crates may differ from page to page while on the
- // same domain.
- if (crates[i] === savedCrate) {
- elem.value = savedCrate;
+ if (!elem) {
+ return;
}
- }
- },
+ var savedCrate = getSettingValue("saved-filter-crate");
+ for (var i = 0, len = crates.length; i < len; ++i) {
+ var option = document.createElement("option");
+ option.value = crates[i];
+ option.innerText = crates[i];
+ elem.appendChild(option);
+ // Set the crate filter from saved storage, if the current page has the saved crate
+ // filter.
+ //
+ // If not, ignore the crate filter -- we want to support filtering for crates on
+ // sites like doc.rust-lang.org where the crates may differ from page to page while
+ // on the
+ // same domain.
+ if (crates[i] === savedCrate) {
+ elem.value = savedCrate;
+ }
+ }
+ },
};
function getPageId() {
}
}
- function highlightSourceLines(match, ev) {
- if (typeof match === "undefined") {
- // If we're in mobile mode, we should hide the sidebar in any case.
- hideSidebar();
- match = window.location.hash.match(/^#?(\d+)(?:-(\d+))?$/);
- }
- if (!match) {
- return;
- }
- var from = parseInt(match[1], 10);
- var to = from;
- if (typeof match[2] !== "undefined") {
- to = parseInt(match[2], 10);
- }
- if (to < from) {
- var tmp = to;
- to = from;
- from = tmp;
- }
- var elem = document.getElementById(from);
- if (!elem) {
- return;
- }
- if (!ev) {
- var x = document.getElementById(from);
- if (x) {
- x.scrollIntoView();
- }
- }
- onEachLazy(document.getElementsByClassName("line-numbers"), function(e) {
- onEachLazy(e.getElementsByTagName("span"), function(i_e) {
- removeClass(i_e, "line-highlighted");
- });
- });
- for (var i = from; i <= to; ++i) {
- elem = document.getElementById(i);
- if (!elem) {
- break;
- }
- addClass(elem, "line-highlighted");
- }
- }
-
function onHashChange(ev) {
// If we're in mobile mode, we should hide the sidebar in any case.
hideSidebar();
- var match = window.location.hash.match(/^#?(\d+)(?:-(\d+))?$/);
- if (match) {
- return highlightSourceLines(match, ev);
- }
handleHashes(ev);
}
}
}
- function findParentElement(elem, tagName) {
- do {
- if (elem && elem.tagName === tagName) {
- return elem;
- }
- elem = elem.parentNode;
- } while (elem);
- return null;
- }
-
document.addEventListener("keypress", handleShortcut);
document.addEventListener("keydown", handleShortcut);
- var handleSourceHighlight = (function() {
- var prev_line_id = 0;
-
- var set_fragment = function(name) {
- var x = window.scrollX,
- y = window.scrollY;
- if (searchState.browserSupportsHistoryApi()) {
- history.replaceState(null, null, "#" + name);
- highlightSourceLines();
- } else {
- location.replace("#" + name);
- }
- // Prevent jumps when selecting one or many lines
- window.scrollTo(x, y);
- };
-
- return function(ev) {
- var cur_line_id = parseInt(ev.target.id, 10);
- ev.preventDefault();
-
- if (ev.shiftKey && prev_line_id) {
- // Swap selection if needed
- if (prev_line_id > cur_line_id) {
- var tmp = prev_line_id;
- prev_line_id = cur_line_id;
- cur_line_id = tmp;
- }
-
- set_fragment(prev_line_id + "-" + cur_line_id);
- } else {
- prev_line_id = cur_line_id;
-
- set_fragment(cur_line_id);
- }
- };
- }());
-
- document.addEventListener("click", function(ev) {
- var helpElem = getHelpElement(false);
- if (hasClass(ev.target, "help-button")) {
- displayHelp(true, ev);
- } else if (ev.target.tagName === "SPAN" && hasClass(ev.target.parentNode, "line-numbers")) {
- handleSourceHighlight(ev);
- } else if (helpElem && hasClass(helpElem, "hidden") === false) {
- var is_inside_help_popup = ev.target !== helpElem && helpElem.contains(ev.target);
- if (is_inside_help_popup === false) {
- addClass(helpElem, "hidden");
- removeClass(document.body, "blur");
- }
- } else {
- // Making a collapsed element visible on onhashchange seems
- // too late
- var a = findParentElement(ev.target, "A");
- if (a && a.hash) {
- expandSection(a.hash.replace(/^#/, ""));
- }
- }
- });
-
(function() {
var x = document.getElementsByClassName("version-selector");
if (x.length > 0) {
});
}());
+ function handleClick(id, f) {
+ var elem = document.getElementById(id);
+ if (elem) {
+ elem.addEventListener("click", f);
+ }
+ }
+ handleClick("help-button", function(ev) {
+ displayHelp(true, ev);
+ });
+
+ onEachLazy(document.getElementsByTagName("a"), function(el) {
+ // For clicks on internal links (<A> tags with a hash property), we expand the section we're
+ // jumping to *before* jumping there. We can't do this in onHashChange, because it changes
+ // the height of the document so we wind up scrolled to the wrong place.
+ if (el.hash) {
+ el.addEventListener("click", function() {
+ expandSection(el.hash.slice(1));
+ });
+ }
+ });
+
onEachLazy(document.getElementsByClassName("notable-traits"), function(e) {
e.onclick = function() {
this.getElementsByClassName('notable-traits-tooltiptext')[0]
};
}
- if (main) {
- onEachLazy(main.getElementsByClassName("loading-content"), function(e) {
- e.remove();
- });
- onEachLazy(main.childNodes, function(e) {
- // Unhide the actual content once loading is complete. Headers get
- // flex treatment for their horizontal layout, divs get block treatment
- // for vertical layout (column-oriented flex layout for divs caused
- // errors in mobile browsers).
- if (e.tagName === "H2" || e.tagName === "H3") {
- var nextTagName = e.nextElementSibling.tagName;
- if (nextTagName === "H2" || nextTagName === "H3") {
- e.nextElementSibling.style.display = "flex";
- } else if (nextTagName !== "DETAILS") {
- e.nextElementSibling.style.display = "block";
- }
- }
- });
- }
-
function buildHelperPopup() {
var popup = document.createElement("aside");
addClass(popup, "hidden");
popup.id = "help";
+ popup.addEventListener("click", function(ev) {
+ if (ev.target === popup) {
+ // Clicked the blurred zone outside the help popup; dismiss help.
+ displayHelp(false, ev);
+ }
+ });
+
var book_info = document.createElement("span");
book_info.innerHTML = "You can find more information in \
<a href=\"https://doc.rust-lang.org/rustdoc/\">the rustdoc book</a>.";
}
onHashChange(null);
- window.onhashchange = onHashChange;
+ window.addEventListener("hashchange", onHashChange);
searchState.setup();
}());
rules.
*/
-#main > h2 + div, #main > h2 + h3, #main > h3 + div {
- display: block;
-}
-
-.loading-content {
- display: none;
-}
-
-#main > h2 + div, #main > h3 + div {
- display: block;
-}
-
-#main > h2 + h3 {
- display: flex;
-}
-
-#main .impl-items .hidden {
- display: block !important;
-}
-
-#main .impl-items h4.hidden {
- /* Without this rule, the version and the "[src]" span aren't on the same line as the header. */
- display: flex !important;
-}
-
#main .attributes {
/* Since there is no toggle (the "[-]") when JS is disabled, no need for this margin either. */
margin-left: 0 !important;
h1, h2, h3, h4,
.sidebar, a.source, .search-input, .content table td:first-child > a,
-.collapse-toggle, div.item-list .out-of-band,
+div.item-list .out-of-band,
#source-sidebar, #sidebar-toggle,
details.rustdoc-toggle > summary::before,
details.undocumented > summary::before,
border: 1px solid;
padding: 13px 8px;
text-align: right;
+ border-top-left-radius: 5px;
+ border-bottom-left-radius: 5px;
}
.rustdoc:not(.source) .example-wrap > pre.rust {
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
- border-top-left-radius: 5px;
- border-bottom-left-radius: 5px;
}
.line-numbers span {
cursor: pointer;
#main > .docblock h2 { font-size: 1.15em; }
#main > .docblock h3, #main > .docblock h4, #main > .docblock h5 { font-size: 1em; }
-#main > h2 + div, #main > h2 + h3, #main > h3 + div {
- display: none; /* Changed to flex or block via js once the page is loaded */
- flex-wrap: wrap;
-}
-
.docblock h1 { font-size: 1em; }
.docblock h2 { font-size: 0.95em; }
.docblock h3, .docblock h4, .docblock h5 { font-size: 0.9em; }
.content .docblock >.impl-items table td {
padding: 0;
}
-.toggle-wrapper.marg-left > .collapse-toggle {
- left: -24px;
-}
.content .docblock > .impl-items .table-display, .impl-items table td {
border: none;
}
font-weight: 300;
}
-.collapse-toggle {
- font-weight: 300;
- position: absolute;
- left: -23px;
- top: 0;
-}
-
-h3 > .collapse-toggle, h4 > .collapse-toggle {
- font-size: 0.8em;
- top: 5px;
-}
-
-.toggle-wrapper > .collapse-toggle {
- left: -24px;
- margin-top: 0px;
-}
-
-.toggle-wrapper {
- position: relative;
- margin-top: 0;
-}
-
-.toggle-wrapper.collapsed {
- height: 25px;
- transition: height .2s;
- margin-bottom: .6em;
-}
-
-.collapse-toggle > .inner {
- display: inline-block;
- width: 1.2ch;
- text-align: center;
-}
-
-.collapse-toggle.hidden-default {
- position: relative;
- margin-left: 20px;
-}
-
.since + .srclink {
display: table-cell;
padding-left: 10px;
margin-right: 5px;
}
-.toggle-wrapper > .collapse-toggle {
- left: 0;
-}
-
-.variant + .toggle-wrapper + .docblock > p {
- margin-top: 5px;
-}
-
.sub-variant, .sub-variant > h3 {
margin-top: 0px !important;
padding-top: 1px;
outline: none;
}
-#settings-menu, .help-button {
+#settings-menu, #help-button {
position: absolute;
top: 10px;
}
outline: none;
}
-#theme-picker, #settings-menu, .help-button, #copy-path {
+#theme-picker, #settings-menu, #help-button, #copy-path {
padding: 4px;
width: 27px;
height: 29px;
cursor: pointer;
}
-.help-button {
+#help-button {
right: 30px;
font-family: "Fira Sans", Arial, sans-serif;
text-align: center;
position: inherit;
}
- .toggle-wrapper > .collapse-toggle {
- left: 0px;
- }
-
- .toggle-wrapper {
- height: 1.5em;
- }
-
#search {
margin-left: 0;
}
border-bottom: 1px solid;
}
- .collapse-toggle {
- left: -20px;
- }
-
- .impl > .collapse-toggle {
- left: -10px;
- }
-
.item-list > details.rustdoc-toggle > summary:not(.hideme)::before {
left: -10px;
}
}
/* We don't display the help button on mobile devices. */
- .help-button {
+ #help-button {
display: none;
}
.search-container > div {
}
@media print {
- nav.sub, .content .out-of-band, .collapse-toggle {
+ nav.sub, .content .out-of-band {
display: none;
}
}
};
if (window.searchIndex !== undefined) {
- initSearch(window.searchIndex);
+ initSearch(window.searchIndex);
}
})();
// Local js definitions:
/* global addClass, getCurrentValue, hasClass, removeClass, updateLocalStorage */
+(function() {
function getCurrentFilePath() {
var parts = window.location.pathname.split("/");
selected_elem.focus();
}
}
+
+var lineNumbersRegex = /^#?(\d+)(?:-(\d+))?$/;
+
+function highlightSourceLines(match, ev) {
+ if (typeof match === "undefined") {
+ match = window.location.hash.match(lineNumbersRegex);
+ }
+ if (!match) {
+ return;
+ }
+ var from = parseInt(match[1], 10);
+ var to = from;
+ if (typeof match[2] !== "undefined") {
+ to = parseInt(match[2], 10);
+ }
+ if (to < from) {
+ var tmp = to;
+ to = from;
+ from = tmp;
+ }
+ var elem = document.getElementById(from);
+ if (!elem) {
+ return;
+ }
+ if (!ev) {
+ var x = document.getElementById(from);
+ if (x) {
+ x.scrollIntoView();
+ }
+ }
+ onEachLazy(document.getElementsByClassName("line-numbers"), function(e) {
+ onEachLazy(e.getElementsByTagName("span"), function(i_e) {
+ removeClass(i_e, "line-highlighted");
+ });
+ });
+ for (var i = from; i <= to; ++i) {
+ elem = document.getElementById(i);
+ if (!elem) {
+ break;
+ }
+ addClass(elem, "line-highlighted");
+ }
+}
+
+var handleSourceHighlight = (function() {
+ var prev_line_id = 0;
+
+ var set_fragment = function(name) {
+ var x = window.scrollX,
+ y = window.scrollY;
+ if (searchState.browserSupportsHistoryApi()) {
+ history.replaceState(null, null, "#" + name);
+ highlightSourceLines();
+ } else {
+ location.replace("#" + name);
+ }
+ // Prevent jumps when selecting one or many lines
+ window.scrollTo(x, y);
+ };
+
+ return function(ev) {
+ var cur_line_id = parseInt(ev.target.id, 10);
+ ev.preventDefault();
+
+ if (ev.shiftKey && prev_line_id) {
+ // Swap selection if needed
+ if (prev_line_id > cur_line_id) {
+ var tmp = prev_line_id;
+ prev_line_id = cur_line_id;
+ cur_line_id = tmp;
+ }
+
+ set_fragment(prev_line_id + "-" + cur_line_id);
+ } else {
+ prev_line_id = cur_line_id;
+
+ set_fragment(cur_line_id);
+ }
+ };
+}());
+
+window.addEventListener("hashchange", function() {
+ var match = window.location.hash.match(lineNumbersRegex);
+ if (match) {
+ return highlightSourceLines(match, ev);
+ }
+});
+
+onEachLazy(document.getElementsByClassName("line-numbers"), function(el) {
+ el.addEventListener("click", handleSourceHighlight);
+});
+
+highlightSourceLines();
+
+window.createSourceSidebar = createSourceSidebar;
+})();
color: #39AFD7;
}
-.collapse-toggle,
details.rustdoc-toggle > summary.hideme > span,
details.rustdoc-toggle > summary::before,
details.undocumented > summary::before {
box-shadow-color: #c6cbd1;
}
-#theme-picker, #settings-menu, .help-button, #copy-path {
+#theme-picker, #settings-menu, #help-button, #copy-path {
border-color: #5c6773;
background-color: #0f1419;
color: #fff;
#theme-picker:hover, #theme-picker:focus,
#settings-menu:hover, #settings-menu:focus,
-.help-button:hover, .help-button:focus,
+#help-button:hover, #help-button:focus,
#copy-path:hover, #copy-path:focus {
border-color: #e0e0e0;
}
color: #dedede;
}
-.collapse-toggle,
details.rustdoc-toggle > summary.hideme > span,
details.rustdoc-toggle > summary::before,
details.undocumented > summary::before {
box-shadow-color: #c6cbd1;
}
-#theme-picker, #settings-menu, .help-button, #copy-path {
+#theme-picker, #settings-menu, #help-button, #copy-path {
border-color: #e0e0e0;
background: #f0f0f0;
color: #000;
#theme-picker:hover, #theme-picker:focus,
#settings-menu:hover, #settings-menu:focus,
-.help-button:hover, .help-button:focus,
+#help-button:hover, #help-button:focus,
#copy-path:hover, #copy-path:focus {
border-color: #ffb900;
}
color: #f5f5f5;
}
-.collapse-toggle,
details.rustdoc-toggle > summary.hideme > span,
details.rustdoc-toggle > summary::before,
details.undocumented > summary::before {
box-shadow-color: #c6cbd1;
}
-#theme-picker, #settings-menu, .help-button, #copy-path {
+#theme-picker, #settings-menu, #help-button, #copy-path {
border-color: #e0e0e0;
background-color: #fff;
}
#theme-picker:hover, #theme-picker:focus,
#settings-menu:hover, #settings-menu:focus,
-.help-button:hover, .help-button:focus,
+#help-button:hover, #help-button:focus,
#copy-path:hover, #copy-path:focus {
border-color: #717171;
}
use rustdoc_json_types::*;
-use crate::clean;
use crate::clean::utils::print_const_expr;
-use crate::clean::FakeDefId;
+use crate::clean::{self, FakeDefId};
use crate::formats::item_type::ItemType;
use crate::json::JsonRenderer;
use std::collections::HashSet;
.into_iter()
.flatten()
.filter_map(|clean::ItemLink { link, did, .. }| {
- did.map(|did| (link.clone(), from_def_id(did)))
+ did.map(|did| (link.clone(), from_def_id(did.into())))
})
.collect();
let docs = item.attrs.collapsed_doc_value();
items: ids(items),
negative: negative_polarity,
synthetic,
- blanket_impl: blanket_impl.map(|x| x.into_tcx(tcx)),
+ blanket_impl: blanket_impl.map(|x| (*x).into_tcx(tcx)),
}
}
}
use std::rc::Rc;
use rustc_data_structures::fx::FxHashMap;
+use rustc_hir::def_id::DefId;
use rustc_middle::ty::TyCtxt;
use rustc_session::Session;
use rustdoc_json_types as types;
use crate::clean;
-use crate::clean::{ExternalCrate, FakeDefId};
+use crate::clean::ExternalCrate;
use crate::config::RenderOptions;
use crate::error::Error;
use crate::formats::cache::Cache;
self.tcx.sess
}
- fn get_trait_implementors(&mut self, id: FakeDefId) -> Vec<types::Id> {
+ fn get_trait_implementors(&mut self, id: DefId) -> Vec<types::Id> {
Rc::clone(&self.cache)
.implementors
.get(&id)
.unwrap_or_default()
}
- fn get_impls(&mut self, id: FakeDefId) -> Vec<types::Id> {
+ fn get_impls(&mut self, id: DefId) -> Vec<types::Id> {
Rc::clone(&self.cache)
.impls
- .get(&id.expect_real())
+ .get(&id)
.map(|impls| {
impls
.iter()
let id = item.def_id;
if let Some(mut new_item) = self.convert_item(item) {
if let types::ItemEnum::Trait(ref mut t) = new_item.inner {
- t.implementors = self.get_trait_implementors(id)
+ t.implementors = self.get_trait_implementors(id.expect_real())
} else if let types::ItemEnum::Struct(ref mut s) = new_item.inner {
- s.impls = self.get_impls(id)
+ s.impls = self.get_impls(id.expect_real())
} else if let types::ItemEnum::Enum(ref mut e) = new_item.inner {
- e.impls = self.get_impls(id)
+ e.impls = self.get_impls(id.expect_real())
}
let removed = self.index.borrow_mut().insert(from_def_id(id), new_item.clone());
use std::mem;
use std::ops::Range;
-use crate::clean::{
- self, utils::find_nearest_parent_module, Crate, FakeDefId, Item, ItemLink, PrimitiveType,
-};
+use crate::clean::{self, utils::find_nearest_parent_module, Crate, Item, ItemLink, PrimitiveType};
use crate::core::DocContext;
use crate::fold::DocFolder;
use crate::html::markdown::{markdown_links, MarkdownLink};
#[derive(Clone, Debug, Hash, PartialEq, Eq)]
struct ResolutionInfo {
- module_id: FakeDefId,
+ module_id: DefId,
dis: Option<Disambiguator>,
path_str: String,
extra_fragment: Option<String>,
///
/// The last module will be used if the parent scope of the current item is
/// unknown.
- mod_ids: Vec<FakeDefId>,
+ mod_ids: Vec<DefId>,
/// This is used to store the kind of associated items,
/// because `clean` and the disambiguator code expect them to be different.
/// See the code for associated items on inherent impls for details.
let inner_docs = item.inner_docs(self.cx.tcx);
if item.is_mod() && inner_docs {
- self.mod_ids.push(item.def_id);
+ self.mod_ids.push(item.def_id.expect_real());
}
// We want to resolve in the lexical scope of the documentation.
Some(if item.is_mod() {
if !inner_docs {
- self.mod_ids.push(item.def_id);
+ self.mod_ids.push(item.def_id.expect_real());
}
let ret = self.fold_item_recur(item);
// we've already pushed this node onto the resolution stack but
// for outer comments we explicitly try and resolve against the
// parent_node first.
- let base_node = if item.is_mod() && inner_docs {
- self.mod_ids.last().copied()
- } else {
- parent_node.map(|id| FakeDefId::new_real(id))
- };
+ let base_node =
+ if item.is_mod() && inner_docs { self.mod_ids.last().copied() } else { parent_node };
let mut module_id = if let Some(id) = base_node {
id
resolved_self = format!("self::{}", &path_str["crate::".len()..]);
path_str = &resolved_self;
}
- module_id = FakeDefId::new_real(DefId { krate, index: CRATE_DEF_INDEX });
+ module_id = DefId { krate, index: CRATE_DEF_INDEX };
}
let (mut res, mut fragment) = self.resolve_with_disambiguator_cached(
report_diagnostic(self.cx.tcx, BROKEN_INTRA_DOC_LINKS, &msg, &diag_info, callback);
};
- let verify = |kind: DefKind, id: FakeDefId| {
- let (kind, id) = self.kind_side_channel.take().unwrap_or((kind, id.expect_real()));
+ let verify = |kind: DefKind, id: DefId| {
+ let (kind, id) = self.kind_side_channel.take().unwrap_or((kind, id));
debug!("intra-doc link to {} resolved to {:?} (id: {:?})", path_str, res, id);
// Disallow e.g. linking to enums with `struct@`
match disambiguator.map(Disambiguator::ns) {
Some(expected_ns @ (ValueNS | TypeNS)) => {
- match self.resolve(path_str, expected_ns, base_node.expect_real(), extra_fragment) {
+ match self.resolve(path_str, expected_ns, base_node, extra_fragment) {
Ok(res) => Some(res),
Err(ErrorKind::Resolve(box mut kind)) => {
// We only looked in one namespace. Try to give a better error if possible.
// FIXME: really it should be `resolution_failure` that does this, not `resolve_with_disambiguator`
// See https://github.com/rust-lang/rust/pull/76955#discussion_r493953382 for a good approach
for &new_ns in &[other_ns, MacroNS] {
- if let Some(res) = self.check_full_res(
- new_ns,
- path_str,
- base_node.expect_real(),
- extra_fragment,
- ) {
+ if let Some(res) =
+ self.check_full_res(new_ns, path_str, base_node, extra_fragment)
+ {
kind = ResolutionFailure::WrongNamespace { res, expected_ns };
break;
}
// Try everything!
let mut candidates = PerNS {
macro_ns: self
- .resolve_macro(path_str, base_node.expect_real())
+ .resolve_macro(path_str, base_node)
.map(|res| (res, extra_fragment.clone())),
- type_ns: match self.resolve(
- path_str,
- TypeNS,
- base_node.expect_real(),
- extra_fragment,
- ) {
+ type_ns: match self.resolve(path_str, TypeNS, base_node, extra_fragment) {
Ok(res) => {
debug!("got res in TypeNS: {:?}", res);
Ok(res)
}
Err(ErrorKind::Resolve(box kind)) => Err(kind),
},
- value_ns: match self.resolve(
- path_str,
- ValueNS,
- base_node.expect_real(),
- extra_fragment,
- ) {
+ value_ns: match self.resolve(path_str, ValueNS, base_node, extra_fragment) {
Ok(res) => Ok(res),
Err(ErrorKind::AnchorFailure(msg)) => {
anchor_failure(self.cx, diag, msg);
}
}
Some(MacroNS) => {
- match self.resolve_macro(path_str, base_node.expect_real()) {
+ match self.resolve_macro(path_str, base_node) {
Ok(res) => Some((res, extra_fragment.clone())),
Err(mut kind) => {
// `resolve_macro` only looks in the macro namespace. Try to give a better error if possible.
for &ns in &[TypeNS, ValueNS] {
- if let Some(res) = self.check_full_res(
- ns,
- path_str,
- base_node.expect_real(),
- extra_fragment,
- ) {
+ if let Some(res) =
+ self.check_full_res(ns, path_str, base_node, extra_fragment)
+ {
kind =
ResolutionFailure::WrongNamespace { res, expected_ns: MacroNS };
break;
// Since only the `DefId` portion of the `Type` instances is known to be same for both the
// `Deref` target type and the impl for type positions, this map of types is keyed by
// `DefId` and for convenience uses a special cleaner that accepts `DefId`s directly.
- if cleaner.keep_impl_with_def_id(&FakeDefId::new_real(*type_did)) {
+ if cleaner.keep_impl_with_def_id(FakeDefId::Real(*type_did)) {
add_deref_target(&type_did_to_deref_target, &mut cleaner, type_did);
}
}
} else if let Some(prim) = ty.primitive_type() {
self.prims.contains(&prim)
} else if let Some(did) = ty.def_id() {
- self.keep_impl_with_def_id(&did.into())
+ self.keep_impl_with_def_id(did.into())
} else {
false
}
}
- fn keep_impl_with_def_id(&self, did: &FakeDefId) -> bool {
- self.items.contains(did)
+ fn keep_impl_with_def_id(&self, did: FakeDefId) -> bool {
+ self.items.contains(&did)
}
}
use crate::clean;
use crate::clean::{FakeDefIdSet, Item, NestedAttributesExt};
use crate::core::DocContext;
-use crate::fold::{DocFolder, StripItem};
+use crate::fold::{strip_item, DocFolder};
use crate::passes::{ImplStripper, Pass};
crate const STRIP_HIDDEN: Pass = Pass {
// strip things like impl methods but when doing so
// we must not add any items to the `retained` set.
let old = mem::replace(&mut self.update_retained, false);
- let ret = StripItem(self.fold_item_recur(i)).strip();
+ let ret = strip_item(self.fold_item_recur(i));
self.update_retained = old;
return Some(ret);
}
use std::mem;
use crate::clean::{self, FakeDefIdSet, GetDefId, Item};
-use crate::fold::{DocFolder, StripItem};
+use crate::fold::{strip_item, DocFolder};
crate struct Stripper<'a> {
crate retained: &'a mut FakeDefIdSet,
clean::StructFieldItem(..) => {
if !i.visibility.is_public() {
- return Some(StripItem(i).strip());
+ return Some(strip_item(i));
}
}
if i.def_id.is_local() && !i.visibility.is_public() {
debug!("Stripper: stripping module {:?}", i.name);
let old = mem::replace(&mut self.update_retained, false);
- let ret = StripItem(self.fold_item_recur(i)).strip();
+ let ret = strip_item(self.fold_item_recur(i));
self.update_retained = old;
return Some(ret);
}
-Subproject commit c78cf18a07f19faa3e51f15220bca39f47d437e0
+Subproject commit 5f67a5715771b7d29e4713e8d68338602d216dcf
--- /dev/null
+// min-llvm-version: 10.0.1
+// only-x86_64
+// assembly-output: emit-asm
+// compile-flags: -C llvm-args=--x86-asm-syntax=intel
+
+#![feature(asm, global_asm)]
+#![crate_type = "rlib"]
+
+// CHECK: mov eax, eax
+global_asm!("mov eax, eax");
+// CHECK: mov ebx, 5
+global_asm!("mov ebx, {}", const 5);
+// CHECK: mov ecx, 5
+global_asm!("movl ${}, %ecx", const 5, options(att_syntax));
--- /dev/null
+// min-llvm-version: 10.0.1
+// assembly-output: emit-asm
+// compile-flags: --target powerpc-unknown-linux-gnu
+// needs-llvm-components: powerpc
+
+#![feature(no_core, lang_items, rustc_attrs, repr_simd)]
+#![crate_type = "rlib"]
+#![no_core]
+#![allow(asm_sub_register, non_camel_case_types)]
+
+#[rustc_builtin_macro]
+macro_rules! asm {
+ () => {};
+}
+#[rustc_builtin_macro]
+macro_rules! concat {
+ () => {};
+}
+#[rustc_builtin_macro]
+macro_rules! stringify {
+ () => {};
+}
+
+#[lang = "sized"]
+trait Sized {}
+#[lang = "copy"]
+trait Copy {}
+
+type ptr = *const i32;
+
+impl Copy for i8 {}
+impl Copy for u8 {}
+impl Copy for i16 {}
+impl Copy for i32 {}
+impl Copy for i64 {}
+impl Copy for f32 {}
+impl Copy for f64 {}
+impl Copy for ptr {}
+extern "C" {
+ fn extern_func();
+ static extern_static: u8;
+}
+
+// Hack to avoid function merging
+extern "Rust" {
+ fn dont_merge(s: &str);
+}
+
+macro_rules! check { ($func:ident, $ty:ty, $class:ident, $mov:literal) => {
+ #[no_mangle]
+ pub unsafe fn $func(x: $ty) -> $ty {
+ dont_merge(stringify!($func));
+
+ let y;
+ asm!(concat!($mov," {}, {}"), out($class) y, in($class) x);
+ y
+ }
+};}
+
+macro_rules! check_reg { ($func:ident, $ty:ty, $rego:tt, $regc:tt, $mov:literal) => {
+ #[no_mangle]
+ pub unsafe fn $func(x: $ty) -> $ty {
+ dont_merge(stringify!($func));
+
+ let y;
+ asm!(concat!($mov, " ", $rego, ", ", $rego), lateout($regc) y, in($regc) x);
+ y
+ }
+};}
+
+// CHECK-LABEL: reg_i8:
+// CHECK: #APP
+// CHECK: mr {{[0-9]+}}, {{[0-9]+}}
+// CHECK: #NO_APP
+check!(reg_i8, i8, reg, "mr");
+
+// CHECK-LABEL: reg_i16:
+// CHECK: #APP
+// CHECK: mr {{[0-9]+}}, {{[0-9]+}}
+// CHECK: #NO_APP
+check!(reg_i16, i16, reg, "mr");
+
+// CHECK-LABEL: reg_i32:
+// CHECK: #APP
+// CHECK: mr {{[0-9]+}}, {{[0-9]+}}
+// CHECK: #NO_APP
+check!(reg_i32, i32, reg, "mr");
+
+// CHECK-LABEL: reg_i8_nz:
+// CHECK: #APP
+// CHECK: mr {{[0-9]+}}, {{[0-9]+}}
+// CHECK: #NO_APP
+check!(reg_i8_nz, i8, reg_nonzero, "mr");
+
+// CHECK-LABEL: reg_i16_nz:
+// CHECK: #APP
+// CHECK: mr {{[0-9]+}}, {{[0-9]+}}
+// CHECK: #NO_APP
+check!(reg_i16_nz, i16, reg_nonzero, "mr");
+
+// CHECK-LABEL: reg_i32_nz:
+// CHECK: #APP
+// CHECK: mr {{[0-9]+}}, {{[0-9]+}}
+// CHECK: #NO_APP
+check!(reg_i32_nz, i32, reg_nonzero, "mr");
+
+// CHECK-LABEL: reg_f32:
+// CHECK: #APP
+// CHECK: fmr {{[0-9]+}}, {{[0-9]+}}
+// CHECK: #NO_APP
+check!(reg_f32, f32, freg, "fmr");
+
+// CHECK-LABEL: reg_f64:
+// CHECK: #APP
+// CHECK: fmr {{[0-9]+}}, {{[0-9]+}}
+// CHECK: #NO_APP
+check!(reg_f64, f64, freg, "fmr");
+
+// CHECK-LABEL: reg_i8_r0:
+// CHECK: #APP
+// CHECK: mr 0, 0
+// CHECK: #NO_APP
+check_reg!(reg_i8_r0, i8, "0", "0", "mr");
+
+// CHECK-LABEL: reg_i16_r0:
+// CHECK: #APP
+// CHECK: mr 0, 0
+// CHECK: #NO_APP
+check_reg!(reg_i16_r0, i16, "0", "0", "mr");
+
+// CHECK-LABEL: reg_i32_r0:
+// CHECK: #APP
+// CHECK: mr 0, 0
+// CHECK: #NO_APP
+check_reg!(reg_i32_r0, i32, "0", "0", "mr");
+
+// CHECK-LABEL: reg_i8_r18:
+// CHECK: #APP
+// CHECK: mr 18, 18
+// CHECK: #NO_APP
+check_reg!(reg_i8_r18, i8, "18", "18", "mr");
+
+// CHECK-LABEL: reg_i16_r18:
+// CHECK: #APP
+// CHECK: mr 18, 18
+// CHECK: #NO_APP
+check_reg!(reg_i16_r18, i16, "18", "18", "mr");
+
+// CHECK-LABEL: reg_i32_r18:
+// CHECK: #APP
+// CHECK: mr 18, 18
+// CHECK: #NO_APP
+check_reg!(reg_i32_r18, i32, "18", "18", "mr");
+
+// CHECK-LABEL: reg_f32_f0:
+// CHECK: #APP
+// CHECK: fmr 0, 0
+// CHECK: #NO_APP
+check_reg!(reg_f32_f0, f32, "0", "f0", "fmr");
+
+// CHECK-LABEL: reg_f64_f0:
+// CHECK: #APP
+// CHECK: fmr 0, 0
+// CHECK: #NO_APP
+check_reg!(reg_f64_f0, f64, "0", "f0", "fmr");
fn main() {
unsafe {
- let _: I32x2 = simd_shuffle2(I32x2(1, 2), I32x2(3, 4), [0, 0]);
- let _: I32x2 = simd_shuffle2(I32x2(1, 2), I32x2(3, 4), [0, 0]);
+ const IDX: [u32; 2] = [0, 0];
+ let _: I32x2 = simd_shuffle2(I32x2(1, 2), I32x2(3, 4), IDX);
+ let _: I32x2 = simd_shuffle2(I32x2(1, 2), I32x2(3, 4), IDX);
}
}
--- /dev/null
+// revisions: rpass1 rpass2
+
+extern crate respan;
+
+#[macro_use]
+#[path = "invalid-span-helper-mod.rs"]
+mod invalid_span_helper_mod;
+
+// Invoke a macro from a different file - this
+// allows us to get tokens with spans from different files
+helper!(1);
--- /dev/null
+#[macro_export]
+macro_rules! helper {
+ // Use `:tt` instead of `:ident` so that we don't get a `None`-delimited group
+ ($first:tt) => {
+ pub fn foo<T>() {
+ // The span of `$first` comes from another file,
+ // so the expression `1 + $first` ends up with an
+ // 'invalid' span that starts and ends in different files.
+ // We use the `respan!` macro to give all tokens the same
+ // `SyntaxContext`, so that the parser will try to merge the spans.
+ respan::respan!(let a = 1 + $first;);
+ }
+ }
+}
--- /dev/null
+// force-host
+// no-prefer-dynamic
+
+#![crate_type = "proc-macro"]
+
+extern crate proc_macro;
+use proc_macro::TokenStream;
+
+
+/// Copies the resolution information (the `SyntaxContext`) of the first
+/// token to all other tokens in the stream. Does not recurse into groups.
+#[proc_macro]
+pub fn respan(input: TokenStream) -> TokenStream {
+ let first_span = input.clone().into_iter().next().unwrap().span();
+ input.into_iter().map(|mut tree| {
+ tree.set_span(tree.span().resolved_at(first_span));
+ tree
+ }).collect()
+}
--- /dev/null
+// revisions: rpass1 rpass2
+// aux-build:respan.rs
+// aux-build:invalid-span-helper-lib.rs
+
+// This issue has several different parts. The high level idea is:
+// 1. We create an 'invalid' span with the help of the `respan` proc-macro,
+// The compiler attempts to prevent the creation of invalid spans by
+// refusing to join spans with different `SyntaxContext`s. We work around
+// this by applying the same `SyntaxContext` to the span of every token,
+// using `Span::resolved_at`
+// 2. We using this invalid span in the body of a function, causing it to get
+// encoded into the `optimized_mir`
+// 3. We call the function from a different crate - since the function is generic,
+// monomorphization runs, causing `optimized_mir` to get called.
+// 4. We re-run compilation using our populated incremental cache, but without
+// making any changes. When we recompile the crate containing our generic function
+// (`invalid_span_helper_lib`), we load the span from the incremental cache, and
+// write it into the crate metadata.
+
+extern crate invalid_span_helper_lib;
+
+fn main() {
+ invalid_span_helper_lib::foo::<u8>();
+}
use std::any::Any;
use std::path::Path;
-pub struct NoLlvmMetadataLoader;
-
-impl MetadataLoader for NoLlvmMetadataLoader {
- fn get_rlib_metadata(&self, _: &Target, filename: &Path) -> Result<MetadataRef, String> {
- unreachable!("some_crate.rs shouldn't depend on any external crates");
- }
-
- fn get_dylib_metadata(&self, target: &Target, filename: &Path) -> Result<MetadataRef, String> {
- unreachable!("some_crate.rs shouldn't depend on any external crates");
- }
-}
-
struct TheBackend;
impl CodegenBackend for TheBackend {
fn metadata_loader(&self) -> Box<MetadataLoaderDyn> {
- Box::new(NoLlvmMetadataLoader)
+ Box::new(rustc_codegen_ssa::back::metadata::DefaultMetadataLoader)
}
fn provide(&self, providers: &mut Providers) {}
movl (%rdi), %eax
inc %eax
retq
-"# );
+"#, options(att_syntax));
extern {
fn cc_plus_one_c(arg : &u32) -> u32;
^^^^
= note: no item named `BarF` in scope
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
- = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the macro `f` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: unresolved link to `error`
--> $DIR/warning.rs:58:30
|
= note: see issue #27812 <https://github.com/rust-lang/rust/issues/27812> for more information
= help: add `#![feature(rustc_private)]` to the crate attributes to enable
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `HashStable` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 5 previous errors
| -------------------------- in this macro invocation
|
= help: try using `declare_lint_pass!` or `impl_lint_pass!` instead
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `custom_lint_pass_macro` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors
| ^ expected `'}'` in format string
|
= note: if you intended to print `{`, you can escape it using `{{`
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `SessionDiagnostic` (in Nightly builds, run with -Z macro-backtrace for more info)
error: invalid format string: unmatched `}` found
--> $DIR/session-derive-errors.rs:119:1
| ^ unmatched `}` in format string
|
= note: if you intended to print `}`, you can escape it using `}}`
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `SessionDiagnostic` (in Nightly builds, run with -Z macro-backtrace for more info)
error: The `#[label = ...]` attribute can only be applied to fields of type Span
--> $DIR/session-derive-errors.rs:138:5
| ^^^^^^^^^^^^^^^^^^^^ the trait `GlobalAlloc` is not implemented for `usize`
|
= note: required by `std::alloc::GlobalAlloc::alloc`
- = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the attribute macro `global_allocator` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `usize: GlobalAlloc` is not satisfied
--> $DIR/not-an-allocator.rs:2:1
| ^^^^^^^^^^^^^^^^^^^^ the trait `GlobalAlloc` is not implemented for `usize`
|
= note: required by `std::alloc::GlobalAlloc::dealloc`
- = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the attribute macro `global_allocator` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `usize: GlobalAlloc` is not satisfied
--> $DIR/not-an-allocator.rs:2:1
| ^^^^^^^^^^^^^^^^^^^^ the trait `GlobalAlloc` is not implemented for `usize`
|
= note: required by `std::alloc::GlobalAlloc::realloc`
- = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the attribute macro `global_allocator` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `usize: GlobalAlloc` is not satisfied
--> $DIR/not-an-allocator.rs:2:1
| ^^^^^^^^^^^^^^^^^^^^ the trait `GlobalAlloc` is not implemented for `usize`
|
= note: required by `std::alloc::GlobalAlloc::alloc_zeroed`
- = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the attribute macro `global_allocator` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 4 previous errors
LL | static B: System = System;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot define a new global allocator
|
- = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the attribute macro `global_allocator` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
macro_rules! asm {
() => {};
}
+#[rustc_builtin_macro]
+macro_rules! global_asm {
+ () => {};
+}
#[lang = "sized"]
trait Sized {}
fn main() {
unsafe {
asm!("");
- //~^ ERROR asm! is unsupported on this target
+ //~^ ERROR inline assembly is unsupported on this target
}
}
+
+global_asm!("");
+//~^ ERROR inline assembly is unsupported on this target
-error[E0472]: asm! is unsupported on this target
- --> $DIR/bad-arch.rs:16:9
+error[E0472]: inline assembly is unsupported on this target
+ --> $DIR/bad-arch.rs:20:9
|
LL | asm!("");
| ^^^^^^^^^
-error: aborting due to previous error
+error[E0472]: inline assembly is unsupported on this target
+ --> $DIR/bad-arch.rs:25:1
+ |
+LL | global_asm!("");
+ | ^^^^^^^^^^^^^^^^
+ |
+ = note: this error originates in the macro `global_asm` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: aborting due to 2 previous errors
// only-x86_64
-#![feature(asm)]
+#![feature(asm, global_asm)]
fn main() {
let mut foo = 0;
//~^ ERROR asm outputs are not allowed with the `noreturn` option
}
}
+
+global_asm!("", options(nomem));
+//~^ ERROR expected one of
+global_asm!("", options(readonly));
+//~^ ERROR expected one of
+global_asm!("", options(noreturn));
+//~^ ERROR expected one of
+global_asm!("", options(pure));
+//~^ ERROR expected one of
+global_asm!("", options(nostack));
+//~^ ERROR expected one of
+global_asm!("", options(preserves_flags));
+//~^ ERROR expected one of
LL | asm!("{}", out(reg) foo, options(noreturn));
| ^^^^^^^^^^^^
-error: aborting due to 5 previous errors
+error: expected one of `)` or `att_syntax`, found `nomem`
+ --> $DIR/bad-options.rs:20:25
+ |
+LL | global_asm!("", options(nomem));
+ | ^^^^^ expected one of `)` or `att_syntax`
+
+error: expected one of `)` or `att_syntax`, found `readonly`
+ --> $DIR/bad-options.rs:22:25
+ |
+LL | global_asm!("", options(readonly));
+ | ^^^^^^^^ expected one of `)` or `att_syntax`
+
+error: expected one of `)` or `att_syntax`, found `noreturn`
+ --> $DIR/bad-options.rs:24:25
+ |
+LL | global_asm!("", options(noreturn));
+ | ^^^^^^^^ expected one of `)` or `att_syntax`
+
+error: expected one of `)` or `att_syntax`, found `pure`
+ --> $DIR/bad-options.rs:26:25
+ |
+LL | global_asm!("", options(pure));
+ | ^^^^ expected one of `)` or `att_syntax`
+
+error: expected one of `)` or `att_syntax`, found `nostack`
+ --> $DIR/bad-options.rs:28:25
+ |
+LL | global_asm!("", options(nostack));
+ | ^^^^^^^ expected one of `)` or `att_syntax`
+
+error: expected one of `)` or `att_syntax`, found `preserves_flags`
+ --> $DIR/bad-options.rs:30:25
+ |
+LL | global_asm!("", options(preserves_flags));
+ | ^^^^^^^^^^^^^^^ expected one of `)` or `att_syntax`
+
+error: aborting due to 11 previous errors
// only-x86_64
-#![feature(asm)]
+#![feature(asm, global_asm)]
fn main() {
let mut foo = 0;
//~^ ERROR multiple unused asm arguments
}
}
+
+const FOO: i32 = 1;
+global_asm!("{}");
+//~^ ERROR invalid reference to argument at index 0
+global_asm!("{1}", const FOO);
+//~^ ERROR invalid reference to argument at index 1
+//~^^ ERROR argument never used
+global_asm!("{a}");
+//~^ ERROR there is no argument named `a`
+global_asm!("{}", a = const FOO);
+//~^ ERROR invalid reference to argument at index 0
+//~^^ ERROR argument never used
+global_asm!("{1}", a = const FOO);
+//~^ ERROR invalid reference to argument at index 1
+//~^^ ERROR named argument never used
+global_asm!("{:foo}", const FOO);
+//~^ ERROR asm template modifier must be a single character
+global_asm!("", const FOO, const FOO);
+//~^ ERROR multiple unused asm arguments
|
= help: if these arguments are intentionally unused, consider using them in an asm comment: `"/* {0} {1} */"`
-error: aborting due to 11 previous errors
+error: invalid reference to argument at index 0
+ --> $DIR/bad-template.rs:31:14
+ |
+LL | global_asm!("{}");
+ | ^^ from here
+ |
+ = note: no arguments were given
+
+error: invalid reference to argument at index 1
+ --> $DIR/bad-template.rs:33:14
+ |
+LL | global_asm!("{1}", const FOO);
+ | ^^^ from here
+ |
+ = note: there is 1 argument
+
+error: argument never used
+ --> $DIR/bad-template.rs:33:20
+ |
+LL | global_asm!("{1}", const FOO);
+ | ^^^^^^^^^ argument never used
+ |
+ = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {0} */"`
+
+error: there is no argument named `a`
+ --> $DIR/bad-template.rs:36:14
+ |
+LL | global_asm!("{a}");
+ | ^^^
+
+error: invalid reference to argument at index 0
+ --> $DIR/bad-template.rs:38:14
+ |
+LL | global_asm!("{}", a = const FOO);
+ | ^^ ------------- named argument
+ | |
+ | from here
+ |
+ = note: no positional arguments were given
+note: named arguments cannot be referenced by position
+ --> $DIR/bad-template.rs:38:19
+ |
+LL | global_asm!("{}", a = const FOO);
+ | ^^^^^^^^^^^^^
+
+error: named argument never used
+ --> $DIR/bad-template.rs:38:19
+ |
+LL | global_asm!("{}", a = const FOO);
+ | ^^^^^^^^^^^^^ named argument never used
+ |
+ = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"`
+
+error: invalid reference to argument at index 1
+ --> $DIR/bad-template.rs:41:14
+ |
+LL | global_asm!("{1}", a = const FOO);
+ | ^^^ from here
+ |
+ = note: no positional arguments were given
+
+error: named argument never used
+ --> $DIR/bad-template.rs:41:20
+ |
+LL | global_asm!("{1}", a = const FOO);
+ | ^^^^^^^^^^^^^ named argument never used
+ |
+ = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"`
+
+error: asm template modifier must be a single character
+ --> $DIR/bad-template.rs:44:16
+ |
+LL | global_asm!("{:foo}", const FOO);
+ | ^^^
+
+error: multiple unused asm arguments
+ --> $DIR/bad-template.rs:46:17
+ |
+LL | global_asm!("", const FOO, const FOO);
+ | ^^^^^^^^^ ^^^^^^^^^ argument never used
+ | |
+ | argument never used
+ |
+ = help: if these arguments are intentionally unused, consider using them in an asm comment: `"/* {0} {1} */"`
+
+error: aborting due to 21 previous errors
// only-x86_64
// run-pass
-#![feature(asm)]
+#![feature(asm, global_asm)]
fn const_generic<const X: usize>() -> usize {
unsafe {
let d = const_generic::<5>();
assert_eq!(d, 5);
}
+
+global_asm!("mov eax, {}", const 5);
+global_asm!("mov eax, {}", const constfn(5));
+global_asm!("mov eax, {}", const constfn(5) + constfn(5));
// only-x86_64
// run-rustfix
-#![feature(asm)]
+#![feature(asm, global_asm)]
fn main() {
unsafe {
);
}
}
+
+global_asm!("", options(att_syntax, ));
+//~^ ERROR the `att_syntax` option was already provided
// only-x86_64
// run-rustfix
-#![feature(asm)]
+#![feature(asm, global_asm)]
fn main() {
unsafe {
);
}
}
+
+global_asm!("", options(att_syntax, att_syntax));
+//~^ ERROR the `att_syntax` option was already provided
LL | options(noreturn),
| ^^^^^^^^ this option was already provided
-error: aborting due to 9 previous errors
+error: the `att_syntax` option was already provided
+ --> $DIR/duplicate-options.rs:28:37
+ |
+LL | global_asm!("", options(att_syntax, att_syntax));
+ | ^^^^^^^^^^ this option was already provided
+
+error: aborting due to 10 previous errors
error: unknown directive
- --> $DIR/inline-syntax.rs:25:15
+.intel_syntax noprefix
+^
+error: unknown directive
+.intel_syntax noprefix
+^
+error: unknown directive
+ |
+note: instantiated into assembly here
+ --> <inline asm>:1:1
+ |
+LL | .intel_syntax noprefix
+ | ^
+
+error: unknown directive
+ --> $DIR/inline-syntax.rs:29:15
|
LL | asm!(".intel_syntax noprefix", "nop");
| ^
| ^
error: unknown directive
- --> $DIR/inline-syntax.rs:28:15
+ --> $DIR/inline-syntax.rs:32:15
|
LL | asm!(".intel_syntax aaa noprefix", "nop");
| ^
| ^
error: unknown directive
- --> $DIR/inline-syntax.rs:31:15
+ --> $DIR/inline-syntax.rs:35:15
|
LL | asm!(".att_syntax noprefix", "nop");
| ^
| ^
error: unknown directive
- --> $DIR/inline-syntax.rs:34:15
+ --> $DIR/inline-syntax.rs:38:15
|
LL | asm!(".att_syntax bbb noprefix", "nop");
| ^
| ^
error: unknown directive
- --> $DIR/inline-syntax.rs:37:15
+ --> $DIR/inline-syntax.rs:41:15
|
LL | asm!(".intel_syntax noprefix; nop");
| ^
| ^
error: unknown directive
- --> $DIR/inline-syntax.rs:43:13
+ --> $DIR/inline-syntax.rs:47:13
|
LL | .intel_syntax noprefix
| ^
LL | .intel_syntax noprefix
| ^
-error: aborting due to 6 previous errors
+error: aborting due to 7 previous errors
macro_rules! asm {
() => {};
}
+#[rustc_builtin_macro]
+macro_rules! global_asm {
+ () => {};
+}
#[lang = "sized"]
trait Sized {}
//[arm]~^^^^ ERROR unknown directive
}
}
+
+global_asm!(".intel_syntax noprefix", "nop");
+//[x86_64]~^ WARN avoid using `.intel_syntax`
+// Assembler errors don't have line numbers, so no error on ARM
warning: avoid using `.intel_syntax`, Intel syntax is the default
- --> $DIR/inline-syntax.rs:25:15
+ --> $DIR/inline-syntax.rs:55:14
|
-LL | asm!(".intel_syntax noprefix", "nop");
- | ^^^^^^^^^^^^^^^^^^^^^^
+LL | global_asm!(".intel_syntax noprefix", "nop");
+ | ^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(bad_asm_style)]` on by default
warning: avoid using `.intel_syntax`, Intel syntax is the default
- --> $DIR/inline-syntax.rs:28:15
+ --> $DIR/inline-syntax.rs:29:15
+ |
+LL | asm!(".intel_syntax noprefix", "nop");
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
+warning: avoid using `.intel_syntax`, Intel syntax is the default
+ --> $DIR/inline-syntax.rs:32:15
|
LL | asm!(".intel_syntax aaa noprefix", "nop");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: avoid using `.att_syntax`, prefer using `options(att_syntax)` instead
- --> $DIR/inline-syntax.rs:31:15
+ --> $DIR/inline-syntax.rs:35:15
|
LL | asm!(".att_syntax noprefix", "nop");
| ^^^^^^^^^^^^^^^^^^^^
warning: avoid using `.att_syntax`, prefer using `options(att_syntax)` instead
- --> $DIR/inline-syntax.rs:34:15
+ --> $DIR/inline-syntax.rs:38:15
|
LL | asm!(".att_syntax bbb noprefix", "nop");
| ^^^^^^^^^^^^^^^^^^^^^^^^
warning: avoid using `.intel_syntax`, Intel syntax is the default
- --> $DIR/inline-syntax.rs:37:15
+ --> $DIR/inline-syntax.rs:41:15
|
LL | asm!(".intel_syntax noprefix; nop");
| ^^^^^^^^^^^^^^^^^^^^^^
warning: avoid using `.intel_syntax`, Intel syntax is the default
- --> $DIR/inline-syntax.rs:43:13
+ --> $DIR/inline-syntax.rs:47:13
|
LL | .intel_syntax noprefix
| ^^^^^^^^^^^^^^^^^^^^^^
-warning: 6 warnings emitted
+warning: 7 warnings emitted
LL | | noreturn nostack att_syntax options);
| |____________________________________________- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
error: the `pure` and `noreturn` options are mutually exclusive
--> $DIR/interpolated-idents.rs:13:13
LL | | noreturn nostack att_syntax options);
| |____________________________________________- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
error: asm outputs are not allowed with the `noreturn` option
--> $DIR/interpolated-idents.rs:10:32
| |____________________________________________in this macro invocation
| in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 3 previous errors
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #32408 <https://github.com/rust-lang/rust/issues/32408>
= help: use the new asm! syntax specified in RFC 2873
- = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the macro `llvm_asm` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: naked functions must contain a single asm block
--> $DIR/naked-functions.rs:108:1
// only-x86_64
-#![feature(asm)]
+#![feature(asm, global_asm)]
fn main() {
let mut foo = 0;
//~^ ERROR asm template must be a string literal
}
}
+
+const FOO: i32 = 1;
+const BAR: i32 = 2;
+global_asm!();
+//~^ ERROR requires at least a template string argument
+global_asm!(FOO);
+//~^ ERROR asm template must be a string literal
+global_asm!("{}" FOO);
+//~^ ERROR expected token: `,`
+global_asm!("{}", FOO);
+//~^ ERROR expected operand, options, or additional template string
+global_asm!("{}", const);
+//~^ ERROR expected expression, found end of macro arguments
+global_asm!("{}", const(reg) FOO);
+//~^ ERROR expected one of
+global_asm!("", options(FOO));
+//~^ ERROR expected one of
+global_asm!("", options(nomem FOO));
+//~^ ERROR expected one of
+global_asm!("", options(nomem, FOO));
+//~^ ERROR expected one of
+global_asm!("{}", options(), const FOO);
+//~^ ERROR arguments are not allowed after options
+global_asm!("{a}", a = const FOO, a = const BAR);
+//~^ ERROR duplicate argument named `a`
+//~^^ ERROR argument never used
+global_asm!("", options(), "");
+//~^ ERROR expected one of
+global_asm!("{}", const FOO, "{}", const FOO);
+//~^ ERROR expected one of
+global_asm!(format!("{{{}}}", 0), const FOO);
+//~^ ERROR asm template must be a string literal
+global_asm!("{1}", format!("{{{}}}", 0), const FOO, const BAR);
+//~^ ERROR asm template must be a string literal
LL | asm!(format!("{{{}}}", 0), in(reg) foo);
| ^^^^^^^^^^^^^^^^^^^^
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info)
error: asm template must be a string literal
--> $DIR/parse-error.rs:62:21
LL | asm!("{1}", format!("{{{}}}", 0), in(reg) foo, out(reg) bar);
| ^^^^^^^^^^^^^^^^^^^^
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: requires at least a template string argument
+ --> $DIR/parse-error.rs:69:1
+ |
+LL | global_asm!();
+ | ^^^^^^^^^^^^^^
+
+error: asm template must be a string literal
+ --> $DIR/parse-error.rs:71:13
+ |
+LL | global_asm!(FOO);
+ | ^^^
+
+error: expected token: `,`
+ --> $DIR/parse-error.rs:73:18
+ |
+LL | global_asm!("{}" FOO);
+ | ^^^ expected `,`
+
+error: expected operand, options, or additional template string
+ --> $DIR/parse-error.rs:75:19
+ |
+LL | global_asm!("{}", FOO);
+ | ^^^ expected operand, options, or additional template string
+
+error: expected expression, found end of macro arguments
+ --> $DIR/parse-error.rs:77:24
+ |
+LL | global_asm!("{}", const);
+ | ^ expected expression
+
+error: expected one of `,`, `.`, `?`, or an operator, found `FOO`
+ --> $DIR/parse-error.rs:79:30
+ |
+LL | global_asm!("{}", const(reg) FOO);
+ | ^^^ expected one of `,`, `.`, `?`, or an operator
+
+error: expected one of `)` or `att_syntax`, found `FOO`
+ --> $DIR/parse-error.rs:81:25
+ |
+LL | global_asm!("", options(FOO));
+ | ^^^ expected one of `)` or `att_syntax`
+
+error: expected one of `)` or `att_syntax`, found `nomem`
+ --> $DIR/parse-error.rs:83:25
+ |
+LL | global_asm!("", options(nomem FOO));
+ | ^^^^^ expected one of `)` or `att_syntax`
+
+error: expected one of `)` or `att_syntax`, found `nomem`
+ --> $DIR/parse-error.rs:85:25
+ |
+LL | global_asm!("", options(nomem, FOO));
+ | ^^^^^ expected one of `)` or `att_syntax`
+
+error: arguments are not allowed after options
+ --> $DIR/parse-error.rs:87:30
+ |
+LL | global_asm!("{}", options(), const FOO);
+ | --------- ^^^^^^^^^ argument
+ | |
+ | previous options
+
+error: duplicate argument named `a`
+ --> $DIR/parse-error.rs:89:35
+ |
+LL | global_asm!("{a}", a = const FOO, a = const BAR);
+ | ------------- ^^^^^^^^^^^^^ duplicate argument
+ | |
+ | previously here
+
+error: argument never used
+ --> $DIR/parse-error.rs:89:35
+ |
+LL | global_asm!("{a}", a = const FOO, a = const BAR);
+ | ^^^^^^^^^^^^^ argument never used
+ |
+ = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {1} */"`
+
+error: expected one of `const` or `options`, found `""`
+ --> $DIR/parse-error.rs:92:28
+ |
+LL | global_asm!("", options(), "");
+ | ^^ expected one of `const` or `options`
+
+error: expected one of `const` or `options`, found `"{}"`
+ --> $DIR/parse-error.rs:94:30
+ |
+LL | global_asm!("{}", const FOO, "{}", const FOO);
+ | ^^^^ expected one of `const` or `options`
+
+error: asm template must be a string literal
+ --> $DIR/parse-error.rs:96:13
+ |
+LL | global_asm!(format!("{{{}}}", 0), const FOO);
+ | ^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: this error originates in the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: asm template must be a string literal
+ --> $DIR/parse-error.rs:98:20
+ |
+LL | global_asm!("{1}", format!("{{{}}}", 0), const FOO, const BAR);
+ | ^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: this error originates in the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0435]: attempt to use a non-constant value in a constant
--> $DIR/parse-error.rs:37:37
LL | asm!("{1}", in("eax") foo, const bar);
| ^^^ non-constant value
-error: aborting due to 31 previous errors
+error: aborting due to 47 previous errors
For more information about this error, try `rustc --explain E0435`.
// only-x86_64
-#![feature(asm, repr_simd, never_type)]
+#![feature(asm, global_asm, repr_simd, never_type)]
#[repr(simd)]
struct SimdNonCopy(f32, f32, f32, f32);
asm!("{}", in(reg) u);
}
}
+
+// Const operands must be integer or floats, and must be constants.
+
+global_asm!("{}", const 0);
+global_asm!("{}", const 0i32);
+global_asm!("{}", const 0f32);
+global_asm!("{}", const 0 as *mut u8);
+//~^ ERROR asm `const` arguments must be integer or floating-point values
| ^^^^^^^
|
= note: only integers, floats, SIMD vectors, pointers and function pointers can be used as arguments for inline assembly
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)
error: cannot use value of type `(i32, i32, i32)` for inline assembly
--> $DIR/type-check-2.rs:70:28
|
= note: only integers, floats, SIMD vectors, pointers and function pointers can be used as arguments for inline assembly
+error: asm `const` arguments must be integer or floating-point values
+ --> $DIR/type-check-2.rs:99:19
+ |
+LL | global_asm!("{}", const 0 as *mut u8);
+ | ^^^^^^^^^^^^^^^^^^
+
error: asm `sym` operand must point to a fn or static
--> $DIR/type-check-2.rs:47:24
|
LL | asm!("{}", inout(reg) v[0]);
| ^ cannot borrow as mutable
-error: aborting due to 14 previous errors
+error: aborting due to 15 previous errors
Some errors have detailed explanations: E0381, E0596.
For more information about an error, try `rustc --explain E0381`.
// only-x86_64
// compile-flags: -C target-feature=+avx512f
-#![feature(asm)]
+#![feature(asm, global_asm)]
use std::arch::x86_64::{_mm256_setzero_ps, _mm_setzero_ps};
asm!("{:r}", inout(reg) main => val_u64);
}
}
+
+// Constants must be... constant
+
+static S: i32 = 1;
+const fn const_foo(x: i32) -> i32 {
+ x
+}
+const fn const_bar<T>(x: T) -> T {
+ x
+}
+global_asm!("{}", const S);
+//~^ ERROR constants cannot refer to statics
+global_asm!("{}", const const_foo(0));
+global_asm!("{}", const const_foo(S));
+//~^ ERROR constants cannot refer to statics
+global_asm!("{}", const const_bar(0));
+global_asm!("{}", const const_bar(S));
+//~^ ERROR constants cannot refer to statics
|
= note: asm inout arguments must have the same type, unless they are both pointers or integers of the same size
-error: aborting due to 9 previous errors; 4 warnings emitted
+error[E0013]: constants cannot refer to statics
+ --> $DIR/type-check-3.rs:82:25
+ |
+LL | global_asm!("{}", const S);
+ | ^
+ |
+ = help: consider extracting the value of the `static` to a `const`, and referring to that
+
+error[E0013]: constants cannot refer to statics
+ --> $DIR/type-check-3.rs:85:35
+ |
+LL | global_asm!("{}", const const_foo(S));
+ | ^
+ |
+ = help: consider extracting the value of the `static` to a `const`, and referring to that
+
+error[E0013]: constants cannot refer to statics
+ --> $DIR/type-check-3.rs:88:35
+ |
+LL | global_asm!("{}", const const_bar(S));
+ | ^
+ |
+ = help: consider extracting the value of the `static` to a `const`, and referring to that
+
+error: aborting due to 12 previous errors; 4 warnings emitted
+For more information about this error, try `rustc --explain E0013`.
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 3 previous errors
--- /dev/null
+error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
+ --> $DIR/async-unsafe-fn-call-in-safe.rs:14:5
+ |
+LL | S::f();
+ | ^^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
+ --> $DIR/async-unsafe-fn-call-in-safe.rs:15:5
+ |
+LL | f();
+ | ^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
+ --> $DIR/async-unsafe-fn-call-in-safe.rs:19:5
+ |
+LL | S::f();
+ | ^^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
+ --> $DIR/async-unsafe-fn-call-in-safe.rs:20:5
+ |
+LL | f();
+ | ^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0133`.
// edition:2018
+// revisions: mir thir
+// [thir]compile-flags: -Z thir-unsafeck
struct S;
+++ /dev/null
-error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
- --> $DIR/async-unsafe-fn-call-in-safe.rs:12:5
- |
-LL | S::f();
- | ^^^^^^ call to unsafe function
- |
- = note: consult the function's documentation for information on how to avoid undefined behavior
-
-error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
- --> $DIR/async-unsafe-fn-call-in-safe.rs:13:5
- |
-LL | f();
- | ^^^ call to unsafe function
- |
- = note: consult the function's documentation for information on how to avoid undefined behavior
-
-error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
- --> $DIR/async-unsafe-fn-call-in-safe.rs:17:5
- |
-LL | S::f();
- | ^^^^^^ call to unsafe function
- |
- = note: consult the function's documentation for information on how to avoid undefined behavior
-
-error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
- --> $DIR/async-unsafe-fn-call-in-safe.rs:18:5
- |
-LL | f();
- | ^^^ call to unsafe function
- |
- = note: consult the function's documentation for information on how to avoid undefined behavior
-
-error: aborting due to 4 previous errors
-
-For more information about this error, try `rustc --explain E0133`.
--- /dev/null
+error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
+ --> $DIR/async-unsafe-fn-call-in-safe.rs:14:5
+ |
+LL | S::f();
+ | ^^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
+ --> $DIR/async-unsafe-fn-call-in-safe.rs:15:5
+ |
+LL | f();
+ | ^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
+ --> $DIR/async-unsafe-fn-call-in-safe.rs:19:5
+ |
+LL | S::f();
+ | ^^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
+ --> $DIR/async-unsafe-fn-call-in-safe.rs:20:5
+ |
+LL | f();
+ | ^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0133`.
| ----- in this macro invocation
|
= note: labels are unreachable through functions, closures, async blocks and modules
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `b` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | bug!();
| ------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `bug` (in Nightly builds, run with -Z macro-backtrace for more info)
error: unexpected token: `{
let res =
LL | some_macro!(u8);
| ---------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `some_macro` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 3 previous errors
LL | pass_nonterminal!(n!());
| ------------------------ in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `pass_nonterminal` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
| for<'r> fn(&'r i32) -> &'r i32 {foo}
| _
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: `for<'r> fn(&'r i32) -> &'r i32 {foo}` doesn't implement `Debug`
--> $DIR/issue-77910-1.rs:8:5
| ---------- required by this bound in `core::panicking::assert_failed`
|
= help: the trait `Debug` is not implemented for `for<'r> fn(&'r i32) -> &'r i32 {foo}`
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors
| ------ borrow later used here
|
= note: consider using a `let` binding to create a longer lived value
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
| |
| borrow later used by call
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `width` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | static settings_dir: String = format!("");
| ^^^^^^^^^^^
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::__export::format_args` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0015]: calls in statics are limited to constant functions, tuple structs and tuple variants
--> $DIR/issue-64453.rs:4:31
LL | static settings_dir: String = format!("");
| ^^^^^^^^^^^
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 3 previous errors
LL | sss!();
| ------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `aaa` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
| ^ `impl Sized` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
= note: required by `std::fmt::Debug::fmt`
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider further restricting this bound
|
LL | fn test_impl(t: impl Sized + std::fmt::Debug) {
| ^ `T` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
= note: required by `std::fmt::Debug::fmt`
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider restricting type parameter `T`
|
LL | fn test_no_bounds<T: std::fmt::Debug>(t: T) {
| ^ `T` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
= note: required by `std::fmt::Debug::fmt`
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider further restricting this bound
|
LL | fn test_one_bound<T: Sized + std::fmt::Debug>(t: T) {
| ^ `Y` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
= note: required by `std::fmt::Debug::fmt`
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider further restricting type parameter `Y`
|
LL | fn test_no_bounds_where<X, Y>(x: X, y: Y) where X: std::fmt::Debug, Y: std::fmt::Debug {
| ^ `X` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
= note: required by `std::fmt::Debug::fmt`
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider further restricting this bound
|
LL | fn test_one_bound_where<X>(x: X) where X: Sized + std::fmt::Debug {
| ^ `X` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
= note: required by `std::fmt::Debug::fmt`
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider further restricting type parameter `X`
|
LL | fn test_many_bounds_where<X>(x: X) where X: Sized, X: Sized, X: std::fmt::Debug {
--- /dev/null
+// run-rustfix
+#![deny(disjoint_capture_migration)]
+
+use std::thread;
+
+/* Test Send Trait Migration */
+struct SendPointer (*mut i32);
+unsafe impl Send for SendPointer {}
+
+fn test_send_trait() {
+ let mut f = 10;
+ let fptr = SendPointer(&mut f as *mut i32);
+ thread::spawn(move || { let _ = &fptr; unsafe {
+ //~^ ERROR: `Send` trait implementation affected for closure because of `capture_disjoint_fields`
+ //~| HELP: add a dummy let to cause `fptr` to be fully captured
+ *fptr.0 = 20;
+ } });
+}
+
+/* Test Sync Trait Migration */
+struct CustomInt (*mut i32);
+struct SyncPointer (CustomInt);
+unsafe impl Sync for SyncPointer {}
+unsafe impl Send for CustomInt {}
+
+fn test_sync_trait() {
+ let mut f = 10;
+ let f = CustomInt(&mut f as *mut i32);
+ let fptr = SyncPointer(f);
+ thread::spawn(move || { let _ = &fptr; unsafe {
+ //~^ ERROR: `Sync`, `Send` trait implementation affected for closure because of `capture_disjoint_fields`
+ //~| HELP: add a dummy let to cause `fptr` to be fully captured
+ *fptr.0.0 = 20;
+ } });
+}
+
+/* Test Clone Trait Migration */
+struct S(String);
+struct T(i32);
+
+struct U(S,T);
+
+impl Clone for U {
+ fn clone(&self) -> Self {
+ U(S(String::from("Hello World")), T(0))
+ }
+}
+
+fn test_clone_trait() {
+ let f = U(S(String::from("Hello World")), T(0));
+ let c = || { let _ = &f;
+ //~^ ERROR: `Clone` trait implementation, and drop order affected for closure because of `capture_disjoint_fields`
+ //~| HELP: add a dummy let to cause `f` to be fully captured
+ let f_1 = f.1;
+ println!("{:?}", f_1.0);
+ };
+
+ let c_clone = c.clone();
+
+ c_clone();
+}
+
+fn main() {
+ test_send_trait();
+ test_sync_trait();
+ test_clone_trait();
+}
--- /dev/null
+// run-rustfix
+#![deny(disjoint_capture_migration)]
+
+use std::thread;
+
+/* Test Send Trait Migration */
+struct SendPointer (*mut i32);
+unsafe impl Send for SendPointer {}
+
+fn test_send_trait() {
+ let mut f = 10;
+ let fptr = SendPointer(&mut f as *mut i32);
+ thread::spawn(move || unsafe {
+ //~^ ERROR: `Send` trait implementation affected for closure because of `capture_disjoint_fields`
+ //~| HELP: add a dummy let to cause `fptr` to be fully captured
+ *fptr.0 = 20;
+ });
+}
+
+/* Test Sync Trait Migration */
+struct CustomInt (*mut i32);
+struct SyncPointer (CustomInt);
+unsafe impl Sync for SyncPointer {}
+unsafe impl Send for CustomInt {}
+
+fn test_sync_trait() {
+ let mut f = 10;
+ let f = CustomInt(&mut f as *mut i32);
+ let fptr = SyncPointer(f);
+ thread::spawn(move || unsafe {
+ //~^ ERROR: `Sync`, `Send` trait implementation affected for closure because of `capture_disjoint_fields`
+ //~| HELP: add a dummy let to cause `fptr` to be fully captured
+ *fptr.0.0 = 20;
+ });
+}
+
+/* Test Clone Trait Migration */
+struct S(String);
+struct T(i32);
+
+struct U(S,T);
+
+impl Clone for U {
+ fn clone(&self) -> Self {
+ U(S(String::from("Hello World")), T(0))
+ }
+}
+
+fn test_clone_trait() {
+ let f = U(S(String::from("Hello World")), T(0));
+ let c = || {
+ //~^ ERROR: `Clone` trait implementation, and drop order affected for closure because of `capture_disjoint_fields`
+ //~| HELP: add a dummy let to cause `f` to be fully captured
+ let f_1 = f.1;
+ println!("{:?}", f_1.0);
+ };
+
+ let c_clone = c.clone();
+
+ c_clone();
+}
+
+fn main() {
+ test_send_trait();
+ test_sync_trait();
+ test_clone_trait();
+}
--- /dev/null
+error: `Send` trait implementation affected for closure because of `capture_disjoint_fields`
+ --> $DIR/auto_traits.rs:13:19
+ |
+LL | thread::spawn(move || unsafe {
+ | ___________________^
+LL | |
+LL | |
+LL | | *fptr.0 = 20;
+LL | | });
+ | |_____^
+ |
+note: the lint level is defined here
+ --> $DIR/auto_traits.rs:2:9
+ |
+LL | #![deny(disjoint_capture_migration)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+help: add a dummy let to cause `fptr` to be fully captured
+ |
+LL | thread::spawn(move || { let _ = &fptr; unsafe {
+LL |
+LL |
+LL | *fptr.0 = 20;
+LL | } });
+ |
+
+error: `Sync`, `Send` trait implementation affected for closure because of `capture_disjoint_fields`
+ --> $DIR/auto_traits.rs:30:19
+ |
+LL | thread::spawn(move || unsafe {
+ | ___________________^
+LL | |
+LL | |
+LL | | *fptr.0.0 = 20;
+LL | | });
+ | |_____^
+ |
+help: add a dummy let to cause `fptr` to be fully captured
+ |
+LL | thread::spawn(move || { let _ = &fptr; unsafe {
+LL |
+LL |
+LL | *fptr.0.0 = 20;
+LL | } });
+ |
+
+error: `Clone` trait implementation, and drop order affected for closure because of `capture_disjoint_fields`
+ --> $DIR/auto_traits.rs:51:13
+ |
+LL | let c = || {
+ | _____________^
+LL | |
+LL | |
+LL | | let f_1 = f.1;
+LL | | println!("{:?}", f_1.0);
+LL | | };
+ | |_____^
+ |
+help: add a dummy let to cause `f` to be fully captured
+ |
+LL | let c = || { let _ = &f;
+LL |
+LL |
+LL | let f_1 = f.1;
+LL | println!("{:?}", f_1.0);
+LL | };
+ |
+
+error: aborting due to 3 previous errors
+
// run-rustfix
-#![deny(disjoint_capture_drop_reorder)]
+#![deny(disjoint_capture_migration)]
//~^ NOTE: the lint level is defined here
// Test cases for types that implement a insignificant drop (stlib defined)
// run-rustfix
-#![deny(disjoint_capture_drop_reorder)]
+#![deny(disjoint_capture_migration)]
//~^ NOTE: the lint level is defined here
// Test cases for types that implement a insignificant drop (stlib defined)
note: the lint level is defined here
--> $DIR/insignificant_drop.rs:3:9
|
-LL | #![deny(disjoint_capture_drop_reorder)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | #![deny(disjoint_capture_migration)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
help: add a dummy let to cause `t`, `t1`, `t2` to be fully captured
|
LL | let c = || { let _ = (&t, &t1, &t2);
// run-pass
-#![warn(disjoint_capture_drop_reorder)]
+#![warn(disjoint_capture_migration)]
fn main() {
if let a = "" {
// run-rustfix
-#![deny(disjoint_capture_drop_reorder)]
+#![deny(disjoint_capture_migration)]
//~^ NOTE: the lint level is defined here
// Test the two possible cases for automated migartion using rustfix
// run-rustfix
-#![deny(disjoint_capture_drop_reorder)]
+#![deny(disjoint_capture_migration)]
//~^ NOTE: the lint level is defined here
// Test the two possible cases for automated migartion using rustfix
note: the lint level is defined here
--> $DIR/migrations_rustfix.rs:2:9
|
-LL | #![deny(disjoint_capture_drop_reorder)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | #![deny(disjoint_capture_migration)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
help: add a dummy let to cause `t` to be fully captured
|
LL | let c = || { let _ = &t;
--- /dev/null
+// run-rustfix
+
+#![deny(disjoint_capture_migration)]
+// ignore-wasm32-bare compiled with panic=abort by default
+
+#![feature(fn_traits)]
+#![feature(never_type)]
+
+use std::panic;
+
+fn foo_diverges() -> ! { panic!() }
+
+fn assert_panics<F>(f: F) where F: FnOnce() {
+ let f = panic::AssertUnwindSafe(f);
+ let result = panic::catch_unwind(move || { let _ = &f;
+ //~^ ERROR: `UnwindSafe`, `RefUnwindSafe` trait implementation affected for closure because of `capture_disjoint_fields`
+ //~| HELP: add a dummy let to cause `f` to be fully captured
+ f.0()
+ });
+ if let Ok(..) = result {
+ panic!("diverging function returned");
+ }
+}
+
+fn test_fn_ptr_panic<T>(mut t: T)
+ where T: Fn() -> !
+{
+ let as_fn = <T as Fn<()>>::call;
+ assert_panics(|| as_fn(&t, ()));
+ let as_fn_mut = <T as FnMut<()>>::call_mut;
+ assert_panics(|| as_fn_mut(&mut t, ()));
+ let as_fn_once = <T as FnOnce<()>>::call_once;
+ assert_panics(|| as_fn_once(t, ()));
+}
+
+fn main() {
+ test_fn_ptr_panic(foo_diverges);
+ test_fn_ptr_panic(foo_diverges as fn() -> !);
+}
--- /dev/null
+// run-rustfix
+
+#![deny(disjoint_capture_migration)]
+// ignore-wasm32-bare compiled with panic=abort by default
+
+#![feature(fn_traits)]
+#![feature(never_type)]
+
+use std::panic;
+
+fn foo_diverges() -> ! { panic!() }
+
+fn assert_panics<F>(f: F) where F: FnOnce() {
+ let f = panic::AssertUnwindSafe(f);
+ let result = panic::catch_unwind(move || {
+ //~^ ERROR: `UnwindSafe`, `RefUnwindSafe` trait implementation affected for closure because of `capture_disjoint_fields`
+ //~| HELP: add a dummy let to cause `f` to be fully captured
+ f.0()
+ });
+ if let Ok(..) = result {
+ panic!("diverging function returned");
+ }
+}
+
+fn test_fn_ptr_panic<T>(mut t: T)
+ where T: Fn() -> !
+{
+ let as_fn = <T as Fn<()>>::call;
+ assert_panics(|| as_fn(&t, ()));
+ let as_fn_mut = <T as FnMut<()>>::call_mut;
+ assert_panics(|| as_fn_mut(&mut t, ()));
+ let as_fn_once = <T as FnOnce<()>>::call_once;
+ assert_panics(|| as_fn_once(t, ()));
+}
+
+fn main() {
+ test_fn_ptr_panic(foo_diverges);
+ test_fn_ptr_panic(foo_diverges as fn() -> !);
+}
--- /dev/null
+error: `UnwindSafe`, `RefUnwindSafe` trait implementation affected for closure because of `capture_disjoint_fields`
+ --> $DIR/mir_calls_to_shims.rs:15:38
+ |
+LL | let result = panic::catch_unwind(move || {
+ | ______________________________________^
+LL | |
+LL | |
+LL | | f.0()
+LL | | });
+ | |_____^
+ |
+note: the lint level is defined here
+ --> $DIR/mir_calls_to_shims.rs:3:9
+ |
+LL | #![deny(disjoint_capture_migration)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+help: add a dummy let to cause `f` to be fully captured
+ |
+LL | let result = panic::catch_unwind(move || { let _ = &f;
+LL |
+LL |
+LL | f.0()
+LL | });
+ |
+
+error: aborting due to previous error
+
// Set of test cases that don't need migrations
-#![deny(disjoint_capture_drop_reorder)]
+#![deny(disjoint_capture_migration)]
// Copy types as copied by the closure instead of being moved into the closure
// run-rustfix
-#![deny(disjoint_capture_drop_reorder)]
+#![deny(disjoint_capture_migration)]
#[derive(Debug)]
struct Foo(i32);
// run-rustfix
-#![deny(disjoint_capture_drop_reorder)]
+#![deny(disjoint_capture_migration)]
#[derive(Debug)]
struct Foo(i32);
note: the lint level is defined here
--> $DIR/precise.rs:3:9
|
-LL | #![deny(disjoint_capture_drop_reorder)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | #![deny(disjoint_capture_migration)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
help: add a dummy let to cause `t` to be fully captured
|
LL | let c = || { let _ = &t;
// run-pass
-#![deny(disjoint_capture_drop_reorder)]
+#![deny(disjoint_capture_migration)]
#[derive(Debug)]
struct Foo(i32);
// run-rustfix
-#![deny(disjoint_capture_drop_reorder)]
+#![deny(disjoint_capture_migration)]
//~^ NOTE: the lint level is defined here
// Test cases for types that implement a significant drop (user defined)
// run-rustfix
-#![deny(disjoint_capture_drop_reorder)]
+#![deny(disjoint_capture_migration)]
//~^ NOTE: the lint level is defined here
// Test cases for types that implement a significant drop (user defined)
note: the lint level is defined here
--> $DIR/significant_drop.rs:2:9
|
-LL | #![deny(disjoint_capture_drop_reorder)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | #![deny(disjoint_capture_migration)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
help: add a dummy let to cause `t`, `t1`, `t2` to be fully captured
|
LL | let c = || { let _ = (&t, &t1, &t2);
error[E0621]: explicit lifetime required in the type of `x`
--> $DIR/closure-bounds-static-cant-capture-borrowed.rs:5:5
|
-LL | fn foo(x: &()) {
- | --- help: add explicit lifetime `'static` to the type of `x`: `&'static ()`
LL | / bar(|| {
LL | |
LL | | let _ = x;
error[E0621]: explicit lifetime required in the type of `x`
--> $DIR/closure-bounds-static-cant-capture-borrowed.rs:5:5
|
-LL | fn foo(x: &()) {
- | --- help: add explicit lifetime `'static` to the type of `x`: `&'static ()`
LL | bar(|| {
| ^^^ lifetime `'static` required
--- /dev/null
+error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
+ --> $DIR/closure_no_cap_coerce_many_unsafe_0.rs:15:23
+ |
+LL | let result: i32 = foo(5, 5);
+ | ^^^^^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
+ --> $DIR/closure_no_cap_coerce_many_unsafe_0.rs:24:23
+ |
+LL | let result: i32 = foo(5, 5);
+ | ^^^^^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0133`.
+// revisions: mir thir
+// [thir]compile-flags: -Z thir-unsafeck
+
// Ensure we get unsafe function after coercion
unsafe fn add(a: i32, b: i32) -> i32 {
a + b
+++ /dev/null
-error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
- --> $DIR/closure_no_cap_coerce_many_unsafe_0.rs:12:23
- |
-LL | let result: i32 = foo(5, 5);
- | ^^^^^^^^^ call to unsafe function
- |
- = note: consult the function's documentation for information on how to avoid undefined behavior
-
-error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
- --> $DIR/closure_no_cap_coerce_many_unsafe_0.rs:21:23
- |
-LL | let result: i32 = foo(5, 5);
- | ^^^^^^^^^ call to unsafe function
- |
- = note: consult the function's documentation for information on how to avoid undefined behavior
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0133`.
--- /dev/null
+error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
+ --> $DIR/closure_no_cap_coerce_many_unsafe_0.rs:15:23
+ |
+LL | let result: i32 = foo(5, 5);
+ | ^^^^^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
+ --> $DIR/closure_no_cap_coerce_many_unsafe_0.rs:24:23
+ |
+LL | let result: i32 = foo(5, 5);
+ | ^^^^^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0133`.
--- /dev/null
+error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
+ --> $DIR/coerce-unsafe-closure-to-unsafe-fn-ptr.rs:5:31
+ |
+LL | let _: unsafe fn() = || { ::std::pin::Pin::new_unchecked(&0_u8); };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0133`.
+// revisions: mir thir
+// [thir]compile-flags: -Z thir-unsafeck
+
fn main() {
let _: unsafe fn() = || { ::std::pin::Pin::new_unchecked(&0_u8); };
//~^ ERROR E0133
+++ /dev/null
-error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
- --> $DIR/coerce-unsafe-closure-to-unsafe-fn-ptr.rs:2:31
- |
-LL | let _: unsafe fn() = || { ::std::pin::Pin::new_unchecked(&0_u8); };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
- |
- = note: consult the function's documentation for information on how to avoid undefined behavior
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0133`.
--- /dev/null
+error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
+ --> $DIR/coerce-unsafe-closure-to-unsafe-fn-ptr.rs:5:31
+ |
+LL | let _: unsafe fn() = || { ::std::pin::Pin::new_unchecked(&0_u8); };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0133`.
LL | format!();
| ^^^^^^^^^^
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::__export::format_args` (in Nightly builds, run with -Z macro-backtrace for more info)
error: expected `,`, found `1`
--> $DIR/bad-format-args.rs:3:16
LL | assert!("foo");
| ^^^^^^^^^^^^^^^ cannot apply unary operator `!`
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | generate_s10!(concat!("nonexistent"));
| -------------------------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `generate_s10` (in Nightly builds, run with -Z macro-backtrace for more info)
error: expected unsuffixed literal or identifier, found `concat!("nonexistent")`
--> $DIR/cfg-attr-syntax-validation.rs:30:25
LL | generate_s10!(concat!("nonexistent"));
| -------------------------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `generate_s10` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 11 previous errors
LL | foo!();
| ------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
| ---------------------- similarly named struct `A` defined here
LL | trait Foo {}
LL | impl Foo for A<N> {}
- | ^ help: a struct with a similar name exists: `A`
+ | ^
+ |
+help: a struct with a similar name exists
+ |
+LL | impl Foo for A<A> {}
+ | ^
+help: you might be missing a type parameter
+ |
+LL | impl<N> Foo for A<N> {}
+ | ^^^
error[E0412]: cannot find type `T` in this scope
--> $DIR/diagnostics.rs:16:32
| ---------------------- similarly named struct `A` defined here
...
LL | impl<const N: u8> Foo for C<N, T> {}
- | ^ help: a struct with a similar name exists: `A`
+ | ^
+ |
+help: a struct with a similar name exists
+ |
+LL | impl<const N: u8> Foo for C<N, A> {}
+ | ^
+help: you might be missing a type parameter
+ |
+LL | impl<const N: u8, T> Foo for C<N, T> {}
+ | ^^^
error[E0747]: unresolved item provided when a constant was expected
--> $DIR/diagnostics.rs:7:16
| ------------- in this macro invocation
|
= note: this may fail depending on what value the parameter takes
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
error: constant expression depends on a generic parameter
--> $DIR/macro_rules-braces.rs:20:13
| ----------- in this macro invocation
|
= note: this may fail depending on what value the parameter takes
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `bar` (in Nightly builds, run with -Z macro-backtrace for more info)
error: constant expression depends on a generic parameter
--> $DIR/macro_rules-braces.rs:25:13
| ------------- in this macro invocation
|
= note: this may fail depending on what value the parameter takes
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `baz` (in Nightly builds, run with -Z macro-backtrace for more info)
error: constant expression depends on a generic parameter
--> $DIR/macro_rules-braces.rs:30:13
| ----------- in this macro invocation
|
= note: this may fail depending on what value the parameter takes
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `biz` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 6 previous errors
LL | ($rusty: ident) => {{ let $rusty = 3; *&$rusty }}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected type
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `gimme_a_const` (in Nightly builds, run with -Z macro-backtrace for more info)
error: expected type, found `{`
--> $DIR/macro-fail.rs:29:27
LL | ($rusty: ident) => {{ let $rusty = 3; *&$rusty }}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected type
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `gimme_a_const` (in Nightly builds, run with -Z macro-backtrace for more info)
error: expected type, found `{`
--> $DIR/macro-fail.rs:4:10
| this macro call doesn't expand to a type
| in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `external_macro` (in Nightly builds, run with -Z macro-backtrace for more info)
error: unexpected end of macro invocation
--> $DIR/macro-fail.rs:39:25
= note: `#[deny(const_err)]` on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
error: any use of this value will cause an error
--> $DIR/const_panic.rs:11:16
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
error: any use of this value will cause an error
--> $DIR/const_panic.rs:15:15
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
error: any use of this value will cause an error
--> $DIR/const_panic.rs:19:15
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
error: any use of this value will cause an error
--> $DIR/const_panic.rs:23:15
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
error: any use of this value will cause an error
--> $DIR/const_panic.rs:27:20
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
error: any use of this value will cause an error
--> $DIR/const_panic.rs:31:21
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
error: any use of this value will cause an error
--> $DIR/const_panic.rs:35:20
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
error: any use of this value will cause an error
--> $DIR/const_panic.rs:39:20
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
error: any use of this value will cause an error
--> $DIR/const_panic.rs:43:20
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 10 previous errors
= note: `#[deny(const_err)]` on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
error: any use of this value will cause an error
--> $DIR/const_panic_libcore_bin.rs:13:15
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
error: any use of this value will cause an error
--> $DIR/const_panic_libcore_bin.rs:17:15
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 3 previous errors
+++ /dev/null
-// check-pass
-
-#![feature(rustc_attrs)]
-
-#[rustc_args_required_const(0)]
-pub const fn a(value: u8) -> u8 {
- value
-}
-
-#[rustc_args_required_const(0)]
-pub fn b(_: u8) {
- unimplemented!()
-}
-
-fn main() {
- let _ = b(a(0));
-}
|
= 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
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0658]: panicking in constants is unstable
--> $DIR/feature-gate-const_panic.rs:6:15
|
= 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
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0658]: panicking in constants is unstable
--> $DIR/feature-gate-const_panic.rs:9:15
|
= 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
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 3 previous errors
| ^^^^^^^^^
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
- = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0080]: erroneous constant used
--> $DIR/panic-assoc-never-type.rs:17:13
| ^^^^^^^^^
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
- = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0080]: erroneous constant used
--> $DIR/panic-never-type.rs:13:13
= note: `#[deny(const_err)]` on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
--- /dev/null
+error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
+ --> $DIR/const-extern-fn-requires-unsafe.rs:11:5
+ |
+LL | foo();
+ | ^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
+ --> $DIR/const-extern-fn-requires-unsafe.rs:9:17
+ |
+LL | let a: [u8; foo()];
+ | ^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0133`.
+// revisions: mir thir
+// [thir]compile-flags: -Z thir-unsafeck
+
#![feature(const_extern_fn)]
const unsafe extern "C" fn foo() -> usize { 5 }
+++ /dev/null
-error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
- --> $DIR/const-extern-fn-requires-unsafe.rs:8:5
- |
-LL | foo();
- | ^^^^^ call to unsafe function
- |
- = note: consult the function's documentation for information on how to avoid undefined behavior
-
-error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
- --> $DIR/const-extern-fn-requires-unsafe.rs:6:17
- |
-LL | let a: [u8; foo()];
- | ^^^^^ call to unsafe function
- |
- = note: consult the function's documentation for information on how to avoid undefined behavior
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0133`.
--- /dev/null
+error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
+ --> $DIR/const-extern-fn-requires-unsafe.rs:11:5
+ |
+LL | foo();
+ | ^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
+ --> $DIR/const-extern-fn-requires-unsafe.rs:9:17
+ |
+LL | let a: [u8; foo()];
+ | ^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0133`.
= note: `#[deny(const_err)]` on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `static_assert` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
= note: `#[deny(const_err)]` on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
+++ /dev/null
-#![feature(rustc_attrs)]
-
-#[rustc_args_required_const(0)]
-fn foo(_imm8: i32) {}
-
-fn bar() {
- let imm8 = 3;
- foo(imm8) //~ ERROR argument 1 is required to be a constant
-}
-
-fn main() {}
+++ /dev/null
-error: argument 1 is required to be a constant
- --> $DIR/const_arg_local.rs:8:5
- |
-LL | foo(imm8)
- | ^^^^^^^^^
-
-error: aborting due to previous error
-
+++ /dev/null
-#![feature(rustc_attrs)]
-
-#[rustc_args_required_const(0)]
-fn foo(_imm8: i32) {}
-
-fn bar() {
- foo(*&mut 42) //~ ERROR argument 1 is required to be a constant
-}
-
-fn main() {}
+++ /dev/null
-error: argument 1 is required to be a constant
- --> $DIR/const_arg_promotable.rs:7:5
- |
-LL | foo(*&mut 42)
- | ^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
+++ /dev/null
-// This test is a regression test for a bug where we only checked function calls in no-const
-// functions for `rustc_args_required_const` arguments. This meant that even though `bar` needs its
-// argument to be const, inside a const fn (callable at runtime), the value for it may come from a
-// non-constant (namely an argument to the const fn).
-
-#![feature(rustc_attrs)]
-const fn foo(a: i32) {
- bar(a); //~ ERROR argument 1 is required to be a constant
-}
-
-#[rustc_args_required_const(0)]
-const fn bar(_: i32) {}
-
-fn main() {
- // this function call will pass a runtime-value (number of program arguments) to `foo`, which
- // will in turn forward it to `bar`, which expects a compile-time argument
- foo(std::env::args().count() as i32);
-}
+++ /dev/null
-error: argument 1 is required to be a constant
- --> $DIR/const_arg_promotable2.rs:8:5
- |
-LL | bar(a);
- | ^^^^^^
-
-error: aborting due to previous error
-
+++ /dev/null
-#![feature(rustc_attrs)]
-
-#[rustc_args_required_const(0)]
-fn foo(_imm8: i32) {}
-
-fn bar(imm8: i32) {
- foo(imm8) //~ ERROR argument 1 is required to be a constant
-}
-
-fn main() {}
+++ /dev/null
-error: argument 1 is required to be a constant
- --> $DIR/const_arg_wrapper.rs:7:5
- |
-LL | foo(imm8)
- | ^^^^^^^^^
-
-error: aborting due to previous error
-
= note: `#[deny(const_err)]` on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors; 1 warning emitted
= note: `#[deny(const_err)]` on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
|
= 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
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0658]: panicking in constants is unstable
--> $DIR/assert.rs:10:15
|
= 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
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors
|
= note: `if` expressions without `else` evaluate to `()`
= help: consider adding an `else` block that evaluates to the expected type
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | | }
| |_- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0308]: mismatched types
--> $DIR/enum-discr-type-err.rs:18:21
LL | | }
| |_- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors
LL | const _: () = unsafe { llvm_asm!("nop") };
| ^^^^^^^^^^^^^^^^
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `llvm_asm` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
|
= 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
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | let _ = [0i32; panic!(2f32)];
| ^^^^^^^^^^^^
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::panic::panic_2015` (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)
+ = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors
LL | panic!(&1);
| ^^^^^^^^^^^
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::panic::panic_2015` (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)
+ = note: this error originates in the macro `$crate::panic::panic_2015` (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)
+ = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 3 previous errors
|
= 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
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | vec![1, 2, 3]
| ^^^^^^^^^^^^^ allocation not allowed in constant functions
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0015]: calls in constant functions are limited to constant functions, tuple structs and tuple variants
--> $DIR/bad_const_fn_body_ice.rs:2:5
LL | vec![1, 2, 3]
| ^^^^^^^^^^^^^
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors
|
LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 10 previous errors; 3 warnings emitted
|
LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 10 previous errors; 3 warnings emitted
LL | unsafe { llvm_asm!("xor %eax, %eax" ::: "eax"); }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ inline assembly is not supported
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `llvm_asm` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0080]: could not evaluate static initializer
--> $DIR/inline_asm.rs:19:14
|
LL | unsafe { asm!("nop"); }
| ^^^^^^^^^^^^
- = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the macro `llvm_asm` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors; 1 warning emitted
+++ /dev/null
-#![feature(rustc_attrs)]
-
-#[rustc_args_required_const(0)]
-fn foo(_a: i32) {
-}
-
-#[rustc_args_required_const(1)]
-fn bar(_a: i32, _b: i32) {
-}
-
-const A: i32 = 3;
-
-const fn baz() -> i32 {
- 3
-}
-
-fn main() {
- foo(2);
- foo(2 + 3);
- const BAZ: i32 = baz();
- foo(BAZ);
- let a = 4;
- foo(A);
- foo(a); //~ ERROR: argument 1 is required to be a constant
- bar(a, 3);
- bar(a, a); //~ ERROR: argument 2 is required to be a constant
-}
+++ /dev/null
-error: argument 1 is required to be a constant
- --> $DIR/rustc-args-required-const.rs:24:5
- |
-LL | foo(a);
- | ^^^^^^
-
-error: argument 2 is required to be a constant
- --> $DIR/rustc-args-required-const.rs:26:5
- |
-LL | bar(a, a);
- | ^^^^^^^^^
-
-error: aborting due to 2 previous errors
-
LL | myprintln!("{}");
| ^^^^^^^^^^^^^^^^^
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `concat` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
|
= note: see issue #71126 <https://github.com/rust-lang/rust/issues/71126> for more information
= help: add `#![feature(destructuring_assignment)]` to the crate attributes to enable
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `underscore` (in Nightly builds, run with -Z macro-backtrace for more info)
error: in expressions, `_` can only be used on the left-hand side of an assignment
--> $DIR/underscore.rs:8:9
LL | underscore!();
| -------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `underscore` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors
| ^^^^^^^^^^^^^^^^^ the trait `Testable` is not implemented for `TestDescAndFn`
|
= note: required for the cast to the object type `dyn Testable`
- = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the attribute macro `test` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
|
LL | #![deny(deprecated)]
| ^^^^^^^^^^
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `macro_test` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
|
LL | #![deny(deprecated)]
| ^^^^^^^^^^
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `macro_test_arg_nested` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | foo3(borrow!(0));
| ---------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `borrow` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0308]: mismatched types
--> $DIR/deref-suggestion.rs:36:5
LL | assert_eq!(3i32, &3i32);
| ^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `&i32`
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0308]: mismatched types
--> $DIR/deref-suggestion.rs:39:17
| ^^^^^^^^ the trait `Clone` is not implemented for `Error`
|
= note: required by `clone`
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
| ^^^^^ the trait `Clone` is not implemented for `Error`
|
= note: required by `clone`
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
| ^^^^^^^^ the trait `Clone` is not implemented for `Error`
|
= note: required by `clone`
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
| ^^^^^ the trait `Clone` is not implemented for `Error`
|
= note: required by `clone`
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
= note: add `#[derive(Debug)]` or manually implement `Debug`
= note: required because of the requirements on the impl of `Debug` for `&Error`
= note: required for the cast to the object type `dyn Debug`
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
= note: add `#[derive(Debug)]` or manually implement `Debug`
= note: required because of the requirements on the impl of `Debug` for `&Error`
= note: required for the cast to the object type `dyn Debug`
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
= note: add `#[derive(Debug)]` or manually implement `Debug`
= note: required because of the requirements on the impl of `Debug` for `&Error`
= note: required for the cast to the object type `dyn Debug`
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
= note: add `#[derive(Debug)]` or manually implement `Debug`
= note: required because of the requirements on the impl of `Debug` for `&Error`
= note: required for the cast to the object type `dyn Debug`
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
| ^^^^^^^^ the trait `Default` is not implemented for `Error`
|
= note: required by `std::default::Default::default`
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
| ^^^^^ the trait `Default` is not implemented for `Error`
|
= note: required by `std::default::Default::default`
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | pub struct AssertParamIsEq<T: Eq + ?Sized> {
| -- required by this bound in `AssertParamIsEq`
|
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | pub struct AssertParamIsEq<T: Eq + ?Sized> {
| -- required by this bound in `AssertParamIsEq`
|
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | pub struct AssertParamIsEq<T: Eq + ?Sized> {
| -- required by this bound in `AssertParamIsEq`
|
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | pub struct AssertParamIsEq<T: Eq + ?Sized> {
| -- required by this bound in `AssertParamIsEq`
|
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | fn hash<H: Hasher>(&self, state: &mut H);
| - required by this bound in `std::hash::Hash::hash`
|
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | fn hash<H: Hasher>(&self, state: &mut H);
| - required by this bound in `std::hash::Hash::hash`
|
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | fn hash<H: Hasher>(&self, state: &mut H);
| - required by this bound in `std::hash::Hash::hash`
|
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | fn hash<H: Hasher>(&self, state: &mut H);
| - required by this bound in `std::hash::Hash::hash`
|
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
| ^^^^^^^^ the trait `Ord` is not implemented for `Error`
|
= note: required by `std::cmp::Ord::cmp`
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
| ^^^^^ the trait `Ord` is not implemented for `Error`
|
= note: required by `std::cmp::Ord::cmp`
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
| ^^^^^^^^ the trait `Ord` is not implemented for `Error`
|
= note: required by `std::cmp::Ord::cmp`
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
| ^^^^^ the trait `Ord` is not implemented for `Error`
|
= note: required by `std::cmp::Ord::cmp`
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
| ^^^^^^^^
|
= note: an implementation of `std::cmp::PartialEq` might be missing for `Error`
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0369]: binary operation `!=` cannot be applied to type `Error`
--> $DIR/derives-span-PartialEq-enum-struct-variant.rs:9:6
| ^^^^^^^^
|
= note: an implementation of `std::cmp::PartialEq` might be missing for `Error`
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors
| ^^^^^
|
= note: an implementation of `std::cmp::PartialEq` might be missing for `Error`
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0369]: binary operation `!=` cannot be applied to type `Error`
--> $DIR/derives-span-PartialEq-enum.rs:9:6
| ^^^^^
|
= note: an implementation of `std::cmp::PartialEq` might be missing for `Error`
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors
| ^^^^^^^^
|
= note: an implementation of `std::cmp::PartialEq` might be missing for `Error`
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0369]: binary operation `!=` cannot be applied to type `Error`
--> $DIR/derives-span-PartialEq-struct.rs:8:5
| ^^^^^^^^
|
= note: an implementation of `std::cmp::PartialEq` might be missing for `Error`
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors
| ^^^^^
|
= note: an implementation of `std::cmp::PartialEq` might be missing for `Error`
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0369]: binary operation `!=` cannot be applied to type `Error`
--> $DIR/derives-span-PartialEq-tuple-struct.rs:8:5
| ^^^^^
|
= note: an implementation of `std::cmp::PartialEq` might be missing for `Error`
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors
|
= help: the trait `PartialOrd` is not implemented for `Error`
= note: required by `std::cmp::PartialOrd::partial_cmp`
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
|
= help: the trait `PartialOrd` is not implemented for `Error`
= note: required by `std::cmp::PartialOrd::partial_cmp`
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
|
= help: the trait `PartialOrd` is not implemented for `Error`
= note: required by `std::cmp::PartialOrd::partial_cmp`
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
|
= help: the trait `PartialOrd` is not implemented for `Error`
= note: required by `std::cmp::PartialOrd::partial_cmp`
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
| ^^^^^^^^^^^^^^
|
= note: an implementation of `std::cmp::PartialEq` might be missing for `NoCloneOrEq`
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0369]: binary operation `!=` cannot be applied to type `NoCloneOrEq`
--> $DIR/deriving-no-inner-impl-error-message.rs:5:5
| ^^^^^^^^^^^^^^
|
= note: an implementation of `std::cmp::PartialEq` might be missing for `NoCloneOrEq`
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `NoCloneOrEq: Clone` is not satisfied
--> $DIR/deriving-no-inner-impl-error-message.rs:10:5
| ^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `NoCloneOrEq`
|
= note: required by `clone`
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 3 previous errors
| ^^^^^^^^^^^^^^^^^^^^
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #82523 <https://github.com/rust-lang/rust/issues/82523>
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `#[derive]` can't be used on a `#[repr(packed)]` struct with type or const parameters (error E0133)
--> $DIR/deriving-with-repr-packed.rs:8:23
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #82523 <https://github.com/rust-lang/rust/issues/82523>
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `#[derive]` can't be used on a `#[repr(packed)]` struct that does not derive Copy (error E0133)
--> $DIR/deriving-with-repr-packed.rs:16:10
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #82523 <https://github.com/rust-lang/rust/issues/82523>
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `#[derive]` can't be used on a `#[repr(packed)]` struct that does not derive Copy (error E0133)
--> $DIR/deriving-with-repr-packed.rs:25:10
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #82523 <https://github.com/rust-lang/rust/issues/82523>
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 4 previous errors
LL | expr!(u8);
| ---------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `expr` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 9 previous errors
LL | pat!(u8) => {}
| -------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `pat` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0599]: no associated item named `AssocItem` found for slice `[u8]` in the current scope
--> $DIR/bad-assoc-pat.rs:3:15
LL | pat!(u8) => {}
| -------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `pat` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0599]: no associated item named `AssocItem` found for type `u8` in the current scope
--> $DIR/bad-assoc-pat.rs:32:16
LL | type J = ty!(u8);
| ------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `ty` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0223]: ambiguous associated type
--> $DIR/bad-assoc-ty.rs:1:10
LL | type J = ty!(u8);
| ------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `ty` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0223]: ambiguous associated type
--> $DIR/bad-assoc-ty.rs:44:10
| -------------------------------------------------- in this macro invocation
|
= help: consider adding a `#![recursion_limit="20"]` attribute to your crate (`recursion_limit_macro`)
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `recurse` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | mod_decl!(foo);
| --------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `mod_decl` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | m!();
| ----- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0432]: unresolved import `a::$crate`
--> $DIR/dollar-crate-is-keyword-2.rs:5:13
LL | m!();
| ----- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0433]: failed to resolve: `$crate` in paths can only be used in start position
--> $DIR/dollar-crate-is-keyword-2.rs:7:21
LL | m!();
| ----- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 3 previous errors
LL | m!();
| ----- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
error: expected identifier, found reserved identifier `$crate`
--> $DIR/dollar-crate-is-keyword.rs:10:23
LL | m!();
| ----- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `$crate` may not be imported
--> $DIR/dollar-crate-is-keyword.rs:9:9
LL | m!();
| ----- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `$crate` may not be imported
--> $DIR/dollar-crate-is-keyword.rs:10:9
LL | m!();
| ----- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 4 previous errors
LL | gen_glob!();
| ^^^^^^^^^^^^
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `gen_glob` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | gen_glob!();
| ^^^^^^^^^^^^
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `gen_glob` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | gen_gated!();
| ^^^^^^^^^^^^^ could not find `E` in the list of imported crates
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `gen_gated` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | produces_async! {}
| ^^^^^^^^^^^^^^^^^^ expected identifier, found keyword
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `produces_async` (in Nightly builds, run with -Z macro-backtrace for more info)
help: you can escape reserved keywords to use them as identifiers
|
LL | () => (pub fn r#async() {})
LL | produces_async! {}
| ^^^^^^^^^^^^^^^^^^ expected identifier, found keyword
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `produces_async` (in Nightly builds, run with -Z macro-backtrace for more info)
help: you can escape reserved keywords to use them as identifiers
|
LL | () => (pub fn r#async() {})
--- /dev/null
+error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
+ --> $DIR/E0133.rs:7:5
+ |
+LL | f();
+ | ^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0133`.
+// revisions: mir thir
+// [thir]compile-flags: -Z thir-unsafeck
+
unsafe fn f() { return; }
fn main() {
+++ /dev/null
-error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
- --> $DIR/E0133.rs:4:5
- |
-LL | f();
- | ^^^ call to unsafe function
- |
- = note: consult the function's documentation for information on how to avoid undefined behavior
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0133`.
--- /dev/null
+error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
+ --> $DIR/E0133.rs:7:5
+ |
+LL | f();
+ | ^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0133`.
LL | #[derive(Copy)]
| ^^^^ Copy not allowed on types with destructors
|
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | #[derive(Default)]
| ^^^^^^^
|
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | #[derive(Copy, Clone)]
| ^^^^ Copy not allowed on types with destructors
|
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0184]: the trait `Copy` may not be implemented for this type; the type has a destructor
--> $DIR/exclusive-drop-and-copy.rs:10:10
LL | #[derive(Copy, Clone)]
| ^^^^ Copy not allowed on types with destructors
|
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors
= note: `#[warn(irrefutable_let_patterns)]` on by default
= note: this pattern will always match, so the `if let` is useless
= help: consider replacing the `if let` with a `let`
- = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: irrefutable `if let` pattern
--> $DIR/if-let.rs:6:13
|
= note: this pattern will always match, so the `if let` is useless
= help: consider replacing the `if let` with a `let`
- = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: irrefutable `if let` pattern
--> $DIR/if-let.rs:26:5
LL | fn main() { env!("__HOPEFULLY_NOT_DEFINED__", "my error message"); }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `env` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | env!("__HOPEFULLY_NOT_DEFINED__");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `env` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | include!(concat!(env!("NON_EXISTENT"), "/data.rs"));
| ^^^^^^^^^^^^^^^^^^^^
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `env` (in Nightly builds, run with -Z macro-backtrace for more info)
error: suffixes on a string literal are invalid
--> $DIR/issue-55897.rs:16:22
| ------- in this macro invocation
|
= help: add `#![feature(allow_internal_unsafe)]` to the crate attributes to enable
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `bar` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
| ------- in this macro invocation
|
= help: add `#![feature(allow_internal_unstable)]` to the crate attributes to enable
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `bar` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | concat_idents!(a, b);
| ^^^^^^^^^^^^^^^^^^^^^ not found in this scope
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `concat_idents` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors
--- /dev/null
+error[E0658]: `transmute` is not allowed in constant functions
+ --> $DIR/feature-gate-const_fn_transmute.rs:11:43
+ |
+LL | const fn transmute_fn() -> u32 { unsafe { mem::transmute(Foo(3)) } }
+ | ^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #53605 <https://github.com/rust-lang/rust/issues/53605> for more information
+ = help: add `#![feature(const_fn_transmute)]` to the crate attributes to enable
+ = note: `transmute` is only allowed in constants and statics for now
+
+error[E0658]: `transmute` is not allowed in constant functions
+ --> $DIR/feature-gate-const_fn_transmute.rs:14:53
+ |
+LL | const fn transmute_fn_intrinsic() -> u32 { unsafe { std::intrinsics::transmute(Foo(3)) } }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #53605 <https://github.com/rust-lang/rust/issues/53605> for more information
+ = help: add `#![feature(const_fn_transmute)]` to the crate attributes to enable
+ = note: `transmute` is only allowed in constants and statics for now
+
+error[E0658]: `transmute` is not allowed in constant functions
+ --> $DIR/feature-gate-const_fn_transmute.rs:17:58
+ |
+LL | const fn transmute_fn_core_intrinsic() -> u32 { unsafe { core::intrinsics::transmute(Foo(3)) } }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #53605 <https://github.com/rust-lang/rust/issues/53605> for more information
+ = help: add `#![feature(const_fn_transmute)]` to the crate attributes to enable
+ = note: `transmute` is only allowed in constants and statics for now
+
+error[E0658]: `transmute` is not allowed in constant functions
+ --> $DIR/feature-gate-const_fn_transmute.rs:20:48
+ |
+LL | const unsafe fn unsafe_transmute_fn() -> u32 { mem::transmute(Foo(3)) }
+ | ^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #53605 <https://github.com/rust-lang/rust/issues/53605> for more information
+ = help: add `#![feature(const_fn_transmute)]` to the crate attributes to enable
+ = note: `transmute` is only allowed in constants and statics for now
+
+error[E0658]: `transmute` is not allowed in constant functions
+ --> $DIR/feature-gate-const_fn_transmute.rs:23:58
+ |
+LL | const unsafe fn unsafe_transmute_fn_intrinsic() -> u32 { std::intrinsics::transmute(Foo(3)) }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #53605 <https://github.com/rust-lang/rust/issues/53605> for more information
+ = help: add `#![feature(const_fn_transmute)]` to the crate attributes to enable
+ = note: `transmute` is only allowed in constants and statics for now
+
+error[E0658]: `transmute` is not allowed in constant functions
+ --> $DIR/feature-gate-const_fn_transmute.rs:26:63
+ |
+LL | const unsafe fn unsafe_transmute_fn_core_intrinsic() -> u32 { core::intrinsics::transmute(Foo(3)) }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #53605 <https://github.com/rust-lang/rust/issues/53605> for more information
+ = help: add `#![feature(const_fn_transmute)]` to the crate attributes to enable
+ = note: `transmute` is only allowed in constants and statics for now
+
+error[E0658]: `transmute` is not allowed in constant functions
+ --> $DIR/feature-gate-const_fn_transmute.rs:29:39
+ |
+LL | const fn safe_transmute_fn() -> u32 { mem::transmute(Foo(3)) }
+ | ^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #53605 <https://github.com/rust-lang/rust/issues/53605> for more information
+ = help: add `#![feature(const_fn_transmute)]` to the crate attributes to enable
+ = note: `transmute` is only allowed in constants and statics for now
+
+error[E0658]: `transmute` is not allowed in constant functions
+ --> $DIR/feature-gate-const_fn_transmute.rs:33:49
+ |
+LL | const fn safe_transmute_fn_intrinsic() -> u32 { std::intrinsics::transmute(Foo(3)) }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #53605 <https://github.com/rust-lang/rust/issues/53605> for more information
+ = help: add `#![feature(const_fn_transmute)]` to the crate attributes to enable
+ = note: `transmute` is only allowed in constants and statics for now
+
+error[E0658]: `transmute` is not allowed in constant functions
+ --> $DIR/feature-gate-const_fn_transmute.rs:37:54
+ |
+LL | const fn safe_transmute_fn_core_intrinsic() -> u32 { core::intrinsics::transmute(Foo(3)) }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #53605 <https://github.com/rust-lang/rust/issues/53605> for more information
+ = help: add `#![feature(const_fn_transmute)]` to the crate attributes to enable
+ = note: `transmute` is only allowed in constants and statics for now
+
+error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
+ --> $DIR/feature-gate-const_fn_transmute.rs:29:39
+ |
+LL | const fn safe_transmute_fn() -> u32 { mem::transmute(Foo(3)) }
+ | ^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
+ --> $DIR/feature-gate-const_fn_transmute.rs:33:49
+ |
+LL | const fn safe_transmute_fn_intrinsic() -> u32 { std::intrinsics::transmute(Foo(3)) }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
+ --> $DIR/feature-gate-const_fn_transmute.rs:37:54
+ |
+LL | const fn safe_transmute_fn_core_intrinsic() -> u32 { core::intrinsics::transmute(Foo(3)) }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error: aborting due to 12 previous errors
+
+Some errors have detailed explanations: E0133, E0658.
+For more information about an error, try `rustc --explain E0133`.
+// revisions: mir thir
+// [thir]compile-flags: -Z thir-unsafeck
+
use std::mem;
#[repr(transparent)]
+++ /dev/null
-error[E0658]: `transmute` is not allowed in constant functions
- --> $DIR/feature-gate-const_fn_transmute.rs:8:43
- |
-LL | const fn transmute_fn() -> u32 { unsafe { mem::transmute(Foo(3)) } }
- | ^^^^^^^^^^^^^^^^^^^^^^
- |
- = note: see issue #53605 <https://github.com/rust-lang/rust/issues/53605> for more information
- = help: add `#![feature(const_fn_transmute)]` to the crate attributes to enable
- = note: `transmute` is only allowed in constants and statics for now
-
-error[E0658]: `transmute` is not allowed in constant functions
- --> $DIR/feature-gate-const_fn_transmute.rs:11:53
- |
-LL | const fn transmute_fn_intrinsic() -> u32 { unsafe { std::intrinsics::transmute(Foo(3)) } }
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
- = note: see issue #53605 <https://github.com/rust-lang/rust/issues/53605> for more information
- = help: add `#![feature(const_fn_transmute)]` to the crate attributes to enable
- = note: `transmute` is only allowed in constants and statics for now
-
-error[E0658]: `transmute` is not allowed in constant functions
- --> $DIR/feature-gate-const_fn_transmute.rs:14:58
- |
-LL | const fn transmute_fn_core_intrinsic() -> u32 { unsafe { core::intrinsics::transmute(Foo(3)) } }
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
- = note: see issue #53605 <https://github.com/rust-lang/rust/issues/53605> for more information
- = help: add `#![feature(const_fn_transmute)]` to the crate attributes to enable
- = note: `transmute` is only allowed in constants and statics for now
-
-error[E0658]: `transmute` is not allowed in constant functions
- --> $DIR/feature-gate-const_fn_transmute.rs:17:48
- |
-LL | const unsafe fn unsafe_transmute_fn() -> u32 { mem::transmute(Foo(3)) }
- | ^^^^^^^^^^^^^^^^^^^^^^
- |
- = note: see issue #53605 <https://github.com/rust-lang/rust/issues/53605> for more information
- = help: add `#![feature(const_fn_transmute)]` to the crate attributes to enable
- = note: `transmute` is only allowed in constants and statics for now
-
-error[E0658]: `transmute` is not allowed in constant functions
- --> $DIR/feature-gate-const_fn_transmute.rs:20:58
- |
-LL | const unsafe fn unsafe_transmute_fn_intrinsic() -> u32 { std::intrinsics::transmute(Foo(3)) }
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
- = note: see issue #53605 <https://github.com/rust-lang/rust/issues/53605> for more information
- = help: add `#![feature(const_fn_transmute)]` to the crate attributes to enable
- = note: `transmute` is only allowed in constants and statics for now
-
-error[E0658]: `transmute` is not allowed in constant functions
- --> $DIR/feature-gate-const_fn_transmute.rs:23:63
- |
-LL | const unsafe fn unsafe_transmute_fn_core_intrinsic() -> u32 { core::intrinsics::transmute(Foo(3)) }
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
- = note: see issue #53605 <https://github.com/rust-lang/rust/issues/53605> for more information
- = help: add `#![feature(const_fn_transmute)]` to the crate attributes to enable
- = note: `transmute` is only allowed in constants and statics for now
-
-error[E0658]: `transmute` is not allowed in constant functions
- --> $DIR/feature-gate-const_fn_transmute.rs:26:39
- |
-LL | const fn safe_transmute_fn() -> u32 { mem::transmute(Foo(3)) }
- | ^^^^^^^^^^^^^^^^^^^^^^
- |
- = note: see issue #53605 <https://github.com/rust-lang/rust/issues/53605> for more information
- = help: add `#![feature(const_fn_transmute)]` to the crate attributes to enable
- = note: `transmute` is only allowed in constants and statics for now
-
-error[E0658]: `transmute` is not allowed in constant functions
- --> $DIR/feature-gate-const_fn_transmute.rs:30:49
- |
-LL | const fn safe_transmute_fn_intrinsic() -> u32 { std::intrinsics::transmute(Foo(3)) }
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
- = note: see issue #53605 <https://github.com/rust-lang/rust/issues/53605> for more information
- = help: add `#![feature(const_fn_transmute)]` to the crate attributes to enable
- = note: `transmute` is only allowed in constants and statics for now
-
-error[E0658]: `transmute` is not allowed in constant functions
- --> $DIR/feature-gate-const_fn_transmute.rs:34:54
- |
-LL | const fn safe_transmute_fn_core_intrinsic() -> u32 { core::intrinsics::transmute(Foo(3)) }
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
- = note: see issue #53605 <https://github.com/rust-lang/rust/issues/53605> for more information
- = help: add `#![feature(const_fn_transmute)]` to the crate attributes to enable
- = note: `transmute` is only allowed in constants and statics for now
-
-error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
- --> $DIR/feature-gate-const_fn_transmute.rs:26:39
- |
-LL | const fn safe_transmute_fn() -> u32 { mem::transmute(Foo(3)) }
- | ^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
- |
- = note: consult the function's documentation for information on how to avoid undefined behavior
-
-error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
- --> $DIR/feature-gate-const_fn_transmute.rs:30:49
- |
-LL | const fn safe_transmute_fn_intrinsic() -> u32 { std::intrinsics::transmute(Foo(3)) }
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
- |
- = note: consult the function's documentation for information on how to avoid undefined behavior
-
-error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
- --> $DIR/feature-gate-const_fn_transmute.rs:34:54
- |
-LL | const fn safe_transmute_fn_core_intrinsic() -> u32 { core::intrinsics::transmute(Foo(3)) }
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
- |
- = note: consult the function's documentation for information on how to avoid undefined behavior
-
-error: aborting due to 12 previous errors
-
-Some errors have detailed explanations: E0133, E0658.
-For more information about an error, try `rustc --explain E0133`.
--- /dev/null
+error[E0658]: `transmute` is not allowed in constant functions
+ --> $DIR/feature-gate-const_fn_transmute.rs:11:43
+ |
+LL | const fn transmute_fn() -> u32 { unsafe { mem::transmute(Foo(3)) } }
+ | ^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #53605 <https://github.com/rust-lang/rust/issues/53605> for more information
+ = help: add `#![feature(const_fn_transmute)]` to the crate attributes to enable
+ = note: `transmute` is only allowed in constants and statics for now
+
+error[E0658]: `transmute` is not allowed in constant functions
+ --> $DIR/feature-gate-const_fn_transmute.rs:14:53
+ |
+LL | const fn transmute_fn_intrinsic() -> u32 { unsafe { std::intrinsics::transmute(Foo(3)) } }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #53605 <https://github.com/rust-lang/rust/issues/53605> for more information
+ = help: add `#![feature(const_fn_transmute)]` to the crate attributes to enable
+ = note: `transmute` is only allowed in constants and statics for now
+
+error[E0658]: `transmute` is not allowed in constant functions
+ --> $DIR/feature-gate-const_fn_transmute.rs:17:58
+ |
+LL | const fn transmute_fn_core_intrinsic() -> u32 { unsafe { core::intrinsics::transmute(Foo(3)) } }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #53605 <https://github.com/rust-lang/rust/issues/53605> for more information
+ = help: add `#![feature(const_fn_transmute)]` to the crate attributes to enable
+ = note: `transmute` is only allowed in constants and statics for now
+
+error[E0658]: `transmute` is not allowed in constant functions
+ --> $DIR/feature-gate-const_fn_transmute.rs:20:48
+ |
+LL | const unsafe fn unsafe_transmute_fn() -> u32 { mem::transmute(Foo(3)) }
+ | ^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #53605 <https://github.com/rust-lang/rust/issues/53605> for more information
+ = help: add `#![feature(const_fn_transmute)]` to the crate attributes to enable
+ = note: `transmute` is only allowed in constants and statics for now
+
+error[E0658]: `transmute` is not allowed in constant functions
+ --> $DIR/feature-gate-const_fn_transmute.rs:23:58
+ |
+LL | const unsafe fn unsafe_transmute_fn_intrinsic() -> u32 { std::intrinsics::transmute(Foo(3)) }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #53605 <https://github.com/rust-lang/rust/issues/53605> for more information
+ = help: add `#![feature(const_fn_transmute)]` to the crate attributes to enable
+ = note: `transmute` is only allowed in constants and statics for now
+
+error[E0658]: `transmute` is not allowed in constant functions
+ --> $DIR/feature-gate-const_fn_transmute.rs:26:63
+ |
+LL | const unsafe fn unsafe_transmute_fn_core_intrinsic() -> u32 { core::intrinsics::transmute(Foo(3)) }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #53605 <https://github.com/rust-lang/rust/issues/53605> for more information
+ = help: add `#![feature(const_fn_transmute)]` to the crate attributes to enable
+ = note: `transmute` is only allowed in constants and statics for now
+
+error[E0658]: `transmute` is not allowed in constant functions
+ --> $DIR/feature-gate-const_fn_transmute.rs:29:39
+ |
+LL | const fn safe_transmute_fn() -> u32 { mem::transmute(Foo(3)) }
+ | ^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #53605 <https://github.com/rust-lang/rust/issues/53605> for more information
+ = help: add `#![feature(const_fn_transmute)]` to the crate attributes to enable
+ = note: `transmute` is only allowed in constants and statics for now
+
+error[E0658]: `transmute` is not allowed in constant functions
+ --> $DIR/feature-gate-const_fn_transmute.rs:33:49
+ |
+LL | const fn safe_transmute_fn_intrinsic() -> u32 { std::intrinsics::transmute(Foo(3)) }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #53605 <https://github.com/rust-lang/rust/issues/53605> for more information
+ = help: add `#![feature(const_fn_transmute)]` to the crate attributes to enable
+ = note: `transmute` is only allowed in constants and statics for now
+
+error[E0658]: `transmute` is not allowed in constant functions
+ --> $DIR/feature-gate-const_fn_transmute.rs:37:54
+ |
+LL | const fn safe_transmute_fn_core_intrinsic() -> u32 { core::intrinsics::transmute(Foo(3)) }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #53605 <https://github.com/rust-lang/rust/issues/53605> for more information
+ = help: add `#![feature(const_fn_transmute)]` to the crate attributes to enable
+ = note: `transmute` is only allowed in constants and statics for now
+
+error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
+ --> $DIR/feature-gate-const_fn_transmute.rs:29:39
+ |
+LL | const fn safe_transmute_fn() -> u32 { mem::transmute(Foo(3)) }
+ | ^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
+ --> $DIR/feature-gate-const_fn_transmute.rs:33:49
+ |
+LL | const fn safe_transmute_fn_intrinsic() -> u32 { std::intrinsics::transmute(Foo(3)) }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
+ --> $DIR/feature-gate-const_fn_transmute.rs:37:54
+ |
+LL | const fn safe_transmute_fn_core_intrinsic() -> u32 { core::intrinsics::transmute(Foo(3)) }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error: aborting due to 12 previous errors
+
+Some errors have detailed explanations: E0133, E0658.
+For more information about an error, try `rustc --explain E0133`.
|
= note: see issue #84223 <https://github.com/rust-lang/rust/issues/84223> for more information
= help: add `#![feature(thread_local_const_init)]` to the crate attributes to enable
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::__thread_local_inner` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
|
= note: see issue #29598 <https://github.com/rust-lang/rust/issues/29598> for more information
= help: add `#![feature(trace_macros)]` to the crate attributes to enable
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `expando` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 5 previous errors
|
= note: did you intend to capture a variable `foo` from the surrounding scope?
= note: to avoid ambiguity, `format_args!` cannot capture variables when the format string is expanded from a macro
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `concat` (in Nightly builds, run with -Z macro-backtrace for more info)
error: there is no argument named `bar`
--> $DIR/format-args-capture-macro-hygiene.rs:5:13
|
= note: did you intend to capture a variable `bar` from the surrounding scope?
= note: to avoid ambiguity, `format_args!` cannot capture variables when the format string is expanded from a macro
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `concat` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors
|
= note: expected reference `&usize`
found reference `&{float}`
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0308]: mismatched types
--> $DIR/ifmt-bad-arg.rs:81:35
|
= note: expected reference `&usize`
found reference `&{float}`
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 36 previous errors
LL | format_args!();
| ^^^^^^^^^^^^^^^
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `format_args` (in Nightly builds, run with -Z macro-backtrace for more info)
error: format argument must be a string literal
--> $DIR/ifmt-bad-format-args.rs:3:18
|
= note: required because of the requirements on the impl of `UpperHex` for `&str`
= note: required by `std::fmt::UpperHex::fmt`
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::__export::format_args` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
--- /dev/null
+error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
+ --> $DIR/foreign-unsafe-fn-called.rs:11:5
+ |
+LL | test::free();
+ | ^^^^^^^^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0133`.
+// revisions: mir thir
+// [thir]compile-flags: -Z thir-unsafeck
+
mod test {
extern "C" {
pub fn free();
+++ /dev/null
-error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
- --> $DIR/foreign-unsafe-fn-called.rs:8:5
- |
-LL | test::free();
- | ^^^^^^^^^^^^ call to unsafe function
- |
- = note: consult the function's documentation for information on how to avoid undefined behavior
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0133`.
--- /dev/null
+error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
+ --> $DIR/foreign-unsafe-fn-called.rs:11:5
+ |
+LL | test::free();
+ | ^^^^^^^^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0133`.
error[E0621]: explicit lifetime required in the type of `x`
--> $DIR/generator-region-requirements.rs:12:51
|
-LL | fn dangle(x: &mut i32) -> &'static mut i32 {
- | -------- help: add explicit lifetime `'static` to the type of `x`: `&'static mut i32`
-...
LL | GeneratorState::Complete(c) => return c,
| ^ lifetime `'static` required
--> $DIR/gat-trait-path-parenthesised-args.rs:8:27
|
LL | fn foo<'a>(arg: Box<dyn X<Y('a) = &'a ()>>) {}
- | ^-------------- help: remove these generics
+ | ^---- help: remove these generics
| |
| expected 0 generic arguments
|
error[E0621]: explicit lifetime required in the type of `x`
--> $DIR/projection-type-lifetime-mismatch.rs:18:5
|
-LL | fn f(x: &impl for<'a> X<Y<'a> = &'a ()>) -> &'static () {
- | ------------------------------- help: add explicit lifetime `'static` to the type of `x`: `&'static impl for<'a> X<Y<'a> = &'a ()>`
LL | x.m()
| ^^^^^ lifetime `'static` required
error[E0621]: explicit lifetime required in the type of `x`
--> $DIR/projection-type-lifetime-mismatch.rs:23:5
|
-LL | fn g<T: for<'a> X<Y<'a> = &'a ()>>(x: &T) -> &'static () {
- | -- help: add explicit lifetime `'static` to the type of `x`: `&'static T`
LL | x.m()
| ^^^^^ lifetime `'static` required
error[E0621]: explicit lifetime required in the type of `x`
--> $DIR/projection-type-lifetime-mismatch.rs:28:5
|
-LL | fn h(x: &()) -> &'static () {
- | --- help: add explicit lifetime `'static` to the type of `x`: `&'static ()`
LL | x.m()
| ^^^^^ lifetime `'static` required
type D = Ty<usize, String, char>;
//~^ ERROR this struct takes 2 generic arguments but 3 generic arguments
//~| HELP remove this
+
+ type E = Ty<>;
+ //~^ ERROR this struct takes 2 generic arguments but 0 generic arguments were supplied
+ //~| HELP add missing
}
mod lifetime_and_type {
//~| HELP consider introducing
type D = Ty<'static, usize>;
+
+ type E = Ty<>;
+ //~^ ERROR this struct takes 1 generic argument but 0 generic arguments
+ //~| ERROR missing lifetime specifier
+ //~| HELP consider introducing
+ //~| HELP add missing
}
mod type_and_type_and_type {
type E = Ty<usize, String, char, f64>;
//~^ ERROR this struct takes at most 3
//~| HELP remove
+
+ type F = Ty<>;
+ //~^ ERROR this struct takes at least 2 generic arguments but 0 generic arguments
+ //~| HELP add missing
}
// Traits have an implicit `Self` type - these tests ensure we don't accidentally return it
type E = Box<dyn GenericType<String, usize>>;
//~^ ERROR this trait takes 1 generic argument but 2 generic arguments
//~| HELP remove
+
+ type F = Box<dyn GenericLifetime<>>;
+ //~^ ERROR missing lifetime specifier
+ //~| HELP consider introducing
+
+ type G = Box<dyn GenericType<>>;
+ //~^ ERROR this trait takes 1 generic argument but 0 generic arguments
+ //~| HELP add missing
+}
+
+mod associated_item {
+ mod non_generic {
+ trait NonGenericAT {
+ type AssocTy;
+ }
+
+ type A = Box<dyn NonGenericAT<usize, AssocTy=()>>;
+ //~^ ERROR this trait takes 0 generic arguments but 1 generic argument
+ //~| HELP remove
+ }
+
+ mod lifetime {
+ trait GenericLifetimeAT<'a> {
+ type AssocTy;
+ }
+
+ type A = Box<dyn GenericLifetimeAT<AssocTy=()>>;
+ //~^ ERROR missing lifetime specifier
+ //~| HELP consider introducing
+
+ type B = Box<dyn GenericLifetimeAT<'static, 'static, AssocTy=()>>;
+ //~^ ERROR this trait takes 1 lifetime argument but 2 lifetime arguments were supplied
+ //~| HELP remove
+
+ type C = Box<dyn GenericLifetimeAT<(), AssocTy=()>>;
+ //~^ ERROR missing lifetime specifier
+ //~| HELP consider introducing
+ //~| ERROR this trait takes 0 generic arguments but 1 generic argument
+ //~| HELP remove
+ }
+
+ mod r#type {
+ trait GenericTypeAT<A> {
+ type AssocTy;
+ }
+
+ type A = Box<dyn GenericTypeAT<AssocTy=()>>;
+ //~^ ERROR this trait takes 1 generic argument but 0 generic arguments
+ //~| HELP add missing
+
+ type B = Box<dyn GenericTypeAT<(), (), AssocTy=()>>;
+ //~^ ERROR this trait takes 1 generic argument but 2 generic arguments
+ //~| HELP remove
+
+ type C = Box<dyn GenericTypeAT<'static, AssocTy=()>>;
+ //~^ ERROR this trait takes 1 generic argument but 0 generic arguments
+ //~| HELP add missing
+ //~| ERROR this trait takes 0 lifetime arguments but 1 lifetime argument was supplied
+ //~| HELP remove
+ }
+
+ mod lifetime_and_type {
+ trait GenericLifetimeTypeAT<'a, A> {
+ type AssocTy;
+ }
+
+ type A = Box<dyn GenericLifetimeTypeAT<AssocTy=()>>;
+ //~^ ERROR this trait takes 1 generic argument but 0 generic arguments
+ //~| HELP add missing
+ //~| ERROR missing lifetime specifier
+ //~| HELP consider introducing
+
+ type B = Box<dyn GenericLifetimeTypeAT<'static, AssocTy=()>>;
+ //~^ ERROR this trait takes 1 generic argument but 0 generic arguments were supplied
+ //~| HELP add missing
+
+ type C = Box<dyn GenericLifetimeTypeAT<'static, 'static, AssocTy=()>>;
+ //~^ ERROR this trait takes 1 lifetime argument but 2 lifetime arguments were supplied
+ //~| HELP remove
+ //~| ERROR this trait takes 1 generic argument but 0 generic arguments
+ //~| HELP add missing
+
+ type D = Box<dyn GenericLifetimeTypeAT<(), AssocTy=()>>;
+ //~^ ERROR missing lifetime specifier
+ //~| HELP consider introducing
+
+ type E = Box<dyn GenericLifetimeTypeAT<(), (), AssocTy=()>>;
+ //~^ ERROR missing lifetime specifier
+ //~| HELP consider introducing
+ //~| ERROR this trait takes 1 generic argument but 2 generic arguments
+ //~| HELP remove
+
+ type F = Box<dyn GenericLifetimeTypeAT<'static, 'static, (), AssocTy=()>>;
+ //~^ ERROR this trait takes 1 lifetime argument but 2 lifetime arguments were supplied
+ //~| HELP remove
+
+ type G = Box<dyn GenericLifetimeTypeAT<'static, (), (), AssocTy=()>>;
+ //~^ ERROR this trait takes 1 generic argument but 2 generic arguments
+ //~| HELP remove
+
+ type H = Box<dyn GenericLifetimeTypeAT<'static, 'static, (), (), AssocTy=()>>;
+ //~^ ERROR this trait takes 1 lifetime argument but 2 lifetime arguments were supplied
+ //~| HELP remove
+ //~| ERROR this trait takes 1 generic argument but 2 generic arguments
+ //~| HELP remove
+ }
+
+ mod type_and_type {
+ trait GenericTypeTypeAT<A, B> {
+ type AssocTy;
+ }
+
+ type A = Box<dyn GenericTypeTypeAT<AssocTy=()>>;
+ //~^ ERROR this trait takes 2 generic arguments but 0 generic arguments
+ //~| HELP add missing
+
+ type B = Box<dyn GenericTypeTypeAT<(), AssocTy=()>>;
+ //~^ ERROR this trait takes 2 generic arguments but 1 generic argument
+ //~| HELP add missing
+
+ type C = Box<dyn GenericTypeTypeAT<(), (), (), AssocTy=()>>;
+ //~^ ERROR this trait takes 2 generic arguments but 3 generic arguments
+ //~| HELP remove
+ }
+
+ mod lifetime_and_lifetime {
+ trait GenericLifetimeLifetimeAT<'a, 'b> {
+ type AssocTy;
+ }
+
+ type A = Box<dyn GenericLifetimeLifetimeAT<AssocTy=()>>;
+ //~^ ERROR missing lifetime specifier
+ //~| HELP consider introducing
+
+ type B = Box<dyn GenericLifetimeLifetimeAT<'static, AssocTy=()>>;
+ //~^ ERROR this trait takes 2 lifetime arguments but 1 lifetime argument was supplied
+ //~| HELP add missing lifetime argument
+ }
+
+ mod lifetime_and_lifetime_and_type {
+ trait GenericLifetimeLifetimeTypeAT<'a, 'b, A> {
+ type AssocTy;
+ }
+
+ type A = Box<dyn GenericLifetimeLifetimeTypeAT<AssocTy=()>>;
+ //~^ ERROR missing lifetime specifier
+ //~| HELP consider introducing
+ //~| ERROR this trait takes 1 generic argument but 0 generic arguments
+ //~| HELP add missing
+
+ type B = Box<dyn GenericLifetimeLifetimeTypeAT<'static, AssocTy=()>>;
+ //~^ ERROR this trait takes 2 lifetime arguments but 1 lifetime argument was supplied
+ //~| HELP add missing lifetime argument
+ //~| ERROR this trait takes 1 generic argument but 0 generic arguments
+ //~| HELP add missing
+
+ type C = Box<dyn GenericLifetimeLifetimeTypeAT<'static, (), AssocTy=()>>;
+ //~^ ERROR this trait takes 2 lifetime arguments but 1 lifetime argument was supplied
+ //~| HELP add missing lifetime argument
+ }
}
mod stdlib {
type D = HashMap<usize, String, char, f64>;
//~^ ERROR this struct takes at most 3
//~| HELP remove this
+
+ type E = HashMap<>;
+ //~^ ERROR this struct takes at least 2 generic arguments but 0 generic arguments
+ //~| HELP add missing
}
mod result {
type D = Result<usize, String, char>;
//~^ ERROR this enum takes 2 generic arguments but 3 generic arguments
//~| HELP remove
+
+ type E = Result<>;
+ //~^ ERROR this enum takes 2 generic arguments but 0 generic arguments
+ //~| HELP add missing
}
}
LL | struct Ty<A, B>;
| ^^ - -
+error[E0107]: this struct takes 2 generic arguments but 0 generic arguments were supplied
+ --> $DIR/wrong-number-of-args.rs:40:14
+ |
+LL | type E = Ty<>;
+ | ^^ expected 2 generic arguments
+ |
+note: struct defined here, with 2 generic parameters: `A`, `B`
+ --> $DIR/wrong-number-of-args.rs:24:12
+ |
+LL | struct Ty<A, B>;
+ | ^^ - -
+help: add missing generic arguments
+ |
+LL | type E = Ty<A, B>;
+ | ^^^^
+
error[E0107]: missing generics for struct `lifetime_and_type::Ty`
- --> $DIR/wrong-number-of-args.rs:44:14
+ --> $DIR/wrong-number-of-args.rs:48:14
|
LL | type A = Ty;
| ^^ expected 1 generic argument
|
note: struct defined here, with 1 generic parameter: `T`
- --> $DIR/wrong-number-of-args.rs:42:12
+ --> $DIR/wrong-number-of-args.rs:46:12
|
LL | struct Ty<'a, T>;
| ^^ -
| ^^^^^
error[E0106]: missing lifetime specifier
- --> $DIR/wrong-number-of-args.rs:44:14
+ --> $DIR/wrong-number-of-args.rs:48:14
|
LL | type A = Ty;
| ^^ expected named lifetime parameter
| ^^^^ ^^^^^^
error[E0107]: this struct takes 1 generic argument but 0 generic arguments were supplied
- --> $DIR/wrong-number-of-args.rs:50:14
+ --> $DIR/wrong-number-of-args.rs:54:14
|
LL | type B = Ty<'static>;
| ^^ expected 1 generic argument
|
note: struct defined here, with 1 generic parameter: `T`
- --> $DIR/wrong-number-of-args.rs:42:12
+ --> $DIR/wrong-number-of-args.rs:46:12
|
LL | struct Ty<'a, T>;
| ^^ -
| ^^^
error[E0106]: missing lifetime specifier
- --> $DIR/wrong-number-of-args.rs:54:17
+ --> $DIR/wrong-number-of-args.rs:58:17
|
LL | type C = Ty<usize>;
| ^ expected named lifetime parameter
LL | type C<'a> = Ty<'a, usize>;
| ^^^^ ^^^
-error[E0107]: missing generics for struct `type_and_type_and_type::Ty`
+error[E0107]: this struct takes 1 generic argument but 0 generic arguments were supplied
--> $DIR/wrong-number-of-args.rs:64:14
|
+LL | type E = Ty<>;
+ | ^^ expected 1 generic argument
+ |
+note: struct defined here, with 1 generic parameter: `T`
+ --> $DIR/wrong-number-of-args.rs:46:12
+ |
+LL | struct Ty<'a, T>;
+ | ^^ -
+help: add missing generic argument
+ |
+LL | type E = Ty<T>;
+ | ^
+
+error[E0106]: missing lifetime specifier
+ --> $DIR/wrong-number-of-args.rs:64:16
+ |
+LL | type E = Ty<>;
+ | ^- expected named lifetime parameter
+ |
+help: consider introducing a named lifetime parameter
+ |
+LL | type E<'a> = Ty<'a>;
+ | ^^^^ ^^
+
+error[E0107]: missing generics for struct `type_and_type_and_type::Ty`
+ --> $DIR/wrong-number-of-args.rs:74:14
+ |
LL | type A = Ty;
| ^^ expected at least 2 generic arguments
|
note: struct defined here, with at least 2 generic parameters: `A`, `B`
- --> $DIR/wrong-number-of-args.rs:62:12
+ --> $DIR/wrong-number-of-args.rs:72:12
|
LL | struct Ty<A, B, C = &'static str>;
| ^^ - -
| ^^^^^^^^
error[E0107]: this struct takes at least 2 generic arguments but 1 generic argument was supplied
- --> $DIR/wrong-number-of-args.rs:68:14
+ --> $DIR/wrong-number-of-args.rs:78:14
|
LL | type B = Ty<usize>;
| ^^ ----- supplied 1 generic argument
| expected at least 2 generic arguments
|
note: struct defined here, with at least 2 generic parameters: `A`, `B`
- --> $DIR/wrong-number-of-args.rs:62:12
+ --> $DIR/wrong-number-of-args.rs:72:12
|
LL | struct Ty<A, B, C = &'static str>;
| ^^ - -
| ^^^
error[E0107]: this struct takes at most 3 generic arguments but 4 generic arguments were supplied
- --> $DIR/wrong-number-of-args.rs:76:14
+ --> $DIR/wrong-number-of-args.rs:86:14
|
LL | type E = Ty<usize, String, char, f64>;
| ^^ --- help: remove this generic argument
| expected at most 3 generic arguments
|
note: struct defined here, with at most 3 generic parameters: `A`, `B`, `C`
- --> $DIR/wrong-number-of-args.rs:62:12
+ --> $DIR/wrong-number-of-args.rs:72:12
|
LL | struct Ty<A, B, C = &'static str>;
| ^^ - - -
+error[E0107]: this struct takes at least 2 generic arguments but 0 generic arguments were supplied
+ --> $DIR/wrong-number-of-args.rs:90:14
+ |
+LL | type F = Ty<>;
+ | ^^ expected at least 2 generic arguments
+ |
+note: struct defined here, with at least 2 generic parameters: `A`, `B`
+ --> $DIR/wrong-number-of-args.rs:72:12
+ |
+LL | struct Ty<A, B, C = &'static str>;
+ | ^^ - -
+help: add missing generic arguments
+ |
+LL | type F = Ty<A, B>;
+ | ^^^^
+
error[E0107]: this trait takes 0 generic arguments but 1 generic argument was supplied
- --> $DIR/wrong-number-of-args.rs:96:22
+ --> $DIR/wrong-number-of-args.rs:110:22
|
LL | type A = Box<dyn NonGeneric<usize>>;
| ^^^^^^^^^^------- help: remove these generics
| expected 0 generic arguments
|
note: trait defined here, with 0 generic parameters
- --> $DIR/wrong-number-of-args.rs:84:11
+ --> $DIR/wrong-number-of-args.rs:98:11
|
LL | trait NonGeneric {
| ^^^^^^^^^^
error[E0106]: missing lifetime specifier
- --> $DIR/wrong-number-of-args.rs:100:22
+ --> $DIR/wrong-number-of-args.rs:114:22
|
LL | type B = Box<dyn GenericLifetime>;
| ^^^^^^^^^^^^^^^ expected named lifetime parameter
| ^^^^ ^^^^^^^^^^^^^^^^^^^
error[E0107]: this trait takes 1 lifetime argument but 2 lifetime arguments were supplied
- --> $DIR/wrong-number-of-args.rs:104:22
+ --> $DIR/wrong-number-of-args.rs:118:22
|
LL | type C = Box<dyn GenericLifetime<'static, 'static>>;
| ^^^^^^^^^^^^^^^ ------- help: remove this lifetime argument
| expected 1 lifetime argument
|
note: trait defined here, with 1 lifetime parameter: `'a`
- --> $DIR/wrong-number-of-args.rs:88:11
+ --> $DIR/wrong-number-of-args.rs:102:11
|
LL | trait GenericLifetime<'a> {
| ^^^^^^^^^^^^^^^ --
error[E0107]: missing generics for trait `GenericType`
- --> $DIR/wrong-number-of-args.rs:108:22
+ --> $DIR/wrong-number-of-args.rs:122:22
|
LL | type D = Box<dyn GenericType>;
| ^^^^^^^^^^^ expected 1 generic argument
|
note: trait defined here, with 1 generic parameter: `A`
- --> $DIR/wrong-number-of-args.rs:92:11
+ --> $DIR/wrong-number-of-args.rs:106:11
|
LL | trait GenericType<A> {
| ^^^^^^^^^^^ -
| ^^^^^^^^^^^^^^
error[E0107]: this trait takes 1 generic argument but 2 generic arguments were supplied
- --> $DIR/wrong-number-of-args.rs:112:22
+ --> $DIR/wrong-number-of-args.rs:126:22
|
LL | type E = Box<dyn GenericType<String, usize>>;
| ^^^^^^^^^^^ ----- help: remove this generic argument
| expected 1 generic argument
|
note: trait defined here, with 1 generic parameter: `A`
- --> $DIR/wrong-number-of-args.rs:92:11
+ --> $DIR/wrong-number-of-args.rs:106:11
|
LL | trait GenericType<A> {
| ^^^^^^^^^^^ -
+error[E0106]: missing lifetime specifier
+ --> $DIR/wrong-number-of-args.rs:130:37
+ |
+LL | type F = Box<dyn GenericLifetime<>>;
+ | ^- expected named lifetime parameter
+ |
+help: consider introducing a named lifetime parameter
+ |
+LL | type F<'a> = Box<dyn GenericLifetime<'a>>;
+ | ^^^^ ^^
+
+error[E0107]: this trait takes 1 generic argument but 0 generic arguments were supplied
+ --> $DIR/wrong-number-of-args.rs:134:22
+ |
+LL | type G = Box<dyn GenericType<>>;
+ | ^^^^^^^^^^^ expected 1 generic argument
+ |
+note: trait defined here, with 1 generic parameter: `A`
+ --> $DIR/wrong-number-of-args.rs:106:11
+ |
+LL | trait GenericType<A> {
+ | ^^^^^^^^^^^ -
+help: add missing generic argument
+ |
+LL | type G = Box<dyn GenericType<A>>;
+ | ^
+
+error[E0107]: this trait takes 0 generic arguments but 1 generic argument was supplied
+ --> $DIR/wrong-number-of-args.rs:145:26
+ |
+LL | type A = Box<dyn NonGenericAT<usize, AssocTy=()>>;
+ | ^^^^^^^^^^^^------------------- help: remove these generics
+ | |
+ | expected 0 generic arguments
+ |
+note: trait defined here, with 0 generic parameters
+ --> $DIR/wrong-number-of-args.rs:141:15
+ |
+LL | trait NonGenericAT {
+ | ^^^^^^^^^^^^
+
+error[E0106]: missing lifetime specifier
+ --> $DIR/wrong-number-of-args.rs:155:44
+ |
+LL | type A = Box<dyn GenericLifetimeAT<AssocTy=()>>;
+ | ^ expected named lifetime parameter
+ |
+help: consider introducing a named lifetime parameter
+ |
+LL | type A<'a> = Box<dyn GenericLifetimeAT<'a, AssocTy=()>>;
+ | ^^^^ ^^^
+
+error[E0107]: this trait takes 1 lifetime argument but 2 lifetime arguments were supplied
+ --> $DIR/wrong-number-of-args.rs:159:26
+ |
+LL | type B = Box<dyn GenericLifetimeAT<'static, 'static, AssocTy=()>>;
+ | ^^^^^^^^^^^^^^^^^ ------- help: remove this lifetime argument
+ | |
+ | expected 1 lifetime argument
+ |
+note: trait defined here, with 1 lifetime parameter: `'a`
+ --> $DIR/wrong-number-of-args.rs:151:15
+ |
+LL | trait GenericLifetimeAT<'a> {
+ | ^^^^^^^^^^^^^^^^^ --
+
+error[E0106]: missing lifetime specifier
+ --> $DIR/wrong-number-of-args.rs:163:44
+ |
+LL | type C = Box<dyn GenericLifetimeAT<(), AssocTy=()>>;
+ | ^ expected named lifetime parameter
+ |
+help: consider introducing a named lifetime parameter
+ |
+LL | type C<'a> = Box<dyn GenericLifetimeAT<'a, (), AssocTy=()>>;
+ | ^^^^ ^^^
+
+error[E0107]: this trait takes 0 generic arguments but 1 generic argument was supplied
+ --> $DIR/wrong-number-of-args.rs:163:26
+ |
+LL | type C = Box<dyn GenericLifetimeAT<(), AssocTy=()>>;
+ | ^^^^^^^^^^^^^^^^^ -- help: remove this generic argument
+ | |
+ | expected 0 generic arguments
+ |
+note: trait defined here, with 0 generic parameters
+ --> $DIR/wrong-number-of-args.rs:151:15
+ |
+LL | trait GenericLifetimeAT<'a> {
+ | ^^^^^^^^^^^^^^^^^
+
+error[E0107]: this trait takes 1 generic argument but 0 generic arguments were supplied
+ --> $DIR/wrong-number-of-args.rs:175:26
+ |
+LL | type A = Box<dyn GenericTypeAT<AssocTy=()>>;
+ | ^^^^^^^^^^^^^ expected 1 generic argument
+ |
+note: trait defined here, with 1 generic parameter: `A`
+ --> $DIR/wrong-number-of-args.rs:171:15
+ |
+LL | trait GenericTypeAT<A> {
+ | ^^^^^^^^^^^^^ -
+help: add missing generic argument
+ |
+LL | type A = Box<dyn GenericTypeAT<A, AssocTy=()>>;
+ | ^^
+
+error[E0107]: this trait takes 1 generic argument but 2 generic arguments were supplied
+ --> $DIR/wrong-number-of-args.rs:179:26
+ |
+LL | type B = Box<dyn GenericTypeAT<(), (), AssocTy=()>>;
+ | ^^^^^^^^^^^^^ -- help: remove this generic argument
+ | |
+ | expected 1 generic argument
+ |
+note: trait defined here, with 1 generic parameter: `A`
+ --> $DIR/wrong-number-of-args.rs:171:15
+ |
+LL | trait GenericTypeAT<A> {
+ | ^^^^^^^^^^^^^ -
+
+error[E0107]: this trait takes 0 lifetime arguments but 1 lifetime argument was supplied
+ --> $DIR/wrong-number-of-args.rs:183:26
+ |
+LL | type C = Box<dyn GenericTypeAT<'static, AssocTy=()>>;
+ | ^^^^^^^^^^^^^--------------------- help: remove these generics
+ | |
+ | expected 0 lifetime arguments
+ |
+note: trait defined here, with 0 lifetime parameters
+ --> $DIR/wrong-number-of-args.rs:171:15
+ |
+LL | trait GenericTypeAT<A> {
+ | ^^^^^^^^^^^^^
+
+error[E0107]: this trait takes 1 generic argument but 0 generic arguments were supplied
+ --> $DIR/wrong-number-of-args.rs:183:26
+ |
+LL | type C = Box<dyn GenericTypeAT<'static, AssocTy=()>>;
+ | ^^^^^^^^^^^^^ expected 1 generic argument
+ |
+note: trait defined here, with 1 generic parameter: `A`
+ --> $DIR/wrong-number-of-args.rs:171:15
+ |
+LL | trait GenericTypeAT<A> {
+ | ^^^^^^^^^^^^^ -
+help: add missing generic argument
+ |
+LL | type C = Box<dyn GenericTypeAT<'static, A, AssocTy=()>>;
+ | ^^^
+
+error[E0106]: missing lifetime specifier
+ --> $DIR/wrong-number-of-args.rs:195:48
+ |
+LL | type A = Box<dyn GenericLifetimeTypeAT<AssocTy=()>>;
+ | ^ expected named lifetime parameter
+ |
+help: consider introducing a named lifetime parameter
+ |
+LL | type A<'a> = Box<dyn GenericLifetimeTypeAT<'a, AssocTy=()>>;
+ | ^^^^ ^^^
+
+error[E0107]: this trait takes 1 generic argument but 0 generic arguments were supplied
+ --> $DIR/wrong-number-of-args.rs:195:26
+ |
+LL | type A = Box<dyn GenericLifetimeTypeAT<AssocTy=()>>;
+ | ^^^^^^^^^^^^^^^^^^^^^ expected 1 generic argument
+ |
+note: trait defined here, with 1 generic parameter: `A`
+ --> $DIR/wrong-number-of-args.rs:191:15
+ |
+LL | trait GenericLifetimeTypeAT<'a, A> {
+ | ^^^^^^^^^^^^^^^^^^^^^ -
+help: add missing generic argument
+ |
+LL | type A = Box<dyn GenericLifetimeTypeAT<A, AssocTy=()>>;
+ | ^^
+
+error[E0107]: this trait takes 1 generic argument but 0 generic arguments were supplied
+ --> $DIR/wrong-number-of-args.rs:201:26
+ |
+LL | type B = Box<dyn GenericLifetimeTypeAT<'static, AssocTy=()>>;
+ | ^^^^^^^^^^^^^^^^^^^^^ expected 1 generic argument
+ |
+note: trait defined here, with 1 generic parameter: `A`
+ --> $DIR/wrong-number-of-args.rs:191:15
+ |
+LL | trait GenericLifetimeTypeAT<'a, A> {
+ | ^^^^^^^^^^^^^^^^^^^^^ -
+help: add missing generic argument
+ |
+LL | type B = Box<dyn GenericLifetimeTypeAT<'static, A, AssocTy=()>>;
+ | ^^^
+
+error[E0107]: this trait takes 1 lifetime argument but 2 lifetime arguments were supplied
+ --> $DIR/wrong-number-of-args.rs:205:26
+ |
+LL | type C = Box<dyn GenericLifetimeTypeAT<'static, 'static, AssocTy=()>>;
+ | ^^^^^^^^^^^^^^^^^^^^^ ------- help: remove this lifetime argument
+ | |
+ | expected 1 lifetime argument
+ |
+note: trait defined here, with 1 lifetime parameter: `'a`
+ --> $DIR/wrong-number-of-args.rs:191:15
+ |
+LL | trait GenericLifetimeTypeAT<'a, A> {
+ | ^^^^^^^^^^^^^^^^^^^^^ --
+
+error[E0107]: this trait takes 1 generic argument but 0 generic arguments were supplied
+ --> $DIR/wrong-number-of-args.rs:205:26
+ |
+LL | type C = Box<dyn GenericLifetimeTypeAT<'static, 'static, AssocTy=()>>;
+ | ^^^^^^^^^^^^^^^^^^^^^ expected 1 generic argument
+ |
+note: trait defined here, with 1 generic parameter: `A`
+ --> $DIR/wrong-number-of-args.rs:191:15
+ |
+LL | trait GenericLifetimeTypeAT<'a, A> {
+ | ^^^^^^^^^^^^^^^^^^^^^ -
+help: add missing generic argument
+ |
+LL | type C = Box<dyn GenericLifetimeTypeAT<'static, 'static, A, AssocTy=()>>;
+ | ^^^
+
+error[E0106]: missing lifetime specifier
+ --> $DIR/wrong-number-of-args.rs:211:48
+ |
+LL | type D = Box<dyn GenericLifetimeTypeAT<(), AssocTy=()>>;
+ | ^ expected named lifetime parameter
+ |
+help: consider introducing a named lifetime parameter
+ |
+LL | type D<'a> = Box<dyn GenericLifetimeTypeAT<'a, (), AssocTy=()>>;
+ | ^^^^ ^^^
+
+error[E0106]: missing lifetime specifier
+ --> $DIR/wrong-number-of-args.rs:215:48
+ |
+LL | type E = Box<dyn GenericLifetimeTypeAT<(), (), AssocTy=()>>;
+ | ^ expected named lifetime parameter
+ |
+help: consider introducing a named lifetime parameter
+ |
+LL | type E<'a> = Box<dyn GenericLifetimeTypeAT<'a, (), (), AssocTy=()>>;
+ | ^^^^ ^^^
+
+error[E0107]: this trait takes 1 generic argument but 2 generic arguments were supplied
+ --> $DIR/wrong-number-of-args.rs:215:26
+ |
+LL | type E = Box<dyn GenericLifetimeTypeAT<(), (), AssocTy=()>>;
+ | ^^^^^^^^^^^^^^^^^^^^^ -- help: remove this generic argument
+ | |
+ | expected 1 generic argument
+ |
+note: trait defined here, with 1 generic parameter: `A`
+ --> $DIR/wrong-number-of-args.rs:191:15
+ |
+LL | trait GenericLifetimeTypeAT<'a, A> {
+ | ^^^^^^^^^^^^^^^^^^^^^ -
+
+error[E0107]: this trait takes 1 lifetime argument but 2 lifetime arguments were supplied
+ --> $DIR/wrong-number-of-args.rs:221:26
+ |
+LL | type F = Box<dyn GenericLifetimeTypeAT<'static, 'static, (), AssocTy=()>>;
+ | ^^^^^^^^^^^^^^^^^^^^^ ------- help: remove this lifetime argument
+ | |
+ | expected 1 lifetime argument
+ |
+note: trait defined here, with 1 lifetime parameter: `'a`
+ --> $DIR/wrong-number-of-args.rs:191:15
+ |
+LL | trait GenericLifetimeTypeAT<'a, A> {
+ | ^^^^^^^^^^^^^^^^^^^^^ --
+
+error[E0107]: this trait takes 1 generic argument but 2 generic arguments were supplied
+ --> $DIR/wrong-number-of-args.rs:225:26
+ |
+LL | type G = Box<dyn GenericLifetimeTypeAT<'static, (), (), AssocTy=()>>;
+ | ^^^^^^^^^^^^^^^^^^^^^ -- help: remove this generic argument
+ | |
+ | expected 1 generic argument
+ |
+note: trait defined here, with 1 generic parameter: `A`
+ --> $DIR/wrong-number-of-args.rs:191:15
+ |
+LL | trait GenericLifetimeTypeAT<'a, A> {
+ | ^^^^^^^^^^^^^^^^^^^^^ -
+
+error[E0107]: this trait takes 1 lifetime argument but 2 lifetime arguments were supplied
+ --> $DIR/wrong-number-of-args.rs:229:26
+ |
+LL | type H = Box<dyn GenericLifetimeTypeAT<'static, 'static, (), (), AssocTy=()>>;
+ | ^^^^^^^^^^^^^^^^^^^^^ ------- help: remove this lifetime argument
+ | |
+ | expected 1 lifetime argument
+ |
+note: trait defined here, with 1 lifetime parameter: `'a`
+ --> $DIR/wrong-number-of-args.rs:191:15
+ |
+LL | trait GenericLifetimeTypeAT<'a, A> {
+ | ^^^^^^^^^^^^^^^^^^^^^ --
+
+error[E0107]: this trait takes 1 generic argument but 2 generic arguments were supplied
+ --> $DIR/wrong-number-of-args.rs:229:26
+ |
+LL | type H = Box<dyn GenericLifetimeTypeAT<'static, 'static, (), (), AssocTy=()>>;
+ | ^^^^^^^^^^^^^^^^^^^^^ -- help: remove this generic argument
+ | |
+ | expected 1 generic argument
+ |
+note: trait defined here, with 1 generic parameter: `A`
+ --> $DIR/wrong-number-of-args.rs:191:15
+ |
+LL | trait GenericLifetimeTypeAT<'a, A> {
+ | ^^^^^^^^^^^^^^^^^^^^^ -
+
+error[E0107]: this trait takes 2 generic arguments but 0 generic arguments were supplied
+ --> $DIR/wrong-number-of-args.rs:241:26
+ |
+LL | type A = Box<dyn GenericTypeTypeAT<AssocTy=()>>;
+ | ^^^^^^^^^^^^^^^^^ expected 2 generic arguments
+ |
+note: trait defined here, with 2 generic parameters: `A`, `B`
+ --> $DIR/wrong-number-of-args.rs:237:15
+ |
+LL | trait GenericTypeTypeAT<A, B> {
+ | ^^^^^^^^^^^^^^^^^ - -
+help: add missing generic arguments
+ |
+LL | type A = Box<dyn GenericTypeTypeAT<A, B, AssocTy=()>>;
+ | ^^^^^
+
+error[E0107]: this trait takes 2 generic arguments but 1 generic argument was supplied
+ --> $DIR/wrong-number-of-args.rs:245:26
+ |
+LL | type B = Box<dyn GenericTypeTypeAT<(), AssocTy=()>>;
+ | ^^^^^^^^^^^^^^^^^ -- supplied 1 generic argument
+ | |
+ | expected 2 generic arguments
+ |
+note: trait defined here, with 2 generic parameters: `A`, `B`
+ --> $DIR/wrong-number-of-args.rs:237:15
+ |
+LL | trait GenericTypeTypeAT<A, B> {
+ | ^^^^^^^^^^^^^^^^^ - -
+help: add missing generic argument
+ |
+LL | type B = Box<dyn GenericTypeTypeAT<(), B, AssocTy=()>>;
+ | ^^^
+
+error[E0107]: this trait takes 2 generic arguments but 3 generic arguments were supplied
+ --> $DIR/wrong-number-of-args.rs:249:26
+ |
+LL | type C = Box<dyn GenericTypeTypeAT<(), (), (), AssocTy=()>>;
+ | ^^^^^^^^^^^^^^^^^ -- help: remove this generic argument
+ | |
+ | expected 2 generic arguments
+ |
+note: trait defined here, with 2 generic parameters: `A`, `B`
+ --> $DIR/wrong-number-of-args.rs:237:15
+ |
+LL | trait GenericTypeTypeAT<A, B> {
+ | ^^^^^^^^^^^^^^^^^ - -
+
+error[E0106]: missing lifetime specifiers
+ --> $DIR/wrong-number-of-args.rs:259:52
+ |
+LL | type A = Box<dyn GenericLifetimeLifetimeAT<AssocTy=()>>;
+ | ^ expected 2 lifetime parameters
+ |
+help: consider introducing a named lifetime parameter
+ |
+LL | type A<'a> = Box<dyn GenericLifetimeLifetimeAT<'a, 'a, AssocTy=()>>;
+ | ^^^^ ^^^^^^^
+
+error[E0107]: this trait takes 2 lifetime arguments but 1 lifetime argument was supplied
+ --> $DIR/wrong-number-of-args.rs:263:26
+ |
+LL | type B = Box<dyn GenericLifetimeLifetimeAT<'static, AssocTy=()>>;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ ------- supplied 1 lifetime argument
+ | |
+ | expected 2 lifetime arguments
+ |
+note: trait defined here, with 2 lifetime parameters: `'a`, `'b`
+ --> $DIR/wrong-number-of-args.rs:255:15
+ |
+LL | trait GenericLifetimeLifetimeAT<'a, 'b> {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ -- --
+help: add missing lifetime argument
+ |
+LL | type B = Box<dyn GenericLifetimeLifetimeAT<'static, 'b, AssocTy=()>>;
+ | ^^^^
+
+error[E0106]: missing lifetime specifiers
+ --> $DIR/wrong-number-of-args.rs:273:56
+ |
+LL | type A = Box<dyn GenericLifetimeLifetimeTypeAT<AssocTy=()>>;
+ | ^ expected 2 lifetime parameters
+ |
+help: consider introducing a named lifetime parameter
+ |
+LL | type A<'a> = Box<dyn GenericLifetimeLifetimeTypeAT<'a, 'a, AssocTy=()>>;
+ | ^^^^ ^^^^^^^
+
+error[E0107]: this trait takes 1 generic argument but 0 generic arguments were supplied
+ --> $DIR/wrong-number-of-args.rs:273:26
+ |
+LL | type A = Box<dyn GenericLifetimeLifetimeTypeAT<AssocTy=()>>;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected 1 generic argument
+ |
+note: trait defined here, with 1 generic parameter: `A`
+ --> $DIR/wrong-number-of-args.rs:269:15
+ |
+LL | trait GenericLifetimeLifetimeTypeAT<'a, 'b, A> {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -
+help: add missing generic argument
+ |
+LL | type A = Box<dyn GenericLifetimeLifetimeTypeAT<A, AssocTy=()>>;
+ | ^^
+
+error[E0107]: this trait takes 2 lifetime arguments but 1 lifetime argument was supplied
+ --> $DIR/wrong-number-of-args.rs:279:26
+ |
+LL | type B = Box<dyn GenericLifetimeLifetimeTypeAT<'static, AssocTy=()>>;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ------- supplied 1 lifetime argument
+ | |
+ | expected 2 lifetime arguments
+ |
+note: trait defined here, with 2 lifetime parameters: `'a`, `'b`
+ --> $DIR/wrong-number-of-args.rs:269:15
+ |
+LL | trait GenericLifetimeLifetimeTypeAT<'a, 'b, A> {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -- --
+help: add missing lifetime argument
+ |
+LL | type B = Box<dyn GenericLifetimeLifetimeTypeAT<'static, 'b, AssocTy=()>>;
+ | ^^^^
+
+error[E0107]: this trait takes 1 generic argument but 0 generic arguments were supplied
+ --> $DIR/wrong-number-of-args.rs:279:26
+ |
+LL | type B = Box<dyn GenericLifetimeLifetimeTypeAT<'static, AssocTy=()>>;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected 1 generic argument
+ |
+note: trait defined here, with 1 generic parameter: `A`
+ --> $DIR/wrong-number-of-args.rs:269:15
+ |
+LL | trait GenericLifetimeLifetimeTypeAT<'a, 'b, A> {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -
+help: add missing generic argument
+ |
+LL | type B = Box<dyn GenericLifetimeLifetimeTypeAT<'static, A, AssocTy=()>>;
+ | ^^^
+
+error[E0107]: this trait takes 2 lifetime arguments but 1 lifetime argument was supplied
+ --> $DIR/wrong-number-of-args.rs:285:26
+ |
+LL | type C = Box<dyn GenericLifetimeLifetimeTypeAT<'static, (), AssocTy=()>>;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ------- supplied 1 lifetime argument
+ | |
+ | expected 2 lifetime arguments
+ |
+note: trait defined here, with 2 lifetime parameters: `'a`, `'b`
+ --> $DIR/wrong-number-of-args.rs:269:15
+ |
+LL | trait GenericLifetimeLifetimeTypeAT<'a, 'b, A> {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -- --
+help: add missing lifetime argument
+ |
+LL | type C = Box<dyn GenericLifetimeLifetimeTypeAT<'static, 'b, (), AssocTy=()>>;
+ | ^^^^
+
error[E0107]: missing generics for struct `HashMap`
- --> $DIR/wrong-number-of-args.rs:121:18
+ --> $DIR/wrong-number-of-args.rs:295:18
|
LL | type A = HashMap;
| ^^^^^^^ expected at least 2 generic arguments
| ^^^^^^^^^^^^^
error[E0107]: this struct takes at least 2 generic arguments but 1 generic argument was supplied
- --> $DIR/wrong-number-of-args.rs:125:18
+ --> $DIR/wrong-number-of-args.rs:299:18
|
LL | type B = HashMap<String>;
| ^^^^^^^ ------ supplied 1 generic argument
| ^^^
error[E0107]: this struct takes 0 lifetime arguments but 1 lifetime argument was supplied
- --> $DIR/wrong-number-of-args.rs:129:18
+ --> $DIR/wrong-number-of-args.rs:303:18
|
LL | type C = HashMap<'static>;
| ^^^^^^^--------- help: remove these generics
| ^^^^^^^
error[E0107]: this struct takes at least 2 generic arguments but 0 generic arguments were supplied
- --> $DIR/wrong-number-of-args.rs:129:18
+ --> $DIR/wrong-number-of-args.rs:303:18
|
LL | type C = HashMap<'static>;
| ^^^^^^^ expected at least 2 generic arguments
| ^^^^^^
error[E0107]: this struct takes at most 3 generic arguments but 4 generic arguments were supplied
- --> $DIR/wrong-number-of-args.rs:135:18
+ --> $DIR/wrong-number-of-args.rs:309:18
|
LL | type D = HashMap<usize, String, char, f64>;
| ^^^^^^^ --- help: remove this generic argument
LL | pub struct HashMap<K, V, S = RandomState> {
| ^^^^^^^ - - -
+error[E0107]: this struct takes at least 2 generic arguments but 0 generic arguments were supplied
+ --> $DIR/wrong-number-of-args.rs:313:18
+ |
+LL | type E = HashMap<>;
+ | ^^^^^^^ expected at least 2 generic arguments
+ |
+note: struct defined here, with at least 2 generic parameters: `K`, `V`
+ --> $SRC_DIR/std/src/collections/hash/map.rs:LL:COL
+ |
+LL | pub struct HashMap<K, V, S = RandomState> {
+ | ^^^^^^^ - -
+help: add missing generic arguments
+ |
+LL | type E = HashMap<K, V>;
+ | ^^^^
+
error[E0107]: missing generics for enum `Result`
- --> $DIR/wrong-number-of-args.rs:141:18
+ --> $DIR/wrong-number-of-args.rs:319:18
|
LL | type A = Result;
| ^^^^^^ expected 2 generic arguments
| ^^^^^^^^^^^^
error[E0107]: this enum takes 2 generic arguments but 1 generic argument was supplied
- --> $DIR/wrong-number-of-args.rs:145:18
+ --> $DIR/wrong-number-of-args.rs:323:18
|
LL | type B = Result<String>;
| ^^^^^^ ------ supplied 1 generic argument
| ^^^
error[E0107]: this enum takes 0 lifetime arguments but 1 lifetime argument was supplied
- --> $DIR/wrong-number-of-args.rs:149:18
+ --> $DIR/wrong-number-of-args.rs:327:18
|
LL | type C = Result<'static>;
| ^^^^^^--------- help: remove these generics
| ^^^^^^
error[E0107]: this enum takes 2 generic arguments but 0 generic arguments were supplied
- --> $DIR/wrong-number-of-args.rs:149:18
+ --> $DIR/wrong-number-of-args.rs:327:18
|
LL | type C = Result<'static>;
| ^^^^^^ expected 2 generic arguments
| ^^^^^^
error[E0107]: this enum takes 2 generic arguments but 3 generic arguments were supplied
- --> $DIR/wrong-number-of-args.rs:155:18
+ --> $DIR/wrong-number-of-args.rs:333:18
|
LL | type D = Result<usize, String, char>;
| ^^^^^^ ---- help: remove this generic argument
LL | pub enum Result<T, E> {
| ^^^^^^ - -
-error: aborting due to 30 previous errors
+error[E0107]: this enum takes 2 generic arguments but 0 generic arguments were supplied
+ --> $DIR/wrong-number-of-args.rs:337:18
+ |
+LL | type E = Result<>;
+ | ^^^^^^ expected 2 generic arguments
+ |
+note: enum defined here, with 2 generic parameters: `T`, `E`
+ --> $SRC_DIR/core/src/result.rs:LL:COL
+ |
+LL | pub enum Result<T, E> {
+ | ^^^^^^ - -
+help: add missing generic arguments
+ |
+LL | type E = Result<T, E>;
+ | ^^^^
+
+error: aborting due to 69 previous errors
Some errors have detailed explanations: E0106, E0107.
For more information about an error, try `rustc --explain E0106`.
LL | mac!(0);
| -------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 5 previous errors
| -------- in this macro invocation
|
= note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`)
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0586]: inclusive range with no end
--> $DIR/half-open-range-pats-inclusive-no-end.rs:21:19
| -------- in this macro invocation
|
= note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`)
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 6 previous errors
LL | | for<'a> fn(&'a u32, &'a u32) -> &'a u32) }
| |_____________________________________________- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `check` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
|
= note: expected enum `Option<for<'a, 'b> fn(&'a u32, &'b u32) -> &'a u32>`
found enum `Option<for<'a> fn(&'a u32, &'a u32) -> &'a u32>`
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `check` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | | fn(&'x u32)) }
| |______________- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `check` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
|
= note: expected enum `Option<for<'a> fn(&'a u32)>`
found enum `Option<fn(&'x u32)>`
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `check` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | | for<'a> fn(Inv<'a>, Inv<'a>)) }
| |__________________________________- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `check` (in Nightly builds, run with -Z macro-backtrace for more info)
error: higher-ranked subtype error
--> $DIR/hr-subtype.rs:45:13
LL | | for<'a> fn(Inv<'a>, Inv<'a>)) }
| |__________________________________- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `check` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors
|
= note: expected enum `Option<for<'a, 'b> fn(Inv<'a>, Inv<'b>)>`
found enum `Option<for<'a> fn(Inv<'a>, Inv<'a>)>`
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `check` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
| |______________- in this macro invocation
|
= help: consider adding the following bound: `'x: 'y`
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `check` (in Nightly builds, run with -Z macro-backtrace for more info)
error: lifetime may not live long enough
--> $DIR/hr-subtype.rs:45:13
| |______________- in this macro invocation
|
= help: consider adding the following bound: `'x: 'y`
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `check` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors
LL | / check! { free_inv_x_vs_free_inv_y: (fn(Inv<'x>),
LL | | fn(Inv<'y>)) }
| |______________- in this macro invocation
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `check` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0308]: mismatched types
--> $DIR/hr-subtype.rs:45:26
LL | / check! { free_inv_x_vs_free_inv_y: (fn(Inv<'x>),
LL | | fn(Inv<'y>)) }
| |______________- in this macro invocation
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `check` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors
| |______________- in this macro invocation
|
= help: consider adding the following bound: `'x: 'y`
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `check` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | / check! { free_x_vs_free_y: (fn(&'x u32),
LL | | fn(&'y u32)) }
| |______________- in this macro invocation
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `check` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | mac_trait_impl!();
| ------------------ in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `mac_trait_impl` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0046]: not all trait items implemented, missing: `method`
--> $DIR/assoc_item_ctxt.rs:34:9
LL | mac_trait_impl!();
| ------------------ in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `mac_trait_impl` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors
| | previous declaration here
| in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0263]: lifetime name `'a` declared twice in the same scope
--> $DIR/duplicate_lifetimes.rs:13:14
| | previous declaration here
| in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `n` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors
LL | a!();
| ----- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `a` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0433]: failed to resolve: use of undeclared crate or module `my_core`
--> $DIR/extern-prelude-from-opaque-fail.rs:11:18
LL | a!();
| ----- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `a` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0433]: failed to resolve: use of undeclared crate or module `my_core`
--> $DIR/extern-prelude-from-opaque-fail.rs:24:14
LL | legacy!(a);
| ----------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `legacy` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
| ----------------- in this macro invocation
|
= note: move occurs because `foo.x` has type `NonCopy`, which does not implement the `Copy` trait
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `copy_legacy` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0382]: use of moved value: `foo.x`
--> $DIR/fields-move.rs:28:42
LL | let s = foo::m!(S, x);
| ------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `foo::m` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `foo::S` is private
--> $DIR/fields.rs:16:17
LL | let s = foo::m!(S, x);
| ------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `foo::m` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `T` is private
--> $DIR/fields.rs:18:17
LL | let s = foo::m!(S, x);
| ------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `foo::m` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `T` is private
--> $DIR/fields.rs:19:17
LL | let s = foo::m!(S, x);
| ------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `foo::m` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 4 previous errors
LL | genmod_transparent!();
| ---------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `genmod_transparent` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0412]: cannot find type `Outer` in this scope
--> $DIR/generate-mod.rs:20:22
LL | genmod_transparent!();
| ---------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `genmod_transparent` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0412]: cannot find type `FromOutside` in this scope
--> $DIR/generate-mod.rs:28:18
LL | genmod_legacy!();
| ----------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `genmod_legacy` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0412]: cannot find type `Outer` in this scope
--> $DIR/generate-mod.rs:29:22
LL | genmod_legacy!();
| ----------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `genmod_legacy` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 6 previous errors
LL | | }
| |_____- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider importing this function
|
LL | use bar::g;
|
= note: consider importing one of these items:
foo::f
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `n` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0425]: cannot find function `f` in this scope
--> $DIR/globs.rs:65:17
|
= note: consider importing one of these items:
foo::f
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `n` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 4 previous errors
LL | 'x: loop { foo!() }
| ------ in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | foo!()
| ------ in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | loop_x!(break 'x);
| ------------------ in this macro invocation
|
- = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the macro `loop_x` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: label name `'x` shadows a label name that is already in scope
--> $DIR/hygienic-labels-in-let.rs:64:9
LL | loop_x!(break 'x);
| ------------------ in this macro invocation
|
- = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the macro `loop_x` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: label name `'x` shadows a label name that is already in scope
--> $DIR/hygienic-labels-in-let.rs:16:9
LL | loop_x!(break 'x);
| ------------------ in this macro invocation
|
- = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the macro `loop_x` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: label name `'x` shadows a label name that is already in scope
--> $DIR/hygienic-labels-in-let.rs:16:9
LL | loop_x!(break 'x);
| ------------------ in this macro invocation
|
- = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the macro `loop_x` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: label name `'x` shadows a label name that is already in scope
--> $DIR/hygienic-labels-in-let.rs:76:9
LL | while_true!(break 'x);
| ---------------------- in this macro invocation
|
- = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the macro `while_true` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: label name `'x` shadows a label name that is already in scope
--> $DIR/hygienic-labels-in-let.rs:27:9
LL | while_true!(break 'x);
| ---------------------- in this macro invocation
|
- = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the macro `while_true` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: label name `'x` shadows a label name that is already in scope
--> $DIR/hygienic-labels-in-let.rs:27:9
LL | while_true!(break 'x);
| ---------------------- in this macro invocation
|
- = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the macro `while_true` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: label name `'x` shadows a label name that is already in scope
--> $DIR/hygienic-labels-in-let.rs:27:9
LL | while_true!(break 'x);
| ---------------------- in this macro invocation
|
- = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the macro `while_true` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: label name `'x` shadows a label name that is already in scope
--> $DIR/hygienic-labels-in-let.rs:27:9
LL | while_true!(break 'x);
| ---------------------- in this macro invocation
|
- = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the macro `while_true` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: label name `'x` shadows a label name that is already in scope
--> $DIR/hygienic-labels-in-let.rs:90:9
LL | run_once!(continue 'x);
| ----------------------- in this macro invocation
|
- = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the macro `run_once` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: label name `'x` shadows a label name that is already in scope
--> $DIR/hygienic-labels-in-let.rs:39:9
LL | run_once!(continue 'x);
| ----------------------- in this macro invocation
|
- = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the macro `run_once` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: label name `'x` shadows a label name that is already in scope
--> $DIR/hygienic-labels-in-let.rs:39:9
LL | run_once!(continue 'x);
| ----------------------- in this macro invocation
|
- = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the macro `run_once` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: label name `'x` shadows a label name that is already in scope
--> $DIR/hygienic-labels-in-let.rs:39:9
LL | run_once!(continue 'x);
| ----------------------- in this macro invocation
|
- = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the macro `run_once` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: label name `'x` shadows a label name that is already in scope
--> $DIR/hygienic-labels-in-let.rs:39:9
LL | run_once!(continue 'x);
| ----------------------- in this macro invocation
|
- = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the macro `run_once` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: label name `'x` shadows a label name that is already in scope
--> $DIR/hygienic-labels-in-let.rs:39:9
LL | run_once!(continue 'x);
| ----------------------- in this macro invocation
|
- = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the macro `run_once` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: label name `'x` shadows a label name that is already in scope
--> $DIR/hygienic-labels-in-let.rs:39:9
LL | run_once!(continue 'x);
| ----------------------- in this macro invocation
|
- = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the macro `run_once` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: 28 warnings emitted
LL | loop_x!(break 'x);
| ------------------ in this macro invocation
|
- = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the macro `loop_x` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: label name `'x` shadows a label name that is already in scope
--> $DIR/hygienic-labels.rs:54:5
LL | loop_x!(break 'x);
| ------------------ in this macro invocation
|
- = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the macro `loop_x` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: label name `'x` shadows a label name that is already in scope
--> $DIR/hygienic-labels.rs:13:9
LL | loop_x!(break 'x);
| ------------------ in this macro invocation
|
- = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the macro `loop_x` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: label name `'x` shadows a label name that is already in scope
--> $DIR/hygienic-labels.rs:13:9
LL | loop_x!(break 'x);
| ------------------ in this macro invocation
|
- = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the macro `loop_x` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: label name `'x` shadows a label name that is already in scope
--> $DIR/hygienic-labels.rs:63:5
LL | while_x!(break 'x);
| ------------------- in this macro invocation
|
- = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the macro `while_x` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: label name `'x` shadows a label name that is already in scope
--> $DIR/hygienic-labels.rs:38:9
LL | while_x!(break 'x);
| ------------------- in this macro invocation
|
- = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the macro `while_x` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: label name `'x` shadows a label name that is already in scope
--> $DIR/hygienic-labels.rs:38:9
LL | while_x!(break 'x);
| ------------------- in this macro invocation
|
- = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the macro `while_x` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: label name `'x` shadows a label name that is already in scope
--> $DIR/hygienic-labels.rs:38:9
LL | while_x!(break 'x);
| ------------------- in this macro invocation
|
- = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the macro `while_x` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: label name `'x` shadows a label name that is already in scope
--> $DIR/hygienic-labels.rs:38:9
LL | while_x!(break 'x);
| ------------------- in this macro invocation
|
- = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the macro `while_x` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: label name `'x` shadows a label name that is already in scope
--> $DIR/hygienic-labels.rs:73:5
LL | run_once!(continue 'x);
| ----------------------- in this macro invocation
|
- = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the macro `run_once` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: label name `'x` shadows a label name that is already in scope
--> $DIR/hygienic-labels.rs:24:9
LL | run_once!(continue 'x);
| ----------------------- in this macro invocation
|
- = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the macro `run_once` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: label name `'x` shadows a label name that is already in scope
--> $DIR/hygienic-labels.rs:24:9
LL | run_once!(continue 'x);
| ----------------------- in this macro invocation
|
- = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the macro `run_once` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: label name `'x` shadows a label name that is already in scope
--> $DIR/hygienic-labels.rs:24:9
LL | run_once!(continue 'x);
| ----------------------- in this macro invocation
|
- = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the macro `run_once` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: label name `'x` shadows a label name that is already in scope
--> $DIR/hygienic-labels.rs:24:9
LL | run_once!(continue 'x);
| ----------------------- in this macro invocation
|
- = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the macro `run_once` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: label name `'x` shadows a label name that is already in scope
--> $DIR/hygienic-labels.rs:24:9
LL | run_once!(continue 'x);
| ----------------------- in this macro invocation
|
- = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the macro `run_once` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: label name `'x` shadows a label name that is already in scope
--> $DIR/hygienic-labels.rs:24:9
LL | run_once!(continue 'x);
| ----------------------- in this macro invocation
|
- = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the macro `run_once` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: 28 warnings emitted
LL | foo::m!();
| ---------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `foo::m` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | assert_eq!(intercrate::foo::m!(), 1);
| ^^^^^^^^^^^^^^^^^^^^^ private type
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `intercrate::foo::m` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | | }
| |_____- this function has a `self` parameter, but a macro invocation can only access identifiers it receives from parameters
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `call_bar` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | Vec::new();
| ^^^ not found in this scope
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `::bar::m` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider importing this struct
|
LL | use std::vec::Vec;
= help: items from traits can only be used if the trait is in scope
= note: the following trait is implemented but not in scope; perhaps add a `use` for it:
`use std::clone::Clone;`
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `::bar::m` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors
...
LL | foo::m!();
| ---------- in this macro invocation
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `foo::m` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
= help: items from traits can only be used if the trait is in scope
= note: the following trait is implemented but not in scope; perhaps add a `use` for it:
`use foo::T;`
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `::baz::m` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | define_std_as_non_existent!();
| ------------------------------ in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `define_std_as_non_existent` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0433]: failed to resolve: use of undeclared crate or module `two_macros`
--> $DIR/extern-prelude-extern-crate-fail.rs:10:9
LL | define_other_core!();
| --------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `define_other_core` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0659]: `Vec` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution)
--> $DIR/extern-prelude-extern-crate-restricted-shadowing.rs:13:9
|
LL | pub use super::v1::*;
| ^^^^^^^^^^^^
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `define_vec` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors
LL | m!();
| ^^^^^
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | import! { a::b::c }
| ------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `import` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | import! { a::b::c }
| ------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `import` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | use inner1::*;
| ^^^^^^^^^
= help: consider adding an explicit import of `exported` to disambiguate
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `define_exported` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0659]: `exported` is ambiguous (glob import vs macro-expanded name in the same module during import/macro resolution)
--> $DIR/local-modularized-tricky-fail-1.rs:28:1
LL | use inner1::*;
| ^^^^^^^^^
= help: consider adding an explicit import of `exported` to disambiguate
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `define_exported` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0659]: `panic` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution)
--> $DIR/local-modularized-tricky-fail-1.rs:36:5
LL | define_panic!();
| ---------------- in this macro invocation
= help: use `crate::panic` to refer to this macro unambiguously
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `define_panic` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0659]: `include` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution)
--> $DIR/local-modularized-tricky-fail-1.rs:47:1
LL | define_include!();
| ------------------ in this macro invocation
= help: use `crate::include` to refer to this macro unambiguously
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `define_include` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 4 previous errors
...
LL | define_exported!();
| ------------------- in this macro invocation
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `define_exported` (in Nightly builds, run with -Z macro-backtrace for more info)
error: macro-expanded `macro_export` macros from the current crate cannot be referred to by absolute paths
--> $DIR/local-modularized-tricky-fail-2.rs:19:5
...
LL | define_exported!();
| ------------------- in this macro invocation
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `define_exported` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors
LL | } }
LL | m!();
| ----- in this macro invocation
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0659]: `n` is ambiguous (glob import vs any other name from outer scope during import/macro resolution)
--> $DIR/shadow_builtin_macros.rs:49:5
LL | autowrapper!(Autowrapped, autowrap_gift, 'a);
| --------------------------------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `autowrapper` (in Nightly builds, run with -Z macro-backtrace for more info)
error: hidden lifetime parameters in types are deprecated
--> $DIR/elided-lifetimes.rs:78:18
LL | let yellow: anytuple_ref_ty!(bool, &str) = laughter.borrow();
| ---------------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `anytuple_ref_ty` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 7 previous errors
|
= note: expected reference `&[u8]`
found reference `&'static str`
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `include_str` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0308]: mismatched types
--> $DIR/mismatched-types.rs:3:19
|
= note: expected reference `&str`
found reference `&'static [u8; 0]`
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `include_bytes` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors
| ------------ in this macro invocation
|
= help: consider adding a `#![recursion_limit="256"]` attribute to your crate (`infinite_macro_expansion`)
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `recursive` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: add `#![feature(function)]` to the crate attributes to enable
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `call_unstable_noallow` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0658]: use of unstable library feature 'struct_field'
--> $DIR/internal-unstable-noallow.rs:18:5
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: add `#![feature(struct_field)]` to the crate attributes to enable
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `construct_unstable_noallow` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0658]: use of unstable library feature 'method'
--> $DIR/internal-unstable-noallow.rs:20:35
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= help: add `#![feature(method)]` to the crate attributes to enable
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `call_method_noallow` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0658]: use of unstable library feature 'struct2_field'
--> $DIR/internal-unstable-noallow.rs:22:35
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: add `#![feature(struct2_field)]` to the crate attributes to enable
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `access_field_noallow` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 4 previous errors
| ------------------------------------ in this macro invocation
|
= help: add `#![feature(function)]` to the crate attributes to enable
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 5 previous errors
--- /dev/null
+error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
+ --> $DIR/unchecked_math_unsafe.rs:8:15
+ |
+LL | let add = std::intrinsics::unchecked_add(x, y);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
+ --> $DIR/unchecked_math_unsafe.rs:9:15
+ |
+LL | let sub = std::intrinsics::unchecked_sub(x, y);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
+ --> $DIR/unchecked_math_unsafe.rs:10:15
+ |
+LL | let mul = std::intrinsics::unchecked_mul(x, y);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0133`.
+// revisions: mir thir
+// [thir]compile-flags: -Z thir-unsafeck
+
#![feature(core_intrinsics)]
fn main() {
+++ /dev/null
-error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
- --> $DIR/unchecked_math_unsafe.rs:5:15
- |
-LL | let add = std::intrinsics::unchecked_add(x, y);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
- |
- = note: consult the function's documentation for information on how to avoid undefined behavior
-
-error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
- --> $DIR/unchecked_math_unsafe.rs:6:15
- |
-LL | let sub = std::intrinsics::unchecked_sub(x, y);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
- |
- = note: consult the function's documentation for information on how to avoid undefined behavior
-
-error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
- --> $DIR/unchecked_math_unsafe.rs:7:15
- |
-LL | let mul = std::intrinsics::unchecked_mul(x, y);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
- |
- = note: consult the function's documentation for information on how to avoid undefined behavior
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0133`.
--- /dev/null
+error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
+ --> $DIR/unchecked_math_unsafe.rs:8:15
+ |
+LL | let add = std::intrinsics::unchecked_add(x, y);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
+ --> $DIR/unchecked_math_unsafe.rs:9:15
+ |
+LL | let sub = std::intrinsics::unchecked_sub(x, y);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
+ --> $DIR/unchecked_math_unsafe.rs:10:15
+ |
+LL | let mul = std::intrinsics::unchecked_mul(x, y);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0133`.
+++ /dev/null
-#![feature(rustc_attrs)]
-
-#[rustc_args_required_const(0)] //~ ERROR index exceeds number of arguments
-fn foo1() {}
-
-#[rustc_args_required_const(1)] //~ ERROR index exceeds number of arguments
-fn foo2(_: u8) {}
-
-#[rustc_args_required_const(a)] //~ ERROR arguments should be non-negative integers
-fn foo4() {}
-
-#[rustc_args_required_const(1, a, 2, b)] //~ ERROR arguments should be non-negative integers
-fn foo5(_: u8, _: u8, _: u8) {}
-
-#[rustc_args_required_const(0)] //~ ERROR attribute should be applied to a function
-struct S;
-
-#[rustc_args_required_const(0usize)] //~ ERROR suffixed literals are not allowed in attributes
-fn foo6(_: u8) {}
-
-extern {
- #[rustc_args_required_const(1)] //~ ERROR index exceeds number of arguments
- fn foo7(_: u8);
-}
-
-#[rustc_args_required_const] //~ ERROR malformed `rustc_args_required_const` attribute
-fn bar1() {}
-
-#[rustc_args_required_const = 1] //~ ERROR malformed `rustc_args_required_const` attribute
-fn bar2() {}
-
-fn main() {}
+++ /dev/null
-error: suffixed literals are not allowed in attributes
- --> $DIR/invalid-rustc_args_required_const-arguments.rs:18:29
- |
-LL | #[rustc_args_required_const(0usize)]
- | ^^^^^^
- |
- = help: instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.)
-
-error: malformed `rustc_args_required_const` attribute input
- --> $DIR/invalid-rustc_args_required_const-arguments.rs:26:1
- |
-LL | #[rustc_args_required_const]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[rustc_args_required_const(N)]`
-
-error: malformed `rustc_args_required_const` attribute input
- --> $DIR/invalid-rustc_args_required_const-arguments.rs:29:1
- |
-LL | #[rustc_args_required_const = 1]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[rustc_args_required_const(N)]`
-
-error: index exceeds number of arguments
- --> $DIR/invalid-rustc_args_required_const-arguments.rs:3:29
- |
-LL | #[rustc_args_required_const(0)]
- | ^ there are only 0 arguments
-
-error: index exceeds number of arguments
- --> $DIR/invalid-rustc_args_required_const-arguments.rs:6:29
- |
-LL | #[rustc_args_required_const(1)]
- | ^ there is only 1 argument
-
-error: arguments should be non-negative integers
- --> $DIR/invalid-rustc_args_required_const-arguments.rs:9:29
- |
-LL | #[rustc_args_required_const(a)]
- | ^
-
-error: arguments should be non-negative integers
- --> $DIR/invalid-rustc_args_required_const-arguments.rs:12:32
- |
-LL | #[rustc_args_required_const(1, a, 2, b)]
- | ^ ^
-
-error: attribute should be applied to a function
- --> $DIR/invalid-rustc_args_required_const-arguments.rs:15:1
- |
-LL | #[rustc_args_required_const(0)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-LL | struct S;
- | --------- not a function
-
-error: index exceeds number of arguments
- --> $DIR/invalid-rustc_args_required_const-arguments.rs:22:33
- |
-LL | #[rustc_args_required_const(1)]
- | ^ there is only 1 argument
-
-error: aborting due to 9 previous errors
-
pub fn make_bar() -> Bar {
Bar(1, 12, 10)
}
+
+mod inner {
+ pub struct Foo(u8, pub u8, u8);
+
+ impl Foo {
+ pub fn new() -> Foo {
+ Foo(1, 12, 10)
+ }
+ }
+}
+
+pub use inner::Foo;
LL | fn bar(x: isize) { }
| ^^^^^^^^^^^^^^^^^^^^ expected `isize`, found `&mut Bencher`
|
- = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the attribute macro `bench` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
|
= note: expected array `[u32; 256]`
found struct `Vec<_>`
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
| ^^^^^^^^^^^^^^ cannot apply unary operator `!`
|
= note: an implementation of `std::ops::Not` might be missing for `BytePos`
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | assert!(1,1);
| ^^^^^^^^^^^^^ expected `bool`, found integer
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | println!("{}", f!());
| ---- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `f` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0425]: cannot find value `n` in this scope
--> $DIR/issue-15167.rs:3:25
LL | println!("{}", f!());
| ---- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `f` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0425]: cannot find value `n` in this scope
--> $DIR/issue-15167.rs:3:25
LL | println!("{}", f!());
| ---- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `f` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0425]: cannot find value `n` in this scope
--> $DIR/issue-15167.rs:3:25
LL | println!("{}", f!());
| ---- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `f` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 4 previous errors
| ------------ in this macro invocation
|
= help: consider adding a `#![recursion_limit="256"]` attribute to your crate (`issue_16098`)
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `prob1` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | panic!(std::default::Default::default());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type for type parameter `M` declared on the function `begin_panic`
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | fn hash<H: Hasher>(&self, state: &mut H);
| - required by this bound in `std::hash::Hash::hash`
|
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | foo!(a);
| -------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0599]: no method named `foo` found for type `i32` in the current scope
--> $DIR/issue-25385.rs:10:15
LL | println!("{}", check_ptr_exist!(item, name));
| ---------------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `check_ptr_exist` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0616]: field `name` of struct `CObj` is private
--> $DIR/issue-25386.rs:26:43
| | cannot assign to this expression
| in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `not_a_place` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0067]: invalid left-hand side of assignment
--> $DIR/issue-26093.rs:5:16
| | cannot assign to this expression
| in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `not_a_place` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors
LL | struct Bar(Foo);
| --- this field does not implement `Copy`
|
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
| | temporary value created here
| returns a value referencing data owned by the current function
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `format_args` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0515]: cannot return reference to temporary value
--> $DIR/issue-27592.rs:16:14
LL | write(|| format_args!("{}", String::from("Hello world")));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returns a reference to data owned by the current function
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `format_args` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors
--- /dev/null
+error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
+ --> $DIR/issue-28776.rs:7:5
+ |
+LL | (&ptr::write)(1 as *mut _, 42);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0133`.
+// revisions: mir thir
+// [thir]compile-flags: -Z thir-unsafeck
+
use std::ptr;
fn main() {
+++ /dev/null
-error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
- --> $DIR/issue-28776.rs:4:5
- |
-LL | (&ptr::write)(1 as *mut _, 42);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
- |
- = note: consult the function's documentation for information on how to avoid undefined behavior
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0133`.
--- /dev/null
+error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
+ --> $DIR/issue-28776.rs:7:5
+ |
+LL | (&ptr::write)(1 as *mut _, 42);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0133`.
LL | foo!(0u8);
| ---------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
--- /dev/null
+error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
+ --> $DIR/issue-3080.rs:10:5
+ |
+LL | X(()).with();
+ | ^^^^^^^^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0133`.
+// revisions: mir thir
+// [thir]compile-flags: -Z thir-unsafeck
+
struct X(());
impl X {
pub unsafe fn with(&self) { }
+++ /dev/null
-error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
- --> $DIR/issue-3080.rs:7:5
- |
-LL | X(()).with();
- | ^^^^^^^^^^^^ call to unsafe function
- |
- = note: consult the function's documentation for information on how to avoid undefined behavior
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0133`.
--- /dev/null
+error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
+ --> $DIR/issue-3080.rs:10:5
+ |
+LL | X(()).with();
+ | ^^^^^^^^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0133`.
LL | log!(context, "entered wrapper");
| --------------------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `log` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | foo!();
| ------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
error: cannot find attribute `derive_Clone` in this scope
--> $DIR/issue-32655.rs:15:7
| ------- in this macro invocation
|
= help: add `#![feature(allow_internal_unstable)]` to the crate attributes to enable
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | concat_idents!(Foo, Bar)
| ^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `concat_idents` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors
|
= help: the trait `PartialOrd` is not implemented for `Comparable`
= note: required by `std::cmp::PartialOrd::partial_cmp`
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
+++ /dev/null
-// run-pass
-// ignore-emscripten FIXME(#45351)
-
-#![feature(platform_intrinsics, repr_simd)]
-
-extern "platform-intrinsic" {
- fn simd_shuffle2<T, U>(x: T, y: T, idx: [u32; 2]) -> U;
-}
-
-#[repr(simd)]
-#[derive(Clone, Copy)]
-#[allow(non_camel_case_types)]
-struct u64x2(u64, u64);
-
-fn main() {
- let a = u64x2(1, 2);
- let r: u64x2 = unsafe { simd_shuffle2(a, a, [0-0, 0-0]) };
- assert_eq!(r.0, 1);
- assert_eq!(r.1, 1);
-}
|
LL | impl<T: NotNull> IntoNullable for T {
| ^^^^^^^^^^^^ ^
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | get_opt!(bar, foo);
| ------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `get_opt` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | is_plainly_printable!(c);
| ------------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `is_plainly_printable` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
error[E0621]: explicit lifetime required in the type of `x`
--> $DIR/issue-46983.rs:2:5
|
-LL | fn foo(x: &u32) -> &'static u32 {
- | ---- help: add explicit lifetime `'static` to the type of `x`: `&'static u32`
LL | &*x
| ^^^ lifetime `'static` required
--- /dev/null
+error: unnecessary `unsafe` block
+ --> $DIR/issue-48131.rs:12:9
+ |
+LL | unsafe { /* unnecessary */ }
+ | ^^^^^^ unnecessary `unsafe` block
+ |
+note: the lint level is defined here
+ --> $DIR/issue-48131.rs:6:9
+ |
+LL | #![deny(unused_unsafe)]
+ | ^^^^^^^^^^^^^
+
+error: unnecessary `unsafe` block
+ --> $DIR/issue-48131.rs:23:13
+ |
+LL | unsafe { /* unnecessary */ }
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: aborting due to 2 previous errors
+
+// revisions: mir thir
+// [thir]compile-flags: -Z thir-unsafeck
+
// This note is annotated because the purpose of the test
// is to ensure that certain other notes are not generated.
#![deny(unused_unsafe)] //~ NOTE
+++ /dev/null
-error: unnecessary `unsafe` block
- --> $DIR/issue-48131.rs:9:9
- |
-LL | unsafe { /* unnecessary */ }
- | ^^^^^^ unnecessary `unsafe` block
- |
-note: the lint level is defined here
- --> $DIR/issue-48131.rs:3:9
- |
-LL | #![deny(unused_unsafe)]
- | ^^^^^^^^^^^^^
-
-error: unnecessary `unsafe` block
- --> $DIR/issue-48131.rs:20:13
- |
-LL | unsafe { /* unnecessary */ }
- | ^^^^^^ unnecessary `unsafe` block
-
-error: aborting due to 2 previous errors
-
--- /dev/null
+error: unnecessary `unsafe` block
+ --> $DIR/issue-48131.rs:12:9
+ |
+LL | unsafe { /* unnecessary */ }
+ | ^^^^^^ unnecessary `unsafe` block
+ |
+note: the lint level is defined here
+ --> $DIR/issue-48131.rs:6:9
+ |
+LL | #![deny(unused_unsafe)]
+ | ^^^^^^^^^^^^^
+
+error: unnecessary `unsafe` block
+ --> $DIR/issue-48131.rs:23:13
+ |
+LL | unsafe { /* unnecessary */ }
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: aborting due to 2 previous errors
+
|
= note: expected reference `&[u8]`
found reference `&'static str`
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `stringify` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
| ------------------------------------------- first implementation here
|
= note: upstream crates may add a new impl of trait `std::clone::Clone` for type `[_]` in future versions
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
| |
| this field does not implement `Copy`
|
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 4 previous errors
| -------------------- in this macro invocation
|
= note: if you intended to print `{`, you can escape it using `{{`
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `macro_with_error` (in Nightly builds, run with -Z macro-backtrace for more info)
error: invalid format string: unmatched `}` found
--> $DIR/issue-51848.rs:18:15
|
LL | fn f() {}
| ^
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `impl_add` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0107]: this associated function takes 0 generic arguments but 1 generic argument was supplied
--> $DIR/issue-53251.rs:11:20
|
LL | fn f() {}
| ^
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `impl_add` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors
--- /dev/null
+error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
+ --> $DIR/issue-5844.rs:8:5
+ |
+LL | issue_5844_aux::rand();
+ | ^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0133`.
//aux-build:issue-5844-aux.rs
+// revisions: mir thir
+// [thir]compile-flags: -Z thir-unsafeck
extern crate issue_5844_aux;
+++ /dev/null
-error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
- --> $DIR/issue-5844.rs:6:5
- |
-LL | issue_5844_aux::rand();
- | ^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
- |
- = note: consult the function's documentation for information on how to avoid undefined behavior
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0133`.
--- /dev/null
+error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
+ --> $DIR/issue-5844.rs:8:5
+ |
+LL | issue_5844_aux::rand();
+ | ^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0133`.
| fn(usize) -> Foo {Foo::Bar}
| fn(usize) -> Foo {Foo::Bar}
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: `fn(usize) -> Foo {Foo::Bar}` doesn't implement `Debug`
--> $DIR/issue-59488.rs:30:5
| ---------- required by this bound in `core::panicking::assert_failed`
|
= help: the trait `Debug` is not implemented for `fn(usize) -> Foo {Foo::Bar}`
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 9 previous errors
LL | e!(foo);
| -------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `e` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | g!(foo);
| -------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `g` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | x!(if);
| ------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `x` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors
| |_- in this macro invocation
|
= note: `A` must be defined only once in the value namespace of this module
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `suite` (in Nightly builds, run with -Z macro-backtrace for more info)
error: missing type for `const` item
--> $DIR/issue-69396-const-no-type-in-macro.rs:4:19
LL | | }
| |_- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `suite` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
--> $DIR/issue-69396-const-no-type-in-macro.rs:4:19
LL | | }
| |_- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `suite` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 3 previous errors
| {integer}
| help: you might have forgotten to call this function: `*left_val()`
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0308]: mismatched types
--> $DIR/issue-70724-add_type_neq_err_label-unwrap.rs:6:5
|
= note: expected fn item `fn() -> i32 {a}`
found type `i32`
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: `fn() -> i32 {a}` doesn't implement `Debug`
--> $DIR/issue-70724-add_type_neq_err_label-unwrap.rs:6:5
|
= help: the trait `Debug` is not implemented for `fn() -> i32 {a}`
= help: use parentheses to call the function: `a()`
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 3 previous errors
extern crate issue_75907 as a;
-use a::{make_bar, Bar};
+use a::{make_bar, Bar, Foo};
fn main() {
let Bar(x, y, z) = make_bar();
//~^ ERROR cannot match against a tuple struct which contains private fields
+
+ let Foo(x, y, z) = Foo::new();
+ //~^ ERROR cannot match against a tuple struct which contains private fields
}
--> $DIR/issue-75907_b.rs:9:9
|
LL | let Bar(x, y, z) = make_bar();
- | ^^^ constructor is not visible here due to private fields
+ | ^^^
+ |
+note: constructor is not visible here due to private fields
+ --> $DIR/issue-75907_b.rs:9:16
+ |
+LL | let Bar(x, y, z) = make_bar();
+ | ^ ^ private field
+ | |
+ | private field
+
+error[E0532]: cannot match against a tuple struct which contains private fields
+ --> $DIR/issue-75907_b.rs:12:9
+ |
+LL | let Foo(x, y, z) = Foo::new();
+ | ^^^
+ |
+note: constructor is not visible here due to private fields
+ --> $DIR/issue-75907_b.rs:12:13
+ |
+LL | let Foo(x, y, z) = Foo::new();
+ | ^ ^ private field
+ | |
+ | private field
-error: aborting due to previous error
+error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0532`.
| - borrow later used here
|
= note: consider using a `let` binding to create a longer lived value
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
|
LL | #![deny(deprecated)]
| ^^^^^^^^^^
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `macro_test` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
|
LL | #![deny(deprecated)]
| ^^^^^^^^^^
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `macro_test_arg_nested` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
| ------------------ in this macro invocation
|
= note: the linker's behavior with multiple libraries exporting duplicate symbol names is undefined and Rust cannot provide guarantees when you manually override them
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `unsafe_in_macro` (in Nightly builds, run with -Z macro-backtrace for more info)
error: declaration of a `no_mangle` static
--> $DIR/lint-unsafe-code.rs:22:9
| ------------------ in this macro invocation
|
= note: the linker's behavior with multiple libraries exporting duplicate symbol names is undefined and Rust cannot provide guarantees when you manually override them
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `unsafe_in_macro` (in Nightly builds, run with -Z macro-backtrace for more info)
error: declaration of a function with `export_name`
--> $DIR/lint-unsafe-code.rs:23:9
| ------------------ in this macro invocation
|
= note: the linker's behavior with multiple libraries exporting duplicate symbol names is undefined and Rust cannot provide guarantees when you manually override them
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `unsafe_in_macro` (in Nightly builds, run with -Z macro-backtrace for more info)
error: declaration of a static with `export_name`
--> $DIR/lint-unsafe-code.rs:25:9
| ------------------ in this macro invocation
|
= note: the linker's behavior with multiple libraries exporting duplicate symbol names is undefined and Rust cannot provide guarantees when you manually override them
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `unsafe_in_macro` (in Nightly builds, run with -Z macro-backtrace for more info)
error: usage of an `unsafe` block
--> $DIR/lint-unsafe-code.rs:27:9
LL | unsafe_in_macro!()
| ------------------ in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `unsafe_in_macro` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 22 previous errors
|
LL | #![warn(unused_imports)]
| ^^^^^^^^^^^^^^
- = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: unused import: `std::string::ToString`
--> $DIR/lints-in-foreign-macros.rs:16:18
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #79813 <https://github.com/rust-lang/rust/issues/79813>
- = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: trailing semicolon in macro used in expression position
--> $DIR/semicolon-in-expressions-from-macros.rs:8:13
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #79813 <https://github.com/rust-lang/rust/issues/79813>
- = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: 2 warnings emitted
| ^^^^^^^
|
= note: requested on the command line with `-D unnameable-test-items`
- = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the attribute macro `test` (in Nightly builds, run with -Z macro-backtrace for more info)
error: cannot test inner items
--> $DIR/test-inner-fn.rs:13:9
LL | #[test]
| ^^^^^^^
|
- = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the attribute macro `test` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #82523 <https://github.com/rust-lang/rust/issues/82523>
= 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)
+ = note: this error originates in the macro `unaligned_references_external_crate::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
| in this macro invocation
|
= help: or consider exporting it for use by other crates
- = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the macro `define_empty_struct_with_visibility` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: unreachable `pub` item
--> $DIR/unreachable_pub-pub_crate.rs:45:9
| in this macro invocation
|
= help: or consider exporting it for use by other crates
- = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the macro `define_empty_struct_with_visibility` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: unreachable `pub` item
--> $DIR/unreachable_pub.rs:41:9
LL | test!();
| -------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `test` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0308]: mismatched types
--> $DIR/liveness-return-last-stmt-semi.rs:7:19
LL | llvm_asm!("" :"={rax"(rax))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `llvm_asm` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0668]: malformed inline assembly
--> $DIR/inline-asm-bad-constraint.rs:30:9
LL | llvm_asm!("callq $0" : : "0"(foo))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `llvm_asm` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0668]: malformed inline assembly
--> $DIR/inline-asm-bad-constraint.rs:37:9
LL | llvm_asm!("addb $1, $0" : "={rax}"((0i32, rax)));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `llvm_asm` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 3 previous errors
LL | llvm_asm!("nop" : "+r"("r15"));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `llvm_asm` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | pong!();
| -------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `pong` (in Nightly builds, run with -Z macro-backtrace for more info)
error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `error`
--> $DIR/main.rs:10:20
LL | ping!();
| -------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `pong` (in Nightly builds, run with -Z macro-backtrace for more info)
error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `error`
--> $DIR/main.rs:10:20
LL | deep!();
| -------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `pong` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 3 previous errors
LL | debug_assert!();
| ^^^^^^^^^^^^^^^^ boolean expression required
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `debug_assert` (in Nightly builds, run with -Z macro-backtrace for more info)
error: expected expression, found keyword `struct`
--> $DIR/assert.rs:5:19
LL | cfg!();
| ^^^^^^^ cfg-pattern required
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `cfg` (in Nightly builds, run with -Z macro-backtrace for more info)
error: expected identifier, found `123`
--> $DIR/cfg.rs:3:10
LL | format_args!(hang!());
| ------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `hang` (in Nightly builds, run with -Z macro-backtrace for more info)
help: you might be missing a string literal to format with
|
LL | format_args!("{}", hang!());
LL | format!();
| ^^^^^^^^^^
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::__export::format_args` (in Nightly builds, run with -Z macro-backtrace for more info)
error: expected expression, found keyword `struct`
--> $DIR/format-parse-errors.rs:5:13
#![feature(global_asm)]
fn main() {
- global_asm!(); //~ ERROR requires a string literal as an argument
+ global_asm!(); //~ ERROR requires at least a template string argument
global_asm!(struct); //~ ERROR expected expression
- global_asm!(123); //~ ERROR inline assembly must be a string literal
+ global_asm!(123); //~ ERROR asm template must be a string literal
}
-error: macro requires a string literal as an argument
+error: requires at least a template string argument
--> $DIR/global-asm.rs:4:5
|
LL | global_asm!();
- | ^^^^^^^^^^^^^^ string literal required
+ | ^^^^^^^^^^^^^^
error: expected expression, found keyword `struct`
--> $DIR/global-asm.rs:5:17
LL | global_asm!(struct);
| ^^^^^^ expected expression
-error: inline assembly must be a string literal
+error: asm template must be a string literal
--> $DIR/global-asm.rs:6:17
|
LL | global_asm!(123);
| ------------- in this macro invocation
|
= note: the macro call doesn't expand to an expression, but it can expand to a statement
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `make_item` (in Nightly builds, run with -Z macro-backtrace for more info)
help: add `;` to interpret the expansion as a statement
|
LL | make_item!(A);
| ------------- in this macro invocation
|
= note: the macro call doesn't expand to an expression, but it can expand to a statement
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `make_item` (in Nightly builds, run with -Z macro-backtrace for more info)
help: add `;` to interpret the expansion as a statement
|
LL | make_item!(B);
LL | define_other_core!();
| --------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `define_other_core` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #79813 <https://github.com/rust-lang/rust/issues/79813>
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `len` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | fake_method_stmt!();
| -------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `fake_method_stmt` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> $DIR/macro-backtrace-invalid-internals.rs:11:13
LL | fake_field_stmt!();
| ------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `fake_field_stmt` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> $DIR/macro-backtrace-invalid-internals.rs:17:15
LL | fake_anon_field_stmt!();
| ------------------------ in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `fake_anon_field_stmt` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0689]: can't call method `neg` on ambiguous numeric type `{float}`
--> $DIR/macro-backtrace-invalid-internals.rs:41:15
LL | real_method_stmt!();
| -------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `real_method_stmt` (in Nightly builds, run with -Z macro-backtrace for more info)
help: you must specify a concrete type for this numeric value, like `f32`
|
LL | 2.0_f32.neg()
LL | let _ = fake_method_expr!();
| ------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `fake_method_expr` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> $DIR/macro-backtrace-invalid-internals.rs:29:13
LL | let _ = fake_field_expr!();
| ------------------ in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `fake_field_expr` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> $DIR/macro-backtrace-invalid-internals.rs:35:15
LL | let _ = fake_anon_field_expr!();
| ----------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `fake_anon_field_expr` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0689]: can't call method `neg` on ambiguous numeric type `{float}`
--> $DIR/macro-backtrace-invalid-internals.rs:47:15
LL | let _ = real_method_expr!();
| ------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `real_method_expr` (in Nightly builds, run with -Z macro-backtrace for more info)
help: you must specify a concrete type for this numeric value, like `f32`
|
LL | 2.0_f32.neg()
LL | 1 + call_nested_expr!();
| ------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `nested_expr` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0425]: cannot find value `fake` in this scope
--> $DIR/macro-backtrace-nested.rs:5:12
LL | call_nested_expr_sum!();
| ------------------------ in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `nested_expr` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors
LL | myprintln!("{}");
| ----------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `concat` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | m!();
| ----- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0412]: cannot find type `i` in this scope
--> $DIR/macro-context.rs:3:13
LL | let a: m!();
| ---- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0425]: cannot find value `i` in this scope
--> $DIR/macro-context.rs:3:13
LL | let i = m!();
| ---- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 6 previous errors
LL | br2!('b);
| --------- in this macro invocation
|
- = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the macro `br2` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: 1 warning emitted
|
LL | thread_local!(static baz: f64 = 0.0);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::__thread_local_inner` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
| ------ in this macro invocation
|
= note: macro-expanded `#[macro_use]`s may not shadow existing macros (see RFC 1560)
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `m1` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0659]: `foo` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution)
--> $DIR/macro-shadowing.rs:17:1
|
LL | macro_rules! foo { () => {} }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `m1` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors
LL | #[derive(Default)]
| ^^^^^^^
|
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info)
error: asm template must be a string literal
--> $DIR/macros-nonfatal-errors.rs:13:10
LL | env!("RUST_HOPEFULLY_THIS_DOESNT_EXIST");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `env` (in Nightly builds, run with -Z macro-backtrace for more info)
error: format argument must be a string literal
--> $DIR/macros-nonfatal-errors.rs:23:13
LL | include_str!("i'd be quite surprised if a file with this name existed");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `include_str` (in Nightly builds, run with -Z macro-backtrace for more info)
error: argument must be a string literal
--> $DIR/macros-nonfatal-errors.rs:29:20
LL | include_bytes!("i'd be quite surprised if a file with this name existed");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `include_bytes` (in Nightly builds, run with -Z macro-backtrace for more info)
error: trace_macros! accepts only `true` or `false`
--> $DIR/macros-nonfatal-errors.rs:32:5
|
= note: `-W unused-must-use` implied by `-W unused`
= note: this `Result` may be an `Err` variant, which should be handled
- = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the macro `write` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: 1 warning emitted
LL | complex_nonterminal!(enum E {});
| -------------------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `complex_nonterminal` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | include!("not-utf8.bin")
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `include` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
...
LL | include!();
| ----------- in this macro invocation
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `gen_gen_inner_invoc` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution)
--> $DIR/restricted-shadowing-legacy.rs:139:42
...
LL | include!();
| ----------- in this macro invocation
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `gen_invoc` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution)
--> $DIR/restricted-shadowing-legacy.rs:148:9
...
LL | include!();
| ----------- in this macro invocation
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `include` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution)
--> $DIR/restricted-shadowing-legacy.rs:164:9
...
LL | include!();
| ----------- in this macro invocation
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `include` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution)
--> $DIR/restricted-shadowing-legacy.rs:180:13
...
LL | include!();
| ----------- in this macro invocation
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `gen_gen_inner_invoc` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution)
--> $DIR/restricted-shadowing-legacy.rs:218:42
...
LL | include!();
| ----------- in this macro invocation
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `gen_invoc` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution)
--> $DIR/restricted-shadowing-legacy.rs:232:9
...
LL | include!();
| ----------- in this macro invocation
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `include` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution)
--> $DIR/restricted-shadowing-legacy.rs:262:42
...
LL | include!();
| ----------- in this macro invocation
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `gen_invoc` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 8 previous errors
...
LL | include!();
| ----------- in this macro invocation
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `gen_gen_inner_invoc` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution)
--> $DIR/restricted-shadowing-modern.rs:147:33
...
LL | include!();
| ----------- in this macro invocation
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `gen_invoc` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution)
--> $DIR/restricted-shadowing-modern.rs:156:13
...
LL | include!();
| ----------- in this macro invocation
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `include` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution)
--> $DIR/restricted-shadowing-modern.rs:172:13
...
LL | include!();
| ----------- in this macro invocation
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `include` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution)
--> $DIR/restricted-shadowing-modern.rs:190:17
...
LL | include!();
| ----------- in this macro invocation
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `gen_gen_inner_invoc` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution)
--> $DIR/restricted-shadowing-modern.rs:233:33
...
LL | include!();
| ----------- in this macro invocation
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `gen_invoc` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 6 previous errors
| |_________________________________^ not allowed after `expr` fragments
|
= note: allowed there are: `=>`, `,` or `;`
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `proc_macro_sequence::make_foo` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `$x:expr` may be followed by `=`, which is not allowed for `expr` fragments
--> $DIR/same-sequence-span.rs:19:1
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not allowed after `expr` fragments
|
= note: allowed there are: `=>`, `,` or `;`
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `proc_macro_sequence::make_foo` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 4 previous errors
LL | bad!(foo whatever);
| ------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `bad` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | my_faulty_macro!();
| ------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `my_faulty_macro` (in Nightly builds, run with -Z macro-backtrace for more info)
note: trace_macro
--> $DIR/trace_faulty_macros.rs:31:5
| ---------------------- in this macro invocation
|
= help: consider adding a `#![recursion_limit="8"]` attribute to your crate (`trace_faulty_macros`)
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `my_recursive_macro` (in Nightly builds, run with -Z macro-backtrace for more info)
note: trace_macro
--> $DIR/trace_faulty_macros.rs:32:5
LL | let a = pat_macro!();
| ------------ in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `pat_macro` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0774]: `derive` may only be applied to structs, enums and unions
--> $DIR/trace_faulty_macros.rs:42:1
LL | Some(vec![43]) => {}
| ^^^^^^^^
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | pub trait Copy: Clone {
| ----- required by this bound in `Copy`
|
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `Test2: Clone` is not satisfied
--> $DIR/malformed-derive-entry.rs:6:10
LL | pub trait Copy: Clone {
| ----- required by this bound in `Copy`
|
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 5 previous errors
--- /dev/null
+#[non_exhaustive]
+pub enum E1 {}
+
+#[non_exhaustive]
+pub enum E2 { A, B }
--- /dev/null
+// aux-build:match_non_exhaustive_lib.rs
+
+/* The error message for non-exhaustive matches on non-local enums
+ * marked as non-exhaustive should mention the fact that the enum
+ * is marked as non-exhaustive (issue #85227).
+ */
+
+// Ignore non_exhaustive in the same crate
+#[non_exhaustive]
+enum L { A, B }
+
+extern crate match_non_exhaustive_lib;
+use match_non_exhaustive_lib::{E1, E2};
+
+fn foo() -> L {todo!()}
+fn bar() -> (E1, E2) {todo!()}
+
+fn main() {
+ let l = foo();
+ // No error for enums defined in this crate
+ match l { L::A => (), L::B => () };
+ // (except if the match is already non-exhaustive)
+ match l { L::A => () };
+ //~^ ERROR: non-exhaustive patterns: `B` not covered [E0004]
+
+ // E1 is not visibly uninhabited from here
+ let (e1, e2) = bar();
+ match e1 {};
+ //~^ ERROR: non-exhaustive patterns: type `E1` is non-empty [E0004]
+ match e2 { E2::A => (), E2::B => () };
+ //~^ ERROR: non-exhaustive patterns: `_` not covered [E0004]
+}
--- /dev/null
+error[E0004]: non-exhaustive patterns: `B` not covered
+ --> $DIR/match_non_exhaustive.rs:23:11
+ |
+LL | enum L { A, B }
+ | ---------------
+ | | |
+ | | not covered
+ | `L` defined here
+...
+LL | match l { L::A => () };
+ | ^ pattern `B` not covered
+ |
+ = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ = note: the matched value is of type `L`
+
+error[E0004]: non-exhaustive patterns: type `E1` is non-empty
+ --> $DIR/match_non_exhaustive.rs:28:11
+ |
+LL | match e1 {};
+ | ^^
+ |
+ = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ = note: the matched value is of type `E1`, which is marked as non-exhaustive
+
+error[E0004]: non-exhaustive patterns: `_` not covered
+ --> $DIR/match_non_exhaustive.rs:30:11
+ |
+LL | match e2 { E2::A => (), E2::B => () };
+ | ^^ pattern `_` not covered
+ |
+ = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ = note: the matched value is of type `E2`, which is marked as non-exhaustive
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0004`.
LL | write!(hello);
| -------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `write` (in Nightly builds, run with -Z macro-backtrace for more info)
help: you can convert a `usize` to a `u64` and panic if the converted value doesn't fit
|
LL | ($arr.len() * size_of($arr[0])).try_into().unwrap());
LL | cast!(2);
| --------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `cast` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors
--- /dev/null
+#![allow(incomplete_features)]
+#![feature(const_generics_defaults)]
+
+struct X<const N: u8>();
+
+impl X<N> {}
+//~^ ERROR cannot find type `N` in this scope
+//~| ERROR unresolved item provided when a constant was expected
+impl<T, const A: u8 = 2> X<N> {}
+//~^ ERROR cannot find type `N` in this scope
+//~| ERROR defaults for const parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
+//~| ERROR unresolved item provided when a constant was expected
+
+fn foo(_: T) where T: Send {}
+//~^ ERROR cannot find type `T` in this scope
+//~| ERROR cannot find type `T` in this scope
+
+fn bar<const N: u8>(_: A) {}
+//~^ ERROR cannot find type `A` in this scope
+
+fn main() {
+}
--- /dev/null
+error[E0412]: cannot find type `N` in this scope
+ --> $DIR/missing-type-parameter2.rs:6:8
+ |
+LL | struct X<const N: u8>();
+ | ------------------------ similarly named struct `X` defined here
+LL |
+LL | impl X<N> {}
+ | ^
+ |
+help: a struct with a similar name exists
+ |
+LL | impl X<X> {}
+ | ^
+help: you might be missing a type parameter
+ |
+LL | impl<N> X<N> {}
+ | ^^^
+
+error[E0412]: cannot find type `N` in this scope
+ --> $DIR/missing-type-parameter2.rs:9:28
+ |
+LL | impl<T, const A: u8 = 2> X<N> {}
+ | - ^
+ | |
+ | similarly named type parameter `T` defined here
+ |
+help: a type parameter with a similar name exists
+ |
+LL | impl<T, const A: u8 = 2> X<T> {}
+ | ^
+help: you might be missing a type parameter
+ |
+LL | impl<T, const A: u8 = 2, N> X<N> {}
+ | ^^^
+
+error[E0412]: cannot find type `T` in this scope
+ --> $DIR/missing-type-parameter2.rs:14:20
+ |
+LL | struct X<const N: u8>();
+ | ------------------------ similarly named struct `X` defined here
+...
+LL | fn foo(_: T) where T: Send {}
+ | ^
+ |
+help: a struct with a similar name exists
+ |
+LL | fn foo(_: T) where X: Send {}
+ | ^
+help: you might be missing a type parameter
+ |
+LL | fn foo<T>(_: T) where T: Send {}
+ | ^^^
+
+error[E0412]: cannot find type `T` in this scope
+ --> $DIR/missing-type-parameter2.rs:14:11
+ |
+LL | struct X<const N: u8>();
+ | ------------------------ similarly named struct `X` defined here
+...
+LL | fn foo(_: T) where T: Send {}
+ | ^
+ |
+help: a struct with a similar name exists
+ |
+LL | fn foo(_: X) where T: Send {}
+ | ^
+help: you might be missing a type parameter
+ |
+LL | fn foo<T>(_: T) where T: Send {}
+ | ^^^
+
+error[E0412]: cannot find type `A` in this scope
+ --> $DIR/missing-type-parameter2.rs:18:24
+ |
+LL | struct X<const N: u8>();
+ | ------------------------ similarly named struct `X` defined here
+...
+LL | fn bar<const N: u8>(_: A) {}
+ | ^
+ |
+help: a struct with a similar name exists
+ |
+LL | fn bar<const N: u8>(_: X) {}
+ | ^
+help: you might be missing a type parameter
+ |
+LL | fn bar<const N: u8, A>(_: A) {}
+ | ^^^
+
+error[E0747]: unresolved item provided when a constant was expected
+ --> $DIR/missing-type-parameter2.rs:6:8
+ |
+LL | impl X<N> {}
+ | ^
+ |
+help: if this generic argument was intended as a const parameter, surround it with braces
+ |
+LL | impl X<{ N }> {}
+ | ^ ^
+
+error: defaults for const parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
+ --> $DIR/missing-type-parameter2.rs:9:15
+ |
+LL | impl<T, const A: u8 = 2> X<N> {}
+ | ^
+
+error[E0747]: unresolved item provided when a constant was expected
+ --> $DIR/missing-type-parameter2.rs:9:28
+ |
+LL | impl<T, const A: u8 = 2> X<N> {}
+ | ^
+ |
+help: if this generic argument was intended as a const parameter, surround it with braces
+ |
+LL | impl<T, const A: u8 = 2> X<{ N }> {}
+ | ^ ^
+
+error: aborting due to 8 previous errors
+
+Some errors have detailed explanations: E0412, E0747.
+For more information about an error, try `rustc --explain E0412`.
| ------------------------------------------------- in this macro invocation
|
= note: `issue_56411_aux` must be defined only once in the type namespace of this module
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `import` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0365]: `issue_56411_aux` is private, and cannot be re-exported
--> $DIR/issue-56411.rs:6:21
| ------------------------------------------------- in this macro invocation
|
= note: consider declaring type or module `issue_56411_aux` with `pub`
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `import` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors
error[E0621]: explicit lifetime required in the type of `x`
--> $DIR/region-lbr-anon-does-not-outlive-static.rs:9:5
|
-LL | fn foo(x: &u32) -> &'static u32 {
- | ---- help: add explicit lifetime `ReStatic` to the type of `x`: `&ReStatic u32`
LL | &*x
| ^^^ lifetime `ReStatic` required
error[E0621]: explicit lifetime required in the type of `s`
--> $DIR/guarantor-issue-46974.rs:15:5
|
-LL | fn bar(s: &Box<(i32,)>) -> &'static i32 {
- | ------------ help: add explicit lifetime `'static` to the type of `s`: `&'static Box<(i32,)>`
-LL | // FIXME(#46983): error message should be better
LL | &s.0
| ^^^^ lifetime `'static` required
= help: the trait `Debug` is not implemented for `Foo`
= note: add `#[derive(Debug)]` or manually implement `Debug`
= note: required by `std::fmt::Debug::fmt`
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: `Bar` doesn't implement `Debug`
--> $DIR/no-debug.rs:10:32
|
= help: the trait `Debug` is not implemented for `Bar`
= note: required by `std::fmt::Debug::fmt`
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: `Foo` doesn't implement `std::fmt::Display`
--> $DIR/no-debug.rs:11:23
= help: the trait `std::fmt::Display` is not implemented for `Foo`
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
= note: required by `std::fmt::Display::fmt`
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: `Bar` doesn't implement `std::fmt::Display`
--> $DIR/no-debug.rs:11:28
= help: the trait `std::fmt::Display` is not implemented for `Bar`
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
= note: required by `std::fmt::Display::fmt`
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 4 previous errors
LL | (true | false, None | Some(t_or_f!())) => {}
| --------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `t_or_f` (in Nightly builds, run with -Z macro-backtrace for more info)
error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:116:14
|
LL | macro_rules! bar { () => {} }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `define_macro` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | m!({});
| ------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
error: cannot use a `block` macro fragment here
--> $DIR/bad-interpolated-block.rs:8:16
LL | m!({});
| ------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
error: cannot use a `block` macro fragment here
--> $DIR/bad-interpolated-block.rs:9:23
LL | m!({});
| ------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 3 previous errors
LL | generate_field_accesses!(1.1, 1.1, 1.1);
| ---------------------------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `generate_field_accesses` (in Nightly builds, run with -Z macro-backtrace for more info)
error: expected one of `.`, `;`, `?`, `}`, or an operator, found `1.1`
--> $DIR/float-field-interpolated.rs:8:13
LL | generate_field_accesses!(1.1, 1.1, 1.1);
| ---------------------------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `generate_field_accesses` (in Nightly builds, run with -Z macro-backtrace for more info)
error: unexpected token: `1.1`
--> $DIR/float-field-interpolated.rs:10:13
LL | generate_field_accesses!(1.1, 1.1, 1.1);
| ---------------------------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `generate_field_accesses` (in Nightly builds, run with -Z macro-backtrace for more info)
error: expected one of `.`, `;`, `?`, `}`, or an operator, found `1.1`
--> $DIR/float-field-interpolated.rs:10:13
LL | generate_field_accesses!(1.1, 1.1, 1.1);
| ---------------------------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `generate_field_accesses` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 4 previous errors
| ------------------ in this macro invocation
|
= help: consider moving the enum out to a nearby module scope
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `expand_to_enum` (in Nightly builds, run with -Z macro-backtrace for more info)
error: struct is not supported in `trait`s or `impl`s
--> $DIR/issue-48137-macros-cannot-interpolate-impl-items-bad-variants.rs:31:5
| ------------------ in this macro invocation
|
= help: consider moving the enum out to a nearby module scope
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `expand_to_enum` (in Nightly builds, run with -Z macro-backtrace for more info)
error: struct is not supported in `extern` blocks
--> $DIR/issue-48137-macros-cannot-interpolate-impl-items-bad-variants.rs:42:5
| ------------------ in this macro invocation
|
= help: consider moving the enum out to a nearby module scope
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `expand_to_enum` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 6 previous errors
| --------------------------- in this macro invocation
|
= note: `mut` may be followed by `variable` and `variable @ pattern`
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `mac1` (in Nightly builds, run with -Z macro-backtrace for more info)
error: expected identifier, found `does_not_exist!()`
--> $DIR/issue-65122-mac-invoc-in-mut-patterns.rs:13:17
LL | mac2! { does_not_exist!() }
| --------------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `mac2` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `mut` must be followed by a named binding
--> $DIR/issue-65122-mac-invoc-in-mut-patterns.rs:13:13
| --------------------------- in this macro invocation
|
= note: `mut` may be followed by `variable` and `variable @ pattern`
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `mac2` (in Nightly builds, run with -Z macro-backtrace for more info)
error: cannot find macro `does_not_exist` in this scope
--> $DIR/issue-65122-mac-invoc-in-mut-patterns.rs:22:13
LL | mac!('a);
| --------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0423]: expected value, found trait `Send`
--> $DIR/issue-73568-lifetime-after-mut.rs:19:28
LL | m!({});
| ------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
error: labeled expression must be followed by `:`
--> $DIR/labeled-no-colon-expr.rs:16:8
LL | test_macro!(String,);
| --------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `test_macro` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | failed!();
| ---------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `failed` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | ignored_expr!();
| ---------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `ignored_expr` (in Nightly builds, run with -Z macro-backtrace for more info)
error: macro expansion ignores token `,` and any following
--> $DIR/macro-incomplete-parse.rs:16:14
| --------- in this macro invocation
|
= help: try adjusting the macro to put `pub` inside the invocation
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `pub_x` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0603]: static `x` is private
--> $DIR/pub-item-macro.rs:20:23
...
LL | pub_x!();
| --------- in this macro invocation
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_x` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors
| |
| consider giving `v` the explicit type `Vec<T>`, where the type parameter `T` is specified
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0282]: type annotations needed for `Vec<T>`
--> $DIR/missing-closing-angle-bracket-eq-constraint.rs:18:20
| |
| consider giving `v` the explicit type `Vec<T>`, where the type parameter `T` is specified
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 5 previous errors
LL | fn main() { m!(0, 0; 0, 0); }
| --------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | foo!(x);
| -------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 13 previous errors
LL | mac!(0);
| -------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0586]: inclusive range with no end
--> $DIR/recover-range-pats.rs:154:19
| -------- in this macro invocation
|
= note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`)
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0586]: inclusive range with no end
--> $DIR/recover-range-pats.rs:155:19
| -------- in this macro invocation
|
= note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`)
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `...` range patterns are deprecated
--> $DIR/recover-range-pats.rs:42:13
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
= note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165>
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `mac2` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0029]: only `char` and numeric types are allowed in range patterns
--> $DIR/recover-range-pats.rs:20:12
--- /dev/null
+// run-rustfix
+#![allow(dead_code)]
+
+enum E {
+ A,
+}
+
+struct S {
+ field1: i32, //~ ERROR default values on `struct` fields aren't supported
+ field2: E, //~ ERROR default values on `struct` fields aren't supported
+ field3: i32, //~ ERROR default values on `struct` fields aren't supported
+ field4: i32, //~ ERROR default values on `struct` fields aren't supported
+ field5: E, //~ ERROR default values on `struct` fields aren't supported
+ field6: E, //~ ERROR default values on `struct` fields aren't supported
+}
+
+struct S1 {
+ field1: i32, //~ ERROR expected `,`, or `}`, found `field2`
+ field2: E, //~ ERROR expected `,`, or `}`, found `field3`
+ field3: i32, //~ ERROR default values on `struct` fields aren't supported
+ field4: i32, //~ ERROR default values on `struct` fields aren't supported
+ field5: E, //~ ERROR default values on `struct` fields aren't supported
+ field6: E, //~ ERROR default values on `struct` fields aren't supported
+}
+
+struct S2 {
+ field1 : i32, //~ ERROR expected `:`, found `=`
+ field2: E, //~ ERROR expected `:`, found `;`
+}
+
+const fn foo(_: i32) -> E {
+ E::A
+}
+
+fn main() {}
--- /dev/null
+// run-rustfix
+#![allow(dead_code)]
+
+enum E {
+ A,
+}
+
+struct S {
+ field1: i32 = 42, //~ ERROR default values on `struct` fields aren't supported
+ field2: E = E::A, //~ ERROR default values on `struct` fields aren't supported
+ field3: i32 = 1 + 2, //~ ERROR default values on `struct` fields aren't supported
+ field4: i32 = { 1 + 2 }, //~ ERROR default values on `struct` fields aren't supported
+ field5: E = foo(42), //~ ERROR default values on `struct` fields aren't supported
+ field6: E = { foo(42) }, //~ ERROR default values on `struct` fields aren't supported
+}
+
+struct S1 {
+ field1: i32 //~ ERROR expected `,`, or `}`, found `field2`
+ field2: E //~ ERROR expected `,`, or `}`, found `field3`
+ field3: i32 = 1 + 2, //~ ERROR default values on `struct` fields aren't supported
+ field4: i32 = { 1 + 2 }, //~ ERROR default values on `struct` fields aren't supported
+ field5: E = foo(42), //~ ERROR default values on `struct` fields aren't supported
+ field6: E = { foo(42) }, //~ ERROR default values on `struct` fields aren't supported
+}
+
+struct S2 {
+ field1 = i32, //~ ERROR expected `:`, found `=`
+ field2; E, //~ ERROR expected `:`, found `;`
+}
+
+const fn foo(_: i32) -> E {
+ E::A
+}
+
+fn main() {}
--- /dev/null
+error: default values on `struct` fields aren't supported
+ --> $DIR/struct-default-values-and-missing-field-separator.rs:9:16
+ |
+LL | field1: i32 = 42,
+ | ^^^^^ help: remove this unsupported default value
+
+error: default values on `struct` fields aren't supported
+ --> $DIR/struct-default-values-and-missing-field-separator.rs:10:14
+ |
+LL | field2: E = E::A,
+ | ^^^^^^^ help: remove this unsupported default value
+
+error: default values on `struct` fields aren't supported
+ --> $DIR/struct-default-values-and-missing-field-separator.rs:11:16
+ |
+LL | field3: i32 = 1 + 2,
+ | ^^^^^^^^ help: remove this unsupported default value
+
+error: default values on `struct` fields aren't supported
+ --> $DIR/struct-default-values-and-missing-field-separator.rs:12:16
+ |
+LL | field4: i32 = { 1 + 2 },
+ | ^^^^^^^^^^^^ help: remove this unsupported default value
+
+error: default values on `struct` fields aren't supported
+ --> $DIR/struct-default-values-and-missing-field-separator.rs:13:14
+ |
+LL | field5: E = foo(42),
+ | ^^^^^^^^^^ help: remove this unsupported default value
+
+error: default values on `struct` fields aren't supported
+ --> $DIR/struct-default-values-and-missing-field-separator.rs:14:14
+ |
+LL | field6: E = { foo(42) },
+ | ^^^^^^^^^^^^^^ help: remove this unsupported default value
+
+error: expected `,`, or `}`, found `field2`
+ --> $DIR/struct-default-values-and-missing-field-separator.rs:18:16
+ |
+LL | field1: i32
+ | ^ help: try adding a comma: `,`
+
+error: expected `,`, or `}`, found `field3`
+ --> $DIR/struct-default-values-and-missing-field-separator.rs:19:14
+ |
+LL | field2: E
+ | ^ help: try adding a comma: `,`
+
+error: default values on `struct` fields aren't supported
+ --> $DIR/struct-default-values-and-missing-field-separator.rs:20:16
+ |
+LL | field3: i32 = 1 + 2,
+ | ^^^^^^^^ help: remove this unsupported default value
+
+error: default values on `struct` fields aren't supported
+ --> $DIR/struct-default-values-and-missing-field-separator.rs:21:16
+ |
+LL | field4: i32 = { 1 + 2 },
+ | ^^^^^^^^^^^^ help: remove this unsupported default value
+
+error: default values on `struct` fields aren't supported
+ --> $DIR/struct-default-values-and-missing-field-separator.rs:22:14
+ |
+LL | field5: E = foo(42),
+ | ^^^^^^^^^^ help: remove this unsupported default value
+
+error: default values on `struct` fields aren't supported
+ --> $DIR/struct-default-values-and-missing-field-separator.rs:23:14
+ |
+LL | field6: E = { foo(42) },
+ | ^^^^^^^^^^^^^^ help: remove this unsupported default value
+
+error: expected `:`, found `=`
+ --> $DIR/struct-default-values-and-missing-field-separator.rs:27:12
+ |
+LL | field1 = i32,
+ | ^
+ | |
+ | expected `:`
+ | help: field names and their types are separated with `:`
+
+error: expected `:`, found `;`
+ --> $DIR/struct-default-values-and-missing-field-separator.rs:28:11
+ |
+LL | field2; E,
+ | ^
+ | |
+ | expected `:`
+ | help: field names and their types are separated with `:`
+
+error: aborting due to 14 previous errors
+
| --------- in this macro invocation
|
= note: only allowed in tuple, tuple struct, and slice patterns
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `mk_pat` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `..` patterns are not allowed here
--> $DIR/rest-pat-semantic-disallowed.rs:18:9
LL | priv_nominal::mac!();
| --------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_nominal::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `for<'r> fn(&'r priv_nominal::Pub) {priv_nominal::Pub::method}` is private
--> $DIR/associated-item-privacy-inherent.rs:15:9
LL | priv_nominal::mac!();
| --------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_nominal::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `for<'r> fn(&'r priv_nominal::Pub) {priv_nominal::Pub::method}` is private
--> $DIR/associated-item-privacy-inherent.rs:17:13
LL | priv_nominal::mac!();
| --------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_nominal::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: associated constant `CONST` is private
--> $DIR/associated-item-privacy-inherent.rs:19:9
LL | priv_nominal::mac!();
| --------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_nominal::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `priv_signature::Priv` is private
--> $DIR/associated-item-privacy-inherent.rs:37:21
LL | priv_signature::mac!();
| ----------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_signature::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `priv_signature::Priv` is private
--> $DIR/associated-item-privacy-inherent.rs:39:9
LL | priv_signature::mac!();
| ----------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_signature::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `priv_signature::Priv` is private
--> $DIR/associated-item-privacy-inherent.rs:41:13
LL | priv_signature::mac!();
| ----------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_signature::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `priv_substs::Priv` is private
--> $DIR/associated-item-privacy-inherent.rs:57:21
LL | priv_substs::mac!();
| -------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `priv_substs::Priv` is private
--> $DIR/associated-item-privacy-inherent.rs:59:9
LL | priv_substs::mac!();
| -------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `priv_substs::Priv` is private
--> $DIR/associated-item-privacy-inherent.rs:61:9
LL | priv_substs::mac!();
| -------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `priv_parent_substs::Priv` is private
--> $DIR/associated-item-privacy-inherent.rs:80:21
LL | priv_parent_substs::mac!();
| --------------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `priv_parent_substs::Priv` is private
--> $DIR/associated-item-privacy-inherent.rs:82:9
LL | priv_parent_substs::mac!();
| --------------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `priv_parent_substs::Priv` is private
--> $DIR/associated-item-privacy-inherent.rs:84:21
LL | priv_parent_substs::mac!();
| --------------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `priv_parent_substs::Priv` is private
--> $DIR/associated-item-privacy-inherent.rs:86:9
LL | priv_parent_substs::mac!();
| --------------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `priv_parent_substs::Priv` is private
--> $DIR/associated-item-privacy-inherent.rs:88:21
LL | priv_parent_substs::mac!();
| --------------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `priv_parent_substs::Priv` is private
--> $DIR/associated-item-privacy-inherent.rs:90:9
LL | priv_parent_substs::mac!();
| --------------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `priv_parent_substs::Priv` is private
--> $DIR/associated-item-privacy-inherent.rs:92:21
LL | priv_parent_substs::mac!();
| --------------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `priv_parent_substs::Priv` is private
--> $DIR/associated-item-privacy-inherent.rs:94:9
LL | priv_parent_substs::mac!();
| --------------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `priv_parent_substs::Priv` is private
--> $DIR/associated-item-privacy-inherent.rs:96:19
LL | priv_parent_substs::mac!();
| --------------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `priv_parent_substs::Priv` is private
--> $DIR/associated-item-privacy-inherent.rs:99:10
LL | priv_parent_substs::mac!();
| --------------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `priv_parent_substs::Priv` is private
--> $DIR/associated-item-privacy-inherent.rs:101:9
LL | priv_parent_substs::mac!();
| --------------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 21 previous errors
LL | priv_trait::mac!();
| ------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_trait::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `for<'r> fn(&'r priv_trait::Pub) {<priv_trait::Pub as PrivTr>::method}` is private
--> $DIR/associated-item-privacy-trait.rs:17:9
LL | priv_trait::mac!();
| ------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_trait::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `for<'r> fn(&'r Self) {<Self as PrivTr>::method}` is private
--> $DIR/associated-item-privacy-trait.rs:19:13
LL | priv_trait::mac!();
| ------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_trait::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: associated constant `<Pub as PrivTr>::CONST` is private
--> $DIR/associated-item-privacy-trait.rs:21:9
LL | priv_trait::mac!();
| ------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_trait::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: associated type `<Pub as PrivTr>::AssocTy` is private
--> $DIR/associated-item-privacy-trait.rs:23:16
LL | priv_trait::mac!();
| ------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_trait::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: trait `PrivTr` is private
--> $DIR/associated-item-privacy-trait.rs:25:34
LL | priv_trait::mac!();
| ------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_trait::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: trait `PrivTr` is private
--> $DIR/associated-item-privacy-trait.rs:27:34
LL | priv_trait::mac!();
| ------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_trait::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: trait `PrivTr` is private
--> $DIR/associated-item-privacy-trait.rs:29:14
LL | priv_trait::mac!();
| ------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_trait::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `priv_signature::Priv` is private
--> $DIR/associated-item-privacy-trait.rs:46:21
LL | priv_signature::mac!();
| ----------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_signature::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `priv_signature::Priv` is private
--> $DIR/associated-item-privacy-trait.rs:48:9
LL | priv_signature::mac!();
| ----------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_signature::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `priv_signature::Priv` is private
--> $DIR/associated-item-privacy-trait.rs:50:13
LL | priv_signature::mac!();
| ----------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_signature::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `priv_substs::Priv` is private
--> $DIR/associated-item-privacy-trait.rs:67:21
LL | priv_substs::mac!();
| -------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `priv_substs::Priv` is private
--> $DIR/associated-item-privacy-trait.rs:69:9
LL | priv_substs::mac!();
| -------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `priv_substs::Priv` is private
--> $DIR/associated-item-privacy-trait.rs:71:9
LL | priv_substs::mac!();
| -------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `priv_parent_substs::Priv` is private
--> $DIR/associated-item-privacy-trait.rs:91:21
LL | priv_parent_substs::mac!();
| --------------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `priv_parent_substs::Priv` is private
--> $DIR/associated-item-privacy-trait.rs:93:9
LL | priv_parent_substs::mac!();
| --------------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `priv_parent_substs::Priv` is private
--> $DIR/associated-item-privacy-trait.rs:95:21
LL | priv_parent_substs::mac!();
| --------------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `priv_parent_substs::Priv` is private
--> $DIR/associated-item-privacy-trait.rs:97:9
LL | priv_parent_substs::mac!();
| --------------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `priv_parent_substs::Priv` is private
--> $DIR/associated-item-privacy-trait.rs:99:9
LL | priv_parent_substs::mac!();
| --------------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `priv_parent_substs::Priv` is private
--> $DIR/associated-item-privacy-trait.rs:102:21
LL | priv_parent_substs::mac!();
| --------------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `priv_parent_substs::Priv` is private
--> $DIR/associated-item-privacy-trait.rs:104:9
LL | priv_parent_substs::mac!();
| --------------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `priv_parent_substs::Priv` is private
--> $DIR/associated-item-privacy-trait.rs:106:9
LL | priv_parent_substs::mac!();
| --------------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `priv_parent_substs::Priv` is private
--> $DIR/associated-item-privacy-trait.rs:109:9
LL | priv_parent_substs::mac!();
| --------------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `priv_parent_substs::Priv` is private
--> $DIR/associated-item-privacy-trait.rs:111:9
LL | priv_parent_substs::mac!();
| --------------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `priv_parent_substs::Priv` is private
--> $DIR/associated-item-privacy-trait.rs:113:9
LL | priv_parent_substs::mac!();
| --------------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `priv_parent_substs::Priv` is private
--> $DIR/associated-item-privacy-trait.rs:117:30
LL | priv_parent_substs::mac!();
| --------------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `priv_parent_substs::Priv` is private
--> $DIR/associated-item-privacy-trait.rs:119:17
LL | priv_parent_substs::mac!();
| --------------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `priv_parent_substs::Priv` is private
--> $DIR/associated-item-privacy-trait.rs:122:35
LL | priv_parent_substs::mac!();
| --------------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `priv_parent_substs::Priv` is private
--> $DIR/associated-item-privacy-trait.rs:124:35
LL | priv_parent_substs::mac!();
| --------------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `priv_parent_substs::Priv` is private
--> $DIR/associated-item-privacy-trait.rs:126:14
LL | priv_parent_substs::mac!();
| --------------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 30 previous errors
LL | priv_trait::mac1!();
| -------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_trait::mac1` (in Nightly builds, run with -Z macro-backtrace for more info)
error: trait `PrivTr` is private
--> $DIR/associated-item-privacy-type-binding.rs:11:16
LL | priv_trait::mac1!();
| -------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_trait::mac1` (in Nightly builds, run with -Z macro-backtrace for more info)
error: trait `PrivTr` is private
--> $DIR/associated-item-privacy-type-binding.rs:14:31
LL | priv_trait::mac1!();
| -------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_trait::mac1` (in Nightly builds, run with -Z macro-backtrace for more info)
error: trait `PrivTr` is private
--> $DIR/associated-item-privacy-type-binding.rs:16:31
LL | priv_trait::mac1!();
| -------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_trait::mac1` (in Nightly builds, run with -Z macro-backtrace for more info)
error: trait `PrivTr` is private
--> $DIR/associated-item-privacy-type-binding.rs:20:13
LL | priv_trait::mac2!();
| -------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_trait::mac2` (in Nightly builds, run with -Z macro-backtrace for more info)
error: trait `PrivTr` is private
--> $DIR/associated-item-privacy-type-binding.rs:20:16
LL | priv_trait::mac2!();
| -------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_trait::mac2` (in Nightly builds, run with -Z macro-backtrace for more info)
error: trait `PrivTr` is private
--> $DIR/associated-item-privacy-type-binding.rs:23:31
LL | priv_trait::mac2!();
| -------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_trait::mac2` (in Nightly builds, run with -Z macro-backtrace for more info)
error: trait `PrivTr` is private
--> $DIR/associated-item-privacy-type-binding.rs:25:31
LL | priv_trait::mac2!();
| -------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_trait::mac2` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `Priv` is private
--> $DIR/associated-item-privacy-type-binding.rs:44:13
LL | priv_parent_substs::mac!();
| --------------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `Priv` is private
--> $DIR/associated-item-privacy-type-binding.rs:44:16
LL | priv_parent_substs::mac!();
| --------------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `Priv` is private
--> $DIR/associated-item-privacy-type-binding.rs:47:13
LL | priv_parent_substs::mac!();
| --------------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `Priv` is private
--> $DIR/associated-item-privacy-type-binding.rs:47:16
LL | priv_parent_substs::mac!();
| --------------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `Priv` is private
--> $DIR/associated-item-privacy-type-binding.rs:50:35
LL | priv_parent_substs::mac!();
| --------------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `Priv` is private
--> $DIR/associated-item-privacy-type-binding.rs:52:35
LL | priv_parent_substs::mac!();
| --------------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `Priv` is private
--> $DIR/associated-item-privacy-type-binding.rs:54:31
LL | priv_parent_substs::mac!();
| --------------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `Priv` is private
--> $DIR/associated-item-privacy-type-binding.rs:56:31
LL | priv_parent_substs::mac!();
| --------------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 16 previous errors
LL | ext::m!();
| ^^^^^^^^^^ private type
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `ext::m` (in Nightly builds, run with -Z macro-backtrace for more info)
error: static `PRIV_STATIC` is private
--> $DIR/private-inferred-type-3.rs:16:5
LL | ext::m!();
| ^^^^^^^^^^ private static
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `ext::m` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `ext::PrivEnum` is private
--> $DIR/private-inferred-type-3.rs:16:5
LL | ext::m!();
| ^^^^^^^^^^ private type
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `ext::m` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `fn() {<u8 as ext::PrivTrait>::method}` is private
--> $DIR/private-inferred-type-3.rs:16:5
LL | ext::m!();
| ^^^^^^^^^^ private type
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `ext::m` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `fn(u8) -> ext::PrivTupleStruct {ext::PrivTupleStruct}` is private
--> $DIR/private-inferred-type-3.rs:16:5
LL | ext::m!();
| ^^^^^^^^^^ private type
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `ext::m` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `fn(u8) -> PubTupleStruct {PubTupleStruct}` is private
--> $DIR/private-inferred-type-3.rs:16:5
LL | ext::m!();
| ^^^^^^^^^^ private type
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `ext::m` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `for<'r> fn(&'r Pub<u8>) {Pub::<u8>::priv_method}` is private
--> $DIR/private-inferred-type-3.rs:16:5
LL | ext::m!();
| ^^^^^^^^^^ private type
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `ext::m` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 7 previous errors
LL | m::m!();
| -------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `m::m` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `PrivEnum` is private
--> $DIR/private-inferred-type.rs:41:9
LL | m::m!();
| -------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `m::m` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `fn() {<u8 as PrivTrait>::method}` is private
--> $DIR/private-inferred-type.rs:43:9
LL | m::m!();
| -------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `m::m` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `fn(u8) -> PrivTupleStruct {PrivTupleStruct}` is private
--> $DIR/private-inferred-type.rs:45:9
LL | m::m!();
| -------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `m::m` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `fn(u8) -> PubTupleStruct {PubTupleStruct}` is private
--> $DIR/private-inferred-type.rs:47:9
LL | m::m!();
| -------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `m::m` (in Nightly builds, run with -Z macro-backtrace for more info)
error: type `for<'r> fn(&'r Pub<u8>) {Pub::<u8>::priv_method}` is private
--> $DIR/private-inferred-type.rs:49:18
LL | m::m!();
| -------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `m::m` (in Nightly builds, run with -Z macro-backtrace for more info)
error: trait `Trait` is private
--> $DIR/private-inferred-type.rs:118:5
LL | #[derive(A)]
| ^ expected `:`
|
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `A` (in Nightly builds, run with -Z macro-backtrace for more info)
error: proc-macro derive produced unparseable tokens
--> $DIR/derive-bad.rs:6:10
LL | #[derive(GenHelperUse)]
| ^^^^^^^^^^^^
|
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `GenHelperUse` (in Nightly builds, run with -Z macro-backtrace for more info)
error: cannot find attribute `empty_helper` in this scope
--> $DIR/derive-helper-shadowing.rs:14:11
LL | gen_helper_use!();
| ------------------ in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `gen_helper_use` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0659]: `empty_helper` is ambiguous (name vs any other name during import resolution)
--> $DIR/derive-helper-shadowing.rs:26:13
LL | #[derive(Unstable)]
| ^^^^^^^^
|
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `Unstable` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
| ^^^^^^^^
|
= help: add `#![feature(core_intrinsics)]` to the crate attributes to enable
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `Unstable` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | generated!();
| ------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `generated` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0425]: cannot find value `local_use` in this scope
--> $DIR/gen-macro-rules-hygiene.rs:12:1
LL | generated!();
| ------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `generated` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0425]: cannot find value `local_def` in this scope
--> $DIR/gen-macro-rules-hygiene.rs:21:9
|
= note: consider importing this struct:
FromOutside
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `generate_mod::check` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0412]: cannot find type `Outer` in this scope
--> $DIR/generate-mod.rs:9:1
|
= note: consider importing this struct:
Outer
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `generate_mod::check` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0412]: cannot find type `FromOutside` in this scope
--> $DIR/generate-mod.rs:12:1
|
= note: consider importing this struct:
FromOutside
- = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the attribute macro `generate_mod::check_attr` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0412]: cannot find type `OuterAttr` in this scope
--> $DIR/generate-mod.rs:12:1
|
= note: consider importing this struct:
OuterAttr
- = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the attribute macro `generate_mod::check_attr` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: cannot find type `FromOutside` in this scope
--> $DIR/generate-mod.rs:16:10
= note: `#[warn(proc_macro_derive_resolution_fallback)]` on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #83583 <https://github.com/rust-lang/rust/issues/83583>
- = note: this warning originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the derive macro `generate_mod::CheckDerive` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: cannot find type `OuterDerive` in this scope
--> $DIR/generate-mod.rs:16:10
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #83583 <https://github.com/rust-lang/rust/issues/83583>
- = note: this warning originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the derive macro `generate_mod::CheckDerive` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: cannot find type `FromOutside` in this scope
--> $DIR/generate-mod.rs:23:14
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #83583 <https://github.com/rust-lang/rust/issues/83583>
- = note: this warning originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the derive macro `generate_mod::CheckDerive` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: cannot find type `OuterDerive` in this scope
--> $DIR/generate-mod.rs:23:14
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #83583 <https://github.com/rust-lang/rust/issues/83583>
- = note: this warning originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the derive macro `generate_mod::CheckDerive` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 4 previous errors; 4 warnings emitted
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125>
= note: the `time-macros-impl` crate will stop compiling in futures version of Rust. Please update to the latest version of the `time` crate to avoid breakage
- = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the macro `impl_macros` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: using an old version of `time-macros-impl`
--> $DIR/time-macros-impl-0.1.0/src/lib.rs:5:32
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125>
= note: the `time-macros-impl` crate will stop compiling in futures version of Rust. Please update to the latest version of the `time` crate to avoid breakage
- = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the macro `impl_macros` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: using an old version of `js-sys`
--> $DIR/js-sys-0.3.17/src/lib.rs:5:32
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125>
= note: older versions of the `js-sys` crate will stop compiling in future versions of Rust; please update to `js-sys` v0.3.40 or above
- = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the macro `arrays` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: using an old version of `actix-web`
--> $DIR/actix-web/src/extract.rs:5:34
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125>
= note: the version of `actix-web` you are using might stop compiling in future versions of Rust; please update to the latest version of the `actix-web` crate to avoid breakage
- = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the macro `tuple_from_req` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: using an old version of `actix-web`
--> $DIR/actix-web-2.0.0/src/extract.rs:5:34
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125>
= note: the version of `actix-web` you are using might stop compiling in future versions of Rust; please update to the latest version of the `actix-web` crate to avoid breakage
- = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the macro `tuple_from_req` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: 5 warnings emitted
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125>
= note: the `time-macros-impl` crate will stop compiling in futures version of Rust. Please update to the latest version of the `time` crate to avoid breakage
- = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the macro `impl_macros` (in Nightly builds, run with -Z macro-backtrace for more info)
Future breakage date: None, diagnostic:
warning: using an old version of `time-macros-impl`
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125>
= note: the `time-macros-impl` crate will stop compiling in futures version of Rust. Please update to the latest version of the `time` crate to avoid breakage
- = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the macro `impl_macros` (in Nightly builds, run with -Z macro-backtrace for more info)
Future breakage date: None, diagnostic:
warning: using an old version of `js-sys`
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125>
= note: older versions of the `js-sys` crate will stop compiling in future versions of Rust; please update to `js-sys` v0.3.40 or above
- = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the macro `arrays` (in Nightly builds, run with -Z macro-backtrace for more info)
Future breakage date: None, diagnostic:
warning: using an old version of `actix-web`
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125>
= note: the version of `actix-web` you are using might stop compiling in future versions of Rust; please update to the latest version of the `actix-web` crate to avoid breakage
- = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the macro `tuple_from_req` (in Nightly builds, run with -Z macro-backtrace for more info)
Future breakage date: None, diagnostic:
warning: using an old version of `actix-web`
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125>
= note: the version of `actix-web` you are using might stop compiling in future versions of Rust; please update to the latest version of the `actix-web` crate to avoid breakage
- = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the macro `tuple_from_req` (in Nightly builds, run with -Z macro-backtrace for more info)
LL | lexer_failure!();
| ^^^^^^^^^^^^^^^^^ unexpected closing delimiter
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `lexer_failure` (in Nightly builds, run with -Z macro-backtrace for more info)
error: proc macro panicked
--> $DIR/invalid-punct-ident-4.rs:6:1
LL | #[derive(A)]
| ^ not found in this scope
|
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `A` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | #![issue_59191::no_main]
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
- = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the attribute macro `issue_59191::no_main` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | issue_83510::dance_like_you_want_to_ice!();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `issue_83510::dance_like_you_want_to_ice` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0404]: expected trait, found struct `Box`
--> $DIR/issue-83510.rs:5:1
LL | issue_83510::dance_like_you_want_to_ice!();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not a trait
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `issue_83510::dance_like_you_want_to_ice` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0405]: cannot find trait `Baz` in this scope
--> $DIR/issue-83510.rs:5:1
LL | issue_83510::dance_like_you_want_to_ice!();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `issue_83510::dance_like_you_want_to_ice` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0658]: inherent associated types are unstable
--> $DIR/issue-83510.rs:5:1
|
= note: see issue #8995 <https://github.com/rust-lang/rust/issues/8995> for more information
= help: add `#![feature(inherent_associated_types)]` to the crate attributes to enable
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `issue_83510::dance_like_you_want_to_ice` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 4 previous errors
| expected type
| this macro call doesn't expand to a type
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `single_quote_alone` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | bang_proc_macro2!();
| ^^^^^^^^^^^^^^^^^^^^ help: a local variable with a similar name exists: `foobar`
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `bang_proc_macro2` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | produce_it!(MyName);
| -------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `produce_it` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | proc_macro_rules!();
| ^^^^^^^^^^^^^^^^^^^^ undeclared label `'label_use`
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `proc_macro_rules` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0425]: cannot find value `local_use` in this scope
--> $DIR/mixed-site-span.rs:13:9
LL | proc_macro_rules!();
| ^^^^^^^^^^^^^^^^^^^^ not found in this scope
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `proc_macro_rules` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0425]: cannot find value `local_def` in this scope
--> $DIR/mixed-site-span.rs:17:9
LL | pass_dollar_crate!();
| ^^^^^^^^^^^^^^^^^^^^^ not found in `$crate`
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `proc_macro_rules` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 4 previous errors
|
LL | hello!(hi);
| ^^
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `hello` (in Nightly builds, run with -Z macro-backtrace for more info)
error: hello to you, too!
--> $DIR/multispan.rs:15:5
|
LL | hello!(hi hi);
| ^^ ^^
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `hello` (in Nightly builds, run with -Z macro-backtrace for more info)
error: hello to you, too!
--> $DIR/multispan.rs:18:5
|
LL | hello!(hi hi hi);
| ^^ ^^ ^^
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `hello` (in Nightly builds, run with -Z macro-backtrace for more info)
error: hello to you, too!
--> $DIR/multispan.rs:21:5
|
LL | hello!(hi hey hi yo hi beep beep hi hi);
| ^^ ^^ ^^ ^^ ^^
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `hello` (in Nightly builds, run with -Z macro-backtrace for more info)
error: hello to you, too!
--> $DIR/multispan.rs:22:5
|
LL | hello!(hi there, hi how are you? hi... hi.);
| ^^ ^^ ^^ ^^
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `hello` (in Nightly builds, run with -Z macro-backtrace for more info)
error: hello to you, too!
--> $DIR/multispan.rs:23:5
|
LL | hello!(whoah. hi di hi di ho);
| ^^ ^^
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `hello` (in Nightly builds, run with -Z macro-backtrace for more info)
error: hello to you, too!
--> $DIR/multispan.rs:24:5
|
LL | hello!(hi good hi and good bye);
| ^^ ^^
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `hello` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 7 previous errors
LL | one!("hello", "world");
| ----------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `two` (in Nightly builds, run with -Z macro-backtrace for more info)
error: second final: "world"
--> $DIR/parent-source-spans.rs:16:16
LL | one!("hello", "world");
| ----------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `two` (in Nightly builds, run with -Z macro-backtrace for more info)
error: first parent: "hello"
--> $DIR/parent-source-spans.rs:10:5
LL | one!("hello", "world");
| ----------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `one` (in Nightly builds, run with -Z macro-backtrace for more info)
error: second parent: "world"
--> $DIR/parent-source-spans.rs:10:5
LL | one!("hello", "world");
| ----------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `one` (in Nightly builds, run with -Z macro-backtrace for more info)
error: first grandparent: "hello"
--> $DIR/parent-source-spans.rs:36:5
LL | two!("yay", "rust");
| -------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `two` (in Nightly builds, run with -Z macro-backtrace for more info)
error: second final: "rust"
--> $DIR/parent-source-spans.rs:16:16
LL | two!("yay", "rust");
| -------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `two` (in Nightly builds, run with -Z macro-backtrace for more info)
error: first parent: "yay"
--> $DIR/parent-source-spans.rs:42:5
LL | Ok(#[stable(feature = "rust1", since = "1.0.0")] T),
| --------------------------------------------------- similarly named tuple variant `Ok` defined here
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `parent_source_spans` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0425]: cannot find value `ok` in this scope
--> $DIR/parent-source-spans.rs:29:5
LL | Ok(#[stable(feature = "rust1", since = "1.0.0")] T),
| --------------------------------------------------- similarly named tuple variant `Ok` defined here
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `parent_source_spans` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0425]: cannot find value `ok` in this scope
--> $DIR/parent-source-spans.rs:29:5
LL | Ok(#[stable(feature = "rust1", since = "1.0.0")] T),
| --------------------------------------------------- similarly named tuple variant `Ok` defined here
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `parent_source_spans` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 21 previous errors
LL | make_bad_struct!(S);
| ^^^^^^^^^^^^^^^^^^^^ expected one of 8 possible tokens
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `make_bad_struct` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | resolve_located_at!(a b)
| ^
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `resolve_located_at` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0308]: mismatched types
--> $DIR/resolved-located-at.rs:7:27
LL | resolve_located_at!(a b)
| ^ expected `()`, found struct `S`
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `resolve_located_at` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors
|
LL | subspan!("hi");
| ^^
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `subspan` (in Nightly builds, run with -Z macro-backtrace for more info)
error: found 'hi's
--> $DIR/subspan.rs:14:1
|
LL | subspan!("hihi");
| ^^^^
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `subspan` (in Nightly builds, run with -Z macro-backtrace for more info)
error: found 'hi's
--> $DIR/subspan.rs:17:1
|
LL | subspan!("hihihi");
| ^^^^^^
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `subspan` (in Nightly builds, run with -Z macro-backtrace for more info)
error: found 'hi's
--> $DIR/subspan.rs:20:1
|
LL | subspan!("why I hide? hi!");
| ^^ ^^
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `subspan` (in Nightly builds, run with -Z macro-backtrace for more info)
error: found 'hi's
--> $DIR/subspan.rs:21:1
|
LL | subspan!("hey, hi, hidy, hidy, hi hi");
| ^^ ^^ ^^ ^^ ^^
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `subspan` (in Nightly builds, run with -Z macro-backtrace for more info)
error: found 'hi's
--> $DIR/subspan.rs:22:1
|
LL | subspan!("this is a hi, and this is another hi");
| ^^ ^^ ^^ ^^
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `subspan` (in Nightly builds, run with -Z macro-backtrace for more info)
error: found 'hi's
--> $DIR/subspan.rs:23:1
|
LL | subspan!("how are you this evening");
| ^^
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `subspan` (in Nightly builds, run with -Z macro-backtrace for more info)
error: found 'hi's
--> $DIR/subspan.rs:24:1
|
LL | subspan!("this is highly eradic");
| ^^ ^^
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `subspan` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 8 previous errors
| ^^^^^^^^^^^^^^^^^^
|
= help: input must be: `===`
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `three_equals` (in Nightly builds, run with -Z macro-backtrace for more info)
error: expected EOF, found `=`.
--> $DIR/three-equals.rs:15:21
LL | other!(50);
| ----------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `inner` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0425]: cannot find value `hidden_ident` in this scope
--> $DIR/weird-hygiene.rs:34:13
LL | invoke_it!(25);
| --------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `invoke_it` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors
|
= help: the trait `PartialOrd` is not implemented for `std::ops::Range<usize>`
= note: required by `std::cmp::PartialOrd::partial_cmp`
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: can't compare `std::ops::RangeTo<usize>` with `std::ops::RangeTo<usize>`
--> $DIR/range_traits-1.rs:8:5
|
= help: the trait `PartialOrd` is not implemented for `std::ops::RangeTo<usize>`
= note: required by `std::cmp::PartialOrd::partial_cmp`
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: can't compare `std::ops::RangeFrom<usize>` with `std::ops::RangeFrom<usize>`
--> $DIR/range_traits-1.rs:11:5
|
= help: the trait `PartialOrd` is not implemented for `std::ops::RangeFrom<usize>`
= note: required by `std::cmp::PartialOrd::partial_cmp`
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: can't compare `std::ops::RangeFull` with `std::ops::RangeFull`
--> $DIR/range_traits-1.rs:14:5
|
= help: the trait `PartialOrd` is not implemented for `std::ops::RangeFull`
= note: required by `std::cmp::PartialOrd::partial_cmp`
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: can't compare `std::ops::RangeInclusive<usize>` with `std::ops::RangeInclusive<usize>`
--> $DIR/range_traits-1.rs:17:5
|
= help: the trait `PartialOrd` is not implemented for `std::ops::RangeInclusive<usize>`
= note: required by `std::cmp::PartialOrd::partial_cmp`
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: can't compare `std::ops::RangeToInclusive<usize>` with `std::ops::RangeToInclusive<usize>`
--> $DIR/range_traits-1.rs:20:5
|
= help: the trait `PartialOrd` is not implemented for `std::ops::RangeToInclusive<usize>`
= note: required by `std::cmp::PartialOrd::partial_cmp`
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `std::ops::Range<usize>: Ord` is not satisfied
--> $DIR/range_traits-1.rs:5:5
| ^^^^^^^^^^^^^^^ the trait `Ord` is not implemented for `std::ops::Range<usize>`
|
= note: required by `std::cmp::Ord::cmp`
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `std::ops::RangeTo<usize>: Ord` is not satisfied
--> $DIR/range_traits-1.rs:8:5
| ^^^^^^^^^^^^^^^^^ the trait `Ord` is not implemented for `std::ops::RangeTo<usize>`
|
= note: required by `std::cmp::Ord::cmp`
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `std::ops::RangeFrom<usize>: Ord` is not satisfied
--> $DIR/range_traits-1.rs:11:5
| ^^^^^^^^^^^^^^^^^^^ the trait `Ord` is not implemented for `std::ops::RangeFrom<usize>`
|
= note: required by `std::cmp::Ord::cmp`
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `std::ops::RangeFull: Ord` is not satisfied
--> $DIR/range_traits-1.rs:14:5
| ^^^^^^^^^^^^ the trait `Ord` is not implemented for `std::ops::RangeFull`
|
= note: required by `std::cmp::Ord::cmp`
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `std::ops::RangeInclusive<usize>: Ord` is not satisfied
--> $DIR/range_traits-1.rs:17:5
| ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Ord` is not implemented for `std::ops::RangeInclusive<usize>`
|
= note: required by `std::cmp::Ord::cmp`
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `std::ops::RangeToInclusive<usize>: Ord` is not satisfied
--> $DIR/range_traits-1.rs:20:5
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Ord` is not implemented for `std::ops::RangeToInclusive<usize>`
|
= note: required by `std::cmp::Ord::cmp`
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 12 previous errors
LL | struct R(Range<usize>);
| ------------ this field does not implement `Copy`
|
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | struct R(RangeFrom<usize>);
| ---------------- this field does not implement `Copy`
|
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | struct R(RangeInclusive<usize>);
| --------------------- this field does not implement `Copy`
|
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
|
LL | #![deny(unreachable_code)]
| ^^^^^^^^^^^^^^^^
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | println!("foo");
| ^^^^^^^^^^^^^^^^ unreachable statement
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors
LL | println!("But I am.");
| ^^^^^^^^^^^^^^^^^^^^^^ unreachable statement
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors
|
LL | #![deny(unreachable_code)]
| ^^^^^^^^^^^^^^^^
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
error: unreachable statement
--> $DIR/expr_loop.rs:21:5
LL | println!("I am dead.");
| ^^^^^^^^^^^^^^^^^^^^^^^ unreachable statement
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
error: unreachable statement
--> $DIR/expr_loop.rs:32:5
LL | println!("I am dead.");
| ^^^^^^^^^^^^^^^^^^^^^^^ unreachable statement
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 3 previous errors
|
LL | #![deny(unreachable_code)]
| ^^^^^^^^^^^^^^^^
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
error: unreachable statement
--> $DIR/expr_match.rs:19:5
LL | println!("I am dead");
| ^^^^^^^^^^^^^^^^^^^^^^ unreachable statement
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors
|
LL | #![deny(unreachable_code)]
| ^^^^^^^^^^^^^^^^
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
error[E0621]: explicit lifetime required in the type of `u`
--> $DIR/regions-static-bound.rs:14:5
|
-LL | fn error(u: &(), v: &()) {
- | --- help: add explicit lifetime `'static` to the type of `u`: `&'static ()`
LL | static_id(&u);
| ^^^^^^^^^^^^^ lifetime `'static` required
error[E0621]: explicit lifetime required in the type of `v`
--> $DIR/regions-static-bound.rs:16:5
|
-LL | fn error(u: &(), v: &()) {
- | --- help: add explicit lifetime `'static` to the type of `v`: `&'static ()`
-...
LL | static_id_indirect(&v);
| ^^^^^^^^^^^^^^^^^^^^^^ lifetime `'static` required
error[E0621]: explicit lifetime required in the type of `u`
--> $DIR/regions-static-bound.rs:14:5
|
-LL | fn error(u: &(), v: &()) {
- | --- help: add explicit lifetime `'static` to the type of `u`: `&'static ()`
LL | static_id(&u);
| ^^^^^^^^^ lifetime `'static` required
error[E0621]: explicit lifetime required in the type of `v`
--> $DIR/regions-static-bound.rs:16:5
|
-LL | fn error(u: &(), v: &()) {
- | --- help: add explicit lifetime `'static` to the type of `v`: `&'static ()`
-...
LL | static_id_indirect(&v);
| ^^^^^^^^^^^^^^^^^^ lifetime `'static` required
error[E0621]: explicit lifetime required in the type of `u`
--> $DIR/regions-static-bound.rs:14:5
|
-LL | fn error(u: &(), v: &()) {
- | --- help: add explicit lifetime `'static` to the type of `u`: `&'static ()`
LL | static_id(&u);
| ^^^^^^^^^^^^^ lifetime `'static` required
error[E0621]: explicit lifetime required in the type of `v`
--> $DIR/regions-static-bound.rs:16:5
|
-LL | fn error(u: &(), v: &()) {
- | --- help: add explicit lifetime `'static` to the type of `v`: `&'static ()`
-...
LL | static_id_indirect(&v);
| ^^^^^^^^^^^^^^^^^^^^^^ lifetime `'static` required
LL | mac!();
| ------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors
| ----------- required by this bound in `assert_test_result`
|
= help: the trait `Termination` is not implemented for `Result<f32, ParseFloatError>`
- = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the attribute macro `test` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
| ^
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
- = note: the matched value is of type `EmptyNonExhaustiveEnum`
+ = note: the matched value is of type `EmptyNonExhaustiveEnum`, which is marked as non-exhaustive
error[E0004]: non-exhaustive patterns: `_` not covered
--> $DIR/enum.rs:16:11
| ^^^^^^^^^ pattern `_` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
- = note: the matched value is of type `NonExhaustiveEnum`
+ = note: the matched value is of type `NonExhaustiveEnum`, which is marked as non-exhaustive
error[E0004]: non-exhaustive patterns: `_` not covered
--> $DIR/enum.rs:23:11
| ^^^^^^^^^ pattern `_` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
- = note: the matched value is of type `NonExhaustiveEnum`
+ = note: the matched value is of type `NonExhaustiveEnum`, which is marked as non-exhaustive
error: aborting due to 3 previous errors
--> $DIR/struct.rs:20:14
|
LL | let ts = TupleStruct(640, 480);
- | ^^^^^^^^^^^ constructor is not visible here due to private fields
+ | ^^^^^^^^^^^
error[E0423]: expected value, found struct `UnitStruct`
--> $DIR/struct.rs:29:14
| ^
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
- = note: the matched value is of type `UninhabitedEnum`
+ = note: the matched value is of type `UninhabitedEnum`, which is marked as non-exhaustive
error[E0004]: non-exhaustive patterns: type `UninhabitedStruct` is non-empty
--> $DIR/match.rs:23:11
| ^
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
- = note: the matched value is of type `UninhabitedEnum`
+ = note: the matched value is of type `UninhabitedEnum`, which is marked as non-exhaustive
error[E0004]: non-exhaustive patterns: type `UninhabitedStruct` is non-empty
--> $DIR/match_with_exhaustive_patterns.rs:26:11
= note: add `#[derive(Debug)]` or manually implement `Debug`
= note: required because of the requirements on the impl of `Debug` for `&NotDebug`
= note: required by `std::fmt::Debug::fmt`
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | m!();
| ----- in this macro invocation
= help: use `self::std` to refer to this module unambiguously
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | m!();
| ----- in this macro invocation
= help: use `crate::std` to refer to this module unambiguously
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
+++ /dev/null
-#![feature(rustc_attrs)]
-
-#[rustc_args_required_const(0)]
-fn foo(_a: i32) {
-}
-
-fn main() {
- let a = foo; //~ ERROR: this function can only be invoked directly
- a(2);
-}
+++ /dev/null
-error: this function can only be invoked directly, not through a function pointer
- --> $DIR/rustc-args-required-const2.rs:8:13
- |
-LL | let a = foo;
- | ^^^
-
-error: aborting due to previous error
-
simd_extract::<_, f32>(x, 0);
//~^ ERROR expected return type `i32` (element of input `i32x4`), found `f32`
- simd_shuffle2::<i32, i32>(0, 0, [0; 2]);
+ const IDX2: [u32; 2] = [0; 2];
+ simd_shuffle2::<i32, i32>(0, 0, IDX2);
//~^ ERROR expected SIMD input type, found non-SIMD `i32`
- simd_shuffle4::<i32, i32>(0, 0, [0; 4]);
+ const IDX4: [u32; 4] = [0; 4];
+ simd_shuffle4::<i32, i32>(0, 0, IDX4);
//~^ ERROR expected SIMD input type, found non-SIMD `i32`
- simd_shuffle8::<i32, i32>(0, 0, [0; 8]);
+ const IDX8: [u32; 8] = [0; 8];
+ simd_shuffle8::<i32, i32>(0, 0, IDX8);
//~^ ERROR expected SIMD input type, found non-SIMD `i32`
- simd_shuffle2::<_, f32x2>(x, x, [0; 2]);
+ simd_shuffle2::<_, f32x2>(x, x, IDX2);
//~^ ERROR element type `i32` (element of input `i32x4`), found `f32x2` with element type `f32`
- simd_shuffle4::<_, f32x4>(x, x, [0; 4]);
+ simd_shuffle4::<_, f32x4>(x, x, IDX4);
//~^ ERROR element type `i32` (element of input `i32x4`), found `f32x4` with element type `f32`
- simd_shuffle8::<_, f32x8>(x, x, [0; 8]);
+ simd_shuffle8::<_, f32x8>(x, x, IDX8);
//~^ ERROR element type `i32` (element of input `i32x4`), found `f32x8` with element type `f32`
- simd_shuffle2::<_, i32x8>(x, x, [0; 2]);
+ simd_shuffle2::<_, i32x8>(x, x, IDX2);
//~^ ERROR expected return type of length 2, found `i32x8` with length 8
- simd_shuffle4::<_, i32x8>(x, x, [0; 4]);
+ simd_shuffle4::<_, i32x8>(x, x, IDX4);
//~^ ERROR expected return type of length 4, found `i32x8` with length 8
- simd_shuffle8::<_, i32x2>(x, x, [0; 8]);
+ simd_shuffle8::<_, i32x2>(x, x, IDX8);
//~^ ERROR expected return type of length 8, found `i32x2` with length 2
}
}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0511]: invalid monomorphization of `simd_shuffle2` intrinsic: expected SIMD input type, found non-SIMD `i32`
- --> $DIR/simd-intrinsic-generic-elements.rs:53:9
+ --> $DIR/simd-intrinsic-generic-elements.rs:54:9
|
-LL | simd_shuffle2::<i32, i32>(0, 0, [0; 2]);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | simd_shuffle2::<i32, i32>(0, 0, IDX2);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0511]: invalid monomorphization of `simd_shuffle4` intrinsic: expected SIMD input type, found non-SIMD `i32`
- --> $DIR/simd-intrinsic-generic-elements.rs:55:9
+ --> $DIR/simd-intrinsic-generic-elements.rs:57:9
|
-LL | simd_shuffle4::<i32, i32>(0, 0, [0; 4]);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | simd_shuffle4::<i32, i32>(0, 0, IDX4);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0511]: invalid monomorphization of `simd_shuffle8` intrinsic: expected SIMD input type, found non-SIMD `i32`
- --> $DIR/simd-intrinsic-generic-elements.rs:57:9
+ --> $DIR/simd-intrinsic-generic-elements.rs:60:9
|
-LL | simd_shuffle8::<i32, i32>(0, 0, [0; 8]);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | simd_shuffle8::<i32, i32>(0, 0, IDX8);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0511]: invalid monomorphization of `simd_shuffle2` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x2` with element type `f32`
- --> $DIR/simd-intrinsic-generic-elements.rs:60:9
+ --> $DIR/simd-intrinsic-generic-elements.rs:63:9
|
-LL | simd_shuffle2::<_, f32x2>(x, x, [0; 2]);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | simd_shuffle2::<_, f32x2>(x, x, IDX2);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0511]: invalid monomorphization of `simd_shuffle4` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x4` with element type `f32`
- --> $DIR/simd-intrinsic-generic-elements.rs:62:9
+ --> $DIR/simd-intrinsic-generic-elements.rs:65:9
|
-LL | simd_shuffle4::<_, f32x4>(x, x, [0; 4]);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | simd_shuffle4::<_, f32x4>(x, x, IDX4);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0511]: invalid monomorphization of `simd_shuffle8` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x8` with element type `f32`
- --> $DIR/simd-intrinsic-generic-elements.rs:64:9
+ --> $DIR/simd-intrinsic-generic-elements.rs:67:9
|
-LL | simd_shuffle8::<_, f32x8>(x, x, [0; 8]);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | simd_shuffle8::<_, f32x8>(x, x, IDX8);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0511]: invalid monomorphization of `simd_shuffle2` intrinsic: expected return type of length 2, found `i32x8` with length 8
- --> $DIR/simd-intrinsic-generic-elements.rs:67:9
+ --> $DIR/simd-intrinsic-generic-elements.rs:70:9
|
-LL | simd_shuffle2::<_, i32x8>(x, x, [0; 2]);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | simd_shuffle2::<_, i32x8>(x, x, IDX2);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0511]: invalid monomorphization of `simd_shuffle4` intrinsic: expected return type of length 4, found `i32x8` with length 8
- --> $DIR/simd-intrinsic-generic-elements.rs:69:9
+ --> $DIR/simd-intrinsic-generic-elements.rs:72:9
|
-LL | simd_shuffle4::<_, i32x8>(x, x, [0; 4]);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | simd_shuffle4::<_, i32x8>(x, x, IDX4);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0511]: invalid monomorphization of `simd_shuffle8` intrinsic: expected return type of length 8, found `i32x2` with length 2
- --> $DIR/simd-intrinsic-generic-elements.rs:71:9
+ --> $DIR/simd-intrinsic-generic-elements.rs:74:9
|
-LL | simd_shuffle8::<_, i32x2>(x, x, [0; 8]);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | simd_shuffle8::<_, i32x2>(x, x, IDX8);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 12 previous errors
#[inline(always)]
unsafe fn inline_me() -> Simd2 {
- simd_shuffle2(Simd2(10, 11), Simd2(12, 13), [0, 3])
+ const IDX: [u32; 2] = [0, 3];
+ simd_shuffle2(Simd2(10, 11), Simd2(12, 13), IDX)
}
fn main() {
unsafe {
- let p_res: Simd2 = simd_shuffle2(Simd2(10, 11), Simd2(12, 13), [0, 1]);
+ const IDX: [u32; 2] = [0, 1];
+ let p_res: Simd2 = simd_shuffle2(Simd2(10, 11), Simd2(12, 13), IDX);
let a_res: Simd2 = inline_me();
assert_10_11(p_res);
#[inline(always)]
unsafe fn inline_me() -> Simd2 {
- simd_shuffle2(Simd2(10, 11), Simd2(12, 13), [0, 3])
+ const IDX: [u32; 2] = [0, 3];
+ simd_shuffle2(Simd2(10, 11), Simd2(12, 13), IDX)
}
LL | test_shuffle_lanes!(2, u8x2, simd_shuffle2, (2, 1));
| ---------------------------------------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `test_shuffle_lanes` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0511]: invalid monomorphization of `simd_shuffle4` intrinsic: shuffle index #0 is out of bounds (limit 8)
--> $DIR/shuffle-not-out-of-bounds.rs:163:21
LL | test_shuffle_lanes!(4, u8x4, simd_shuffle4, (4, 3, 2, 1));
| ---------------------------------------------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `test_shuffle_lanes` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0511]: invalid monomorphization of `simd_shuffle8` intrinsic: shuffle index #0 is out of bounds (limit 16)
--> $DIR/shuffle-not-out-of-bounds.rs:163:21
LL | test_shuffle_lanes!(8, u8x8, simd_shuffle8, (8, 7, 6, 5, 4, 3, 2, 1));
| ---------------------------------------------------------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `test_shuffle_lanes` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0511]: invalid monomorphization of `simd_shuffle16` intrinsic: shuffle index #0 is out of bounds (limit 32)
--> $DIR/shuffle-not-out-of-bounds.rs:163:21
LL | | (16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1));
| |_________________________________________________________________- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `test_shuffle_lanes` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0511]: invalid monomorphization of `simd_shuffle32` intrinsic: shuffle index #0 is out of bounds (limit 64)
--> $DIR/shuffle-not-out-of-bounds.rs:163:21
LL | | 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1));
| |_____________________________________________________________- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `test_shuffle_lanes` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0511]: invalid monomorphization of `simd_shuffle64` intrinsic: shuffle index #0 is out of bounds (limit 128)
--> $DIR/shuffle-not-out-of-bounds.rs:163:21
LL | | 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1));
| |_________________________________________________________________- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `test_shuffle_lanes` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 6 previous errors
// ignore-emscripten FIXME(#45351) hits an LLVM assert
#![feature(repr_simd, platform_intrinsics)]
+#![allow(incomplete_features)]
+#![feature(inline_const)]
#[repr(simd)]
#[derive(Copy, Clone, Debug, PartialEq)]
let y4 = i32x4(140, 141, 142, 143);
let y8 = i32x8(180, 181, 182, 183, 184, 185, 186, 187);
unsafe {
- all_eq!(simd_shuffle2(x2, y2, [3, 0]), i32x2(121, 20));
- all_eq!(simd_shuffle4(x2, y2, [3, 0, 1, 2]), i32x4(121, 20, 21, 120));
- all_eq!(simd_shuffle8(x2, y2, [3, 0, 1, 2, 1, 2, 3, 0]),
+ all_eq!(simd_shuffle2(x2, y2, const { [3u32, 0] }), i32x2(121, 20));
+ all_eq!(simd_shuffle4(x2, y2, const { [3u32, 0, 1, 2] }), i32x4(121, 20, 21, 120));
+ all_eq!(simd_shuffle8(x2, y2, const { [3u32, 0, 1, 2, 1, 2, 3, 0] }),
i32x8(121, 20, 21, 120, 21, 120, 121, 20));
- all_eq!(simd_shuffle2(x4, y4, [7, 2]), i32x2(143, 42));
- all_eq!(simd_shuffle4(x4, y4, [7, 2, 5, 0]), i32x4(143, 42, 141, 40));
- all_eq!(simd_shuffle8(x4, y4, [7, 2, 5, 0, 3, 6, 4, 1]),
+ all_eq!(simd_shuffle2(x4, y4, const { [7u32, 2] }), i32x2(143, 42));
+ all_eq!(simd_shuffle4(x4, y4, const { [7u32, 2, 5, 0] }), i32x4(143, 42, 141, 40));
+ all_eq!(simd_shuffle8(x4, y4, const { [7u32, 2, 5, 0, 3, 6, 4, 1] }),
i32x8(143, 42, 141, 40, 43, 142, 140, 41));
- all_eq!(simd_shuffle2(x8, y8, [11, 5]), i32x2(183, 85));
- all_eq!(simd_shuffle4(x8, y8, [11, 5, 15, 0]), i32x4(183, 85, 187, 80));
- all_eq!(simd_shuffle8(x8, y8, [11, 5, 15, 0, 3, 8, 12, 1]),
+ all_eq!(simd_shuffle2(x8, y8, const { [11u32, 5] }), i32x2(183, 85));
+ all_eq!(simd_shuffle4(x8, y8, const { [11u32, 5, 15, 0] }), i32x4(183, 85, 187, 80));
+ all_eq!(simd_shuffle8(x8, y8, const { [11u32, 5, 15, 0, 3, 8, 12, 1] }),
i32x8(183, 85, 187, 80, 83, 180, 184, 81));
}
LL | ty: &'a mut bool,
| ---------------- this field does not implement `Copy`
|
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0204]: the trait `Copy` may not be implemented for this type
--> $DIR/E0204.rs:17:6
LL | Bar(&'a mut bool),
| ------------ this field does not implement `Copy`
|
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 4 previous errors
LL | s = format!("foo");
| ^^^^^^^^^^^^^^ expected `&mut String`, found struct `String`
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 6 previous errors
LL | stream.write_fmt(format!("message received"))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `Arguments`, found struct `String`
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | #![warn(unused)]
| ^^^^^^
= note: `#[warn(dead_code)]` implied by `#[warn(unused)]`
- = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: 1 warning emitted
| - borrow later used here
|
= note: consider using a `let` binding to create a longer lived value
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | | };
| |______^ expected `&str`, found struct `String`
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | assert_eq!(10u64, 10usize);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u64`, found `usize`
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
= note: the following trait bounds were not satisfied:
`&dyn std::io::Write: std::io::Write`
which is required by `BufWriter<&dyn std::io::Write>: std::io::Write`
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `writeln` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 4 previous errors
= note: call `.display()` or `.to_string_lossy()` to safely print paths, as they may contain non-Unicode data
= note: required because of the requirements on the impl of `std::fmt::Display` for `&Path`
= note: required by `std::fmt::Display::fmt`
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
--- /dev/null
+error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
+ --> $DIR/issue-43733.rs:17:5
+ |
+LL | __KEY.get(Default::default)
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
+ --> $DIR/issue-43733.rs:20:42
+ |
+LL | static FOO: std::thread::LocalKey<Foo> = std::thread::LocalKey::new(__getit);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0133`.
+// revisions: mir thir
+// [thir]compile-flags: -Z thir-unsafeck
+
#![feature(thread_local)]
#![feature(cfg_target_thread_local, thread_local_internals)]
#[cfg(target_thread_local)]
#[thread_local]
-static __KEY: std::thread::__FastLocalKeyInner<Foo> =
- std::thread::__FastLocalKeyInner::new();
+static __KEY: std::thread::__FastLocalKeyInner<Foo> = std::thread::__FastLocalKeyInner::new();
#[cfg(not(target_thread_local))]
-static __KEY: std::thread::__OsLocalKeyInner<Foo> =
- std::thread::__OsLocalKeyInner::new();
+static __KEY: std::thread::__OsLocalKeyInner<Foo> = std::thread::__OsLocalKeyInner::new();
-fn __getit() -> std::option::Option<&'static Foo>
-{
+fn __getit() -> std::option::Option<&'static Foo> {
__KEY.get(Default::default) //~ ERROR call to unsafe function is unsafe
}
-static FOO: std::thread::LocalKey<Foo> =
- std::thread::LocalKey::new(__getit);
+static FOO: std::thread::LocalKey<Foo> = std::thread::LocalKey::new(__getit);
//~^ ERROR call to unsafe function is unsafe
fn main() {
FOO.with(|foo| println!("{}", foo.borrow()));
std::thread::spawn(|| {
FOO.with(|foo| *foo.borrow_mut() += "foo");
- }).join().unwrap();
+ })
+ .join()
+ .unwrap();
FOO.with(|foo| println!("{}", foo.borrow()));
}
+++ /dev/null
-error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
- --> $DIR/issue-43733.rs:17:5
- |
-LL | __KEY.get(Default::default)
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
- |
- = note: consult the function's documentation for information on how to avoid undefined behavior
-
-error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
- --> $DIR/issue-43733.rs:21:5
- |
-LL | std::thread::LocalKey::new(__getit);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
- |
- = note: consult the function's documentation for information on how to avoid undefined behavior
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0133`.
--- /dev/null
+error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
+ --> $DIR/issue-43733.rs:17:5
+ |
+LL | __KEY.get(Default::default)
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
+ --> $DIR/issue-43733.rs:20:42
+ |
+LL | static FOO: std::thread::LocalKey<Foo> = std::thread::LocalKey::new(__getit);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0133`.
--- /dev/null
+#![feature(rustc_attrs)]
+
+// Test for a particular corner case where the evaluation
+// cache can get out of date. The problem here is that
+// when we cache C, we have observed that it reaches
+// to depth 2 (the node for B), but we later realize
+// that B itself depends on A (reached depth 0). We
+// failed to update the depth for C transitively, which
+// resulted in an assertion failure when it was referenced
+// from D.
+//
+// A (reached depth 0)
+// E
+// B // depth 2 -- reached depth = 0
+// C // depth 3 -- reached depth = 2 (should be 0)
+// B
+// A // depth 0
+// D (depth 1)
+// C (cache -- reached depth = 2)
+
+struct A {
+ e: E,
+ d: C,
+}
+
+struct E {
+ b: B,
+}
+
+struct B {
+ a: Option<Box<A>>,
+ c: C,
+}
+
+struct C {
+ b: Option<Box<B>>,
+}
+
+#[rustc_evaluate_where_clauses]
+fn test<X: ?Sized + Send>() {}
+
+fn main() {
+ test::<A>();
+ //~^ ERROR evaluate(Binder(TraitPredicate(<A as std::marker::Send>), [])) = Ok(EvaluatedToOk)
+}
--- /dev/null
+error: evaluate(Binder(TraitPredicate(<A as std::marker::Send>), [])) = Ok(EvaluatedToOk)
+ --> $DIR/cache-reached-depth-ice.rs:43:5
+ |
+LL | fn test<X: ?Sized + Send>() {}
+ | ---- predicate
+...
+LL | test::<A>();
+ | ^^^^^^^^^
+
+error: aborting due to previous error
+
|
= note: required because of the requirements on the impl of `Clone` for `Vec<Foo>`
= note: required by `clone`
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
--> $DIR/issue-75627.rs:3:26
|
LL | unsafe impl Send for Foo<T> {}
- | ^ not found in this scope
+ | - ^ not found in this scope
+ | |
+ | help: you might be missing a type parameter: `<T>`
error: aborting due to previous error
--> $DIR/issue-78372.rs:3:31
|
LL | impl<T> DispatchFromDyn<Smaht<U, MISC>> for T {}
- | - ^ help: a type parameter with a similar name exists: `T`
+ | - ^
| |
| similarly named type parameter `T` defined here
+ |
+help: a type parameter with a similar name exists
+ |
+LL | impl<T> DispatchFromDyn<Smaht<T, MISC>> for T {}
+ | ^
+help: you might be missing a type parameter
+ |
+LL | impl<T, U> DispatchFromDyn<Smaht<U, MISC>> for T {}
+ | ^^^
error[E0412]: cannot find type `MISC` in this scope
--> $DIR/issue-78372.rs:3:34
<&T as Clone>
= note: `Clone` is implemented for `&T`, but not for `&mut T`
= note: required by `clone`
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
--- /dev/null
+// Regression test for issue #83538. The problem here is that we have
+// two cycles:
+//
+// * `Ty` embeds `Box<Ty>` indirectly, which depends on `Global: 'static`, which is OkModuloRegions.
+// * But `Ty` also references `First`, which has a cycle on itself. That should just be `Ok`.
+//
+// But our caching mechanism was blending both cycles and giving the incorrect result.
+
+#![feature(rustc_attrs)]
+#![allow(bad_style)]
+
+struct First {
+ b: Vec<First>,
+}
+
+pub struct Second {
+ d: Vec<First>,
+}
+
+struct Third<f> {
+ g: Vec<f>,
+}
+
+enum Ty {
+ j(Fourth, Fifth, Sixth),
+}
+
+struct Fourth {
+ o: Vec<Ty>,
+}
+
+struct Fifth {
+ bounds: First,
+}
+
+struct Sixth {
+ p: Box<Ty>,
+}
+
+#[rustc_evaluate_where_clauses]
+fn forward()
+where
+ Vec<First>: Unpin,
+ Third<Ty>: Unpin,
+{
+}
+
+#[rustc_evaluate_where_clauses]
+fn reverse()
+where
+ Third<Ty>: Unpin,
+ Vec<First>: Unpin,
+{
+}
+
+fn main() {
+ // Key is that Vec<First> is "ok" and Third<Ty> is "ok modulo regions":
+
+ forward();
+ //~^ ERROR evaluate(Binder(TraitPredicate(<std::vec::Vec<First> as std::marker::Unpin>), [])) = Ok(EvaluatedToOk)
+ //~| ERROR evaluate(Binder(TraitPredicate(<Third<Ty> as std::marker::Unpin>), [])) = Ok(EvaluatedToOkModuloRegions)
+
+ reverse();
+ //~^ ERROR evaluate(Binder(TraitPredicate(<std::vec::Vec<First> as std::marker::Unpin>), [])) = Ok(EvaluatedToOk)
+ //~| ERROR evaluate(Binder(TraitPredicate(<Third<Ty> as std::marker::Unpin>), [])) = Ok(EvaluatedToOkModuloRegions)
+}
--- /dev/null
+error: evaluate(Binder(TraitPredicate(<std::vec::Vec<First> as std::marker::Unpin>), [])) = Ok(EvaluatedToOk)
+ --> $DIR/issue-83538-tainted-cache-after-cycle.rs:59:5
+ |
+LL | Vec<First>: Unpin,
+ | ----- predicate
+...
+LL | forward();
+ | ^^^^^^^
+
+error: evaluate(Binder(TraitPredicate(<Third<Ty> as std::marker::Unpin>), [])) = Ok(EvaluatedToOkModuloRegions)
+ --> $DIR/issue-83538-tainted-cache-after-cycle.rs:59:5
+ |
+LL | Third<Ty>: Unpin,
+ | ----- predicate
+...
+LL | forward();
+ | ^^^^^^^
+
+error: evaluate(Binder(TraitPredicate(<Third<Ty> as std::marker::Unpin>), [])) = Ok(EvaluatedToOkModuloRegions)
+ --> $DIR/issue-83538-tainted-cache-after-cycle.rs:63:5
+ |
+LL | Third<Ty>: Unpin,
+ | ----- predicate
+...
+LL | reverse();
+ | ^^^^^^^
+
+error: evaluate(Binder(TraitPredicate(<std::vec::Vec<First> as std::marker::Unpin>), [])) = Ok(EvaluatedToOk)
+ --> $DIR/issue-83538-tainted-cache-after-cycle.rs:63:5
+ |
+LL | Vec<First>: Unpin,
+ | ----- predicate
+...
+LL | reverse();
+ | ^^^^^^^
+
+error: aborting due to 4 previous errors
+
LL | assert_eq!(cfg_res, 5);
| ^^^^^^^^^^^^^^^^^^^^^^^ use of possibly-uninitialized `cfg_res`
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | define_struct! { (foo) }
| ------------------------ in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `define_struct` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0412]: cannot find type `foo` in this scope
--> $DIR/test2.rs:11:23
LL | define_struct! { foo }
| ---------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `define_struct` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0412]: cannot find type `foo` in this scope
--> $DIR/test3.rs:11:22
| help: maybe write a path separator here: `::`
|
= note: `#![feature(type_ascription)]` lets you annotate an expression with a type: `<expr>: <type>`
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::__rust_force_expr` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
| |
| consider giving `x` the explicit type `Vec<T>`, where the type parameter `T` is specified
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
| |
| consider giving this pattern the explicit type `(Vec<T>,)`, where the type parameter `T` is specified
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | f(|x| lib::d!(x));
| ^^^^^^^^^^ expected `()`, found `i32`
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `lib::d` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0308]: mismatched types
--> $DIR/issue-81943.rs:8:28
LL | f(|x| d!(x));
| ----- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `d` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider using a semicolon here
|
LL | ($e:expr) => { match $e { x => { g(x); } } }
fn bar() {
let x: Box<Bar()> = panic!();
//~^ ERROR parenthesized type parameters may only be used with a `Fn` trait
- //~| ERROR missing generics for struct `Bar`
+ //~| ERROR this struct takes 1 generic argument but 0 generic arguments
}
fn main() { }
LL | let x: Box<Bar()> = panic!();
| ^^^^^ only `Fn` traits may use parentheses
-error[E0107]: missing generics for struct `Bar`
+error[E0107]: this struct takes 1 generic argument but 0 generic arguments were supplied
--> $DIR/unboxed-closure-sugar-used-on-struct-1.rs:8:16
|
LL | let x: Box<Bar()> = panic!();
| ^^^ -
help: add missing generic argument
|
-LL | let x: Box<Bar<A>()> = panic!();
- | ^^^^^^
+LL | let x: Box<Bar(A)> = panic!();
+ | ^
error: aborting due to 2 previous errors
fn foo(b: Box<Bar()>) {
//~^ ERROR parenthesized type parameters may only be used with a `Fn` trait
- //~| ERROR missing generics for struct `Bar`
+ //~| ERROR this struct takes 1 generic argument but 0 generic arguments
}
fn main() { }
LL | fn foo(b: Box<Bar()>) {
| ^^^^^ only `Fn` traits may use parentheses
-error[E0107]: missing generics for struct `Bar`
+error[E0107]: this struct takes 1 generic argument but 0 generic arguments were supplied
--> $DIR/unboxed-closure-sugar-used-on-struct.rs:7:15
|
LL | fn foo(b: Box<Bar()>) {
| ^^^ -
help: add missing generic argument
|
-LL | fn foo(b: Box<Bar<A>()>) {
- | ^^^^^^
+LL | fn foo(b: Box<Bar(A)>) {
+ | ^
error: aborting due to 2 previous errors
LL | pub struct AssertParamIsCopy<T: Copy + ?Sized> {
| ---- required by this bound in `AssertParamIsCopy`
|
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0599]: the method `clone` exists for union `U5<CloneNoCopy>`, but its trait bounds were not satisfied
--> $DIR/union-derive-clone.rs:35:15
LL | pub struct AssertParamIsEq<T: Eq + ?Sized> {
| -- required by this bound in `AssertParamIsEq`
|
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
--- /dev/null
+error: unnecessary `unsafe` block
+ --> $DIR/unsafe-around-compiler-generated-unsafe.rs:9:5
+ |
+LL | unsafe { println!("foo"); }
+ | ^^^^^^ unnecessary `unsafe` block
+ |
+note: the lint level is defined here
+ --> $DIR/unsafe-around-compiler-generated-unsafe.rs:6:9
+ |
+LL | #![deny(unused_unsafe)]
+ | ^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
// issue #12418
+// revisions: mir thir
+// [thir]compile-flags: -Z thir-unsafeck
+
#![deny(unused_unsafe)]
fn main() {
+++ /dev/null
-error: unnecessary `unsafe` block
- --> $DIR/unsafe-around-compiler-generated-unsafe.rs:6:5
- |
-LL | unsafe { println!("foo"); }
- | ^^^^^^ unnecessary `unsafe` block
- |
-note: the lint level is defined here
- --> $DIR/unsafe-around-compiler-generated-unsafe.rs:3:9
- |
-LL | #![deny(unused_unsafe)]
- | ^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
--- /dev/null
+error: unnecessary `unsafe` block
+ --> $DIR/unsafe-around-compiler-generated-unsafe.rs:9:5
+ |
+LL | unsafe { println!("foo"); }
+ | ^^^^^^ unnecessary `unsafe` block
+ |
+note: the lint level is defined here
+ --> $DIR/unsafe-around-compiler-generated-unsafe.rs:6:9
+ |
+LL | #![deny(unused_unsafe)]
+ | ^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
--- /dev/null
+error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
+ --> $DIR/unsafe-const-fn.rs:10:18
+ |
+LL | const VAL: u32 = dummy(0xFFFF);
+ | ^^^^^^^^^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0133`.
// A quick test of 'unsafe const fn' functionality
+// revisions: mir thir
+// [thir]compile-flags: -Z thir-unsafeck
+
const unsafe fn dummy(v: u32) -> u32 {
!v
}
+++ /dev/null
-error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
- --> $DIR/unsafe-const-fn.rs:7:18
- |
-LL | const VAL: u32 = dummy(0xFFFF);
- | ^^^^^^^^^^^^^ call to unsafe function
- |
- = note: consult the function's documentation for information on how to avoid undefined behavior
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0133`.
--- /dev/null
+error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
+ --> $DIR/unsafe-const-fn.rs:10:18
+ |
+LL | const VAL: u32 = dummy(0xFFFF);
+ | ^^^^^^^^^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0133`.
--- /dev/null
+error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
+ --> $DIR/unsafe-fn-called-from-safe.rs:7:5
+ |
+LL | f();
+ | ^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0133`.
+// revisions: mir thir
+// [thir]compile-flags: -Z thir-unsafeck
+
unsafe fn f() { return; }
fn main() {
+++ /dev/null
-error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
- --> $DIR/unsafe-fn-called-from-safe.rs:4:5
- |
-LL | f();
- | ^^^ call to unsafe function
- |
- = note: consult the function's documentation for information on how to avoid undefined behavior
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0133`.
--- /dev/null
+error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
+ --> $DIR/unsafe-fn-called-from-safe.rs:7:5
+ |
+LL | f();
+ | ^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0133`.
--- /dev/null
+error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
+ --> $DIR/unsafe-fn-used-as-value.rs:8:5
+ |
+LL | x();
+ | ^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0133`.
+// revisions: mir thir
+// [thir]compile-flags: -Z thir-unsafeck
+
unsafe fn f() { return; }
fn main() {
+++ /dev/null
-error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
- --> $DIR/unsafe-fn-used-as-value.rs:5:5
- |
-LL | x();
- | ^^^ call to unsafe function
- |
- = note: consult the function's documentation for information on how to avoid undefined behavior
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0133`.
--- /dev/null
+error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
+ --> $DIR/unsafe-fn-used-as-value.rs:8:5
+ |
+LL | x();
+ | ^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0133`.
LL | create_macro!();
| ---------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `create_macro` (in Nightly builds, run with -Z macro-backtrace for more info)
error: unused macro definition
--> $DIR/unused-macro-rules.rs:24:5
= note: `#[warn(irrefutable_let_patterns)]` on by default
= note: this pattern will always match, so the loop will never exit
= help: consider instead using a `loop { ... }` with a `let` inside it
- = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: irrefutable `while let` pattern
--> $DIR/while-let.rs:7:13
|
= note: this pattern will always match, so the loop will never exit
= help: consider instead using a `loop { ... }` with a `let` inside it
- = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this warning originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: irrefutable `while let` pattern
--> $DIR/while-let.rs:27:5
LL | #![deny(clippy::internal)]
| ^^^^^^^^^^^^^^^^
= note: `#[deny(clippy::default_lint)]` implied by `#[deny(clippy::internal)]`
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::declare_tool_lint` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | | }
| |_____^
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `__if_chain` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `let` expression should be above the `if_chain!`
--> $DIR/if_chain_style.rs:40:9
LL | #![deny(clippy::internal)]
| ^^^^^^^^^^^^^^^^
= note: `#[deny(clippy::lint_without_lint_pass)]` implied by `#[deny(clippy::internal)]`
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `declare_tool_lint` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
|
= note: `-D clippy::assertions-on-constants` implied by `-D warnings`
= help: remove it
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `assert!(false)` should probably be replaced
--> $DIR/assertions_on_constants.rs:12:5
| ^^^^^^^^^^^^^^^
|
= help: use `panic!()` or `unreachable!()`
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `assert!(true)` will be optimized out by the compiler
--> $DIR/assertions_on_constants.rs:13:5
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: remove it
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `assert!(false, "false message")` should probably be replaced
--> $DIR/assertions_on_constants.rs:14:5
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: use `panic!("false message")` or `unreachable!("false message")`
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `assert!(false, msg.to_uppercase())` should probably be replaced
--> $DIR/assertions_on_constants.rs:17:5
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: use `panic!(msg.to_uppercase())` or `unreachable!(msg.to_uppercase())`
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `assert!(true)` will be optimized out by the compiler
--> $DIR/assertions_on_constants.rs:20:5
| ^^^^^^^^^^^
|
= help: remove it
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `assert!(false)` should probably be replaced
--> $DIR/assertions_on_constants.rs:23:5
| ^^^^^^^^^^^
|
= help: use `panic!()` or `unreachable!()`
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `assert!(false, "C message")` should probably be replaced
--> $DIR/assertions_on_constants.rs:24:5
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: use `panic!("C message")` or `unreachable!("C message")`
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `debug_assert!(true)` will be optimized out by the compiler
--> $DIR/assertions_on_constants.rs:26:5
| ^^^^^^^^^^^^^^^^^^^^
|
= help: remove it
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::assert` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 9 previous errors
LL | m!(x);
| ------ in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
error: you checked before that `unwrap()` cannot fail, instead of checking and unwrapping, it's better to use `if let` or `match`
--> $DIR/simple_conditionals.rs:54:9
| ^^^ ^^^^^^^ with this pattern
| |
| replace this binding
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: unnecessary nested match
--> $DIR/collapsible_match2.rs:51:20
LL | define_other_core!();
| --------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `define_other_core` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
LL | declare_const!(_ONCE: Once = Once::new()); //~ ERROR interior mutable
| ------------------------------------------ in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `declare_const` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 4 previous errors
LL | declare_const!(ANOTHER_ATOMIC: AtomicUsize = Self::ATOMIC); //~ ERROR interior mutable
| ----------------------------------------------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `declare_const` (in Nightly builds, run with -Z macro-backtrace for more info)
error: a `const` item should never be interior mutable
--> $DIR/traits.rs:43:5
LL | m!(self)
| -------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
error: immediately dereferencing a reference
--> $DIR/deref_addrof.rs:51:9
LL | m_mut!(self)
| ------------ in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `m_mut` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 10 previous errors
LL | | }
LL | | }
| |_^
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info)
error: you are deriving `Hash` but have implemented `PartialEq` explicitly
--> $DIR/derive_hash_xor_eq.rs:19:10
LL | | }
LL | | }
| |_^
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info)
error: you are implementing `Hash` explicitly but have derived `PartialEq`
--> $DIR/derive_hash_xor_eq.rs:31:1
|
LL | #[derive(PartialEq)]
| ^^^^^^^^^
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
error: you are implementing `Hash` explicitly but have derived `PartialEq`
--> $DIR/derive_hash_xor_eq.rs:49:5
|
LL | #[derive(PartialEq)]
| ^^^^^^^^^
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 4 previous errors
LL | | }
LL | | }
| |_^
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info)
error: you are deriving `Ord` but have implemented `PartialOrd` explicitly
--> $DIR/derive_ord_xor_partial_ord.rs:30:10
LL | | }
LL | | }
| |_^
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info)
error: you are implementing `Ord` explicitly but have derived `PartialOrd`
--> $DIR/derive_ord_xor_partial_ord.rs:42:1
|
LL | #[derive(PartialOrd, PartialEq, Eq)]
| ^^^^^^^^^^
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
error: you are implementing `Ord` explicitly but have derived `PartialOrd`
--> $DIR/derive_ord_xor_partial_ord.rs:62:5
|
LL | #[derive(PartialOrd, PartialEq, Eq)]
| ^^^^^^^^^^
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 4 previous errors
LL | very_unsafe!();
| --------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `very_unsafe` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 5 previous errors
| ----------------------- in this macro invocation
|
= note: `-D clippy::eq-op` implied by `-D warnings`
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `assert_in_macro_def` (in Nightly builds, run with -Z macro-backtrace for more info)
error: identical args used in this `assert_ne!` macro call
--> $DIR/eq_op_macros.rs:8:20
LL | assert_in_macro_def!();
| ----------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `assert_in_macro_def` (in Nightly builds, run with -Z macro-backtrace for more info)
error: identical args used in this `assert_eq!` macro call
--> $DIR/eq_op_macros.rs:22:16
LL | assert_in_macro_def!();
| ----------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `assert_in_macro_def` (in Nightly builds, run with -Z macro-backtrace for more info)
error: identical args used in this `debug_assert_ne!` macro call
--> $DIR/eq_op_macros.rs:10:26
LL | assert_in_macro_def!();
| ----------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `assert_in_macro_def` (in Nightly builds, run with -Z macro-backtrace for more info)
error: identical args used in this `debug_assert_eq!` macro call
--> $DIR/eq_op_macros.rs:38:22
|
LL | panic!();
| ^^^^^^^^^
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
error: consider implementing `TryFrom` instead
--> $DIR/fallible_impl_from.rs:35:1
| ^^^^^^^^^^^^^^^^^^^^^^^^^
LL | panic!("{:?}", s);
| ^^^^^^^^^^^^^^^^^^
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
error: consider implementing `TryFrom` instead
--> $DIR/fallible_impl_from.rs:53:1
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | panic!("{:?}", s);
| ^^^^^^^^^^^^^^^^^^
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 4 previous errors
LL | gen!(impl);
| ----------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `gen` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider adding a type parameter
|
LL | impl<K: Hash + Eq, V, S: ::std::hash::BuildHasher + Default> Foo<u8> for HashMap<K, V, S> {
LL | gen!(fn bar);
| ------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `gen` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider adding a type parameter
|
LL | pub fn $name<S: ::std::hash::BuildHasher>(_map: &mut HashMap<i32, i32, S>, _set: &mut HashSet<i32>) {}
LL | gen!(fn bar);
| ------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `gen` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider adding a type parameter
|
LL | pub fn $name<S: ::std::hash::BuildHasher>(_map: &mut HashMap<i32, i32>, _set: &mut HashSet<i32, S>) {}
LL | b!();
| ----- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `b` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 3 previous errors
|
LL | (Ok(x), Some(_)) => println!("ok {}", x),
| ^^^^^^^^^^^^^^^^
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
error: this `match` has identical arm bodies
--> $DIR/match_same_arms2.rs:117:18
|
LL | Ok(3) => println!("ok"),
| ^^^^^
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
error: this `match` has identical arm bodies
--> $DIR/match_same_arms2.rs:144:14
| | help: try dereferencing: `*rro`
| in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `mem_discriminant_but_in_a_macro` (in Nightly builds, run with -Z macro-backtrace for more info)
error: calling `mem::discriminant` on non-enum type `&&&&&std::option::Option<i32>`
--> $DIR/mem_discriminant.rs:34:5
| --------- in this macro invocation
|
= note: `-D clippy::mem-replace-with-default` implied by `-D warnings`
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `take` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
|
LL | panic!("This function panics")
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
error: docs for function which may panic missing `# Panics` section
--> $DIR/missing_panics_doc.rs:18:1
|
LL | todo!()
| ^^^^^^^
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
error: docs for function which may panic missing `# Panics` section
--> $DIR/missing_panics_doc.rs:23:1
|
LL | panic!()
| ^^^^^^^^
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
error: docs for function which may panic missing `# Panics` section
--> $DIR/missing_panics_doc.rs:32:1
|
LL | if true { unreachable!() } else { panic!() }
| ^^^^^^^^
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
error: docs for function which may panic missing `# Panics` section
--> $DIR/missing_panics_doc.rs:37:1
|
LL | assert_eq!(x, 0);
| ^^^^^^^^^^^^^^^^^
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
error: docs for function which may panic missing `# Panics` section
--> $DIR/missing_panics_doc.rs:43:1
|
LL | assert_ne!(x, 0);
| ^^^^^^^^^^^^^^^^^
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `assert_ne` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 7 previous errors
LL | let mut z = mut_ptr!(&mut 3u32);
| ------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `mut_ptr` (in Nightly builds, run with -Z macro-backtrace for more info)
error: this expression mutably borrows a mutable reference. Consider reborrowing
--> $DIR/mut_mut.rs:22:21
LL | let _x = some_and_qmark_in_macro!(x?);
| ---------------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `some_and_qmark_in_macro` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 12 previous errors
| -------------------------- in this macro invocation
|
= help: consider using the `env!` macro instead
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `option_env_unwrap` (in Nightly builds, run with -Z macro-backtrace for more info)
error: this will panic at run-time if the environment variable doesn't exist at compile-time
--> $DIR/option_env_unwrap.rs:12:9
| ----------------------------------------------------------------- in this macro invocation
|
= help: consider using the `env!` macro instead
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `option_env_unwrap` (in Nightly builds, run with -Z macro-backtrace for more info)
error: this will panic at run-time if the environment variable doesn't exist at compile-time
--> $DIR/option_env_unwrap.rs:21:13
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider using the `env!` macro instead
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `option_env_unwrap_external` (in Nightly builds, run with -Z macro-backtrace for more info)
error: this will panic at run-time if the environment variable doesn't exist at compile-time
--> $DIR/option_env_unwrap.rs:22:13
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider using the `env!` macro instead
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `option_env_unwrap_external` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 6 previous errors
|
LL | panic!("error");
| ^^^^^^^^^^^^^^^^
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
error: used `unimplemented!()`, `unreachable!()`, `todo!()`, `panic!()` or assertion in a function that returns `Result`
--> $DIR/panic_in_result_fn.rs:12:5
|
LL | unimplemented!();
| ^^^^^^^^^^^^^^^^^
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `unimplemented` (in Nightly builds, run with -Z macro-backtrace for more info)
error: used `unimplemented!()`, `unreachable!()`, `todo!()`, `panic!()` or assertion in a function that returns `Result`
--> $DIR/panic_in_result_fn.rs:17:5
|
LL | unreachable!();
| ^^^^^^^^^^^^^^^
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `unreachable` (in Nightly builds, run with -Z macro-backtrace for more info)
error: used `unimplemented!()`, `unreachable!()`, `todo!()`, `panic!()` or assertion in a function that returns `Result`
--> $DIR/panic_in_result_fn.rs:22:5
|
LL | todo!("Finish this");
| ^^^^^^^^^^^^^^^^^^^^^
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `todo` (in Nightly builds, run with -Z macro-backtrace for more info)
error: used `unimplemented!()`, `unreachable!()`, `todo!()`, `panic!()` or assertion in a function that returns `Result`
--> $DIR/panic_in_result_fn.rs:53:1
|
LL | panic!("error");
| ^^^^^^^^^^^^^^^^
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
error: used `unimplemented!()`, `unreachable!()`, `todo!()`, `panic!()` or assertion in a function that returns `Result`
--> $DIR/panic_in_result_fn.rs:68:1
|
LL | todo!("finish main method");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `todo` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 6 previous errors
|
LL | assert!(x == 5, "wrong argument");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info)
error: used `unimplemented!()`, `unreachable!()`, `todo!()`, `panic!()` or assertion in a function that returns `Result`
--> $DIR/panic_in_result_fn_assertions.rs:13:5
|
LL | assert_eq!(x, 5);
| ^^^^^^^^^^^^^^^^^
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
error: used `unimplemented!()`, `unreachable!()`, `todo!()`, `panic!()` or assertion in a function that returns `Result`
--> $DIR/panic_in_result_fn_assertions.rs:19:5
|
LL | assert_ne!(x, 1);
| ^^^^^^^^^^^^^^^^^
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `assert_ne` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 3 previous errors
| ^^^^^^^^
|
= note: `-D clippy::todo` implied by `-D warnings`
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `todo` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `todo` should not be present in production code
--> $DIR/panicking_macros.rs:17:5
LL | todo!("message");
| ^^^^^^^^^^^^^^^^^
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `todo` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `todo` should not be present in production code
--> $DIR/panicking_macros.rs:18:5
LL | todo!("{} {}", "panic with", "multiple arguments");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `todo` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `unimplemented` should not be present in production code
--> $DIR/panicking_macros.rs:24:5
| ^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::unimplemented` implied by `-D warnings`
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `unimplemented` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `unimplemented` should not be present in production code
--> $DIR/panicking_macros.rs:25:5
LL | unimplemented!("message");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `unimplemented` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `unimplemented` should not be present in production code
--> $DIR/panicking_macros.rs:26:5
LL | unimplemented!("{} {}", "panic with", "multiple arguments");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `unimplemented` (in Nightly builds, run with -Z macro-backtrace for more info)
error: usage of the `unreachable!` macro
--> $DIR/panicking_macros.rs:32:5
| ^^^^^^^^^^^^^^^
|
= note: `-D clippy::unreachable` implied by `-D warnings`
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `unreachable` (in Nightly builds, run with -Z macro-backtrace for more info)
error: usage of the `unreachable!` macro
--> $DIR/panicking_macros.rs:33:5
LL | unreachable!("message");
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::unreachable` (in Nightly builds, run with -Z macro-backtrace for more info)
error: usage of the `unreachable!` macro
--> $DIR/panicking_macros.rs:34:5
LL | unreachable!("{} {}", "panic with", "multiple arguments");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `unreachable` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `panic` should not be present in production code
--> $DIR/panicking_macros.rs:40:5
LL | todo!();
| ^^^^^^^^
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `todo` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `unimplemented` should not be present in production code
--> $DIR/panicking_macros.rs:42:5
LL | unimplemented!();
| ^^^^^^^^^^^^^^^^^
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `unimplemented` (in Nightly builds, run with -Z macro-backtrace for more info)
error: usage of the `unreachable!` macro
--> $DIR/panicking_macros.rs:43:5
LL | unreachable!();
| ^^^^^^^^^^^^^^^
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `unreachable` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 16 previous errors
| ----------------------- in this macro invocation
|
= help: use `*` to dereference the match expression or explicitly match against a `&_` pattern and adjust the enclosed variable bindings
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `matching_macro` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 9 previous errors
LL | gen_binding!();
| --------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `gen_binding` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 6 previous errors
LL | gen_function!();
| ---------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `gen_function` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors
LL | try_validation!(Ok::<_, i32>(5));
| --------------------------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `try_validation` (in Nightly builds, run with -Z macro-backtrace for more info)
error: returning an `Err(_)` with the `?` operator
--> $DIR/try_err.rs:102:23
LL | try_validation_in_macro!(Ok::<_, i32>(5));
| ------------------------------------------ in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `try_validation_in_macro` (in Nightly builds, run with -Z macro-backtrace for more info)
error: returning an `Err(_)` with the `?` operator
--> $DIR/try_err.rs:141:9
LL | | );
| |______^
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `debug_assert_eq` of unit values detected. This will always succeed
--> $DIR/unit_cmp.rs:32:5
LL | | );
| |______^
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `assert_ne` of unit values detected. This will always fail
--> $DIR/unit_cmp.rs:41:5
LL | | );
| |______^
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `assert_ne` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `debug_assert_ne` of unit values detected. This will always fail
--> $DIR/unit_cmp.rs:49:5
LL | | );
| |______^
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::assert_ne` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 6 previous errors
|
= note: `-D clippy::unsafe-derive-deserialize` implied by `-D warnings`
= help: consider implementing `serde::Deserialize` manually. See https://serde.rs/impl-deserialize.html
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info)
error: you are deriving `serde::Deserialize` on a type that has methods using `unsafe`
--> $DIR/unsafe_derive_deserialize.rs:16:10
| ^^^^^^^^^^^
|
= help: consider implementing `serde::Deserialize` manually. See https://serde.rs/impl-deserialize.html
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info)
error: you are deriving `serde::Deserialize` on a type that has methods using `unsafe`
--> $DIR/unsafe_derive_deserialize.rs:22:10
| ^^^^^^^^^^^
|
= help: consider implementing `serde::Deserialize` manually. See https://serde.rs/impl-deserialize.html
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info)
error: you are deriving `serde::Deserialize` on a type that has methods using `unsafe`
--> $DIR/unsafe_derive_deserialize.rs:30:10
| ^^^^^^^^^^^
|
= help: consider implementing `serde::Deserialize` manually. See https://serde.rs/impl-deserialize.html
- = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the derive macro `Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 4 previous errors
LL | let _ = lit_from_macro!();
| ----------------- in this macro invocation
|
- = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `lit_from_macro` (in Nightly builds, run with -Z macro-backtrace for more info)
error: integer type suffix should be separated by an underscore
--> $DIR/unseparated_prefix_literals.rs:40:16
-Subproject commit 38b5f236d2c62ff0b1017efd183b193f5db33123
+Subproject commit bcae3315a76876eb48e06519749cfe6e453a8e93
const ENTRY_LIMIT: usize = 1000;
// FIXME: The following limits should be reduced eventually.
-const ROOT_ENTRY_LIMIT: usize = 1388;
-const ISSUES_ENTRY_LIMIT: usize = 2551;
+const ROOT_ENTRY_LIMIT: usize = 1370;
+const ISSUES_ENTRY_LIMIT: usize = 2555;
fn check_entries(path: &Path, bad: &mut bool) {
let dirs = walkdir::WalkDir::new(&path.join("test/ui"))