Auto merge of #57405 - pietroalbini:rollup, r=pietroalbini

Rollup of 6 pull requests

Successful merges:

 - #57290 (remove outdated comment)
 - #57308 (Make CompileController thread-safe)
 - #57358 (use utf-8 throughout htmldocck)
 - #57369 (Provide the option to use libc++ even on all platforms)
 - #57375 (Add duration constants)
 - #57403 (Make extern ref HTTPS)

Failed merges:

 - #57370 (Support passing cflags/cxxflags/ldflags to LLVM build)

r? @ghost
This commit is contained in:
bors 2019-01-07 17:01:25 +00:00
commit 59e70f2775
14 changed files with 72 additions and 26 deletions

View file

@ -35,6 +35,6 @@ And if someone takes issue with something you said or did, resist the urge to be
The enforcement policies listed above apply to all official Rust venues; including official IRC channels (#rust, #rust-internals, #rust-tools, #rust-libs, #rustc, #rust-beginners, #rust-docs, #rust-community, #rust-lang, and #cargo); GitHub repositories under rust-lang, rust-lang-nursery, and rust-lang-deprecated; and all forums under rust-lang.org (users.rust-lang.org, internals.rust-lang.org). For other projects adopting the Rust Code of Conduct, please contact the maintainers of those projects for enforcement. If you wish to use this code of conduct for your own project, consider explicitly mentioning your moderation policy or making a copy with your own moderation policy so as to avoid confusion.
*Adapted from the [Node.js Policy on Trolling](http://blog.izs.me/post/30036893703/policy-on-trolling) as well as the [Contributor Covenant v1.3.0](https://www.contributor-covenant.org/version/1/3/0/).*
*Adapted from the [Node.js Policy on Trolling](https://blog.izs.me/2012/08/policy-on-trolling) as well as the [Contributor Covenant v1.3.0](https://www.contributor-covenant.org/version/1/3/0/).*
[mod_team]: https://www.rust-lang.org/team.html#Moderation-team

View file

@ -90,6 +90,12 @@
# with clang-cl, so this is special in that it only compiles LLVM with clang-cl
#clang-cl = '/path/to/clang-cl.exe'
# Use libc++ when building LLVM instead of libstdc++. This is the default on
# platforms already use libc++ as the default C++ library, but this option
# allows you to use libc++ even on platforms when it's not. You need to ensure
# that your host compiler ships with libc++.
#use-libcxx = true
# =============================================================================
# General build configuration options
# =============================================================================

View file

@ -723,6 +723,9 @@ pub fn build_codegen_backend(builder: &Builder,
{
cargo.env("LLVM_LINK_SHARED", "1");
}
if builder.config.llvm_use_libcxx {
cargo.env("LLVM_USE_LIBCXX", "1");
}
}
_ => panic!("unknown backend: {}", backend),
}

View file

@ -82,6 +82,8 @@ pub struct Config {
pub lldb_enabled: bool,
pub llvm_tools_enabled: bool,
pub llvm_use_libcxx: bool,
// rust codegen options
pub rust_optimize: bool,
pub rust_codegen_units: Option<u32>,
@ -252,6 +254,7 @@ struct Llvm {
link_shared: Option<bool>,
version_suffix: Option<String>,
clang_cl: Option<String>,
use_libcxx: Option<bool>,
}
#[derive(Deserialize, Default, Clone)]
@ -513,6 +516,7 @@ impl Config {
config.llvm_link_jobs = llvm.link_jobs;
config.llvm_version_suffix = llvm.version_suffix.clone();
config.llvm_clang_cl = llvm.clang_cl.clone();
set(&mut config.llvm_use_libcxx, llvm.use_libcxx);
}
if let Some(ref rust) = toml.rust {

View file

@ -62,6 +62,7 @@ o("full-tools", None, "enable all tools")
o("lld", "rust.lld", "build lld")
o("lldb", "rust.lldb", "build lldb")
o("missing-tools", "dist.missing-tools", "allow failures when building tools")
o("use-libcxx", "llvm.use_libcxx", "build LLVM with libc++")
# Optimization and debugging options. These may be overridden by the release
# channel, etc.

View file

@ -1,3 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
r"""
htmldocck.py is a custom checker script for Rustdoc HTML outputs.
@ -98,7 +101,10 @@ checks if the given file does not exist, for example.
"""
from __future__ import print_function
from __future__ import absolute_import, print_function, unicode_literals
import codecs
import io
import sys
import os.path
import re
@ -110,14 +116,10 @@ except ImportError:
from HTMLParser import HTMLParser
from xml.etree import cElementTree as ET
# &larrb;/&rarrb; are not in HTML 4 but are in HTML 5
try:
from html.entities import entitydefs
from html.entities import name2codepoint
except ImportError:
from htmlentitydefs import entitydefs
entitydefs['larrb'] = u'\u21e4'
entitydefs['rarrb'] = u'\u21e5'
entitydefs['nbsp'] = ' '
from htmlentitydefs import name2codepoint
# "void elements" (no closing tag) from the HTML Standard section 12.1.2
VOID_ELEMENTS = set(['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'keygen',
@ -157,11 +159,11 @@ class CustomHTMLParser(HTMLParser):
self.__builder.data(data)
def handle_entityref(self, name):
self.__builder.data(entitydefs[name])
self.__builder.data(unichr(name2codepoint[name]))
def handle_charref(self, name):
code = int(name[1:], 16) if name.startswith(('x', 'X')) else int(name, 10)
self.__builder.data(unichr(code).encode('utf-8'))
self.__builder.data(unichr(code))
def close(self):
HTMLParser.close(self)
@ -210,11 +212,11 @@ LINE_PATTERN = re.compile(r'''
(?<=(?<!\S)@)(?P<negated>!?)
(?P<cmd>[A-Za-z]+(?:-[A-Za-z]+)*)
(?P<args>.*)$
''', re.X)
''', re.X | re.UNICODE)
def get_commands(template):
with open(template, 'rU') as f:
with io.open(template, encoding='utf-8') as f:
for lineno, line in concat_multi_lines(f):
m = LINE_PATTERN.search(line)
if not m:
@ -226,7 +228,10 @@ def get_commands(template):
if args and not args[:1].isspace():
print_err(lineno, line, 'Invalid template syntax')
continue
args = shlex.split(args)
try:
args = shlex.split(args)
except UnicodeEncodeError:
args = [arg.decode('utf-8') for arg in shlex.split(args.encode('utf-8'))]
yield Command(negated=negated, cmd=cmd, args=args, lineno=lineno+1, context=line)
@ -280,7 +285,7 @@ class CachedFiles(object):
if not(os.path.exists(abspath) and os.path.isfile(abspath)):
raise FailedCheck('File does not exist {!r}'.format(path))
with open(abspath) as f:
with io.open(abspath, encoding='utf-8') as f:
data = f.read()
self.files[path] = data
return data
@ -294,9 +299,9 @@ class CachedFiles(object):
if not(os.path.exists(abspath) and os.path.isfile(abspath)):
raise FailedCheck('File does not exist {!r}'.format(path))
with open(abspath) as f:
with io.open(abspath, encoding='utf-8') as f:
try:
tree = ET.parse(f, CustomHTMLParser())
tree = ET.fromstringlist(f.readlines(), CustomHTMLParser())
except Exception as e:
raise RuntimeError('Cannot parse an HTML file {!r}: {}'.format(path, e))
self.trees[path] = tree
@ -313,7 +318,7 @@ def check_string(data, pat, regexp):
if not pat:
return True # special case a presence testing
elif regexp:
return re.search(pat, data) is not None
return re.search(pat, data, flags=re.UNICODE) is not None
else:
data = ' '.join(data.split())
pat = ' '.join(pat.split())
@ -350,7 +355,7 @@ def check_tree_text(tree, path, pat, regexp):
break
except Exception as e:
print('Failed to get path "{}"'.format(path))
raise e
raise
return ret
@ -359,7 +364,12 @@ def get_tree_count(tree, path):
return len(tree.findall(path))
def stderr(*args):
print(*args, file=sys.stderr)
if sys.version_info.major < 3:
file = codecs.getwriter('utf-8')(sys.stderr)
else:
file = sys.stderr
print(*args, file=file)
def print_err(lineno, context, err, message=None):
global ERR_COUNT

View file

@ -23,6 +23,22 @@ const MILLIS_PER_SEC: u64 = 1_000;
const MICROS_PER_SEC: u64 = 1_000_000;
const MAX_NANOS_F64: f64 = ((u64::MAX as u128 + 1)*(NANOS_PER_SEC as u128)) as f64;
/// The duration of one second.
#[unstable(feature = "duration_constants", issue = "57391")]
pub const SECOND: Duration = Duration::from_secs(1);
/// The duration of one millisecond.
#[unstable(feature = "duration_constants", issue = "57391")]
pub const MILLISECOND: Duration = Duration::from_millis(1);
/// The duration of one microsecond.
#[unstable(feature = "duration_constants", issue = "57391")]
pub const MICROSECOND: Duration = Duration::from_micros(1);
/// The duration of one nanosecond.
#[unstable(feature = "duration_constants", issue = "57391")]
pub const NANOSECOND: Duration = Duration::from_nanos(1);
/// A `Duration` type to represent a span of time, typically used for system
/// timeouts.
///

View file

@ -2930,9 +2930,6 @@ impl<T, R, E> InternIteratorElement<T, R> for Result<T, E> {
}
pub fn provide(providers: &mut ty::query::Providers<'_>) {
// FIXME(#44234): almost all of these queries have no sub-queries and
// therefore no actual inputs, they're just reading tables calculated in
// resolve! Does this work? Unsure! That's what the issue is about.
providers.in_scope_traits_map = |tcx, id| tcx.gcx.trait_map.get(&id).cloned();
providers.module_exports = |tcx, id| tcx.gcx.export_map.get(&id).cloned();
providers.crate_name = |tcx, id| {

View file

@ -323,6 +323,7 @@ cfg_if! {
}
pub fn assert_sync<T: ?Sized + Sync>() {}
pub fn assert_send<T: ?Sized + Send>() {}
pub fn assert_send_val<T: ?Sized + Send>(_t: &T) {}
pub fn assert_send_sync_val<T: ?Sized + Sync + Send>(_t: &T) {}

View file

@ -402,14 +402,15 @@ pub struct CompileController<'a> {
/// Allows overriding default rustc query providers,
/// after `default_provide` has installed them.
pub provide: Box<dyn Fn(&mut ty::query::Providers) + 'a>,
pub provide: Box<dyn Fn(&mut ty::query::Providers) + 'a + sync::Send>,
/// Same as `provide`, but only for non-local crates,
/// applied after `default_provide_extern`.
pub provide_extern: Box<dyn Fn(&mut ty::query::Providers) + 'a>,
pub provide_extern: Box<dyn Fn(&mut ty::query::Providers) + 'a + sync::Send>,
}
impl<'a> CompileController<'a> {
pub fn basic() -> CompileController<'a> {
sync::assert_send::<Self>();
CompileController {
after_parse: PhaseController::basic(),
after_expand: PhaseController::basic(),
@ -499,7 +500,7 @@ pub struct PhaseController<'a> {
// If true then the compiler will try to run the callback even if the phase
// ends with an error. Note that this is not always possible.
pub run_callback_on_error: bool,
pub callback: Box<dyn Fn(&mut CompileState) + 'a>,
pub callback: Box<dyn Fn(&mut CompileState) + 'a + sync::Send>,
}
impl<'a> PhaseController<'a> {

View file

@ -236,6 +236,7 @@ fn main() {
}
let llvm_static_stdcpp = env::var_os("LLVM_STATIC_STDCPP");
let llvm_use_libcxx = env::var_os("LLVM_USE_LIBCXX");
let stdcppname = if target.contains("openbsd") {
// llvm-config on OpenBSD doesn't mention stdlib=libc++
@ -245,6 +246,8 @@ fn main() {
} else if target.contains("netbsd") && llvm_static_stdcpp.is_some() {
// NetBSD uses a separate library when relocation is required
"stdc++_pic"
} else if llvm_use_libcxx.is_some() {
"c++"
} else {
"stdc++"
};

View file

@ -248,6 +248,7 @@
#![feature(const_cstr_unchecked)]
#![feature(core_intrinsics)]
#![feature(dropck_eyepatch)]
#![feature(duration_constants)]
#![feature(exact_size_is_empty)]
#![feature(external_doc)]
#![feature(fixed_size_array)]

View file

@ -21,6 +21,9 @@ use sys_common::FromInner;
#[stable(feature = "time", since = "1.3.0")]
pub use core::time::Duration;
#[unstable(feature = "duration_constants", issue = "57391")]
pub use core::time::{SECOND, MILLISECOND, MICROSECOND, NANOSECOND};
/// A measurement of a monotonically nondecreasing clock.
/// Opaque and useful only with `Duration`.
///

View file

@ -10,7 +10,7 @@
// 'Deprecated since 1.0.0: text'
// @has - '<code>test</code>&nbsp;<a href="http://issue_url/32374">#32374</a>'
// @matches issue_32374/struct.T.html '//*[@class="stab unstable"]' \
// '🔬 This is a nightly-only experimental API. \(test #32374\)$'
// '🔬 This is a nightly-only experimental API. \(test\s#32374\)$'
/// Docs
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[unstable(feature = "test", issue = "32374")]