10000 Rollup of 12 pull requests by tmandry · Pull Request #65075 · rust-lang/rust · GitHub
[go: up one dir, main page]

Skip to content

Rollup of 12 pull requests #65075

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 38 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
8e3b9d2
Stabilize todo macro
Jun 15, 2019
560bf1b
Update src/libcore/macros.rs
Sep 4, 2019
711f673
Update macros.rs
Sep 4, 2019
445e735
Prevent rustdoc feature to be passed down to doctests
GuillaumeGomez Sep 25, 2019
366fdeb
Add new rustdoc-ui test to ensuire that rustdoc feature isn't passed …
GuillaumeGomez Sep 30, 2019
2ab7a67
Replace mentions of IRC with Discord
Oct 2, 2019
a336536
Set RUST_BACKTRACE=0 in tests that include a backtrace in stderr
Aaron1011 Oct 2, 2019
a8b2fe0
[RFC 2091] Add #[track_caller] attribute.
ayosec Jul 20, 2019
a8d70d1
Add visit_projection_elem method to visitors
spastorino Oct 2, 2019
e9deff0
track_caller run-pass test, lint cleanup, PR review.
anp Oct 3, 2019
1e78d99
track_caller feature gate starts in 1.40.0.
anp Oct 3, 2019
287ceed
Deprecate `#![plugin]` and `#[plugin_registrar]`.
Centril Sep 21, 2019
1b8ec97
plugin_registrary: use normal deprecation instead of hard coded warning.
Centril Oct 3, 2019
da86007
Mark #![feature(track_caller)] as incomplete.
anp Oct 3, 2019
8ac9104
track_caller error numbers and text.
anp Oct 3, 2019
9e301d1
track_caller tests account for incomplete feature warning.
anp Oct 3, 2019
d1f95ef
--bless ui-fulldeps tests
Centril Oct 3, 2019
d1310dc
proc_macro: Add `Span::mixed_site` exposing `macro_rules` hygiene
petrochenkov Sep 22, 2019
4396a1c
add regression test for #60218
nikomatsakis Sep 20, 2019
3a4921c
The crux of the bug fix.
pnkfelix Sep 27, 2019
a18d424
Allocate a new diagnostic for defaulted type parameters cannot use `S…
pnkfelix Sep 27, 2019
e86af1b
Add long error explanation for E0556
GuillaumeGomez Oct 3, 2019
1d49f9a
update ui tests
GuillaumeGomez Oct 3, 2019
126bf3b
typo: fix typo in E0392
mathstuf Oct 3, 2019
b9ed642
Make visit_projection iterative
spastorino Oct 2, 2019
e443e1b
Regression tests.
pnkfelix Sep 27, 2019
2d5f4df
Rollup merge of #61879 - stjepang:stabilize-todo, r=withoutboats
tmandry Oct 3, 2019
ae41bcd
Rollup merge of #64675 - Centril:deprecate-plugin, r=oli-obk
tmandry Oct 3, 2019
a647b74
Rollup merge of #64690 - petrochenkov:mixed, r=dtolnay
tmandry Oct 3, 2019
b6d8169
Rollup merge of #64706 - nikomatsakis:issue-60218-test-case, r=centril
tmandry Oct 3, 2019
cd0028e
Rollup merge of #64741 - GuillaumeGomez:prevent-rustdoc-feature-docte…
tmandry Oct 3, 2019
4cc2872
Rollup merge of #64842 - pnkfelix:fix-issue-61631-self-in-type-param-…
tmandry Oct 3, 2019
51dd307
Rollup merge of #65004 - BO41:mentions, r=alexcrichton
tmandry Oct 3, 2019
772f689
Rollup merge of #65018 - Aaron1011:fix/backtrace-stderr, r=nikomatsakis
tmandry Oct 3, 2019
6d6a3fb
Rollup merge of #65037 - anp:track-caller, r=oli-obk
tmandry Oct 3, 2019
c086b9f
Rollup merge of #65055 - GuillaumeGomez:long-err-explanation-E0556, r…
tmandry Oct 3, 2019
a9244f7
Rollup merge of #65056 - spastorino:place-mut-visitor-adjusts, r=oli-obk
tmandry Oct 3, 2019
5264e69
Rollup merge of #65057 - mathstuf:fix-warning-typo, r=Centril
tmandry Oct 3, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
track_caller run-pass test, lint cleanup, PR review.
  • Loading branch information
anp committed Oct 3, 2019
commit e9deff0df974ea674f3035428804aefa84b7c8d5
8 changes: 4 additions & 4 deletions src/librustc/error_codes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1728,13 +1728,13 @@ attribute.
"##,

E0900: r##"
TODO: change error number
TODO: track_caller: invalid syntax
FIXME(anp): change error number
FIXME(anp): track_caller: invalid syntax
"##,

E0901: r##"
TODO: change error number
TODO: track_caller: no naked functions
FIXME(anp): change error number
FIXME(anp): track_caller: no naked functions
"##,

E0522: r##"
Expand Down
28 changes: 11 additions & 17 deletions src/librustc/hir/check_attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use crate::ty::TyCtxt;
use crate::ty::query::Providers;

use std::fmt::{self, Display};
use syntax::symbol::sym;
use syntax::{attr, symbol::sym};
use syntax_pos::Span;

#[derive(Copy, Clone, PartialEq)]
Expand Down Expand Up @@ -94,7 +94,6 @@ impl CheckAttrVisitor<'tcx> {
/// Checks any attribute.
fn check_attributes(&self, item: &hir::Item, target: Target) {
let mut is_valid = true;
let mut track_caller_span = None;
for attr in &item.attrs {
is_valid &= if attr.check_name(sym::inline) {
self.check_inline(attr, &item.span, target)
Expand All @@ -105,7 +104,6 @@ impl CheckAttrVisitor<'tcx> {
} else if attr.check_name(sym::target_feature) {
self.check_target_feature(attr, item, target)
} else if attr.check_name(sym::track_caller) {
track_caller_span = Some(attr.span);
self.check_track_caller(attr, &item, target)
} else {
true
Expand All @@ -122,19 +120,6 @@ impl CheckAttrVisitor<'tcx> {

self.check_repr(item, target);
self.check_used(item, target);

// Checks if `#[track_caller]` and `#[naked]` are both used.
if let Some(span) = track_caller_span {
if item.attrs.iter().any(|attr| attr.check_name(sym::naked)) {
struct_span_err!(
self.tcx.sess,
span,
E0901,
"cannot use `#[track_caller]` with `#[naked]`",
)
.emit();
}
}
}

/// Checks if an `#[inline]` is applied to a function or a closure. Returns `true` if valid.
Expand All @@ -152,7 +137,7 @@ impl CheckAttrVisitor<'tcx> {
}
}

/// Checks if a `#[target_feature]` can be applied.
/// Checks if a `#[track_caller]` is applied to a non-naked function. Returns `true` if valid.
fn check_track_caller(&self, attr: &hir::Attribute, item: &hir::Item, target: Target) -> bool {
if target != Target::Fn {
struct_span_err!(
Expand All @@ -164,6 +149,15 @@ impl CheckAttrVisitor<'tcx> {
.span_label(item.span, "not a function")
.emit();
false
} else if attr::contains_name(&item.attrs, sym::naked) {
struct_span_err!(
self.tcx.sess,
attr.span,
E0901,
"cannot use `#[track_caller]` with `#[naked]`",
)
.emit();
false
} else {
true
}
Expand Down
8 changes: 4 additions & 4 deletions src/librustc_typeck/error_codes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4909,13 +4909,13 @@ and the pin is required to keep it in the same place in memory.
"##,

E0902: r##"
TODO: change error number
TODO: track_caller: require Rust ABI to use track_caller
FIXME(anp): change error number
FIXME(anp): track_caller: require Rust ABI to use track_caller
"##,

E0903: r##"
TODO: change error number
TODO: track_caller: can't apply in traits
FIXME(anp): change error number
FIXME(anp): track_caller: can't apply in traits
"##,

;
Expand Down
2 changes: 1 addition & 1 deletion src/libsyntax/feature_gate/active.rs
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ declare_features! (
(active, or_patterns, "1.38.0", Some(54883), None),

/// Enable accurate caller location reporting during panic (RFC 2091).
(active, track_caller, "1.37.0", Some(47809), None),
(active, track_caller, "1.39.0", Some(47809), None),

// -------------------------------------------------------------------------
// feature-group-end: actual feature gates
Expand Down
5 changes: 1 addition & 4 deletions src/libsyntax/feature_gate/builtin_attrs.rs
< 105AA tr data-hunk="394ecb2330690e11ffea9e8c265fbf9ecda8ac2811462aa514a768d5cf09d8cc" class="show-top-border">
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 341A @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
),

gated!(ffi_returns_twice, Whitelisted, template!(Word), experimental!(ffi_returns_twice)),
gated!(track_caller, Whitelisted, template!(Word), experimental!(track_caller)),

// ==========================================================================
// Internal attributes: Stability, deprecation, and unsafe:
Expand Down Expand Up @@ -482,10 +483,6 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
cfg_fn!(no_debug)
)
),
gated!(
track_caller, Whitelisted, template!(Word),
"the `#[track_caller]` attribute is an experimental feature",
),
gated!(
// Used in resolve:
prelude_import, Whitelisted, template!(Word),
Expand Down
1 change: 0 additions & 1 deletion src/test/ui/feature-gates/feature-gate-track_caller.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

#[track_caller]
fn f() {}
//~^^ ERROR the `#[track_caller]` attribute is an experimental feature
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/feature-gates/feature-gate-track_caller.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0658]: the `#[track_caller]` attribute is an experimental feature
--> $DIR/feature-gate-track_caller.rs:2:1
--> $DIR/feature-gate-track_caller.rs:1:1
|
LL | #[track_caller]
| ^^^^^^^^^^^^^^^
Expand Down
9 changes: 9 additions & 0 deletions src/test/ui/rfc-2091-track-caller/pass.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// run-pass
#![feature(track_caller)]

#[track_caller]
fn f() {}

fn main() {
f();
}
0