Skip to content
Closed
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
50d9b30
Added better error message for shared borrow treated as unique for pu…
Polkaverse Oct 8, 2020
db8ddbf
Move tooltips messages to CSS instead of inside HTML
GuillaumeGomez Dec 5, 2020
9b62936
Update tests
GuillaumeGomez Dec 5, 2020
b66eb69
Refactored verbose print into a function
hencrice Dec 13, 2020
0e0ae47
Add a new lint to rustdoc for invalid codeblocks
poliorcetics Dec 15, 2020
830ceaa
Remap instrument-coverage line numbers in doctests
Swatinem Dec 6, 2020
f9fa3fe
add an attribute to inner doctest fn
Swatinem Dec 20, 2020
8cfaf94
update rustfmt to v1.4.30
calebcartwright Dec 20, 2020
087101e
make path normalization compatible with mac python2
Swatinem Dec 21, 2020
a272d62
Implemented a compiler diagnostic for move async mistake
diondokter Dec 18, 2020
aec3575
Rename rustc_middle::lint::LintSource
pierwill Dec 21, 2020
d3900d3
Document rustc_middle::lint::LevelSource
pierwill Dec 21, 2020
163f5da
Add installation commands to `x` tool README
pierwill Dec 22, 2020
2046a55
path trimming: ignore type aliases
da-x Dec 13, 2020
d18f6c1
Fix run-make-fulldeps/coverage-spanview
da-x Dec 22, 2020
0fd4f8f
Add a custom `Res` type
jyn514 Dec 19, 2020
4092891
Fix intra-doc links for non-path primitives
jyn514 Dec 19, 2020
8842c1c
Fix new ambiguity in the standard library
jyn514 Dec 19, 2020
a6d377d
Include rustdoc in the compiler docs index.
ehuss Dec 23, 2020
732afd4
Exclude unnecessary info from CodegenResults
Dec 19, 2020
e8a564e
Add a test that rustc compiles and links separately
Dec 23, 2020
c625d31
Updated the match with the matches macro
Polkaverse Dec 23, 2020
619c200
Make doc-test pass with the new rustdoc
poliorcetics Dec 19, 2020
f459b0f
Addressed feedbacks
hencrice Dec 23, 2020
ecba49c
Fixed formatting
hencrice Dec 23, 2020
152d4e7
Update HTML DOM attribute "edition" to "data-edition"
GuillaumeGomez Dec 23, 2020
78b91af
Rollup merge of #77692 - PankajChaudhary5:issue-76630, r=davidtwco
Dylan-DPC Dec 23, 2020
ce6432a
Rollup merge of #78052 - da-x:path-trimming-type-aliases, r=davidtwco
Dylan-DPC Dec 23, 2020
cb22d73
Rollup merge of #79742 - GuillaumeGomez:move-tooltips-messages-out-of…
Dylan-DPC Dec 23, 2020
b317c85
Rollup merge of #79762 - Swatinem:remap-doctest-coverage, r=Swatinem
Dylan-DPC Dec 23, 2020
f21b06a
Rollup merge of #79816 - poliorcetics:rustdoc-fail-on-deny, r=jyn514
Dylan-DPC Dec 23, 2020
c2f99ea
Rollup merge of #79999 - hencrice:yenlinc/79799, r=oli-obk
Dylan-DPC Dec 23, 2020
8829cf0
Rollup merge of #80160 - diondokter:move_async_fix, r=davidtwco
Dylan-DPC Dec 23, 2020
a0aee25
Rollup merge of #80181 - jyn514:intra-doc-primitives, r=Manishearth
Dylan-DPC Dec 23, 2020
5bf0ba9
Rollup merge of #80187 - 0dvictor:nativelib, r=bjorn3
Dylan-DPC Dec 23, 2020
bbb66e8
Rollup merge of #80249 - calebcartwright:update-rustfmt, r=Mark-Simul…
Dylan-DPC Dec 23, 2020
1b662dd
Rollup merge of #80274 - pierwill:lintlevelsource, r=petrochenkov
Dylan-DPC Dec 23, 2020
c9d7b44
Rollup merge of #80280 - pierwill:x-readme, r=Mark-Simulacrum
Dylan-DPC Dec 23, 2020
59873e7
Rollup merge of #80316 - ehuss:rustdoc-index, r=Mark-Simulacrum
Dylan-DPC Dec 23, 2020
b48e221
Rollup merge of #80327 - PankajChaudhary5:PankajChaudhary, r=Guillaum…
Dylan-DPC Dec 23, 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
4 changes: 2 additions & 2 deletions Cargo.lock
Original file line number Diff line number Diff line change
@@ -4396,7 +4396,7 @@ dependencies = [

[[package]]
name = "rustfmt-nightly"
version = "1.4.29"
version = "1.4.30"
dependencies = [
"annotate-snippets 0.6.1",
"anyhow",
@@ -5342,7 +5342,7 @@ dependencies = [
"chrono",
"lazy_static",
"matchers",
"parking_lot 0.11.0",
"parking_lot 0.9.0",
"regex",
"serde",
"serde_json",
5 changes: 3 additions & 2 deletions compiler/rustc_codegen_ssa/src/back/link.rs
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ use rustc_data_structures::fx::FxHashSet;
use rustc_data_structures::temp_dir::MaybeTempDir;
use rustc_fs_util::fix_windows_verbatim_for_gcc;
use rustc_hir::def_id::CrateNum;
use rustc_middle::middle::cstore::{EncodedMetadata, LibSource, NativeLib};
use rustc_middle::middle::cstore::{EncodedMetadata, LibSource};
use rustc_middle::middle::dependency_format::Linkage;
use rustc_session::config::{self, CFGuard, CrateType, DebugInfo};
use rustc_session::config::{OutputFilenames, OutputType, PrintRequest, SanitizerSet};
@@ -22,7 +22,8 @@ use super::command::Command;
use super::linker::{self, Linker};
use super::rpath::{self, RPathConfig};
use crate::{
looks_like_rust_object_file, CodegenResults, CompiledModule, CrateInfo, METADATA_FILENAME,
looks_like_rust_object_file, CodegenResults, CompiledModule, CrateInfo, NativeLib,
METADATA_FILENAME,
};

use cc::windows_registry;
5 changes: 3 additions & 2 deletions compiler/rustc_codegen_ssa/src/base.rs
Original file line number Diff line number Diff line change
@@ -766,7 +766,7 @@ impl CrateInfo {
profiler_runtime: None,
is_no_builtins: Default::default(),
native_libraries: Default::default(),
used_libraries: tcx.native_libraries(LOCAL_CRATE),
used_libraries: tcx.native_libraries(LOCAL_CRATE).iter().map(Into::into).collect(),
link_args: tcx.link_args(LOCAL_CRATE),
crate_name: Default::default(),
used_crates_dynamic: cstore::used_crates(tcx, LinkagePreference::RequireDynamic),
@@ -787,7 +787,8 @@ impl CrateInfo {
info.missing_lang_items.reserve(n_crates);

for &cnum in crates.iter() {
info.native_libraries.insert(cnum, tcx.native_libraries(cnum));
info.native_libraries
.insert(cnum, tcx.native_libraries(cnum).iter().map(Into::into).collect());
info.crate_name.insert(cnum, tcx.crate_name(cnum).to_string());
info.used_crate_source.insert(cnum, tcx.used_crate_source(cnum));
if tcx.is_panic_runtime(cnum) {
21 changes: 18 additions & 3 deletions compiler/rustc_codegen_ssa/src/lib.rs
Original file line number Diff line number Diff line change
@@ -21,15 +21,17 @@ extern crate tracing;
#[macro_use]
extern crate rustc_middle;

use rustc_ast as ast;
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
use rustc_data_structures::sync::Lrc;
use rustc_hir::def_id::CrateNum;
use rustc_hir::LangItem;
use rustc_middle::dep_graph::WorkProduct;
use rustc_middle::middle::cstore::{CrateSource, LibSource, NativeLib};
use rustc_middle::middle::cstore::{self, CrateSource, LibSource};
use rustc_middle::middle::dependency_format::Dependencies;
use rustc_middle::ty::query::Providers;
use rustc_session::config::{OutputFilenames, OutputType, RUST_CGU_EXT};
use rustc_session::utils::NativeLibKind;
use rustc_span::symbol::Symbol;
use std::path::{Path, PathBuf};

@@ -105,6 +107,19 @@ bitflags::bitflags! {
}
}

#[derive(Clone, Debug, Encodable, Decodable, HashStable)]
pub struct NativeLib {
pub kind: NativeLibKind,
pub name: Option<Symbol>,
pub cfg: Option<ast::MetaItem>,
}

impl From<&cstore::NativeLib> for NativeLib {
fn from(lib: &cstore::NativeLib) -> Self {
NativeLib { kind: lib.kind.clone(), name: lib.name.clone(), cfg: lib.cfg.clone() }
}
}

/// Misc info we load from metadata to persist beyond the tcx.
///
/// Note: though `CrateNum` is only meaningful within the same tcx, information within `CrateInfo`
@@ -119,9 +134,9 @@ pub struct CrateInfo {
pub compiler_builtins: Option<CrateNum>,
pub profiler_runtime: Option<CrateNum>,
pub is_no_builtins: FxHashSet<CrateNum>,
pub native_libraries: FxHashMap<CrateNum, Lrc<Vec<NativeLib>>>,
pub native_libraries: FxHashMap<CrateNum, Vec<NativeLib>>,
pub crate_name: FxHashMap<CrateNum, String>,
pub used_libraries: Lrc<Vec<NativeLib>>,
pub used_libraries: Vec<NativeLib>,
pub link_args: Lrc<Vec<String>>,
pub used_crate_source: FxHashMap<CrateNum, Lrc<CrateSource>>,
pub used_crates_static: Vec<(CrateNum, LibSource)>,
22 changes: 12 additions & 10 deletions compiler/rustc_lint/src/levels.rs
Original file line number Diff line number Diff line change
@@ -12,7 +12,9 @@ use rustc_hir::{intravisit, HirId};
use rustc_middle::hir::map::Map;
use rustc_middle::lint::LevelSource;
use rustc_middle::lint::LintDiagnosticBuilder;
use rustc_middle::lint::{struct_lint_level, LintLevelMap, LintLevelSets, LintSet, LintSource};
use rustc_middle::lint::{
struct_lint_level, LintLevelMap, LintLevelSets, LintLevelSource, LintSet,
};
use rustc_middle::ty::query::Providers;
use rustc_middle::ty::TyCtxt;
use rustc_session::lint::{builtin, Level, Lint, LintId};
@@ -91,7 +93,7 @@ impl<'s> LintLevelsBuilder<'s> {
};
for id in ids {
self.check_gated_lint(id, DUMMY_SP);
let src = LintSource::CommandLine(lint_flag_val, orig_level);
let src = LintLevelSource::CommandLine(lint_flag_val, orig_level);
specs.insert(id, (level, src));
}
}
@@ -128,19 +130,19 @@ impl<'s> LintLevelsBuilder<'s> {
);
diag_builder.span_label(src.span(), "overruled by previous forbid");
match old_src {
LintSource::Default => {
LintLevelSource::Default => {
diag_builder.note(&format!(
"`forbid` lint level is the default for {}",
id.to_string()
));
}
LintSource::Node(_, forbid_source_span, reason) => {
LintLevelSource::Node(_, forbid_source_span, reason) => {
diag_builder.span_label(forbid_source_span, "`forbid` level set here");
if let Some(rationale) = reason {
diag_builder.note(&rationale.as_str());
}
}
LintSource::CommandLine(_, _) => {
LintLevelSource::CommandLine(_, _) => {
diag_builder.note("`forbid` lint level was set on command line");
}
}
@@ -276,7 +278,7 @@ impl<'s> LintLevelsBuilder<'s> {
let name = meta_item.path.segments.last().expect("empty lint name").ident.name;
match store.check_lint_name(&name.as_str(), tool_name) {
CheckLintNameResult::Ok(ids) => {
let src = LintSource::Node(name, li.span(), reason);
let src = LintLevelSource::Node(name, li.span(), reason);
for &id in ids {
self.check_gated_lint(id, attr.span);
self.insert_spec(&mut specs, id, (level, src));
@@ -287,7 +289,7 @@ impl<'s> LintLevelsBuilder<'s> {
match result {
Ok(ids) => {
let complete_name = &format!("{}::{}", tool_name.unwrap(), name);
let src = LintSource::Node(
let src = LintLevelSource::Node(
Symbol::intern(complete_name),
li.span(),
reason,
@@ -324,7 +326,7 @@ impl<'s> LintLevelsBuilder<'s> {
},
);

let src = LintSource::Node(
let src = LintLevelSource::Node(
Symbol::intern(&new_lint_name),
li.span(),
reason,
@@ -403,7 +405,7 @@ impl<'s> LintLevelsBuilder<'s> {
}

let (lint_attr_name, lint_attr_span) = match *src {
LintSource::Node(name, span, _) => (name, span),
LintLevelSource::Node(name, span, _) => (name, span),
_ => continue,
};

@@ -460,7 +462,7 @@ impl<'s> LintLevelsBuilder<'s> {
}

/// Find the lint level for a lint.
pub fn lint_level(&self, lint: &'static Lint) -> (Level, LintSource) {
pub fn lint_level(&self, lint: &'static Lint) -> (Level, LintLevelSource) {
self.sets.get_lint_level(lint, self.cur, None, self.sess)
}

3 changes: 2 additions & 1 deletion compiler/rustc_lint/src/lib.rs
Original file line number Diff line number Diff line change
@@ -70,7 +70,7 @@ use rustc_middle::ty::TyCtxt;
use rustc_session::lint::builtin::{
BARE_TRAIT_OBJECTS, BROKEN_INTRA_DOC_LINKS, ELIDED_LIFETIMES_IN_PATHS,
EXPLICIT_OUTLIVES_REQUIREMENTS, INVALID_CODEBLOCK_ATTRIBUTES, INVALID_HTML_TAGS,
MISSING_DOC_CODE_EXAMPLES, NON_AUTOLINKS, PRIVATE_DOC_TESTS,
INVALID_RUST_CODEBLOCK, MISSING_DOC_CODE_EXAMPLES, NON_AUTOLINKS, PRIVATE_DOC_TESTS,
};
use rustc_span::symbol::{Ident, Symbol};
use rustc_span::Span;
@@ -319,6 +319,7 @@ fn register_builtins(store: &mut LintStore, no_interleave_lints: bool) {
BROKEN_INTRA_DOC_LINKS,
PRIVATE_INTRA_DOC_LINKS,
INVALID_CODEBLOCK_ATTRIBUTES,
INVALID_RUST_CODEBLOCK,
MISSING_DOC_CODE_EXAMPLES,
PRIVATE_DOC_TESTS,
INVALID_HTML_TAGS
13 changes: 13 additions & 0 deletions compiler/rustc_lint_defs/src/builtin.rs
Original file line number Diff line number Diff line change
@@ -1846,6 +1846,18 @@ declare_lint! {
"codeblock attribute looks a lot like a known one"
}

declare_lint! {
/// The `invalid_rust_codeblock` lint detects Rust code blocks in
/// documentation examples that are invalid (e.g. empty, not parsable as
/// Rust code). This is a `rustdoc` only lint, see the documentation in the
/// [rustdoc book].
///
/// [rustdoc book]: ../../../rustdoc/lints.html#invalid_rust_codeblock
pub INVALID_RUST_CODEBLOCK,
Warn,
"codeblock could not be parsed as valid Rust or is empty"
}

declare_lint! {
/// The `missing_crate_level_docs` lint detects if documentation is
/// missing at the crate root. This is a `rustdoc` only lint, see the
@@ -2846,6 +2858,7 @@ declare_lint_pass! {
BROKEN_INTRA_DOC_LINKS,
PRIVATE_INTRA_DOC_LINKS,
INVALID_CODEBLOCK_ATTRIBUTES,
INVALID_RUST_CODEBLOCK,
MISSING_CRATE_LEVEL_DOCS,
MISSING_DOC_CODE_EXAMPLES,
INVALID_HTML_TAGS,
33 changes: 17 additions & 16 deletions compiler/rustc_middle/src/lint.rs
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ use rustc_span::{symbol, Span, Symbol, DUMMY_SP};

/// How a lint level was set.
#[derive(Clone, Copy, PartialEq, Eq, HashStable)]
pub enum LintSource {
pub enum LintLevelSource {
/// Lint is at the default level as declared
/// in rustc or a plugin.
Default,
@@ -27,25 +27,26 @@ pub enum LintSource {
CommandLine(Symbol, Level),
}

impl LintSource {
impl LintLevelSource {
pub fn name(&self) -> Symbol {
match *self {
LintSource::Default => symbol::kw::Default,
LintSource::Node(name, _, _) => name,
LintSource::CommandLine(name, _) => name,
LintLevelSource::Default => symbol::kw::Default,
LintLevelSource::Node(name, _, _) => name,
LintLevelSource::CommandLine(name, _) => name,
}
}

pub fn span(&self) -> Span {
match *self {
LintSource::Default => DUMMY_SP,
LintSource::Node(_, span, _) => span,
LintSource::CommandLine(_, _) => DUMMY_SP,
LintLevelSource::Default => DUMMY_SP,
LintLevelSource::Node(_, span, _) => span,
LintLevelSource::CommandLine(_, _) => DUMMY_SP,
}
}
}

pub type LevelSource = (Level, LintSource);
/// A tuple of a lint level and its source.
pub type LevelSource = (Level, LintLevelSource);

pub struct LintLevelSets {
pub list: Vec<LintSet>,
@@ -113,7 +114,7 @@ impl LintLevelSets {
id: LintId,
mut idx: u32,
aux: Option<&FxHashMap<LintId, LevelSource>>,
) -> (Option<Level>, LintSource) {
) -> (Option<Level>, LintLevelSource) {
if let Some(specs) = aux {
if let Some(&(level, src)) = specs.get(&id) {
return (Some(level), src);
@@ -125,7 +126,7 @@ impl LintLevelSets {
if let Some(&(level, src)) = specs.get(&id) {
return (Some(level), src);
}
return (None, LintSource::Default);
return (None, LintLevelSource::Default);
}
LintSet::Node { ref specs, parent } => {
if let Some(&(level, src)) = specs.get(&id) {
@@ -213,7 +214,7 @@ pub fn struct_lint_level<'s, 'd>(
sess: &'s Session,
lint: &'static Lint,
level: Level,
src: LintSource,
src: LintLevelSource,
span: Option<MultiSpan>,
decorate: impl for<'a> FnOnce(LintDiagnosticBuilder<'a>) + 'd,
) {
@@ -223,7 +224,7 @@ pub fn struct_lint_level<'s, 'd>(
sess: &'s Session,
lint: &'static Lint,
level: Level,
src: LintSource,
src: LintLevelSource,
span: Option<MultiSpan>,
decorate: Box<dyn for<'b> FnOnce(LintDiagnosticBuilder<'b>) + 'd>,
) {
@@ -274,14 +275,14 @@ pub fn struct_lint_level<'s, 'd>(

let name = lint.name_lower();
match src {
LintSource::Default => {
LintLevelSource::Default => {
sess.diag_note_once(
&mut err,
DiagnosticMessageId::from(lint),
&format!("`#[{}({})]` on by default", level.as_str(), name),
);
}
LintSource::CommandLine(lint_flag_val, orig_level) => {
LintLevelSource::CommandLine(lint_flag_val, orig_level) => {
let flag = match orig_level {
Level::Warn => "-W",
Level::Deny => "-D",
@@ -310,7 +311,7 @@ pub fn struct_lint_level<'s, 'd>(
);
}
}
LintSource::Node(lint_attr_name, src, reason) => {
LintLevelSource::Node(lint_attr_name, src, reason) => {
if let Some(rationale) = reason {
err.note(&rationale.as_str());
}
4 changes: 2 additions & 2 deletions compiler/rustc_middle/src/ty/context.rs
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ use crate::dep_graph::{self, DepGraph, DepKind, DepNode, DepNodeExt};
use crate::hir::exports::ExportMap;
use crate::ich::{NodeIdHashingMode, StableHashingContext};
use crate::infer::canonical::{Canonical, CanonicalVarInfo, CanonicalVarInfos};
use crate::lint::{struct_lint_level, LintDiagnosticBuilder, LintSource};
use crate::lint::{struct_lint_level, LintDiagnosticBuilder, LintLevelSource};
use crate::middle;
use crate::middle::cstore::{CrateStoreDyn, EncodedMetadata};
use crate::middle::resolve_lifetime::{self, ObjectLifetimeDefault};
@@ -2559,7 +2559,7 @@ impl<'tcx> TyCtxt<'tcx> {
self,
lint: &'static Lint,
mut id: hir::HirId,
) -> (Level, LintSource) {
) -> (Level, LintLevelSource) {
let sets = self.lint_levels(LOCAL_CRATE);
loop {
if let Some(pair) = sets.level_and_source(lint, id, self.sess) {
1 change: 1 addition & 0 deletions compiler/rustc_middle/src/ty/print/pretty.rs
Original file line number Diff line number Diff line change
@@ -2160,6 +2160,7 @@ fn for_each_def(tcx: TyCtxt<'_>, mut collect_fn: impl for<'b> FnMut(&'b Ident, N

match child.res {
def::Res::Def(DefKind::AssocTy, _) => {}
def::Res::Def(DefKind::TyAlias, _) => {}
def::Res::Def(defkind, def_id) => {
if let Some(ns) = defkind.ns() {
collect_fn(&child.ident, ns, def_id);
5 changes: 1 addition & 4 deletions compiler/rustc_middle/src/ty/sty.rs
Original file line number Diff line number Diff line change
@@ -215,10 +215,7 @@ pub enum TyKind<'tcx> {
impl TyKind<'tcx> {
#[inline]
pub fn is_primitive(&self) -> bool {
match self {
Bool | Char | Int(_) | Uint(_) | Float(_) => true,
_ => false,
}
matches!(self, Bool | Char | Int(_) | Uint(_) | Float(_))
}

/// Get the article ("a" or "an") to use with this type.
Loading