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 10 pull requests #59300

Closed
wants to merge 31 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
2131b15
Check which blocks are cleanup in mir-opt tests
matthewjasper Mar 3, 2019
8a78019
Don't incorrectly mark blocks in generator drop shims as cleanup
matthewjasper Mar 3, 2019
5e68c57
Use the correct state for poisoning a generator
matthewjasper Mar 3, 2019
96e361f
Fix buffer invalidation for BufRead
andre-vm Mar 4, 2019
c36d91c
Fix buffer invalidation at BufReader.read_vectored
Mar 6, 2019
8353487
refactor build-mainfest.
Centril Mar 7, 2019
ff5e31f
Fix a broken link to the rustc-guide
varkor Mar 14, 2019
6e449da
Remove trailing newlines
varkor Mar 14, 2019
205ab0c
Add a link to the Discord and Zulip servers
varkor Mar 14, 2019
6f3fda9
Add links to @rust-highfive and @bors
varkor Mar 14, 2019
eadb844
Update r+ syntax
varkor Mar 14, 2019
308a002
Make all references to @bors or users links
varkor Mar 14, 2019
3a00649
Move rollup description earlier
varkor Mar 14, 2019
037596c
Fix capitalisation problem
varkor Mar 14, 2019
541ad45
Add default keyword handling in rustdoc
GuillaumeGomez Mar 5, 2019
e07d163
Fix undefined behavior in hint::spin_loop for x86 targets without SSE2
gnzlbg Mar 16, 2019
6430318
Use a valid name for graphviz graphs
matthewjasper Mar 17, 2019
db74efc
Make meta-item API compatible with `LocalInternedString::get` soundne…
petrochenkov Mar 17, 2019
6007e6f
Do not complain about non-existing fields after parse recovery
estebank Mar 18, 2019
30d5dc9
Do not encode gensymed imports in metadata
petrochenkov Mar 19, 2019
757eb67
review comments
estebank Mar 19, 2019
fdb2ecd
Rollup merge of #58902 - matthewjasper:generator-cleanup-blocks, r=da…
Centril Mar 19, 2019
0329e03
Rollup merge of #58913 - Milack27:patch_buf_reader, r=joshtriplett
Centril Mar 19, 2019
9176c71
Rollup merge of #58927 - GuillaumeGomez:default-keyword, r=QuietMisdr…
Centril Mar 19, 2019
0612ad0
Rollup merge of #58995 - Centril:refactor-build-manifest, r=alexcrichton
Centril Mar 19, 2019
46cae3e
Rollup merge of #59172 - varkor:contributing-contributions, r=stevekl…
Centril Mar 19, 2019
703e351
Rollup merge of #59239 - gnzlbg:fix_spin_loop, r=nagisa
Centril Mar 19, 2019
29af625
Rollup merge of #59251 - matthewjasper:fix-graphviz, r=petrochenkov
Centril Mar 19, 2019
e6e1ccb
Rollup merge of #59256 - petrochenkov:derval2, r=Zoxc
Centril Mar 19, 2019
3ff78d4
Rollup merge of #59266 - estebank:struct-parse-recovery, r=petrochenkov
Centril Mar 19, 2019
080332b
Rollup merge of #59296 - petrochenkov:stdup, r=estebank
Centril Mar 19, 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
52 changes: 29 additions & 23 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ links to the major sections:
* [Helpful Links and Information](#helpful-links-and-information)

If you have questions, please make a post on [internals.rust-lang.org][internals] or
hop on [#rust-internals][pound-rust-internals].
hop on the [Rust Discord server][rust-discord], [Rust Zulip server][rust-zulip] or [#rust-internals][pound-rust-internals].

As a reminder, all contributors are expected to follow our [Code of Conduct][coc].

Expand All @@ -27,14 +27,17 @@ can give you a good example of how a typical contribution would go.

[pound-rust-internals]: https://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust-internals
[internals]: https://internals.rust-lang.org
[rust-discord]: http://discord.gg/rust-lang
[rust-zulip]: https://rust-lang.zulipchat.com
[coc]: https://www.rust-lang.org/conduct.html
[rustc-guide]: https://rust-lang.github.io/rustc-guide/
[walkthrough]: https://rust-lang.github.io/rustc-guide/walkthrough.html

## Feature Requests
[feature-requests]: #feature-requests

To request a change to the way the Rust language works, please head over
to the [RFCs repository](https://github.com/rust-lang/rfcs) and view the
to the [RFCs repository](https://github.com/rust-lang/rfcs) and view the
[README](https://github.com/rust-lang/rfcs/blob/master/README.md)
for instructions.

Expand Down Expand Up @@ -129,28 +132,40 @@ request); you can add [git hooks](https://git-scm.com/book/en/v2/Customizing-Git
before every push to make sure you never forget to make this check.

All pull requests are reviewed by another person. We have a bot,
@rust-highfive, that will automatically assign a random person to review your
[@rust-highfive][rust-highfive], that will automatically assign a random person to review your
request.

If you want to request that a specific person reviews your pull request,
you can add an `r?` to the message. For example, Steve usually reviews
you can add an `r?` to the message. For example, [Steve][steveklabnik] usually reviews
documentation changes. So if you were to make a documentation change, add

r? @steveklabnik

to the end of the message, and @rust-highfive will assign @steveklabnik instead
to the end of the message, and @rust-highfive will assign [@steveklabnik][steveklabnik] instead
of a random person. This is entirely optional.

After someone has reviewed your pull request, they will leave an annotation
on the pull request with an `r+`. It will look something like this:

@bors: r+ 38fe8d2
@bors r+

This tells @bors, our lovable integration bot, that your pull request has
been approved. The PR then enters the [merge queue][merge-queue], where @bors
This tells [@bors][bors], our lovable integration bot, that your pull request has
been approved. The PR then enters the [merge queue][merge-queue], where [@bors][bors]
will run all the tests on every platform we support. If it all works out,
@bors will merge your code into `master` and close the pull request.
[@bors][bors] will merge your code into `master` and close the pull request.

Depending on the scale of the change, you may see a slightly different form of `r+`:

@bors r+ rollup

The additional `rollup` tells [@bors][bors] that this change is eligible for to be
"rolled up". Changes that are rolled up are tested and merged at the same time, to
speed the process up. Typically only small changes that are expected not to conflict
with one another are rolled up.

[rust-highfive]: https://github.com/rust-highfive
[steveklabnik]: https://github.com/steveklabnik
[bors]: https://github.com/bors
[merge-queue]: https://buildbot2.rust-lang.org/homu/queue/rust

Speaking of tests, Rust has a comprehensive test suite. More information about
Expand Down Expand Up @@ -190,7 +205,7 @@ before the PR is merged.
[breaking-tools-built-with-the-compiler]: #breaking-tools-built-with-the-compiler

Rust's build system builds a number of tools that make use of the
internals of the compiler. This includes
internals of the compiler. This includes
[Clippy](https://github.com/rust-lang/rust-clippy),
[RLS](https://github.com/rust-lang/rls) and
[rustfmt](https://github.com/rust-lang/rustfmt). If these tools
Expand Down Expand Up @@ -292,18 +307,8 @@ the submodule to. Running `./x.py build` should work now.

Documentation improvements are very welcome. The source of `doc.rust-lang.org`
is located in `src/doc` in the tree, and standard API documentation is generated
from the source code itself.

Documentation pull requests function in the same way as other pull requests,
though you may see a slightly different form of `r+`:

@bors: r+ 38fe8d2 rollup

That additional `rollup` tells @bors that this change is eligible for a 'rollup'.
To save @bors some work, and to get small changes through more quickly, when
@bors attempts to merge a commit that's rollup-eligible, it will also merge
the other rollup-eligible patches too, and they'll get tested and merged at
the same time.
from the source code itself. Documentation pull requests function in the same way
as other pull requests.

To find documentation-related issues, sort by the [T-doc label][tdoc].

Expand Down Expand Up @@ -428,7 +433,8 @@ are:
* Although out of date, [Tom Lee's great blog article][tlgba] is very helpful
* [rustaceans.org][ro] is helpful, but mostly dedicated to IRC
* The [Rust Compiler Testing Docs][rctd]
* For @bors, [this cheat sheet][cheatsheet] is helpful (Remember to replace `@homu` with `@bors` in the commands that you use.)
* For [@bors][bors], [this cheat sheet][cheatsheet] is helpful
(though you'll need to replace `@homu` with `@bors` in any commands)
* **Google!** ([search only in Rust Documentation][gsearchdocs] to find types, traits, etc. quickly)
* Don't be afraid to ask! The Rust community is friendly and helpful.

Expand Down
33 changes: 26 additions & 7 deletions src/libcore/hint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

//! Hints to compiler that affects how code should be emitted or optimized.

use intrinsics;
use {arch, intrinsics};

/// Informs the compiler that this point in the code is not reachable, enabling
/// further optimizations.
Expand Down Expand Up @@ -62,13 +62,32 @@ pub unsafe fn unreachable_unchecked() -> ! {
#[inline]
#[unstable(feature = "renamed_spin_loop", issue = "55002")]
pub fn spin_loop() {
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
unsafe {
asm!("pause" ::: "memory" : "volatile");
#[cfg(
all(
any(target_arch = "x86", target_arch = "x86_64"),
target_feature = "sse2"
)
)] {
#[cfg(target_arch = "x86")] {
unsafe { arch::x86::_mm_pause() };
}

#[cfg(target_arch = "x86_64")] {
unsafe { arch::x86_64::_mm_pause() };
}
}

#[cfg(target_arch = "aarch64")]
unsafe {
asm!("yield" ::: "memory" : "volatile");
#[cfg(
any(
target_arch = "aarch64",
all(target_arch = "arm", target_feature = "v6")
)
)] {
#[cfg(target_arch = "aarch64")] {
unsafe { arch::aarch64::__yield() };
}
#[cfg(target_arch = "arm")] {
unsafe { arch::arm::__yield() };
}
}
}
12 changes: 2 additions & 10 deletions src/librustc/hir/check_attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,16 +177,8 @@ impl<'a, 'tcx> CheckAttrVisitor<'a, 'tcx> {
let mut is_transparent = false;

for hint in &hints {
let name = if let Some(name) = hint.ident_str() {
name
} else {
// Invalid repr hint like repr(42). We don't check for unrecognized hints here
// (libsyntax does that), so just ignore it.
continue;
};

let (article, allowed_targets) = match name {
"C" | "align" => {
let (article, allowed_targets) = match hint.name_or_empty().get() {
name @ "C" | name @ "align" => {
is_c |= name == "C";
if target != Target::Struct &&
target != Target::Union &&
Expand Down
3 changes: 2 additions & 1 deletion src/librustc/hir/lowering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2672,7 +2672,7 @@ impl<'a> LoweringContext<'a> {

fn lower_variant_data(&mut self, vdata: &VariantData) -> hir::VariantData {
match *vdata {
VariantData::Struct(ref fields, id) => {
VariantData::Struct(ref fields, id, recovered) => {
let LoweredNodeId { node_id: _, hir_id } = self.lower_node_id(id);

hir::VariantData::Struct(
Expand All @@ -2682,6 +2682,7 @@ impl<'a> LoweringContext<'a> {
.map(|f| self.lower_struct_field(f))
.collect(),
hir_id,
recovered,
)
},
VariantData::Tuple(ref fields, id) => {
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/hir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2173,7 +2173,7 @@ impl StructField {
/// Id of the whole struct lives in `Item`.
#[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable)]
pub enum VariantData {
Struct(HirVec<StructField>, HirId),
Struct(HirVec<StructField>, HirId, /* recovered */ bool),
Tuple(HirVec<StructField>, HirId),
Unit(HirId),
}
Expand All @@ -2187,7 +2187,7 @@ impl VariantData {
}
pub fn hir_id(&self) -> HirId {
match *self {
VariantData::Struct(_, hir_id)
VariantData::Struct(_, hir_id, _)
| VariantData::Tuple(_, hir_id)
| VariantData::Unit(hir_id) => hir_id,
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/lint/levels.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ impl<'a> LintLevelsBuilder<'a> {
struct_span_err!(sess, span, E0452, "malformed lint attribute")
};
for attr in attrs {
let level = match attr.ident_str().and_then(|name| Level::from_str(name)) {
let level = match Level::from_str(&attr.name_or_empty()) {
None => continue,
Some(lvl) => lvl,
};
Expand Down
7 changes: 1 addition & 6 deletions src/librustc/lint/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -723,12 +723,7 @@ pub fn struct_lint_level<'a>(sess: &'a Session,

pub fn maybe_lint_level_root(tcx: TyCtxt<'_, '_, '_>, id: hir::HirId) -> bool {
let attrs = tcx.hir().attrs_by_hir_id(id);
for attr in attrs {
if attr.ident_str().and_then(Level::from_str).is_some() {
return true;
}
}
false
attrs.iter().any(|attr| Level::from_str(&attr.name_or_empty()).is_some())
}

fn lint_levels<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, cnum: CrateNum)
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/middle/lib_features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ impl<'a, 'tcx> LibFeatureCollector<'a, 'tcx> {
for meta in metas {
if let Some(mi) = meta.meta_item() {
// Find the `feature = ".."` meta-item.
match (mi.ident_str(), mi.value_str()) {
(Some("feature"), val) => feature = val,
(Some("since"), val) => since = val,
match (mi.name_or_empty().get(), mi.value_str()) {
("feature", val) => feature = val,
("since", val) => since = val,
_ => {}
}
}
Expand Down
11 changes: 5 additions & 6 deletions src/librustc/middle/stability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,11 @@ impl<'a, 'tcx: 'a> Annotator<'a, 'tcx> {
} else {
// Emit errors for non-staged-api crates.
for attr in attrs {
if let Some(tag) = attr.ident_str() {
if tag == "unstable" || tag == "stable" || tag == "rustc_deprecated" {
attr::mark_used(attr);
self.tcx.sess.span_err(attr.span, "stability attributes may not be used \
outside of the standard library");
}
let name = attr.name_or_empty();
if ["unstable", "stable", "rustc_deprecated"].contains(&name.get()) {
attr::mark_used(attr);
self.tcx.sess.span_err(attr.span, "stability attributes may not be used \
outside of the standard library");
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/librustc/traits/on_unimplemented.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,9 @@ impl<'a, 'gcx, 'tcx> OnUnimplementedDirective {
for command in self.subcommands.iter().chain(Some(self)).rev() {
if let Some(ref condition) = command.condition {
if !attr::eval_condition(condition, &tcx.sess.parse_sess, &mut |c| {
c.ident_str().map_or(false, |name| {
c.ident().map_or(false, |ident| {
options.contains(&(
name.to_string(),
ident.to_string(),
c.value_str().map(|s| s.as_str().to_string())
))
})
Expand Down
28 changes: 16 additions & 12 deletions src/librustc/ty/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1811,6 +1811,7 @@ pub struct VariantDef {
pub fields: Vec<FieldDef>,
pub ctor_kind: CtorKind,
flags: VariantFlags,
pub recovered: bool,
}

impl<'a, 'gcx, 'tcx> VariantDef {
Expand All @@ -1829,16 +1830,17 @@ impl<'a, 'gcx, 'tcx> VariantDef {
///
/// If someone speeds up attribute loading to not be a performance concern, they can
/// remove this hack and use the constructor `DefId` everywhere.
pub fn new(tcx: TyCtxt<'a, 'gcx, 'tcx>,
did: DefId,
ident: Ident,
discr: VariantDiscr,
fields: Vec<FieldDef>,
adt_kind: AdtKind,
ctor_kind: CtorKind,
attribute_def_id: DefId)
-> Self
{
pub fn new(
tcx: TyCtxt<'a, 'gcx, 'tcx>,
did: DefId,
ident: Ident,
discr: VariantDiscr,
fields: Vec<FieldDef>,
adt_kind: AdtKind,
ctor_kind: CtorKind,
attribute_def_id: DefId,
recovered: bool,
) -> Self {
debug!("VariantDef::new({:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?})", did, ident, discr,
fields, adt_kind, ctor_kind, attribute_def_id);
let mut flags = VariantFlags::NO_VARIANT_FLAGS;
Expand All @@ -1852,7 +1854,8 @@ impl<'a, 'gcx, 'tcx> VariantDef {
discr,
fields,
ctor_kind,
flags
flags,
recovered,
}
}

Expand All @@ -1868,7 +1871,8 @@ impl_stable_hash_for!(struct VariantDef {
discr,
fields,
ctor_kind,
flags
flags,
recovered
});

#[derive(Copy, Clone, Debug, PartialEq, Eq, RustcEncodable, RustcDecodable, HashStable)]
Expand Down
12 changes: 11 additions & 1 deletion src/librustc_driver/pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -633,10 +633,20 @@ fn print_flowgraph<'a, 'tcx, W: Write>(variants: Vec<borrowck_dot::Variant>,
let body = tcx.hir().body(body_id);
let cfg = cfg::CFG::new(tcx, &body);
let labelled_edges = mode != PpFlowGraphMode::UnlabelledEdges;
let hir_id = code.id();
// We have to disassemble the hir_id because name must be ASCII
// alphanumeric. This does not appear in the rendered graph, so it does not
// have to be user friendly.
let name = format!(
"hir_id_{}_{}_{}",
hir_id.owner.address_space().index(),
hir_id.owner.as_array_index(),
hir_id.local_id.index(),
);
let lcfg = LabelledCFG {
tcx,
cfg: &cfg,
name: format!("node_{}", code.id()),
name,
labelled_edges,
};

Expand Down
4 changes: 2 additions & 2 deletions src/librustc_incremental/persist/dirty_clean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -576,8 +576,8 @@ fn expect_associated_value(tcx: TyCtxt<'_, '_, '_>, item: &NestedMetaItem) -> as
if let Some(value) = item.value_str() {
value
} else {
let msg = if let Some(name) = item.ident_str() {
format!("associated value expected for `{}`", name)
let msg = if let Some(ident) = item.ident() {
format!("associated value expected for `{}`", ident)
} else {
"expected an associated value".to_string()
};
Expand Down
3 changes: 2 additions & 1 deletion src/librustc_lint/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -759,8 +759,9 @@ impl LintPass for DeprecatedAttr {

impl EarlyLintPass for DeprecatedAttr {
fn check_attribute(&mut self, cx: &EarlyContext<'_>, attr: &ast::Attribute) {
let name = attr.name_or_empty();
for &&(n, _, _, ref g) in &self.depr_attrs {
if attr.ident_str() == Some(n) {
if name == n {
if let &AttributeGate::Gated(Stability::Deprecated(link, suggestion),
ref name,
ref reason,
Expand Down
Loading