1
Fork 0

Auto merge of #95180 - matthiaskrgr:rollup-ai1ch2s, r=matthiaskrgr

Rollup of 6 pull requests

Successful merges:

 - #95074 (Refactor: use `format-args-capture` and remove unnecessary nested if blocks in some parts of `rust_passes`)
 - #95085 (Return err instead of ICE)
 - #95116 (Add needs-* directives to many tests)
 - #95129 (Remove animation on source sidebar)
 - #95166 (Update the unstable book with the new `values()` form of check-cfg)
 - #95175 (move `adt_const_params`  to its own tracking issue)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2022-03-21 19:23:00 +00:00
commit 3c17c84a38
40 changed files with 250 additions and 222 deletions

View file

@ -287,7 +287,7 @@ declare_features! (
/// Allows `extern "x86-interrupt" fn()`. /// Allows `extern "x86-interrupt" fn()`.
(active, abi_x86_interrupt, "1.17.0", Some(40180), None), (active, abi_x86_interrupt, "1.17.0", Some(40180), None),
/// Allows additional const parameter types, such as `&'static str` or user defined types /// Allows additional const parameter types, such as `&'static str` or user defined types
(incomplete, adt_const_params, "1.56.0", Some(44580), None), (incomplete, adt_const_params, "1.56.0", Some(95174), None),
/// Allows defining an `#[alloc_error_handler]`. /// Allows defining an `#[alloc_error_handler]`.
(active, alloc_error_handler, "1.29.0", Some(51540), None), (active, alloc_error_handler, "1.29.0", Some(51540), None),
/// Allows explicit discriminants on non-unit enum variants. /// Allows explicit discriminants on non-unit enum variants.

View file

@ -196,8 +196,7 @@ impl CheckAttrVisitor<'_> {
fn inline_attr_str_error_with_macro_def(&self, hir_id: HirId, attr: &Attribute, sym: &str) { fn inline_attr_str_error_with_macro_def(&self, hir_id: HirId, attr: &Attribute, sym: &str) {
self.tcx.struct_span_lint_hir(UNUSED_ATTRIBUTES, hir_id, attr.span, |lint| { self.tcx.struct_span_lint_hir(UNUSED_ATTRIBUTES, hir_id, attr.span, |lint| {
lint.build(&format!( lint.build(&format!(
"`#[{}]` is ignored on struct fields, match arms and macro defs", "`#[{sym}]` is ignored on struct fields, match arms and macro defs",
sym,
)) ))
.warn( .warn(
"this was previously accepted by the compiler but is \ "this was previously accepted by the compiler but is \
@ -214,7 +213,7 @@ impl CheckAttrVisitor<'_> {
fn inline_attr_str_error_without_macro_def(&self, hir_id: HirId, attr: &Attribute, sym: &str) { fn inline_attr_str_error_without_macro_def(&self, hir_id: HirId, attr: &Attribute, sym: &str) {
self.tcx.struct_span_lint_hir(UNUSED_ATTRIBUTES, hir_id, attr.span, |lint| { self.tcx.struct_span_lint_hir(UNUSED_ATTRIBUTES, hir_id, attr.span, |lint| {
lint.build(&format!("`#[{}]` is ignored on struct fields and match arms", sym)) lint.build(&format!("`#[{sym}]` is ignored on struct fields and match arms"))
.warn( .warn(
"this was previously accepted by the compiler but is \ "this was previously accepted by the compiler but is \
being phased out; it will become a hard error in \ being phased out; it will become a hard error in \
@ -721,7 +720,7 @@ impl CheckAttrVisitor<'_> {
.sess .sess
.struct_span_err( .struct_span_err(
meta.name_value_literal_span().unwrap_or_else(|| meta.span()), meta.name_value_literal_span().unwrap_or_else(|| meta.span()),
&format!("`{}` is not a valid identifier", doc_keyword), &format!("`{doc_keyword}` is not a valid identifier"),
) )
.emit(); .emit();
return false; return false;
@ -805,8 +804,7 @@ impl CheckAttrVisitor<'_> {
.struct_span_err( .struct_span_err(
meta.span(), meta.span(),
&format!( &format!(
"`#![doc({} = \"...\")]` isn't allowed as a crate-level attribute", "`#![doc({attr_name} = \"...\")]` isn't allowed as a crate-level attribute",
attr_name,
), ),
) )
.emit(); .emit();
@ -1035,8 +1033,7 @@ impl CheckAttrVisitor<'_> {
attr.meta().unwrap().span, attr.meta().unwrap().span,
"use `doc = include_str!` instead", "use `doc = include_str!` instead",
format!( format!(
"#{}[doc = include_str!(\"{}\")]", "#{inner}[doc = include_str!(\"{value}\")]",
inner, value
), ),
applicability, applicability,
); );
@ -1230,7 +1227,7 @@ impl CheckAttrVisitor<'_> {
if let Some(value) = attr.value_str() { if let Some(value) = attr.value_str() {
diag.span_help( diag.span_help(
attr.span, attr.span,
&format!(r#"try `#[link(name = "{}")]` instead"#, value), &format!(r#"try `#[link(name = "{value}")]` instead"#),
); );
} else { } else {
diag.span_help(attr.span, r#"try `#[link(name = "...")]` instead"#); diag.span_help(attr.span, r#"try `#[link(name = "...")]` instead"#);
@ -1518,15 +1515,14 @@ impl CheckAttrVisitor<'_> {
}; };
self.tcx.struct_span_lint_hir(UNUSED_ATTRIBUTES, hir_id, attr.span, |lint| { self.tcx.struct_span_lint_hir(UNUSED_ATTRIBUTES, hir_id, attr.span, |lint| {
lint.build(&format!( lint.build(&format!(
"`#[no_mangle]` has no effect on a foreign {}", "`#[no_mangle]` has no effect on a foreign {foreign_item_kind}"
foreign_item_kind
)) ))
.warn( .warn(
"this was previously accepted by the compiler but is \ "this was previously accepted by the compiler but is \
being phased out; it will become a hard error in \ being phased out; it will become a hard error in \
a future release!", a future release!",
) )
.span_label(span, format!("foreign {}", foreign_item_kind)) .span_label(span, format!("foreign {foreign_item_kind}"))
.note("symbol names in extern blocks are not mangled") .note("symbol names in extern blocks are not mangled")
.span_suggestion( .span_suggestion(
attr.span, attr.span,
@ -1692,9 +1688,9 @@ impl CheckAttrVisitor<'_> {
hint.span(), hint.span(),
E0517, E0517,
"{}", "{}",
&format!("attribute should be applied to {} {}", article, allowed_targets) &format!("attribute should be applied to {article} {allowed_targets}")
) )
.span_label(span, &format!("not {} {}", article, allowed_targets)) .span_label(span, &format!("not {article} {allowed_targets}"))
.emit(); .emit();
} }

View file

@ -80,8 +80,7 @@ impl<'tcx> hir::itemlikevisit::ItemLikeVisitor<'tcx> for CheckConstTraitVisitor<
/// of the trait being implemented; as those provided functions can be non-const. /// of the trait being implemented; as those provided functions can be non-const.
fn visit_item<'hir>(&mut self, item: &'hir hir::Item<'hir>) { fn visit_item<'hir>(&mut self, item: &'hir hir::Item<'hir>) {
let _: Option<_> = try { let _: Option<_> = try {
if let hir::ItemKind::Impl(ref imp) = item.kind { if let hir::ItemKind::Impl(ref imp) = item.kind && let hir::Constness::Const = imp.constness {
if let hir::Constness::Const = imp.constness {
let trait_def_id = imp.of_trait.as_ref()?.trait_def_id()?; let trait_def_id = imp.of_trait.as_ref()?.trait_def_id()?;
let ancestors = self let ancestors = self
.tcx .tcx
@ -132,7 +131,6 @@ impl<'tcx> hir::itemlikevisit::ItemLikeVisitor<'tcx> for CheckConstTraitVisitor<
.note(&format!("`{}` not implemented", to_implement.join("`, `"))) .note(&format!("`{}` not implemented", to_implement.join("`, `")))
.emit(); .emit();
} }
}
} }
}; };
} }

View file

@ -61,10 +61,9 @@ fn collect_item(tcx: TyCtxt<'_>, items: &mut DiagnosticItems, name: Symbol, item
if let Some(original_def_id) = items.name_to_id.insert(name, item_def_id) { if let Some(original_def_id) = items.name_to_id.insert(name, item_def_id) {
if original_def_id != item_def_id { if original_def_id != item_def_id {
let mut err = match tcx.hir().span_if_local(item_def_id) { let mut err = match tcx.hir().span_if_local(item_def_id) {
Some(span) => tcx.sess.struct_span_err( Some(span) => tcx
span, .sess
&format!("duplicate diagnostic item found: `{}`.", name), .struct_span_err(span, &format!("duplicate diagnostic item found: `{name}`.")),
),
None => tcx.sess.struct_err(&format!( None => tcx.sess.struct_err(&format!(
"duplicate diagnostic item in crate `{}`: `{}`.", "duplicate diagnostic item in crate `{}`: `{}`.",
tcx.crate_name(item_def_id.krate), tcx.crate_name(item_def_id.krate),

View file

@ -148,33 +148,29 @@ fn configure_main(tcx: TyCtxt<'_>, visitor: &EntryContext<'_, '_>) -> Option<(De
} else if let Some((def_id, _)) = visitor.attr_main_fn { } else if let Some((def_id, _)) = visitor.attr_main_fn {
Some((def_id.to_def_id(), EntryFnType::Main)) Some((def_id.to_def_id(), EntryFnType::Main))
} else { } else {
if let Some(main_def) = tcx.resolutions(()).main_def { if let Some(main_def) = tcx.resolutions(()).main_def && let Some(def_id) = main_def.opt_fn_def_id() {
if let Some(def_id) = main_def.opt_fn_def_id() { // non-local main imports are handled below
// non-local main imports are handled below if let Some(def_id) = def_id.as_local() && matches!(tcx.hir().find_by_def_id(def_id), Some(Node::ForeignItem(_))) {
if let Some(def_id) = def_id.as_local() { tcx.sess
if matches!(tcx.hir().find_by_def_id(def_id), Some(Node::ForeignItem(_))) { .struct_span_err(
tcx.sess tcx.def_span(def_id),
.struct_span_err( "the `main` function cannot be declared in an `extern` block",
tcx.def_span(def_id),
"the `main` function cannot be declared in an `extern` block",
)
.emit();
return None;
}
}
if main_def.is_import && !tcx.features().imported_main {
let span = main_def.span;
feature_err(
&tcx.sess.parse_sess,
sym::imported_main,
span,
"using an imported function as entry point `main` is experimental",
) )
.emit(); .emit();
} return None;
return Some((def_id, EntryFnType::Main));
} }
if main_def.is_import && !tcx.features().imported_main {
let span = main_def.span;
feature_err(
&tcx.sess.parse_sess,
sym::imported_main,
span,
"using an imported function as entry point `main` is experimental",
)
.emit();
}
return Some((def_id, EntryFnType::Main));
} }
no_main_err(tcx, visitor); no_main_err(tcx, visitor);
None None
@ -225,11 +221,9 @@ fn no_main_err(tcx: TyCtxt<'_>, visitor: &EntryContext<'_, '_>) {
err.note(&note); err.note(&note);
} }
if let Some(main_def) = tcx.resolutions(()).main_def { if let Some(main_def) = tcx.resolutions(()).main_def && main_def.opt_fn_def_id().is_none(){
if main_def.opt_fn_def_id().is_none() { // There is something at `crate::main`, but it is not a function definition.
// There is something at `crate::main`, but it is not a function definition. err.span_label(main_def.span, "non-function item at `crate::main` is found");
err.span_label(main_def.span, "non-function item at `crate::main` is found");
}
} }
if tcx.sess.teach(&err.get_code().unwrap()) { if tcx.sess.teach(&err.get_code().unwrap()) {

View file

@ -79,27 +79,25 @@ impl<'tcx> ExprVisitor<'tcx> {
// Special-case transmuting from `typeof(function)` and // Special-case transmuting from `typeof(function)` and
// `Option<typeof(function)>` to present a clearer error. // `Option<typeof(function)>` to present a clearer error.
let from = unpack_option_like(self.tcx, from); let from = unpack_option_like(self.tcx, from);
if let (&ty::FnDef(..), SizeSkeleton::Known(size_to)) = (from.kind(), sk_to) { if let (&ty::FnDef(..), SizeSkeleton::Known(size_to)) = (from.kind(), sk_to) && size_to == Pointer.size(&self.tcx) {
if size_to == Pointer.size(&self.tcx) { struct_span_err!(self.tcx.sess, span, E0591, "can't transmute zero-sized type")
struct_span_err!(self.tcx.sess, span, E0591, "can't transmute zero-sized type") .note(&format!("source type: {from}"))
.note(&format!("source type: {}", from)) .note(&format!("target type: {to}"))
.note(&format!("target type: {}", to)) .help("cast with `as` to a pointer instead")
.help("cast with `as` to a pointer instead") .emit();
.emit(); return;
return;
}
} }
} }
// Try to display a sensible error with as much information as possible. // Try to display a sensible error with as much information as possible.
let skeleton_string = |ty: Ty<'tcx>, sk| match sk { let skeleton_string = |ty: Ty<'tcx>, sk| match sk {
Ok(SizeSkeleton::Known(size)) => format!("{} bits", size.bits()), Ok(SizeSkeleton::Known(size)) => format!("{} bits", size.bits()),
Ok(SizeSkeleton::Pointer { tail, .. }) => format!("pointer to `{}`", tail), Ok(SizeSkeleton::Pointer { tail, .. }) => format!("pointer to `{tail}`"),
Err(LayoutError::Unknown(bad)) => { Err(LayoutError::Unknown(bad)) => {
if bad == ty { if bad == ty {
"this type does not have a fixed size".to_owned() "this type does not have a fixed size".to_owned()
} else { } else {
format!("size can vary because of {}", bad) format!("size can vary because of {bad}")
} }
} }
Err(err) => err.to_string(), Err(err) => err.to_string(),
@ -113,7 +111,7 @@ impl<'tcx> ExprVisitor<'tcx> {
or dependently-sized types" or dependently-sized types"
); );
if from == to { if from == to {
err.note(&format!("`{}` does not have a fixed size", from)); err.note(&format!("`{from}` does not have a fixed size"));
} else { } else {
err.note(&format!("source type: `{}` ({})", from, skeleton_string(from, sk_from))) err.note(&format!("source type: `{}` ({})", from, skeleton_string(from, sk_from)))
.note(&format!("target type: `{}` ({})", to, skeleton_string(to, sk_to))); .note(&format!("target type: `{}` ({})", to, skeleton_string(to, sk_to)));
@ -201,7 +199,7 @@ impl<'tcx> ExprVisitor<'tcx> {
_ => None, _ => None,
}; };
let Some(asm_ty) = asm_ty else { let Some(asm_ty) = asm_ty else {
let msg = &format!("cannot use value of type `{}` for inline assembly", ty); let msg = &format!("cannot use value of type `{ty}` for inline assembly");
let mut err = self.tcx.sess.struct_span_err(expr.span, msg); let mut err = self.tcx.sess.struct_span_err(expr.span, msg);
err.note( err.note(
"only integers, floats, SIMD vectors, pointers and function pointers \ "only integers, floats, SIMD vectors, pointers and function pointers \
@ -216,7 +214,7 @@ impl<'tcx> ExprVisitor<'tcx> {
if !ty.is_copy_modulo_regions(self.tcx.at(DUMMY_SP), self.param_env) { if !ty.is_copy_modulo_regions(self.tcx.at(DUMMY_SP), self.param_env) {
let msg = "arguments for inline assembly must be copyable"; let msg = "arguments for inline assembly must be copyable";
let mut err = self.tcx.sess.struct_span_err(expr.span, msg); let mut err = self.tcx.sess.struct_span_err(expr.span, msg);
err.note(&format!("`{}` does not implement the Copy trait", ty)); err.note(&format!("`{ty}` does not implement the Copy trait"));
err.emit(); err.emit();
} }
@ -237,7 +235,7 @@ impl<'tcx> ExprVisitor<'tcx> {
in_expr.span, in_expr.span,
&format!("type `{}`", self.typeck_results.expr_ty_adjusted(in_expr)), &format!("type `{}`", self.typeck_results.expr_ty_adjusted(in_expr)),
); );
err.span_label(expr.span, &format!("type `{}`", ty)); err.span_label(expr.span, &format!("type `{ty}`"));
err.note( err.note(
"asm inout arguments must have the same type, \ "asm inout arguments must have the same type, \
unless they are both pointers or integers of the same size", unless they are both pointers or integers of the same size",
@ -256,7 +254,7 @@ impl<'tcx> ExprVisitor<'tcx> {
let reg_class = reg.reg_class(); let reg_class = reg.reg_class();
let supported_tys = reg_class.supported_types(asm_arch); let supported_tys = reg_class.supported_types(asm_arch);
let Some((_, feature)) = supported_tys.iter().find(|&&(t, _)| t == asm_ty) else { let Some((_, feature)) = supported_tys.iter().find(|&&(t, _)| t == asm_ty) else {
let msg = &format!("type `{}` cannot be used with this register class", ty); let msg = &format!("type `{ty}` cannot be used with this register class");
let mut err = self.tcx.sess.struct_span_err(expr.span, msg); let mut err = self.tcx.sess.struct_span_err(expr.span, msg);
let supported_tys: Vec<_> = let supported_tys: Vec<_> =
supported_tys.iter().map(|(t, _)| t.to_string()).collect(); supported_tys.iter().map(|(t, _)| t.to_string()).collect();
@ -326,12 +324,10 @@ impl<'tcx> ExprVisitor<'tcx> {
let mut err = lint.build(msg); let mut err = lint.build(msg);
err.span_label(expr.span, "for this argument"); err.span_label(expr.span, "for this argument");
err.help(&format!( err.help(&format!(
"use the `{}` modifier to have the register formatted as `{}`", "use the `{suggested_modifier}` modifier to have the register formatted as `{suggested_result}`",
suggested_modifier, suggested_result,
)); ));
err.help(&format!( err.help(&format!(
"or use the `{}` modifier to keep the default formatting of `{}`", "or use the `{default_modifier}` modifier to keep the default formatting of `{default_result}`",
default_modifier, default_result,
)); ));
err.emit(); err.emit();
}, },
@ -509,14 +505,14 @@ impl<'tcx> Visitor<'tcx> for ExprVisitor<'tcx> {
match expr.kind { match expr.kind {
hir::ExprKind::Path(ref qpath) => { hir::ExprKind::Path(ref qpath) => {
let res = self.typeck_results.qpath_res(qpath, expr.hir_id); let res = self.typeck_results.qpath_res(qpath, expr.hir_id);
if let Res::Def(DefKind::Fn, did) = res { if let Res::Def(DefKind::Fn, did) = res
if self.def_id_is_transmute(did) { && self.def_id_is_transmute(did)
let typ = self.typeck_results.node_type(expr.hir_id); {
let sig = typ.fn_sig(self.tcx); let typ = self.typeck_results.node_type(expr.hir_id);
let from = sig.inputs().skip_binder()[0]; let sig = typ.fn_sig(self.tcx);
let to = sig.output().skip_binder(); let from = sig.inputs().skip_binder()[0];
self.check_transmute(expr.span, from, to); let to = sig.output().skip_binder();
} self.check_transmute(expr.span, from, to);
} }
} }

View file

@ -1,3 +1,4 @@
// ignore-tidy-filelength
//! Name resolution for lifetimes. //! Name resolution for lifetimes.
//! //!
//! Name resolution for lifetimes follows *much* simpler rules than the //! Name resolution for lifetimes follows *much* simpler rules than the
@ -230,6 +231,10 @@ enum Scope<'a> {
hir_id: hir::HirId, hir_id: hir::HirId,
s: ScopeRef<'a>, s: ScopeRef<'a>,
/// In some cases not allowing late bounds allows us to avoid ICEs.
/// This is almost ways set to true.
allow_late_bound: bool,
}, },
/// Lifetimes introduced by a fn are scoped to the call-site for that fn, /// Lifetimes introduced by a fn are scoped to the call-site for that fn,
@ -302,6 +307,7 @@ impl<'a> fmt::Debug for TruncatedScopeDebug<'a> {
scope_type, scope_type,
hir_id, hir_id,
s: _, s: _,
allow_late_bound,
} => f } => f
.debug_struct("Binder") .debug_struct("Binder")
.field("lifetimes", lifetimes) .field("lifetimes", lifetimes)
@ -311,6 +317,7 @@ impl<'a> fmt::Debug for TruncatedScopeDebug<'a> {
.field("scope_type", scope_type) .field("scope_type", scope_type)
.field("hir_id", hir_id) .field("hir_id", hir_id)
.field("s", &"..") .field("s", &"..")
.field("allow_late_bound", allow_late_bound)
.finish(), .finish(),
Scope::Body { id, s: _ } => { Scope::Body { id, s: _ } => {
f.debug_struct("Body").field("id", id).field("s", &"..").finish() f.debug_struct("Body").field("id", id).field("s", &"..").finish()
@ -703,6 +710,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
track_lifetime_uses: true, track_lifetime_uses: true,
opaque_type_parent: false, opaque_type_parent: false,
scope_type: BinderScopeType::Normal, scope_type: BinderScopeType::Normal,
allow_late_bound: true,
}; };
self.with(scope, move |_old_scope, this| { self.with(scope, move |_old_scope, this| {
intravisit::walk_fn(this, fk, fd, b, s, hir_id) intravisit::walk_fn(this, fk, fd, b, s, hir_id)
@ -828,6 +836,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
track_lifetime_uses, track_lifetime_uses,
scope_type: BinderScopeType::Normal, scope_type: BinderScopeType::Normal,
s: ROOT_SCOPE, s: ROOT_SCOPE,
allow_late_bound: false,
}; };
self.with(scope, |old_scope, this| { self.with(scope, |old_scope, this| {
this.check_lifetime_params(old_scope, &generics.params); this.check_lifetime_params(old_scope, &generics.params);
@ -896,6 +905,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
track_lifetime_uses: true, track_lifetime_uses: true,
opaque_type_parent: false, opaque_type_parent: false,
scope_type: BinderScopeType::Normal, scope_type: BinderScopeType::Normal,
allow_late_bound: true,
}; };
self.with(scope, |old_scope, this| { self.with(scope, |old_scope, this| {
// a bare fn has no bounds, so everything // a bare fn has no bounds, so everything
@ -1077,6 +1087,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
track_lifetime_uses: true, track_lifetime_uses: true,
opaque_type_parent: false, opaque_type_parent: false,
scope_type: BinderScopeType::Normal, scope_type: BinderScopeType::Normal,
allow_late_bound: false,
}; };
this.with(scope, |_old_scope, this| { this.with(scope, |_old_scope, this| {
this.visit_generics(generics); this.visit_generics(generics);
@ -1097,6 +1108,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
track_lifetime_uses: true, track_lifetime_uses: true,
opaque_type_parent: false, opaque_type_parent: false,
scope_type: BinderScopeType::Normal, scope_type: BinderScopeType::Normal,
allow_late_bound: false,
}; };
self.with(scope, |_old_scope, this| { self.with(scope, |_old_scope, this| {
let scope = Scope::TraitRefBoundary { s: this.scope }; let scope = Scope::TraitRefBoundary { s: this.scope };
@ -1156,6 +1168,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
track_lifetime_uses: true, track_lifetime_uses: true,
opaque_type_parent: true, opaque_type_parent: true,
scope_type: BinderScopeType::Normal, scope_type: BinderScopeType::Normal,
allow_late_bound: false,
}; };
self.with(scope, |old_scope, this| { self.with(scope, |old_scope, this| {
this.check_lifetime_params(old_scope, &generics.params); this.check_lifetime_params(old_scope, &generics.params);
@ -1225,6 +1238,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
track_lifetime_uses: true, track_lifetime_uses: true,
opaque_type_parent: true, opaque_type_parent: true,
scope_type: BinderScopeType::Normal, scope_type: BinderScopeType::Normal,
allow_late_bound: true,
}; };
self.with(scope, |old_scope, this| { self.with(scope, |old_scope, this| {
this.check_lifetime_params(old_scope, &generics.params); this.check_lifetime_params(old_scope, &generics.params);
@ -1378,6 +1392,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
track_lifetime_uses: true, track_lifetime_uses: true,
opaque_type_parent: false, opaque_type_parent: false,
scope_type: BinderScopeType::Normal, scope_type: BinderScopeType::Normal,
allow_late_bound: true,
}; };
this.with(scope, |old_scope, this| { this.with(scope, |old_scope, this| {
this.check_lifetime_params(old_scope, &bound_generic_params); this.check_lifetime_params(old_scope, &bound_generic_params);
@ -1425,6 +1440,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
track_lifetime_uses: true, track_lifetime_uses: true,
opaque_type_parent: false, opaque_type_parent: false,
scope_type, scope_type,
allow_late_bound: true,
}; };
self.with(scope, |_, this| { self.with(scope, |_, this| {
intravisit::walk_param_bound(this, bound); intravisit::walk_param_bound(this, bound);
@ -1477,6 +1493,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
track_lifetime_uses: true, track_lifetime_uses: true,
opaque_type_parent: false, opaque_type_parent: false,
scope_type, scope_type,
allow_late_bound: true,
}; };
self.with(scope, |old_scope, this| { self.with(scope, |old_scope, this| {
this.check_lifetime_params(old_scope, &trait_ref.bound_generic_params); this.check_lifetime_params(old_scope, &trait_ref.bound_generic_params);
@ -2180,6 +2197,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
opaque_type_parent: true, opaque_type_parent: true,
track_lifetime_uses: false, track_lifetime_uses: false,
scope_type: BinderScopeType::Normal, scope_type: BinderScopeType::Normal,
allow_late_bound: true,
}; };
self.with(scope, move |old_scope, this| { self.with(scope, move |old_scope, this| {
this.check_lifetime_params(old_scope, &generics.params); this.check_lifetime_params(old_scope, &generics.params);
@ -2602,7 +2620,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
let mut scope = &*self.scope; let mut scope = &*self.scope;
let hir_id = loop { let hir_id = loop {
match scope { match scope {
Scope::Binder { hir_id, .. } => { Scope::Binder { hir_id, allow_late_bound: true, .. } => {
break *hir_id; break *hir_id;
} }
Scope::ObjectLifetimeDefault { ref s, .. } Scope::ObjectLifetimeDefault { ref s, .. }
@ -2611,8 +2629,11 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
| Scope::TraitRefBoundary { ref s, .. } => { | Scope::TraitRefBoundary { ref s, .. } => {
scope = *s; scope = *s;
} }
Scope::Root | Scope::Body { .. } => { Scope::Root
| Scope::Body { .. }
| Scope::Binder { allow_late_bound: false, .. } => {
// See issues #83907 and #83693. Just bail out from looking inside. // See issues #83907 and #83693. Just bail out from looking inside.
// See the issue #95023 for not allowing late bound
self.tcx.sess.delay_span_bug( self.tcx.sess.delay_span_bug(
rustc_span::DUMMY_SP, rustc_span::DUMMY_SP,
"In fn_like_elision without appropriate scope above", "In fn_like_elision without appropriate scope above",

View file

@ -92,8 +92,6 @@ and `cfg!(name = "value")` call. It will check that the `"value"` specified is p
list of expected values. If `"value"` is not in it, then `rustc` will report an `unexpected_cfgs` list of expected values. If `"value"` is not in it, then `rustc` will report an `unexpected_cfgs`
lint diagnostic. The default diagnostic level for this lint is `Warn`. lint diagnostic. The default diagnostic level for this lint is `Warn`.
The form `values()` is an error, because it does not specify a condition name.
To enable checking of values, but to provide an empty set of valid values, use this form: To enable checking of values, but to provide an empty set of valid values, use this form:
```bash ```bash
@ -104,13 +102,17 @@ The `--check-cfg values(...)` option can be repeated, both for the same conditio
different names. If it is repeated for the same condition name, then the sets of values for that different names. If it is repeated for the same condition name, then the sets of values for that
condition are merged together. condition are merged together.
If `values()` is specified, then `rustc` will enable the checking of well-known values defined
by itself. Note that it's necessary to specify the `values()` form to enable the checking of
well known values, specifying the other forms doesn't implicitly enable it.
## Examples ## Examples
Consider this command line: Consider this command line:
```bash ```bash
rustc --check-cfg 'names(feature)' \ rustc --check-cfg 'names(feature)' \
--check-cfg 'values(feature,"lion","zebra")' \ --check-cfg 'values(feature, "lion", "zebra")' \
--cfg 'feature="lion"' -Z unstable-options \ --cfg 'feature="lion"' -Z unstable-options \
example.rs example.rs
``` ```

View file

@ -400,7 +400,6 @@ nav.sub {
.source .sidebar > *:not(#sidebar-toggle) { .source .sidebar > *:not(#sidebar-toggle) {
opacity: 0; opacity: 0;
visibility: hidden; visibility: hidden;
transition: opacity 0.5s;
} }
.source .sidebar.expanded { .source .sidebar.expanded {
@ -1677,12 +1676,6 @@ details.rustdoc-toggle[open] > summary.hideme::after {
display: none; display: none;
} }
/* It doesn't render well on mobile because of the layout, so better only have the transition
on desktop. */
.rustdoc.source .sidebar {
transition: width .5s;
}
.source .sidebar.expanded { .source .sidebar.expanded {
width: 300px; width: 300px;
} }

View file

@ -3,6 +3,5 @@ goto: file://|DOC_PATH|/test_docs/index.html
click: ".srclink" click: ".srclink"
wait-for: "#sidebar-toggle" wait-for: "#sidebar-toggle"
click: "#sidebar-toggle" click: "#sidebar-toggle"
wait-for: 500
fail: true fail: true
assert-css: ("#source-sidebar", { "left": "-300px" }) assert-css: ("#source-sidebar", { "left": "-300px" })

View file

@ -5,6 +5,7 @@
// ignore-android // ignore-android
// ignore-arm // ignore-arm
// ignore-aarch64 // ignore-aarch64
// needs-asm-support
#![feature(asm_sym)] #![feature(asm_sym)]
#[cfg(target_arch = "x86_64")] #[cfg(target_arch = "x86_64")]

View file

@ -1,5 +1,6 @@
// only-aarch64 // only-aarch64
// run-pass // run-pass
// needs-asm-support
// revisions: mirunsafeck thirunsafeck // revisions: mirunsafeck thirunsafeck
// [thirunsafeck]compile-flags: -Z thir-unsafeck // [thirunsafeck]compile-flags: -Z thir-unsafeck

View file

@ -1,4 +1,5 @@
// only-aarch64 // only-aarch64
// needs-asm-support
// run-rustfix // run-rustfix
use std::arch::asm; use std::arch::asm;

View file

@ -1,4 +1,5 @@
// only-aarch64 // only-aarch64
// needs-asm-support
// run-rustfix // run-rustfix
use std::arch::asm; use std::arch::asm;

View file

@ -1,53 +1,53 @@
error: the `nomem` option was already provided error: the `nomem` option was already provided
--> $DIR/duplicate-options.rs:8:33 --> $DIR/duplicate-options.rs:9:33
| |
LL | asm!("", options(nomem, nomem)); LL | asm!("", options(nomem, nomem));
| ^^^^^ this option was already provided | ^^^^^ this option was already provided
error: the `preserves_flags` option was already provided error: the `preserves_flags` option was already provided
--> $DIR/duplicate-options.rs:10:43 --> $DIR/duplicate-options.rs:11:43
| |
LL | asm!("", options(preserves_flags, preserves_flags)); LL | asm!("", options(preserves_flags, preserves_flags));
| ^^^^^^^^^^^^^^^ this option was already provided | ^^^^^^^^^^^^^^^ this option was already provided
error: the `nostack` option was already provided error: the `nostack` option was already provided
--> $DIR/duplicate-options.rs:12:61 --> $DIR/duplicate-options.rs:13:61
| |
LL | asm!("", options(nostack, preserves_flags), options(nostack)); LL | asm!("", options(nostack, preserves_flags), options(nostack));
| ^^^^^^^ this option was already provided | ^^^^^^^ this option was already provided
error: the `nostack` option was already provided error: the `nostack` option was already provided
--> $DIR/duplicate-options.rs:14:35 --> $DIR/duplicate-options.rs:15:35
| |
LL | asm!("", options(nostack, nostack), options(nostack), options(nostack)); LL | asm!("", options(nostack, nostack), options(nostack), options(nostack));
| ^^^^^^^ this option was already provided | ^^^^^^^ this option was already provided
error: the `nostack` option was already provided error: the `nostack` option was already provided
--> $DIR/duplicate-options.rs:14:53 --> $DIR/duplicate-options.rs:15:53
| |
LL | asm!("", options(nostack, nostack), options(nostack), options(nostack)); LL | asm!("", options(nostack, nostack), options(nostack), options(nostack));
| ^^^^^^^ this option was already provided | ^^^^^^^ this option was already provided
error: the `nostack` option was already provided error: the `nostack` option was already provided
--> $DIR/duplicate-options.rs:14:71 --> $DIR/duplicate-options.rs:15:71
| |
LL | asm!("", options(nostack, nostack), options(nostack), options(nostack)); LL | asm!("", options(nostack, nostack), options(nostack), options(nostack));
| ^^^^^^^ this option was already provided | ^^^^^^^ this option was already provided
error: the `noreturn` option was already provided error: the `noreturn` option was already provided
--> $DIR/duplicate-options.rs:21:38 --> $DIR/duplicate-options.rs:22:38
| |
LL | options(preserves_flags, noreturn), LL | options(preserves_flags, noreturn),
| ^^^^^^^^ this option was already provided | ^^^^^^^^ this option was already provided
error: the `nomem` option was already provided error: the `nomem` option was already provided
--> $DIR/duplicate-options.rs:22:21 --> $DIR/duplicate-options.rs:23:21
| |
LL | options(nomem, nostack), LL | options(nomem, nostack),
| ^^^^^ this option was already provided | ^^^^^ this option was already provided
error: the `noreturn` option was already provided error: the `noreturn` option was already provided
--> $DIR/duplicate-options.rs:23:21 --> $DIR/duplicate-options.rs:24:21
| |
LL | options(noreturn), LL | options(noreturn),
| ^^^^^^^^ this option was already provided | ^^^^^^^^ this option was already provided

View file

@ -1,5 +1,5 @@
// only-aarch64 // only-aarch64
// needs-asm-support
use std::arch::asm; use std::arch::asm;
macro_rules! m { macro_rules! m {

View file

@ -1,5 +1,6 @@
// only-aarch64 // only-aarch64
// build-fail // build-fail
// needs-asm-support
// compile-flags: -Ccodegen-units=1 // compile-flags: -Ccodegen-units=1
use std::arch::asm; use std::arch::asm;

View file

@ -1,5 +1,5 @@
error: unrecognized instruction mnemonic error: unrecognized instruction mnemonic
--> $DIR/srcloc.rs:11:15 --> $DIR/srcloc.rs:12:15
| |
LL | asm!("invalid_instruction"); LL | asm!("invalid_instruction");
| ^ | ^
@ -11,7 +11,7 @@ LL | invalid_instruction
| ^ | ^
error: unrecognized instruction mnemonic error: unrecognized instruction mnemonic
--> $DIR/srcloc.rs:15:13 --> $DIR/srcloc.rs:16:13
| |
LL | invalid_instruction LL | invalid_instruction
| ^ | ^
@ -23,7 +23,7 @@ LL | invalid_instruction
| ^ | ^
error: unrecognized instruction mnemonic error: unrecognized instruction mnemonic
--> $DIR/srcloc.rs:20:13 --> $DIR/srcloc.rs:21:13
| |
LL | invalid_instruction LL | invalid_instruction
| ^ | ^
@ -35,7 +35,7 @@ LL | invalid_instruction
| ^ | ^
error: unrecognized instruction mnemonic error: unrecognized instruction mnemonic
--> $DIR/srcloc.rs:26:13 --> $DIR/srcloc.rs:27:13
| |
LL | invalid_instruction LL | invalid_instruction
| ^ | ^
@ -47,7 +47,7 @@ LL | invalid_instruction
| ^ | ^
error: unrecognized instruction mnemonic error: unrecognized instruction mnemonic
--> $DIR/srcloc.rs:33:13 --> $DIR/srcloc.rs:34:13
| |
LL | invalid_instruction LL | invalid_instruction
| ^ | ^
@ -59,7 +59,7 @@ LL | invalid_instruction
| ^ | ^
error: unrecognized instruction mnemonic error: unrecognized instruction mnemonic
--> $DIR/srcloc.rs:38:14 --> $DIR/srcloc.rs:39:14
| |
LL | asm!(concat!("invalid", "_", "instruction")); LL | asm!(concat!("invalid", "_", "instruction"));
| ^ | ^
@ -71,7 +71,7 @@ LL | invalid_instruction
| ^ | ^
error: unrecognized instruction mnemonic error: unrecognized instruction mnemonic
--> $DIR/srcloc.rs:42:14 --> $DIR/srcloc.rs:43:14
| |
LL | "invalid_instruction", LL | "invalid_instruction",
| ^ | ^
@ -83,7 +83,7 @@ LL | invalid_instruction
| ^ | ^
error: unrecognized instruction mnemonic error: unrecognized instruction mnemonic
--> $DIR/srcloc.rs:48:14 --> $DIR/srcloc.rs:49:14
| |
LL | "invalid_instruction", LL | "invalid_instruction",
| ^ | ^
@ -95,7 +95,7 @@ LL | invalid_instruction
| ^ | ^
error: unrecognized instruction mnemonic error: unrecognized instruction mnemonic
--> $DIR/srcloc.rs:55:14 --> $DIR/srcloc.rs:56:14
| |
LL | "invalid_instruction", LL | "invalid_instruction",
| ^ | ^
@ -107,7 +107,7 @@ LL | invalid_instruction
| ^ | ^
error: unrecognized instruction mnemonic error: unrecognized instruction mnemonic
--> $DIR/srcloc.rs:62:13 --> $DIR/srcloc.rs:63:13
| |
LL | concat!("invalid", "_", "instruction"), LL | concat!("invalid", "_", "instruction"),
| ^ | ^
@ -119,7 +119,7 @@ LL | invalid_instruction
| ^ | ^
error: unrecognized instruction mnemonic error: unrecognized instruction mnemonic
--> $DIR/srcloc.rs:69:13 --> $DIR/srcloc.rs:70:13
| |
LL | concat!("invalid", "_", "instruction"), LL | concat!("invalid", "_", "instruction"),
| ^ | ^
@ -131,7 +131,7 @@ LL | invalid_instruction
| ^ | ^
error: unrecognized instruction mnemonic error: unrecognized instruction mnemonic
--> $DIR/srcloc.rs:76:14 --> $DIR/srcloc.rs:77:14
| |
LL | "invalid_instruction1", LL | "invalid_instruction1",
| ^ | ^
@ -143,7 +143,7 @@ LL | invalid_instruction1
| ^ | ^
error: unrecognized instruction mnemonic error: unrecognized instruction mnemonic
--> $DIR/srcloc.rs:77:14 --> $DIR/srcloc.rs:78:14
| |
LL | "invalid_instruction2", LL | "invalid_instruction2",
| ^ | ^
@ -155,7 +155,7 @@ LL | invalid_instruction2
| ^ | ^
error: unrecognized instruction mnemonic error: unrecognized instruction mnemonic
--> $DIR/srcloc.rs:83:13 --> $DIR/srcloc.rs:84:13
| |
LL | concat!( LL | concat!(
| ^ | ^
@ -167,7 +167,7 @@ LL | invalid_instruction1
| ^ | ^
error: unrecognized instruction mnemonic error: unrecognized instruction mnemonic
--> $DIR/srcloc.rs:83:13 --> $DIR/srcloc.rs:84:13
| |
LL | concat!( LL | concat!(
| ^ | ^
@ -179,7 +179,7 @@ LL | invalid_instruction2
| ^ | ^
error: unrecognized instruction mnemonic error: unrecognized instruction mnemonic
--> $DIR/srcloc.rs:92:13 --> $DIR/srcloc.rs:93:13
| |
LL | concat!( LL | concat!(
| ^ | ^
@ -191,7 +191,7 @@ LL | invalid_instruction1
| ^ | ^
error: unrecognized instruction mnemonic error: unrecognized instruction mnemonic
--> $DIR/srcloc.rs:92:13 --> $DIR/srcloc.rs:93:13
| |
LL | concat!( LL | concat!(
| ^ | ^
@ -203,7 +203,7 @@ LL | invalid_instruction2
| ^ | ^
error: unrecognized instruction mnemonic error: unrecognized instruction mnemonic
--> $DIR/srcloc.rs:96:13 --> $DIR/srcloc.rs:97:13
| |
LL | concat!( LL | concat!(
| ^ | ^
@ -215,7 +215,7 @@ LL | invalid_instruction3
| ^ | ^
error: unrecognized instruction mnemonic error: unrecognized instruction mnemonic
--> $DIR/srcloc.rs:96:13 --> $DIR/srcloc.rs:97:13
| |
LL | concat!( LL | concat!(
| ^ | ^
@ -227,7 +227,7 @@ LL | invalid_instruction4
| ^ | ^
error: unrecognized instruction mnemonic error: unrecognized instruction mnemonic
--> $DIR/srcloc.rs:107:13 --> $DIR/srcloc.rs:108:13
| |
LL | concat!( LL | concat!(
| ^ | ^
@ -239,7 +239,7 @@ LL | invalid_instruction1
| ^ | ^
error: unrecognized instruction mnemonic error: unrecognized instruction mnemonic
--> $DIR/srcloc.rs:107:13 --> $DIR/srcloc.rs:108:13
| |
LL | concat!( LL | concat!(
| ^ | ^
@ -251,7 +251,7 @@ LL | invalid_instruction2
| ^ | ^
error: unrecognized instruction mnemonic error: unrecognized instruction mnemonic
--> $DIR/srcloc.rs:111:13 --> $DIR/srcloc.rs:112:13
| |
LL | concat!( LL | concat!(
| ^ | ^
@ -263,7 +263,7 @@ LL | invalid_instruction3
| ^ | ^
error: unrecognized instruction mnemonic error: unrecognized instruction mnemonic
--> $DIR/srcloc.rs:111:13 --> $DIR/srcloc.rs:112:13
| |
LL | concat!( LL | concat!(
| ^ | ^

View file

@ -1,5 +1,6 @@
// only-aarch64 // only-aarch64
// only-linux // only-linux
// needs-asm-support
// run-pass // run-pass
#![feature(thread_local, asm_sym)] #![feature(thread_local, asm_sym)]

View file

@ -13,7 +13,7 @@ LL | .intel_syntax noprefix
| ^ | ^
error: unknown directive error: unknown directive
--> $DIR/inline-syntax.rs:31:15 --> $DIR/inline-syntax.rs:32:15
| |
LL | asm!(".intel_syntax noprefix", "nop"); LL | asm!(".intel_syntax noprefix", "nop");
| ^ | ^
@ -25,7 +25,7 @@ LL | .intel_syntax noprefix
| ^ | ^
error: unknown directive error: unknown directive
--> $DIR/inline-syntax.rs:34:15 --> $DIR/inline-syntax.rs:35:15
| |
LL | asm!(".intel_syntax aaa noprefix", "nop"); LL | asm!(".intel_syntax aaa noprefix", "nop");
| ^ | ^
@ -37,7 +37,7 @@ LL | .intel_syntax aaa noprefix
| ^ | ^
error: unknown directive error: unknown directive
--> $DIR/inline-syntax.rs:37:15 --> $DIR/inline-syntax.rs:38:15
| |
LL | asm!(".att_syntax noprefix", "nop"); LL | asm!(".att_syntax noprefix", "nop");
| ^ | ^
@ -49,7 +49,7 @@ LL | .att_syntax noprefix
| ^ | ^
error: unknown directive error: unknown directive
--> $DIR/inline-syntax.rs:40:15 --> $DIR/inline-syntax.rs:41:15
| |
LL | asm!(".att_syntax bbb noprefix", "nop"); LL | asm!(".att_syntax bbb noprefix", "nop");
| ^ | ^
@ -61,7 +61,7 @@ LL | .att_syntax bbb noprefix
| ^ | ^
error: unknown directive error: unknown directive
--> $DIR/inline-syntax.rs:43:15 --> $DIR/inline-syntax.rs:44:15
| |
LL | asm!(".intel_syntax noprefix; nop"); LL | asm!(".intel_syntax noprefix; nop");
| ^ | ^
@ -73,7 +73,7 @@ LL | .intel_syntax noprefix; nop
| ^ | ^
error: unknown directive error: unknown directive
--> $DIR/inline-syntax.rs:49:13 --> $DIR/inline-syntax.rs:50:13
| |
LL | .intel_syntax noprefix LL | .intel_syntax noprefix
| ^ | ^

View file

@ -8,6 +8,7 @@
//[arm] compile-flags: --target armv7-unknown-linux-gnueabihf //[arm] compile-flags: --target armv7-unknown-linux-gnueabihf
//[arm] build-fail //[arm] build-fail
//[arm] needs-llvm-components: arm //[arm] needs-llvm-components: arm
// needs-asm-support
#![feature(no_core, lang_items, rustc_attrs)] #![feature(no_core, lang_items, rustc_attrs)]
#![crate_type = "rlib"] #![crate_type = "rlib"]

View file

@ -1,5 +1,5 @@
warning: avoid using `.intel_syntax`, Intel syntax is the default warning: avoid using `.intel_syntax`, Intel syntax is the default
--> $DIR/inline-syntax.rs:57:14 --> $DIR/inline-syntax.rs:58:14
| |
LL | global_asm!(".intel_syntax noprefix", "nop"); LL | global_asm!(".intel_syntax noprefix", "nop");
| ^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^
@ -7,37 +7,37 @@ LL | global_asm!(".intel_syntax noprefix", "nop");
= note: `#[warn(bad_asm_style)]` on by default = note: `#[warn(bad_asm_style)]` on by default
warning: avoid using `.intel_syntax`, Intel syntax is the default warning: avoid using `.intel_syntax`, Intel syntax is the default
--> $DIR/inline-syntax.rs:31:15 --> $DIR/inline-syntax.rs:32:15
| |
LL | asm!(".intel_syntax noprefix", "nop"); LL | asm!(".intel_syntax noprefix", "nop");
| ^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^
warning: avoid using `.intel_syntax`, Intel syntax is the default warning: avoid using `.intel_syntax`, Intel syntax is the default
--> $DIR/inline-syntax.rs:34:15 --> $DIR/inline-syntax.rs:35:15
| |
LL | asm!(".intel_syntax aaa noprefix", "nop"); LL | asm!(".intel_syntax aaa noprefix", "nop");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: avoid using `.att_syntax`, prefer using `options(att_syntax)` instead warning: avoid using `.att_syntax`, prefer using `options(att_syntax)` instead
--> $DIR/inline-syntax.rs:37:15 --> $DIR/inline-syntax.rs:38:15
| |
LL | asm!(".att_syntax noprefix", "nop"); LL | asm!(".att_syntax noprefix", "nop");
| ^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^
warning: avoid using `.att_syntax`, prefer using `options(att_syntax)` instead warning: avoid using `.att_syntax`, prefer using `options(att_syntax)` instead
--> $DIR/inline-syntax.rs:40:15 --> $DIR/inline-syntax.rs:41:15
| |
LL | asm!(".att_syntax bbb noprefix", "nop"); LL | asm!(".att_syntax bbb noprefix", "nop");
| ^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^
warning: avoid using `.intel_syntax`, Intel syntax is the default warning: avoid using `.intel_syntax`, Intel syntax is the default
--> $DIR/inline-syntax.rs:43:15 --> $DIR/inline-syntax.rs:44:15
| |
LL | asm!(".intel_syntax noprefix; nop"); LL | asm!(".intel_syntax noprefix; nop");
| ^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^
warning: avoid using `.intel_syntax`, Intel syntax is the default warning: avoid using `.intel_syntax`, Intel syntax is the default
--> $DIR/inline-syntax.rs:49:13 --> $DIR/inline-syntax.rs:50:13
| |
LL | .intel_syntax noprefix LL | .intel_syntax noprefix
| ^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^

View file

@ -1,5 +1,6 @@
// compile-flags: --target armv5te-unknown-linux-gnueabi // compile-flags: --target armv5te-unknown-linux-gnueabi
// needs-llvm-components: arm // needs-llvm-components: arm
// needs-asm-support
// build-pass // build-pass
#![feature(no_core, lang_items, rustc_attrs, isa_attribute)] #![feature(no_core, lang_items, rustc_attrs, isa_attribute)]

View file

@ -1,66 +1,66 @@
error: unused variable: `a` error: unused variable: `a`
--> $DIR/naked-functions-unused.rs:16:32 --> $DIR/naked-functions-unused.rs:17:32
| |
LL | pub extern "C" fn function(a: usize, b: usize) -> usize { LL | pub extern "C" fn function(a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_a` | ^ help: if this is intentional, prefix it with an underscore: `_a`
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/naked-functions-unused.rs:4:9 --> $DIR/naked-functions-unused.rs:5:9
| |
LL | #![deny(unused)] LL | #![deny(unused)]
| ^^^^^^ | ^^^^^^
= note: `#[deny(unused_variables)]` implied by `#[deny(unused)]` = note: `#[deny(unused_variables)]` implied by `#[deny(unused)]`
error: unused variable: `b` error: unused variable: `b`
--> $DIR/naked-functions-unused.rs:16:42 --> $DIR/naked-functions-unused.rs:17:42
| |
LL | pub extern "C" fn function(a: usize, b: usize) -> usize { LL | pub extern "C" fn function(a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_b` | ^ help: if this is intentional, prefix it with an underscore: `_b`
error: unused variable: `a` error: unused variable: `a`
--> $DIR/naked-functions-unused.rs:25:38 --> $DIR/naked-functions-unused.rs:26:38
| |
LL | pub extern "C" fn associated(a: usize, b: usize) -> usize { LL | pub extern "C" fn associated(a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_a` | ^ help: if this is intentional, prefix it with an underscore: `_a`
error: unused variable: `b` error: unused variable: `b`
--> $DIR/naked-functions-unused.rs:25:48 --> $DIR/naked-functions-unused.rs:26:48
| |
LL | pub extern "C" fn associated(a: usize, b: usize) -> usize { LL | pub extern "C" fn associated(a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_b` | ^ help: if this is intentional, prefix it with an underscore: `_b`
error: unused variable: `a` error: unused variable: `a`
--> $DIR/naked-functions-unused.rs:31:41 --> $DIR/naked-functions-unused.rs:32:41
| |
LL | pub extern "C" fn method(&self, a: usize, b: usize) -> usize { LL | pub extern "C" fn method(&self, a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_a` | ^ help: if this is intentional, prefix it with an underscore: `_a`
error: unused variable: `b` error: unused variable: `b`
--> $DIR/naked-functions-unused.rs:31:51 --> $DIR/naked-functions-unused.rs:32:51
| |
LL | pub extern "C" fn method(&self, a: usize, b: usize) -> usize { LL | pub extern "C" fn method(&self, a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_b` | ^ help: if this is intentional, prefix it with an underscore: `_b`
error: unused variable: `a` error: unused variable: `a`
--> $DIR/naked-functions-unused.rs:39:40 --> $DIR/naked-functions-unused.rs:40:40
| |
LL | extern "C" fn trait_associated(a: usize, b: usize) -> usize { LL | extern "C" fn trait_associated(a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_a` | ^ help: if this is intentional, prefix it with an underscore: `_a`
error: unused variable: `b` error: unused variable: `b`
--> $DIR/naked-functions-unused.rs:39:50 --> $DIR/naked-functions-unused.rs:40:50
| |
LL | extern "C" fn trait_associated(a: usize, b: usize) -> usize { LL | extern "C" fn trait_associated(a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_b` | ^ help: if this is intentional, prefix it with an underscore: `_b`
error: unused variable: `a` error: unused variable: `a`
--> $DIR/naked-functions-unused.rs:45:43 --> $DIR/naked-functions-unused.rs:46:43
| |
LL | extern "C" fn trait_method(&self, a: usize, b: usize) -> usize { LL | extern "C" fn trait_method(&self, a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_a` | ^ help: if this is intentional, prefix it with an underscore: `_a`
error: unused variable: `b` error: unused variable: `b`
--> $DIR/naked-functions-unused.rs:45:53 --> $DIR/naked-functions-unused.rs:46:53
| |
LL | extern "C" fn trait_method(&self, a: usize, b: usize) -> usize { LL | extern "C" fn trait_method(&self, a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_b` | ^ help: if this is intentional, prefix it with an underscore: `_b`

View file

@ -1,4 +1,5 @@
// revisions: x86_64 aarch64 // revisions: x86_64 aarch64
// needs-asm-support
//[x86_64] only-x86_64 //[x86_64] only-x86_64
//[aarch64] only-aarch64 //[aarch64] only-aarch64
#![deny(unused)] #![deny(unused)]

View file

@ -1,66 +1,66 @@
error: unused variable: `a` error: unused variable: `a`
--> $DIR/naked-functions-unused.rs:16:32 --> $DIR/naked-functions-unused.rs:17:32
| |
LL | pub extern "C" fn function(a: usize, b: usize) -> usize { LL | pub extern "C" fn function(a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_a` | ^ help: if this is intentional, prefix it with an underscore: `_a`
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/naked-functions-unused.rs:4:9 --> $DIR/naked-functions-unused.rs:5:9
| |
LL | #![deny(unused)] LL | #![deny(unused)]
| ^^^^^^ | ^^^^^^
= note: `#[deny(unused_variables)]` implied by `#[deny(unused)]` = note: `#[deny(unused_variables)]` implied by `#[deny(unused)]`
error: unused variable: `b` error: unused variable: `b`
--> $DIR/naked-functions-unused.rs:16:42 --> $DIR/naked-functions-unused.rs:17:42
| |
LL | pub extern "C" fn function(a: usize, b: usize) -> usize { LL | pub extern "C" fn function(a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_b` | ^ help: if this is intentional, prefix it with an underscore: `_b`
error: unused variable: `a` error: unused variable: `a`
--> $DIR/naked-functions-unused.rs:25:38 --> $DIR/naked-functions-unused.rs:26:38
| |
LL | pub extern "C" fn associated(a: usize, b: usize) -> usize { LL | pub extern "C" fn associated(a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_a` | ^ help: if this is intentional, prefix it with an underscore: `_a`
error: unused variable: `b` error: unused variable: `b`
--> $DIR/naked-functions-unused.rs:25:48 --> $DIR/naked-functions-unused.rs:26:48
| |
LL | pub extern "C" fn associated(a: usize, b: usize) -> usize { LL | pub extern "C" fn associated(a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_b` | ^ help: if this is intentional, prefix it with an underscore: `_b`
error: unused variable: `a` error: unused variable: `a`
--> $DIR/naked-functions-unused.rs:31:41 --> $DIR/naked-functions-unused.rs:32:41
| |
LL | pub extern "C" fn method(&self, a: usize, b: usize) -> usize { LL | pub extern "C" fn method(&self, a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_a` | ^ help: if this is intentional, prefix it with an underscore: `_a`
error: unused variable: `b` error: unused variable: `b`
--> $DIR/naked-functions-unused.rs:31:51 --> $DIR/naked-functions-unused.rs:32:51
| |
LL | pub extern "C" fn method(&self, a: usize, b: usize) -> usize { LL | pub extern "C" fn method(&self, a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_b` | ^ help: if this is intentional, prefix it with an underscore: `_b`
error: unused variable: `a` error: unused variable: `a`
--> $DIR/naked-functions-unused.rs:39:40 --> $DIR/naked-functions-unused.rs:40:40
| |
LL | extern "C" fn trait_associated(a: usize, b: usize) -> usize { LL | extern "C" fn trait_associated(a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_a` | ^ help: if this is intentional, prefix it with an underscore: `_a`
error: unused variable: `b` error: unused variable: `b`
--> $DIR/naked-functions-unused.rs:39:50 --> $DIR/naked-functions-unused.rs:40:50
| |
LL | extern "C" fn trait_associated(a: usize, b: usize) -> usize { LL | extern "C" fn trait_associated(a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_b` | ^ help: if this is intentional, prefix it with an underscore: `_b`
error: unused variable: `a` error: unused variable: `a`
--> $DIR/naked-functions-unused.rs:45:43 --> $DIR/naked-functions-unused.rs:46:43
| |
LL | extern "C" fn trait_method(&self, a: usize, b: usize) -> usize { LL | extern "C" fn trait_method(&self, a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_a` | ^ help: if this is intentional, prefix it with an underscore: `_a`
error: unused variable: `b` error: unused variable: `b`
--> $DIR/naked-functions-unused.rs:45:53 --> $DIR/naked-functions-unused.rs:46:53
| |
LL | extern "C" fn trait_method(&self, a: usize, b: usize) -> usize { LL | extern "C" fn trait_method(&self, a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_b` | ^ help: if this is intentional, prefix it with an underscore: `_b`

View file

@ -1,5 +1,6 @@
// only-x86_64 // only-x86_64
// run-pass // run-pass
// needs-asm-support
// revisions: mirunsafeck thirunsafeck // revisions: mirunsafeck thirunsafeck
// [thirunsafeck]compile-flags: -Z thir-unsafeck // [thirunsafeck]compile-flags: -Z thir-unsafeck

View file

@ -1,4 +1,5 @@
// build-pass // build-pass
// needs-asm-support
// only-x86_64 // only-x86_64
#![feature(target_feature_11)] #![feature(target_feature_11)]

View file

@ -1,6 +1,7 @@
// min-llvm-version: 12.0.1 // min-llvm-version: 12.0.1
// only-x86_64 // only-x86_64
// only-linux // only-linux
// needs-asm-support
// run-pass // run-pass
#![feature(thread_local, asm_sym)] #![feature(thread_local, asm_sym)]

View file

@ -88,28 +88,31 @@ fn runtest(me: &str) {
assert!(!s.contains("stack backtrace") && !s.contains(" - foo"), assert!(!s.contains("stack backtrace") && !s.contains(" - foo"),
"bad output3: {}", s); "bad output3: {}", s);
// Make sure a stack trace is printed #[cfg(not(panic = "abort"))]
let p = template(me).arg("double-fail").spawn().unwrap(); {
let out = p.wait_with_output().unwrap(); // Make sure a stack trace is printed
assert!(!out.status.success()); let p = template(me).arg("double-fail").spawn().unwrap();
let s = str::from_utf8(&out.stderr).unwrap(); let out = p.wait_with_output().unwrap();
// loosened the following from double::h to double:: due to assert!(!out.status.success());
// spurious failures on mac, 32bit, optimized let s = str::from_utf8(&out.stderr).unwrap();
assert!(s.contains("stack backtrace") && contains_verbose_expected(s, "double"), // loosened the following from double::h to double:: due to
"bad output3: {}", s); // spurious failures on mac, 32bit, optimized
assert!(s.contains("stack backtrace") && contains_verbose_expected(s, "double"),
"bad output3: {}", s);
// Make sure a stack trace isn't printed too many times // Make sure a stack trace isn't printed too many times
let p = template(me).arg("double-fail") let p = template(me).arg("double-fail")
.env("RUST_BACKTRACE", "1").spawn().unwrap(); .env("RUST_BACKTRACE", "1").spawn().unwrap();
let out = p.wait_with_output().unwrap(); let out = p.wait_with_output().unwrap();
assert!(!out.status.success()); assert!(!out.status.success());
let s = str::from_utf8(&out.stderr).unwrap(); let s = str::from_utf8(&out.stderr).unwrap();
let mut i = 0; let mut i = 0;
for _ in 0..2 { for _ in 0..2 {
i += s[i + 10..].find("stack backtrace").unwrap() + 10; i += s[i + 10..].find("stack backtrace").unwrap() + 10;
}
assert!(s[i + 10..].find("stack backtrace").is_none(),
"bad output4: {}", s);
} }
assert!(s[i + 10..].find("stack backtrace").is_none(),
"bad output4: {}", s);
} }
fn main() { fn main() {

View file

@ -5,7 +5,7 @@ LL | #![feature(adt_const_params)]
| ^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^
| |
= note: `#[warn(incomplete_features)]` on by default = note: `#[warn(incomplete_features)]` on by default
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information = note: see issue #95174 <https://github.com/rust-lang/rust/issues/95174> for more information
warning: 1 warning emitted warning: 1 warning emitted

View file

@ -5,7 +5,7 @@ LL | #![feature(adt_const_params)]
| ^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^
| |
= note: `#[warn(incomplete_features)]` on by default = note: `#[warn(incomplete_features)]` on by default
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information = note: see issue #95174 <https://github.com/rust-lang/rust/issues/95174> for more information
error[E0771]: use of non-static lifetime `'a` in const generic error[E0771]: use of non-static lifetime `'a` in const generic
--> $DIR/E0771.rs:4:41 --> $DIR/E0771.rs:4:41

View file

@ -1,5 +1,5 @@
// check-pass // check-pass
#[derive(Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] #[derive(Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd, Clone, Copy)]
struct Array<T> { struct Array<T> {
f00: [T; 00], f00: [T; 00],
f01: [T; 01], f01: [T; 01],
@ -36,44 +36,6 @@ struct Array<T> {
f32: [T; 32], f32: [T; 32],
} }
// FIXME(#44580): merge with `Array` once `[T; N]: Clone` where `T: Clone`
#[derive(Clone, Copy)]
struct CopyArray<T: Copy> {
f00: [T; 00],
f01: [T; 01],
f02: [T; 02],
f03: [T; 03],
f04: [T; 04],
f05: [T; 05],
f06: [T; 06],
f07: [T; 07],
f08: [T; 08],
f09: [T; 09],
f10: [T; 10],
f11: [T; 11],
f12: [T; 12],
f13: [T; 13],
f14: [T; 14],
f15: [T; 15],
f16: [T; 16],
f17: [T; 17],
f18: [T; 18],
f19: [T; 19],
f20: [T; 20],
f21: [T; 21],
f22: [T; 22],
f23: [T; 23],
f24: [T; 24],
f25: [T; 25],
f26: [T; 26],
f27: [T; 27],
f28: [T; 28],
f29: [T; 29],
f30: [T; 30],
f31: [T; 31],
f32: [T; 32],
}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
struct Fn<A, B, C, D, E, F, G, H, I, J, K, L> { struct Fn<A, B, C, D, E, F, G, H, I, J, K, L> {
f00: fn(), f00: fn(),

View file

@ -0,0 +1,11 @@
struct ErrorKind;
struct Error(ErrorKind);
impl Fn(&isize) for Error {
//~^ ERROR manual implementations of `Fn` are experimental [E0183]
//~^^ ERROR associated type bindings are not allowed here [E0229]
fn foo<const N: usize>(&self) -> Self::B<{N}>;
//~^ ERROR associated function in `impl` without body
//~^^ ERROR method `foo` is not a member of trait `Fn` [E0407]
//~^^^ ERROR associated type `B` not found for `Self` [E0220]
}
fn main() {}

View file

@ -0,0 +1,38 @@
error: associated function in `impl` without body
--> $DIR/issue-95023.rs:6:5
|
LL | fn foo<const N: usize>(&self) -> Self::B<{N}>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
| |
| help: provide a definition for the function: `{ <body> }`
error[E0407]: method `foo` is not a member of trait `Fn`
--> $DIR/issue-95023.rs:6:5
|
LL | fn foo<const N: usize>(&self) -> Self::B<{N}>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not a member of trait `Fn`
error[E0183]: manual implementations of `Fn` are experimental
--> $DIR/issue-95023.rs:3:6
|
LL | impl Fn(&isize) for Error {
| ^^^^^^^^^^ manual implementations of `Fn` are experimental
|
= help: add `#![feature(unboxed_closures)]` to the crate attributes to enable
error[E0229]: associated type bindings are not allowed here
--> $DIR/issue-95023.rs:3:6
|
LL | impl Fn(&isize) for Error {
| ^^^^^^^^^^ associated type not allowed here
error[E0220]: associated type `B` not found for `Self`
--> $DIR/issue-95023.rs:6:44
|
LL | fn foo<const N: usize>(&self) -> Self::B<{N}>;
| ^ associated type `B` not found
error: aborting due to 5 previous errors
Some errors have detailed explanations: E0183, E0220, E0229, E0407.
For more information about an error, try `rustc --explain E0183`.

View file

@ -1,6 +1,7 @@
// run-pass // run-pass
#![allow(unused_must_use)] #![allow(unused_must_use)]
// ignore-emscripten no threads support // ignore-emscripten no threads support
// needs-unwind
#![feature(rustc_attrs)] #![feature(rustc_attrs)]
use std::thread; use std::thread;

View file

@ -1,4 +1,5 @@
// run-pass // run-pass
// needs-unwind
// ignore-emscripten no subprocess support // ignore-emscripten no subprocess support
#![feature(internal_output_capture)] #![feature(internal_output_capture)]

View file

@ -1,6 +1,7 @@
// run-pass // run-pass
// ignore-emscripten no processes // ignore-emscripten no processes
// ignore-sgx no processes // ignore-sgx no processes
// needs-unwind
fn check_for_no_backtrace(test: std::process::Output) { fn check_for_no_backtrace(test: std::process::Output) {
assert!(!test.status.success()); assert!(!test.status.success());

View file

@ -1,5 +1,6 @@
// compile-flags:--test // compile-flags:--test
// run-pass // run-pass
// needs-unwind
// ignore-emscripten no subprocess support // ignore-emscripten no subprocess support
use std::fmt; use std::fmt;

View file

@ -7,7 +7,7 @@ use std::path::Path;
const ENTRY_LIMIT: usize = 1000; const ENTRY_LIMIT: usize = 1000;
// FIXME: The following limits should be reduced eventually. // FIXME: The following limits should be reduced eventually.
const ROOT_ENTRY_LIMIT: usize = 984; const ROOT_ENTRY_LIMIT: usize = 985;
const ISSUES_ENTRY_LIMIT: usize = 2310; const ISSUES_ENTRY_LIMIT: usize = 2310;
fn check_entries(path: &Path, bad: &mut bool) { fn check_entries(path: &Path, bad: &mut bool) {