Skip to content

Rollup of 9 pull requests #50290

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

Merged
merged 30 commits into from
Apr 27, 2018
Merged
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
f817d19
std: Mark `ptr::Unique` with `#[doc(hidden)]`
Apr 10, 2018
54d6bcb
alloc: Mark `Box::into_unique` with `#[doc(hidden)]`
Apr 11, 2018
d2dc21d
Add documentation for SyntaxContext::remove_mark
sapphire-arches Apr 21, 2018
263b36b
Implement parent() on `syntax_pos::Span`
sapphire-arches Apr 21, 2018
498dbe4
Implement a least upper bound for marks.
sapphire-arches Apr 21, 2018
a2a9cc6
rustc: Disable threads in LLD for wasm
alexcrichton Apr 26, 2018
d92d193
Don't ICE on tuple struct ctor with incorrect arg count
estebank Apr 26, 2018
73e0c1e
Fix review nits
sapphire-arches Apr 26, 2018
20ad427
rustc: Emit `uwtable` for allocator shims
alexcrichton Apr 27, 2018
3565556
Update `parking_lot` dependencies
alexcrichton Apr 27, 2018
5f2c111
Allow #[inline] on closures
Amanieu Apr 27, 2018
199ee32
stop requiring the feature-gate to use dyn_trait
pvdrz Apr 12, 2018
c86f1c8
removed dyn_trait feature from tests
pvdrz Apr 12, 2018
0efb567
dyn_trait feature-gate just for stage0
pvdrz Apr 12, 2018
55a653d
removed linting for dyn_trait
pvdrz Apr 13, 2018
4bf35f9
updated stderr files and removed feature-gate test for dyn_trait
pvdrz Apr 14, 2018
72a8eb9
fixed rustc version for dyn_trait
pvdrz Apr 15, 2018
cadf251
removed dyn trait attribute from librustdoc
pvdrz Apr 18, 2018
74412d2
fix search load page failure
GuillaumeGomez Apr 27, 2018
b80472d
fixed tests
pvdrz Apr 25, 2018
b5c7cbf
rustdoc asks for dyn_trait feature in stage0
pvdrz Apr 25, 2018
a18e7a6
Rollup merge of #49858 - dmizuk:unique-doc-hidden, r=steveklabnik
kennytm Apr 27, 2018
8b36d9a
Rollup merge of #49968 - christianpoveda:stabilize_dyn, r=nikomatsakis
kennytm Apr 27, 2018
4a961d1
Rollup merge of #50192 - bobtwinkles:libsyntax_extensions, r=jseyfried
kennytm Apr 27, 2018
1c1fd27
Rollup merge of #50251 - alexcrichton:wasm-no-threads, r=eddyb
kennytm Apr 27, 2018
0da4bde
Rollup merge of #50263 - alexcrichton:uwtable-allcoators, r=eddyb
kennytm Apr 27, 2018
28762ed
Rollup merge of #50269 - alexcrichton:update-parking-lot, r=Mark-Simu…
kennytm Apr 27, 2018
3f84ce2
Rollup merge of #50273 - Amanieu:issue-49532, r=alexcrichton
kennytm Apr 27, 2018
e598394
Rollup merge of #50284 - GuillaumeGomez:search-load-failure, r=SimonS…
kennytm Apr 27, 2018
dc6b167
Rollup merge of #50257 - estebank:fix-49560, r=nikomatsakis
kennytm Apr 27, 2018
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
18 changes: 9 additions & 9 deletions src/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/liballoc/boxed.rs
Original file line number Diff line number Diff line change
@@ -184,6 +184,7 @@ impl<T: ?Sized> Box<T> {

#[unstable(feature = "ptr_internals", issue = "0", reason = "use into_raw_non_null instead")]
#[inline]
#[doc(hidden)]
pub fn into_unique(b: Box<T>) -> Unique<T> {
let unique = b.0;
mem::forget(b);
1 change: 1 addition & 0 deletions src/libcore/ptr.rs
Original file line number Diff line number Diff line change
@@ -2513,6 +2513,7 @@ impl<T: ?Sized> PartialOrd for *mut T {
reason = "use NonNull instead and consider PhantomData<T> \
(if you also use #[may_dangle]), Send, and/or Sync")]
#[allow(deprecated)]
#[doc(hidden)]
pub struct Unique<T: ?Sized> {
pointer: NonZero<*const T>,
// NOTE: this marker has no consequences for variance, but is necessary
2 changes: 1 addition & 1 deletion src/libproc_macro/lib.rs
Original file line number Diff line number Diff line change
@@ -270,7 +270,7 @@ impl Span {
/// `self` was generated from, if any.
#[unstable(feature = "proc_macro", issue = "38356")]
pub fn parent(&self) -> Option<Span> {
self.0.ctxt().outer().expn_info().map(|i| Span(i.call_site))
self.0.parent().map(Span)
}

/// The span for the origin source code that `self` was generated from. If
15 changes: 10 additions & 5 deletions src/librustc/hir/check_attr.rs
Original file line number Diff line number Diff line change
@@ -30,6 +30,7 @@ enum Target {
ForeignMod,
Expression,
Statement,
Closure,
Other,
}

@@ -103,14 +104,14 @@ impl<'a, 'tcx> CheckAttrVisitor<'a, 'tcx> {
self.check_repr(item, target);
}

/// Check if an `#[inline]` is applied to a function.
/// Check if an `#[inline]` is applied to a function or a closure.
fn check_inline(&self, attr: &hir::Attribute, span: &Span, target: Target) {
if target != Target::Fn {
if target != Target::Fn && target != Target::Closure {
struct_span_err!(self.tcx.sess,
attr.span,
E0518,
"attribute should be applied to function")
.span_label(*span, "not a function")
"attribute should be applied to function or closure")
.span_label(*span, "not a function or closure")
.emit();
}
}
@@ -286,9 +287,13 @@ impl<'a, 'tcx> CheckAttrVisitor<'a, 'tcx> {
}

fn check_expr_attributes(&self, expr: &hir::Expr) {
let target = match expr.node {
hir::ExprClosure(..) => Target::Closure,
_ => Target::Expression,
};
for attr in expr.attrs.iter() {
if attr.check_name("inline") {
self.check_inline(attr, &expr.span, Target::Expression);
self.check_inline(attr, &expr.span, target);
}
if attr.check_name("repr") {
self.emit_repr_error(
16 changes: 7 additions & 9 deletions src/librustc/hir/lowering.rs
Original file line number Diff line number Diff line change
@@ -4107,15 +4107,13 @@ impl<'a> LoweringContext<'a> {
}

fn maybe_lint_bare_trait(&self, span: Span, id: NodeId, is_global: bool) {
if self.sess.features_untracked().dyn_trait {
self.sess.buffer_lint_with_diagnostic(
builtin::BARE_TRAIT_OBJECT,
id,
span,
"trait objects without an explicit `dyn` are deprecated",
builtin::BuiltinLintDiagnostics::BareTraitObject(span, is_global),
)
}
self.sess.buffer_lint_with_diagnostic(
builtin::BARE_TRAIT_OBJECT,
id,
span,
"trait objects without an explicit `dyn` are deprecated",
builtin::BuiltinLintDiagnostics::BareTraitObject(span, is_global),
)
}

fn wrap_in_try_constructor(
2 changes: 1 addition & 1 deletion src/librustc/lib.rs
Original file line number Diff line number Diff line change
@@ -45,8 +45,8 @@
#![feature(const_fn)]
#![feature(core_intrinsics)]
#![feature(drain_filter)]
#![feature(dyn_trait)]
#![feature(entry_or_default)]
#![cfg_attr(stage0, feature(dyn_trait))]
#![feature(from_ref)]
#![feature(fs_read_write)]
#![cfg_attr(windows, feature(libc))]
6 changes: 6 additions & 0 deletions src/librustc/traits/error_reporting.rs
Original file line number Diff line number Diff line change
@@ -979,6 +979,12 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
ArgKind::Arg(format!("{}", field.name), "_".to_string())
}).collect::<Vec<_>>())
}
hir::map::NodeStructCtor(ref variant_data) => {
(self.tcx.sess.codemap().def_span(self.tcx.hir.span(variant_data.id())),
variant_data.fields()
.iter().map(|_| ArgKind::Arg("_".to_owned(), "_".to_owned()))
.collect())
}
_ => panic!("non-FnLike node found: {:?}", node),
}
}
2 changes: 1 addition & 1 deletion src/librustc_mir/lib.rs
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@ Rust MIR: a lowered representation of Rust. Also: an experiment!
#![feature(const_fn)]
#![feature(core_intrinsics)]
#![feature(decl_macro)]
#![feature(dyn_trait)]
#![cfg_attr(stage0, feature(dyn_trait))]
#![feature(fs_read_write)]
#![feature(macro_vis_matcher)]
#![feature(exhaustive_patterns)]
4 changes: 4 additions & 0 deletions src/librustc_trans/allocator.rs
Original file line number Diff line number Diff line change
@@ -11,6 +11,7 @@
use std::ffi::CString;
use std::ptr;

use attributes;
use libc::c_uint;
use rustc::middle::allocator::AllocatorKind;
use rustc::ty::TyCtxt;
@@ -67,6 +68,9 @@ pub(crate) unsafe fn trans(tcx: TyCtxt, mods: &ModuleLlvm, kind: AllocatorKind)
if tcx.sess.target.target.options.default_hidden_visibility {
llvm::LLVMRustSetVisibility(llfn, llvm::Visibility::Hidden);
}
if tcx.sess.target.target.options.requires_uwtable {
attributes::emit_uwtable(llfn, true);
}

let callee = CString::new(kind.fn_name(method.name)).unwrap();
let callee = llvm::LLVMRustGetOrInsertFunction(llmod,
6 changes: 5 additions & 1 deletion src/librustc_trans/back/linker.rs
Original file line number Diff line number Diff line change
@@ -959,7 +959,11 @@ impl Linker for WasmLd {
}

fn finalize(&mut self) -> Command {
self.cmd.arg("--threads");
// There have been reports in the wild (rustwasm/wasm-bindgen#119) of
// using threads causing weird hangs and bugs. Disable it entirely as
// this isn't yet the bottleneck of compilation at all anyway.
self.cmd.arg("--no-threads");

self.cmd.arg("-z").arg("stack-size=1048576");

// FIXME we probably shouldn't pass this but instead pass an explicit
3 changes: 2 additions & 1 deletion src/librustc_typeck/lib.rs
Original file line number Diff line number Diff line change
@@ -71,6 +71,8 @@ This API is completely unstable and subject to change.

#![allow(non_camel_case_types)]

#![cfg_attr(stage0, feature(dyn_trait))]

#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(crate_visibility_modifier)]
@@ -81,7 +83,6 @@ This API is completely unstable and subject to change.
#![feature(rustc_diagnostic_macros)]
#![feature(slice_patterns)]
#![feature(slice_sort_by_cached_key)]
#![feature(dyn_trait)]
#![feature(never_type)]

#[macro_use] extern crate log;
2 changes: 1 addition & 1 deletion src/librustdoc/html/layout.rs
Original file line number Diff line number Diff line change
@@ -146,9 +146,9 @@ pub fn render<T: fmt::Display, S: fmt::Display>(
window.rootPath = \"{root_path}\";\
window.currentCrate = \"{krate}\";\
</script>\
<script src=\"{root_path}aliases.js\"></script>\
<script src=\"{root_path}main{suffix}.js\"></script>\
<script defer src=\"{root_path}search-index.js\"></script>\
<script defer src=\"{root_path}aliases.js\"></script>\
</body>\
</html>",
css_extension = if css_file_extension {
3 changes: 2 additions & 1 deletion src/librustdoc/lib.rs
Original file line number Diff line number Diff line change
@@ -13,6 +13,8 @@
html_root_url = "https://doc.rust-lang.org/nightly/",
html_playground_url = "https://play.rust-lang.org/")]

#![cfg_attr(stage0, feature(dyn_trait))]

#![feature(ascii_ctype)]
#![feature(rustc_private)]
#![feature(box_patterns)]
@@ -23,7 +25,6 @@
#![feature(test)]
#![feature(vec_remove_item)]
#![feature(entry_and_modify)]
#![feature(dyn_trait)]

extern crate arena;
extern crate getopts;
9 changes: 2 additions & 7 deletions src/libsyntax/feature_gate.rs
Original file line number Diff line number Diff line change
@@ -375,9 +375,6 @@ declare_features! (
// Future-proofing enums/structs with #[non_exhaustive] attribute (RFC 2008)
(active, non_exhaustive, "1.22.0", Some(44109), None),

// Trait object syntax with `dyn` prefix
(active, dyn_trait, "1.22.0", Some(44662), Some(Edition::Edition2018)),

// `crate` as visibility modifier, synonymous to `pub(crate)`
(active, crate_visibility_modifier, "1.23.0", Some(45388), Some(Edition::Edition2018)),

@@ -592,6 +589,8 @@ declare_features! (
(accepted, cfg_target_feature, "1.27.0", Some(29717), None),
// Allows #[target_feature(...)]
(accepted, target_feature, "1.27.0", None, None),
// Trait object syntax with `dyn` prefix
(accepted, dyn_trait, "1.27.0", Some(44662), None),
);

// If you change this, please modify src/doc/unstable-book as well. You must
@@ -1657,10 +1656,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
gate_feature_post!(&self, never_type, ty.span,
"The `!` type is experimental");
}
ast::TyKind::TraitObject(_, ast::TraitObjectSyntax::Dyn) => {
gate_feature_post!(&self, dyn_trait, ty.span,
"`dyn Trait` syntax is unstable");
}
_ => {}
}
visit::walk_ty(self, ty)
43 changes: 43 additions & 0 deletions src/libsyntax_pos/hygiene.rs
Original file line number Diff line number Diff line change
@@ -21,6 +21,7 @@ use symbol::{Ident, Symbol};

use serialize::{Encodable, Decodable, Encoder, Decoder};
use std::collections::HashMap;
use rustc_data_structures::fx::FxHashSet;
use std::fmt;

/// A SyntaxContext represents a chain of macro expansions (represented by marks).
@@ -117,6 +118,32 @@ impl Mark {
true
})
}

/// Computes a mark such that both input marks are descendants of (or equal to) the returned
/// mark. That is, the following holds:
///
/// ```rust
/// let la = least_ancestor(a, b);
/// assert!(a.is_descendant_of(la))
/// assert!(b.is_descendant_of(la))
/// ```
pub fn least_ancestor(mut a: Mark, mut b: Mark) -> Mark {
HygieneData::with(|data| {
// Compute the path from a to the root
let mut a_path = FxHashSet::<Mark>();
while a != Mark::root() {
a_path.insert(a);
a = data.marks[a.0 as usize].parent;
}

// While the path from b to the root hasn't intersected, move up the tree
while !a_path.contains(&b) {
b = data.marks[b.0 as usize].parent;
}

b
})
}
}

pub struct HygieneData {
@@ -238,6 +265,22 @@ impl SyntaxContext {
})
}

/// Pulls a single mark off of the syntax context. This effectively moves the
/// context up one macro definition level. That is, if we have a nested macro
/// definition as follows:
///
/// ```rust
/// macro_rules! f {
/// macro_rules! g {
/// ...
/// }
/// }
/// ```
///
/// and we have a SyntaxContext that is referring to something declared by an invocation
/// of g (call it g1), calling remove_mark will result in the SyntaxContext for the
/// invocation of f that created g1.
/// Returns the mark that was removed.
pub fn remove_mark(&mut self) -> Mark {
HygieneData::with(|data| {
let outer_mark = data.syntax_contexts[self.0 as usize].outer_mark;
6 changes: 6 additions & 0 deletions src/libsyntax_pos/lib.rs
Original file line number Diff line number Diff line change
@@ -291,6 +291,12 @@ impl Span {
self.ctxt().outer().expn_info().map(|info| info.call_site.source_callsite()).unwrap_or(self)
}

/// The `Span` for the tokens in the previous macro expansion from which `self` was generated,
/// if any
pub fn parent(self) -> Option<Span> {
self.ctxt().outer().expn_info().map(|i| i.call_site)
}

/// Return the source callee.
///
/// Returns None if the supplied span has no expansion trace,
2 changes: 1 addition & 1 deletion src/test/compile-fail/attr-usage-inline.rs
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@
#[inline]
fn f() {}

#[inline] //~ ERROR: attribute should be applied to function
#[inline] //~ ERROR: attribute should be applied to function or closure
struct S;

fn main() {}
1 change: 0 additions & 1 deletion src/test/compile-fail/impl-trait/where-allowed.rs
Original file line number Diff line number Diff line change
@@ -10,7 +10,6 @@

//! A simple test for testing many permutations of allowedness of
//! impl Trait
#![feature(dyn_trait)]
use std::fmt::Debug;

// Allowed
2 changes: 1 addition & 1 deletion src/test/compile-fail/issue-31769.rs
Original file line number Diff line number Diff line change
@@ -9,6 +9,6 @@
// except according to those terms.

fn main() {
#[inline] struct Foo; //~ ERROR attribute should be applied to function
#[inline] struct Foo; //~ ERROR attribute should be applied to function or closure
#[repr(C)] fn foo() {} //~ ERROR attribute should be applied to struct, enum or union
}
Loading