Skip to content
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

Rollup of 9 pull requests #78589

Closed
wants to merge 34 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
37ce212
make exp_m1 examples more representative of use
tspiteri Sep 23, 2020
50d3ddc
make ln_1p examples more representative of use
tspiteri Sep 23, 2020
01b0aff
Add std::panic::panic_box.
m-ou-se Jul 22, 2020
16201da
Rename panic_box to panic_any.
m-ou-se Oct 18, 2020
9e16213
Suggest calling associated `fn` inside `trait`s
estebank Oct 26, 2020
a9d334d
Update panic_any feature name.
m-ou-se Oct 28, 2020
b48fee0
Add tracking issue number for panic_any.
m-ou-se Oct 28, 2020
4ba57aa
Strip tokens from trait and impl items before printing AST JSON
Aaron1011 Oct 29, 2020
dcbf2f3
rustc_llvm: unwrap LLVMMetadataRef before casting
cuviper Oct 29, 2020
93ca9ae
Qualify `panic!` as `core::panic!` in non-built-in `core` macros
camelid Oct 25, 2020
5c87941
Clean up `core` macros documentation
camelid Oct 25, 2020
7b3d897
Add two more test cases
camelid Oct 29, 2020
8cf7d66
Create config.toml in the current directory, not the top-level directory
jyn514 Oct 30, 2020
59c6ae6
Use SOCK_CLOEXEC and accept4() on more platforms.
de-vri-es Oct 30, 2020
922ebf4
Remove unused `use std::panic;`s
camelid Oct 30, 2020
23018a5
Implement rustc side of report-future-incompat
Aaron1011 Aug 13, 2020
6bdb4e3
Some work
Aaron1011 Oct 18, 2020
a77a65c
Print future breakage report
Aaron1011 Oct 19, 2020
2d17597
Strip out non-diagnostic lines from rustfix input
Aaron1011 Oct 19, 2020
4b4f84f
Only error on unfixed diagnostics
Aaron1011 Oct 19, 2020
4621ce9
Update into-iter-on-arrays test to check future-incompat-report
Aaron1011 Oct 19, 2020
2f6e59d
Don't display empty future-compat report
Aaron1011 Oct 19, 2020
7b7c223
Always pass `-Z future-incompat-report` to UI tests
Aaron1011 Oct 19, 2020
ac12e6f
Fix test
Aaron1011 Oct 20, 2020
6db00a2
Update Clippy path to `Lint`
Aaron1011 Oct 31, 2020
0541f8e
Rollup merge of #74622 - fusion-engineering-forks:panic-box, r=KodrAus
Dylan-DPC Oct 31, 2020
185b7fd
Rollup merge of #75534 - Aaron1011:feature/new-future-breakage, r=pnk…
Dylan-DPC Oct 31, 2020
fcffbcf
Rollup merge of #77099 - tspiteri:exp_m1-examples, r=m-ou-se
Dylan-DPC Oct 31, 2020
3eba549
Rollup merge of #78343 - camelid:macros-qualify-panic, r=m-ou-se
Dylan-DPC Oct 31, 2020
c5272d6
Rollup merge of #78420 - estebank:suggest-assoc-fn, r=petrochenkov
Dylan-DPC Oct 31, 2020
bd515ee
Rollup merge of #78526 - Aaron1011:fix/assoc-tokens, r=estebank
Dylan-DPC Oct 31, 2020
ebcf144
Rollup merge of #78531 - cuviper:unwrap-metadata, r=tmandry
Dylan-DPC Oct 31, 2020
61eb1a8
Rollup merge of #78550 - jyn514:setup, r=Mark-Simulacrum
Dylan-DPC Oct 31, 2020
defae8d
Rollup merge of #78572 - de-vri-es:bsd-cloexec, r=m-ou-se
Dylan-DPC Oct 31, 2020
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
14 changes: 14 additions & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3638,6 +3638,7 @@ dependencies = [
"annotate-snippets 0.8.0",
"atty",
"rustc_data_structures",
"rustc_lint_defs",
"rustc_macros",
"rustc_serialize",
"rustc_span",
Expand Down Expand Up @@ -3830,6 +3831,18 @@ dependencies = [
"unicode-security",
]

[[package]]
name = "rustc_lint_defs"
version = "0.0.0"
dependencies = [
"rustc_ast",
"rustc_data_structures",
"rustc_macros",
"rustc_serialize",
"rustc_span",
"tracing",
]

[[package]]
name = "rustc_llvm"
version = "0.0.0"
Expand Down Expand Up @@ -4112,6 +4125,7 @@ dependencies = [
"rustc_errors",
"rustc_feature",
"rustc_fs_util",
"rustc_lint_defs",
"rustc_macros",
"rustc_serialize",
"rustc_span",
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_ast_lowering/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
E0726,
"implicit elided lifetime not allowed here"
);
rustc_session::lint::add_elided_lifetime_in_path_suggestion(
&self.sess,
rustc_errors::add_elided_lifetime_in_path_suggestion(
&self.sess.source_map(),
&mut err,
expected_lifetimes,
path_span,
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_errors/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ rustc_serialize = { path = "../rustc_serialize" }
rustc_span = { path = "../rustc_span" }
rustc_macros = { path = "../rustc_macros" }
rustc_data_structures = { path = "../rustc_data_structures" }
rustc_lint_defs = { path = "../rustc_lint_defs" }
unicode-width = "0.1.4"
atty = "0.2"
termcolor = "1.0"
Expand Down
4 changes: 3 additions & 1 deletion compiler/rustc_errors/src/annotate_snippet_emitter_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ fn annotation_type_for_level(level: Level) -> AnnotationType {
Level::Help => AnnotationType::Help,
// FIXME(#59346): Not sure how to map these two levels
Level::Cancelled | Level::FailureNote => AnnotationType::Error,
Level::Allow => panic!("Should not call with Allow"),
}
}

Expand Down Expand Up @@ -143,7 +144,8 @@ impl AnnotateSnippetEmitterWriter {
title: Some(Annotation {
label: Some(&message),
id: code.as_ref().map(|c| match c {
DiagnosticId::Error(val) | DiagnosticId::Lint(val) => val.as_str(),
DiagnosticId::Error(val)
| DiagnosticId::Lint { name: val, has_future_breakage: _ } => val.as_str(),
}),
annotation_type: annotation_type_for_level(*level),
}),
Expand Down
13 changes: 10 additions & 3 deletions compiler/rustc_errors/src/diagnostic.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use crate::snippet::Style;
use crate::Applicability;
use crate::CodeSuggestion;
use crate::Level;
use crate::Substitution;
use crate::SubstitutionPart;
use crate::SuggestionStyle;
use rustc_lint_defs::Applicability;
use rustc_span::{MultiSpan, Span, DUMMY_SP};
use std::fmt;

Expand All @@ -27,7 +27,7 @@ pub struct Diagnostic {
#[derive(Clone, Debug, PartialEq, Eq, Hash, Encodable, Decodable)]
pub enum DiagnosticId {
Error(String),
Lint(String),
Lint { name: String, has_future_breakage: bool },
}

/// For example a note attached to an error.
Expand Down Expand Up @@ -107,7 +107,14 @@ impl Diagnostic {
match self.level {
Level::Bug | Level::Fatal | Level::Error | Level::FailureNote => true,

Level::Warning | Level::Note | Level::Help | Level::Cancelled => false,
Level::Warning | Level::Note | Level::Help | Level::Cancelled | Level::Allow => false,
}
}

pub fn has_future_breakage(&self) -> bool {
match self.code {
Some(DiagnosticId::Lint { has_future_breakage, .. }) => has_future_breakage,
_ => false,
}
}

Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_errors/src/diagnostic_builder.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use crate::{Applicability, Handler, Level, StashKey};
use crate::{Diagnostic, DiagnosticId, DiagnosticStyledString};
use crate::{Handler, Level, StashKey};
use rustc_lint_defs::Applicability;

use rustc_span::{MultiSpan, Span};
use std::fmt::{self, Debug};
Expand Down
9 changes: 6 additions & 3 deletions compiler/rustc_errors/src/emitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@

use Destination::*;

use rustc_lint_defs::FutureBreakage;
use rustc_span::source_map::SourceMap;
use rustc_span::{MultiSpan, SourceFile, Span};

use crate::snippet::{Annotation, AnnotationType, Line, MultilineAnnotation, Style, StyledString};
use crate::styled_buffer::StyledBuffer;
use crate::{
pluralize, CodeSuggestion, Diagnostic, DiagnosticId, Level, SubDiagnostic, SuggestionStyle,
};
use crate::{CodeSuggestion, Diagnostic, DiagnosticId, Level, SubDiagnostic, SuggestionStyle};

use rustc_lint_defs::pluralize;

use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::sync::Lrc;
Expand Down Expand Up @@ -192,6 +193,8 @@ pub trait Emitter {
/// other formats can, and will, simply ignore it.
fn emit_artifact_notification(&mut self, _path: &Path, _artifact_type: &str) {}

fn emit_future_breakage_report(&mut self, _diags: Vec<(FutureBreakage, Diagnostic)>) {}

/// Checks if should show explanations about "rustc --explain"
fn should_show_explain(&self) -> bool {
true
Expand Down
41 changes: 39 additions & 2 deletions compiler/rustc_errors/src/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ use rustc_span::source_map::{FilePathMapping, SourceMap};

use crate::emitter::{Emitter, HumanReadableErrorType};
use crate::registry::Registry;
use crate::{Applicability, DiagnosticId};
use crate::DiagnosticId;
use crate::{CodeSuggestion, SubDiagnostic};
use rustc_lint_defs::{Applicability, FutureBreakage};

use rustc_data_structures::sync::Lrc;
use rustc_span::hygiene::ExpnData;
Expand Down Expand Up @@ -131,6 +132,31 @@ impl Emitter for JsonEmitter {
}
}

fn emit_future_breakage_report(&mut self, diags: Vec<(FutureBreakage, crate::Diagnostic)>) {
let data: Vec<FutureBreakageItem> = diags
.into_iter()
.map(|(breakage, mut diag)| {
if diag.level == crate::Level::Allow {
diag.level = crate::Level::Warning;
}
FutureBreakageItem {
future_breakage_date: breakage.date,
diagnostic: Diagnostic::from_errors_diagnostic(&diag, self),
}
})
.collect();
let report = FutureIncompatReport { future_incompat_report: data };
let result = if self.pretty {
writeln!(&mut self.dst, "{}", as_pretty_json(&report))
} else {
writeln!(&mut self.dst, "{}", as_json(&report))
}
.and_then(|_| self.dst.flush());
if let Err(e) = result {
panic!("failed to print future breakage report: {:?}", e);
}
}

fn source_map(&self) -> Option<&Lrc<SourceMap>> {
Some(&self.sm)
}
Expand Down Expand Up @@ -223,6 +249,17 @@ struct ArtifactNotification<'a> {
emit: &'a str,
}

#[derive(Encodable)]
struct FutureBreakageItem {
future_breakage_date: Option<&'static str>,
diagnostic: Diagnostic,
}

#[derive(Encodable)]
struct FutureIncompatReport {
future_incompat_report: Vec<FutureBreakageItem>,
}

impl Diagnostic {
fn from_errors_diagnostic(diag: &crate::Diagnostic, je: &JsonEmitter) -> Diagnostic {
let sugg = diag.suggestions.iter().map(|sugg| Diagnostic {
Expand Down Expand Up @@ -432,7 +469,7 @@ impl DiagnosticCode {
s.map(|s| {
let s = match s {
DiagnosticId::Error(s) => s,
DiagnosticId::Lint(s) => s,
DiagnosticId::Lint { name, has_future_breakage: _ } => name,
};
let je_result =
je.registry.as_ref().map(|registry| registry.try_find_description(&s)).unwrap();
Expand Down
Loading