Auto merge of #85110 - RalfJung:no-rustc_args_required_const, r=oli-obk
Remove rustc_args_required_const attribute Now that stdarch no longer needs it (thanks `@Amanieu!),` we can kill the `rustc_args_required_const` attribute. This means that lifetime extension of references to temporaries is the only remaining job that promotion is performing. :-) r? `@oli-obk` Fixes https://github.com/rust-lang/rust/issues/69493
This commit is contained in:
commit
d2df620789
33 changed files with 111 additions and 613 deletions
|
@ -1537,8 +1537,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ use rustc_middle::ty::adjustment::AllowTwoPhase;
|
|||
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};
|
||||
|
||||
|
@ -720,34 +720,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
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:
|
||||
///
|
||||
/// ```
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue