8000 Rollup of 10 pull requests by Centril · Pull Request #58428 · rust-lang/rust · GitHub
[go: up one dir, main page]

Skip to content

Rollup of 10 pull requests #58428

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 36 commits into from
Closed
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
da5a0cd
De-duplicate number formatting implementations for smaller code size
fitzgen Feb 7, 2019
ed2157a
De-duplicate write_prefix lambda in pad_integral
fitzgen Feb 7, 2019
e633f15
Un-monomorphize and inline formatting with padding
fitzgen Feb 7, 2019
05f0dee
Improve the error messages for missing stability attributes
varkor Feb 7, 2019
c104b5c
Also de-duplicate 32- and 64-bit number formatting on wasm32
fitzgen Feb 7, 2019
05df9ff
Add a wasm code size test for stringifying numbers
fitzgen Feb 7, 2019
8fea705
Use write_char for writing padding characters
fitzgen Feb 8, 2019
f00f0e6
Don't shadow the provided `stringify!` macro in a wasm code size test…
fitzgen Feb 8, 2019
03d4fd9
Use descriptive variant name
varkor Feb 8, 2019
bb1eed0
Correct descriptive item name for impl
varkor Feb 8, 2019
18089df
Fix ICE and invalid filenames in MIR printing code
matthewjasper Feb 10, 2019
d7afd3e
Add test for MIR printing changes
matthewjasper Feb 10, 2019
3737d4d
Do not apply future deprecation warning for #[deprecated]
varkor Feb 5, 2019
87cd09b
Don't display "Deprecated since" for non-rustc deprecated items
varkor Feb 5, 2019
8000
2a8a25b
Display "Deprecation planned" in rustdoc for future rustc deprecations
varkor Feb 5, 2019
3dc660f
Update existing rustdoc test
varkor Feb 6, 2019
01df8fe
Add a rustdoc test for future rustc_deprecated attributes
varkor Feb 6, 2019
c875241
Add rustdoc index page test for future deprecation attributes
varkor Feb 6, 2019
b5fa870
Add a test for rustc_deprecated
varkor Feb 11, 2019
48b0c9d
Only suggest imports if not imported.
davidtwco Feb 11, 2019
ddb6c4f
Set the query in the ImplicitCtxt before trying to mark it green
Zoxc Feb 12, 2019
3a8448c
Fix rustc_driver swallowing errors when compilation is stopped
gnzlbg Feb 12, 2019
eac43cc
HirId-ify hir::BodyId
ljedrz Feb 4, 2019
15e4bd3
target/uefi: clarify documentation
dvdhrm Feb 13, 2019
fba102c
libpanic_unwind => 2018
Centril Feb 2, 2019
3657eaa
libpanic_unwind => 2018: fix ICEs.
Centril Feb 12, 2019
6a4f535
Rollup merge of #58110 - Centril:libpanic_unwind-2018, r=oli-obk
Centril Feb 13, 2019
d303710
Rollup merge of #58167 - ljedrz:HirIdify_body_id, r=Zoxc
Centril Feb 13, 2019
44352df
Rollup merge of #58202 - varkor:deprecated-future-external, r=Guillau…
Centril Feb 13, 2019
08d6585
Rollup merge of #58272 - fitzgen:num-format-code-size, r=Mark-Simulacrum
Centril Feb 13, 2019
23b5be4
Rollup merge of #58276 - varkor:missing-stability-attr-top-level, r=d…
Centril Feb 13, 2019
9d46076
Rollup merge of #58354 - matthewjasper:mir-dump-fixes, r=wesleywiser
Centril Feb 13, 2019
99fd506
Rollup merge of #58381 - davidtwco:issue-42944, r=estebank
Centril Feb 13, 2019
4597c05
Rollup merge of #58386 - Zoxc:fix-54242, r=michaelwoerister
Centril Feb 13, 2019
e1c97f2
Rollup merge of #58400 - gnzlbg:fix_driver, r=oli-obk
Centril Feb 13, 2019
f4dfad8
Rollup merge of #58420 - dvdhrm:target-uefi-comments, r=nagisa
Centril Feb 13, 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
28 changes: 1 addition & 27 deletions src/librustc/middle/stability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -593,37 +593,11 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
// Deprecated attributes apply in-crate and cross-crate.
if let Some(id) = id {
if let Some(depr_entry) = self.lookup_deprecation_entry(def_id) {
// If the deprecation is scheduled for a future Rust
// version, then we should display no warning message.
let deprecated_in_future_version = if let Some(sym) = depr_entry.attr.since {
let since = sym.as_str();
if !deprecation_in_effect(&since) {
Some(since)
} else {
None
}
} else {
None
};

let parent_def_id = self.hir().local_def_id(self.hir().get_parent(id));
let skip = self.lookup_deprecation_entry(parent_def_id)
.map_or(false, |parent_depr| parent_depr.same_origin(&depr_entry));

if let Some(since) = deprecated_in_future_version {
let path = self.item_path_str(def_id);
let message = format!("use of item '{}' \
that will be deprecated in future version {}",
path,
since);

lint_deprecated(def_id,
id,
depr_entry.attr.note,
None,
&message,
lint::builtin::DEPRECATED_IN_FUTURE);
} else if !skip {
if !skip {
let path = self.item_path_str(def_id);
let message = format!("use of deprecated item '{}'", path);
lint_deprecated(def_id,
Expand Down
31 changes: 24 additions & 7 deletions src/librustdoc/html/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2823,7 +2823,17 @@ fn stability_tags(item: &clean::Item) -> String {

// The trailing space after each tag is to space it properly against the rest of the docs.
if item.deprecation().is_some() {
tags += &tag_html("deprecated", "Deprecated");
let mut message = "Deprecated";
if let Some(ref stab) = item.stability {
if let Some(ref depr) = stab.deprecation {
if let Some(ref since) = depr.since {
if !stability::deprecation_in_effect(&since) {
message = "Deprecation planned";
}
}
}
}
tags += &tag_html("deprecated", message);
}

if let Some(stab) = item
Expand Down Expand Up @@ -2851,16 +2861,23 @@ fn short_stability(item: &clean::Item, cx: &Context) -> Vec<String> {
let mut stability = vec![];
let error_codes = ErrorCodes::from(UnstableFeatures::from_environment().is_nightly_build());

if let Some(Deprecation { since, note }) = &item.deprecation() {
if let Some(Deprecation { note, since }) = &item.deprecation() {
// We display deprecation messages for #[deprecated] and #[rustc_deprecated]
// but only display the future-deprecation messages for #[rustc_deprecated].
let mut message = if let Some(since) = since {
if stability::deprecation_in_effect(since) {
format!("Deprecated since {}", Escape(since))
} else {
format!("Deprecating in {}", Escape(since))
}
format!("Deprecated since {}", Escape(since))
} else {
String::from("Deprecated")
};
if let Some(ref stab) = item.stability {
if let Some(ref depr) = stab.deprecation {
if let Some(ref since) = depr.since {
if !stability::deprecation_in_effect(&since) {
message = format!("Deprecating in {}", Escape(&since));
}
}
}
}

if let Some(note) = note {
let mut ids = cx.id_map.borrow_mut();
Expand Down
4 changes: 3 additions & 1 deletion src/test/rustdoc/deprecated-future.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#![feature(deprecated)]

// @has deprecated_future/index.html '//*[@class="stab deprecated"]' \
// 'Deprecated'
// @has deprecated_future/struct.S.html '//*[@class="stab deprecated"]' \
// 'Deprecating in 99.99.99: effectively never'
// 'Deprecated since 99.99.99: effectively never'
#[deprecated(since = "99.99.99", note = "effectively never")]
pub struct S;
11 changes: 11 additions & 0 deletions src/test/rustdoc/rustc_deprecated-future.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#![feature(staged_api)]

#![stable(feature = "rustc_deprecated-future-test", since = "1.0.0")]

// @has rustc_deprecated_future/index.html '//*[@class="stab deprecated"]' \
// 'Deprecation planned'
// @has rustc_deprecated_future/struct.S.html '//*[@class="stab deprecated"]' \
// 'Deprecating in 99.99.99: effectively never'
#[rustc_deprecated(since = "99.99.99", reason = "effectively never")]
#[stable(feature = "rustc_deprecated-future-test", since = "1.0.0")]
pub struct S;
4 changes: 3 additions & 1 deletion src/test/ui/deprecation/deprecation-in-future.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
// ignore-tidy-linelength

// run-pass

#![deny(deprecated_in_future)]

#[deprecated(since = "99.99.99", note = "text")]
pub fn deprecated_future() {}

fn test() {
deprecated_future(); //~ ERROR use of item 'deprecated_future' that will be deprecated in future version 99.99.99: text
deprecated_future(); // ok; deprecated_in_future only applies to rustc_deprecated
}

fn main() {}
14 changes: 4 additions & 10 deletions src/test/ui/deprecation/deprecation-in-future.stderr
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
error: use of item 'deprecated_future' that will be deprecated in future version 99.99.99: text
--> $DIR/deprecation-in-future.rs:9:5
warning: use of deprecated item 'deprecated_future': text
--> $DIR/deprecation-in-future.rs:11:5
|
LL | deprecated_future(); //~ ERROR use of item 'deprecated_future' that will be deprecated in future version 99.99.99: text
LL | deprecated_future(); // ok; deprecated_in_future only applies to rustc_deprecated
| ^^^^^^^^^^^^^^^^^
|
note: lint level defined here
--> $DIR/deprecation-in-future.rs:3:9
|
LL | #![deny(deprecated_in_future)]
| ^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error
= note: #[warn(deprecated)] on by default

5 changes: 3 additions & 2 deletions src/test/ui/deprecation/deprecation-lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,9 @@ mod this_crate {
<Foo>::trait_deprecated_text(&foo); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated_text': text
<Foo as Trait>::trait_deprecated_text(&foo); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated_text': text

deprecated_future(); // Fine; no error.
deprecated_future_text(); // Fine; no error.
// Future deprecations are only permitted for rustc_deprecated.
deprecated_future(); //~ ERROR use of deprecated item
deprecated_future_text(); //~ ERROR use of deprecated item

let _ = DeprecatedStruct {
//~^ ERROR use of deprecated item 'this_crate::DeprecatedStruct': text
Expand Down
Loading
0