Auto merge of #77462 - jonas-schievink:rollup-m0rqdh5, r=jonas-schievink

Rollup of 12 pull requests

Successful merges:

 - #76101 (Update RELEASES.md for 1.47.0)
 - #76739 (resolve: prohibit anon const non-static lifetimes)
 - #76811 (Doc alias name restriction)
 - #77405 (Add tracking issue of iter_advance_by feature)
 - #77409 (Add example for iter chain struct)
 - #77415 (Better error message for `async` blocks in a const-context)
 - #77423 (Add `-Zprecise-enum-drop-elaboration`)
 - #77432 (Use posix_spawn on musl targets)
 - #77441 (Fix AVR stack corruption bug)
 - #77442 (Clean up on example doc fixes for ptr::copy)
 - #77444 (Fix span for incorrect pattern field and add label)
 - #77453 (Stop running macOS builds on Azure Pipelines)

Failed merges:

r? `@ghost`
This commit is contained in:
bors 2020-10-02 19:42:07 +00:00
commit 8876ffc923
32 changed files with 409 additions and 212 deletions

View File

@ -1,3 +1,138 @@
Version 1.47.0 (2020-10-08)
==========================
Language
--------
- [Closures will now warn when not used.][74869]
Compiler
--------
- [Stabilized the `-C control-flow-guard` codegen option][73893], which enables
[Control Flow Guard][1.47.0-cfg] for Windows platforms, and is ignored on other
platforms.
- [Upgraded to LLVM 11.][73526]
- [Added tier 3\* support for the `thumbv4t-none-eabi` target.][74419]
- [Upgrade the FreeBSD toolchain to version 11.4][75204]
- [`RUST_BACKTRACE`'s output is now more compact.][75048]
\* Refer to Rust's [platform support page][forge-platform-support] for more
information on Rust's tiered platform support.
Libraries
---------
- [`CStr` now implements `Index<RangeFrom<usize>>`.][74021]
- [Traits in `std`/`core` are now implemented for arrays of any length, not just
those of length less than 33.][74060]
- [`ops::RangeFull` and `ops::Range` now implement Default.][73197]
- [`panic::Location` now implements `Copy`, `Clone`, `Eq`, `Hash`, `Ord`,
`PartialEq`, and `PartialOrd`.][73583]
Stabilized APIs
---------------
- [`Ident::new_raw`]
- [`Range::is_empty`]
- [`RangeInclusive::is_empty`]
- [`Result::as_deref`]
- [`Result::as_deref_mut`]
- [`Vec::leak`]
- [`pointer::offset_from`]
- [`f32::TAU`]
- [`f64::TAU`]
The following previously stable APIs have now been made const.
- [The `new` method for all `NonZero` integers.][73858]
- [The `checked_add`,`checked_sub`,`checked_mul`,`checked_neg`, `checked_shl`,
`checked_shr`, `saturating_add`, `saturating_sub`, and `saturating_mul`
methods for all integers.][73858]
- [The `checked_abs`, `saturating_abs`, `saturating_neg`, and `signum` for all
signed integers.][73858]
- [The `is_ascii_alphabetic`, `is_ascii_uppercase`, `is_ascii_lowercase`,
`is_ascii_alphanumeric`, `is_ascii_digit`, `is_ascii_hexdigit`,
`is_ascii_punctuation`, `is_ascii_graphic`, `is_ascii_whitespace`, and
`is_ascii_control` methods for `char` and `u8`.][73858]
Cargo
-----
- [`build-dependencies` are now built with opt-level 0 by default.][cargo/8500]
You can override this by setting the following in your `Cargo.toml`.
```toml
[profile.release.build-override]
opt-level = 3
```
- [`cargo-help` will now display man pages for commands rather just the
`--help` text.][cargo/8456]
- [`cargo-metadata` now emits a `test` field indicating if a target has
tests enabled.][cargo/8478]
- [`workspace.default-members` now respects `workspace.exclude`.][cargo/8485]
- [`cargo-publish` will now use an alternative registry by default if it's the
only registry specified in `package.publish`.][cargo/8571]
Misc
----
- [Added a help button beside Rustdoc's searchbar that explains rustdoc's
type based search.][75366]
- [Added the Ayu theme to rustdoc.][71237]
Compatibility Notes
-------------------
- [Bumped the minimum supported Emscripten version to 1.39.20.][75716]
- [Fixed a regression parsing `{} && false` in tail expressions.][74650]
- [Added changes to how proc-macros are expanded in `macro_rules!` that should
help to preserve more span information.][73084] These changes may cause
compiliation errors if your macro was unhygenic or didn't correctly handle
`Delimiter::None`.
- [Moved support for the CloudABI target to tier 3.][75568]
- [`linux-gnu` targets now require minimum kernel 2.6.32 and glibc 2.11.][74163]
- [Added the `rustc-docs` component.][75560] This allows you to install
and read the documentation for the compiler internal APIs. (Currently only
available for `x86_64-unknown-linux-gnu`.)
Internal Only
--------
- [Improved default settings for bootstrapping in `x.py`.][73964] You can read details about this change in the ["Changes To `x.py` Defaults"](https://blog.rust-lang.org/inside-rust/2020/08/30/changes-to-x-py-defaults.html) post on the Inside Rust blog.
[1.47.0-cfg]: https://docs.microsoft.com/en-us/windows/win32/secbp/control-flow-guard
[75048]: https://github.com/rust-lang/rust/pull/75048/
[74163]: https://github.com/rust-lang/rust/pull/74163/
[71237]: https://github.com/rust-lang/rust/pull/71237/
[74869]: https://github.com/rust-lang/rust/pull/74869/
[73858]: https://github.com/rust-lang/rust/pull/73858/
[75716]: https://github.com/rust-lang/rust/pull/75716/
[75908]: https://github.com/rust-lang/rust/pull/75908/
[75516]: https://github.com/rust-lang/rust/pull/75516/
[75560]: https://github.com/rust-lang/rust/pull/75560/
[75568]: https://github.com/rust-lang/rust/pull/75568/
[75366]: https://github.com/rust-lang/rust/pull/75366/
[75204]: https://github.com/rust-lang/rust/pull/75204/
[74650]: https://github.com/rust-lang/rust/pull/74650/
[74419]: https://github.com/rust-lang/rust/pull/74419/
[73964]: https://github.com/rust-lang/rust/pull/73964/
[74021]: https://github.com/rust-lang/rust/pull/74021/
[74060]: https://github.com/rust-lang/rust/pull/74060/
[73893]: https://github.com/rust-lang/rust/pull/73893/
[73526]: https://github.com/rust-lang/rust/pull/73526/
[73583]: https://github.com/rust-lang/rust/pull/73583/
[73084]: https://github.com/rust-lang/rust/pull/73084/
[73197]: https://github.com/rust-lang/rust/pull/73197/
[72488]: https://github.com/rust-lang/rust/pull/72488/
[cargo/8456]: https://github.com/rust-lang/cargo/pull/8456/
[cargo/8478]: https://github.com/rust-lang/cargo/pull/8478/
[cargo/8485]: https://github.com/rust-lang/cargo/pull/8485/
[cargo/8500]: https://github.com/rust-lang/cargo/pull/8500/
[cargo/8571]: https://github.com/rust-lang/cargo/pull/8571/
[`Ident::new_raw`]: https://doc.rust-lang.org/nightly/proc_macro/struct.Ident.html#method.new_raw
[`Range::is_empty`]: https://doc.rust-lang.org/nightly/std/ops/struct.Range.html#method.is_empty
[`RangeInclusive::is_empty`]: https://doc.rust-lang.org/nightly/std/ops/struct.RangeInclusive.html#method.is_empty
[`Result::as_deref_mut`]: https://doc.rust-lang.org/nightly/std/result/enum.Result.html#method.as_deref_mut
[`Result::as_deref`]: https://doc.rust-lang.org/nightly/std/result/enum.Result.html#method.as_deref
[`TypeId::of`]: https://doc.rust-lang.org/nightly/std/any/struct.TypeId.html#method.of
[`Vec::leak`]: https://doc.rust-lang.org/nightly/std/vec/struct.Vec.html#method.leak
[`f32::TAU`]: https://doc.rust-lang.org/nightly/std/f32/consts/constant.TAU.html
[`f64::TAU`]: https://doc.rust-lang.org/nightly/std/f64/consts/constant.TAU.html
[`pointer::offset_from`]: https://doc.rust-lang.org/nightly/std/primitive.pointer.html#method.offset_from
Version 1.46.0 (2020-08-27)
==========================

View File

@ -568,6 +568,7 @@ fn test_debugging_options_tracking_hash() {
tracked!(osx_rpath_install_name, true);
tracked!(panic_abort_tests, true);
tracked!(plt, Some(true));
tracked!(precise_enum_drop_elaboration, false);
tracked!(print_fuel, Some("abc".to_string()));
tracked!(profile, true);
tracked!(profile_emit, Some(PathBuf::from("abc")));

View File

@ -358,6 +358,10 @@ impl<'tcx> GenKillAnalysis<'tcx> for MaybeInitializedPlaces<'_, 'tcx> {
discr: &mir::Operand<'tcx>,
edge_effects: &mut impl SwitchIntEdgeEffects<G>,
) {
if !self.tcx.sess.opts.debugging_opts.precise_enum_drop_elaboration {
return;
}
let enum_ = discr.place().and_then(|discr| {
switch_on_enum_discriminant(self.tcx, &self.body, &self.body[block], discr)
});
@ -469,6 +473,10 @@ impl<'tcx> GenKillAnalysis<'tcx> for MaybeUninitializedPlaces<'_, 'tcx> {
discr: &mir::Operand<'tcx>,
edge_effects: &mut impl SwitchIntEdgeEffects<G>,
) {
if !self.tcx.sess.opts.debugging_opts.precise_enum_drop_elaboration {
return;
}
if !self.mark_inactive_variants_as_uninit {
return;
}

View File

@ -151,14 +151,15 @@ impl NonConstOp for FnPtrCast {
}
#[derive(Debug)]
pub struct Generator;
pub struct Generator(pub hir::GeneratorKind);
impl NonConstOp for Generator {
fn status_in_item(&self, _: &ConstCx<'_, '_>) -> Status {
Status::Forbidden
}
fn build_error(&self, ccx: &ConstCx<'_, 'tcx>, span: Span) -> DiagnosticBuilder<'tcx> {
ccx.tcx.sess.struct_span_err(span, "Generators and `async` functions cannot be `const`")
let msg = format!("{}s are not allowed in {}s", self.0, ccx.const_kind());
ccx.tcx.sess.struct_span_err(span, &msg)
}
}

View File

@ -770,6 +770,14 @@ impl Visitor<'tcx> for Validator<'mir, 'tcx> {
return;
}
// `async` blocks get lowered to `std::future::from_generator(/* a closure */)`.
let is_async_block = Some(callee) == tcx.lang_items().from_generator_fn();
if is_async_block {
let kind = hir::GeneratorKind::Async(hir::AsyncGeneratorKind::Block);
self.check_op(ops::Generator(kind));
return;
}
// HACK: This is to "unstabilize" the `transmute` intrinsic
// within const fns. `transmute` is allowed in all other const contexts.
// This won't really scale to more intrinsics or functions. Let's allow const
@ -869,7 +877,7 @@ impl Visitor<'tcx> for Validator<'mir, 'tcx> {
TerminatorKind::Abort => self.check_op(ops::Abort),
TerminatorKind::GeneratorDrop | TerminatorKind::Yield { .. } => {
self.check_op(ops::Generator)
self.check_op(ops::Generator(hir::GeneratorKind::Gen))
}
TerminatorKind::Assert { .. }

View File

@ -795,6 +795,7 @@ impl<'a> Parser<'a> {
}
self.bump();
let (fields, etc) = self.parse_pat_fields().unwrap_or_else(|mut e| {
e.span_label(path.span, "while parsing the fields for this pattern");
e.emit();
self.recover_stmt();
(vec![], true)
@ -844,7 +845,7 @@ impl<'a> Parser<'a> {
// check that a comma comes after every field
if !ate_comma {
let err = self.struct_span_err(self.prev_token.span, "expected `,`");
let err = self.struct_span_err(self.token.span, "expected `,`");
if let Some(mut delayed) = delayed_err {
delayed.emit();
}

View File

@ -260,23 +260,42 @@ impl CheckAttrVisitor<'tcx> {
}
}
fn doc_alias_str_error(&self, meta: &NestedMetaItem) {
self.tcx
.sess
.struct_span_err(
meta.span(),
"doc alias attribute expects a string: #[doc(alias = \"0\")]",
)
.emit();
}
fn check_doc_alias(&self, attr: &Attribute, hir_id: HirId, target: Target) -> bool {
if let Some(mi) = attr.meta() {
if let Some(list) = mi.meta_item_list() {
for meta in list {
if meta.has_name(sym::alias) {
if !meta.is_value_str()
|| meta
.value_str()
.map(|s| s.to_string())
.unwrap_or_else(String::new)
.is_empty()
if !meta.is_value_str() {
self.doc_alias_str_error(meta);
return false;
}
let doc_alias =
meta.value_str().map(|s| s.to_string()).unwrap_or_else(String::new);
if doc_alias.is_empty() {
self.doc_alias_str_error(meta);
return false;
}
if let Some(c) =
doc_alias.chars().find(|&c| c == '"' || c == '\'' || c.is_whitespace())
{
self.tcx
.sess
.struct_span_err(
meta.span(),
"doc alias attribute expects a string: #[doc(alias = \"0\")]",
&format!(
"{:?} character isn't allowed in `#[doc(alias = \"...\")]`",
c,
),
)
.emit();
return false;
@ -312,6 +331,7 @@ impl CheckAttrVisitor<'tcx> {
&format!("`#[doc(alias = \"...\")]` isn't allowed on {}", err),
)
.emit();
return false;
}
}
}

View File

@ -16,6 +16,7 @@ use rustc_hir::def::{self, CtorKind, DefKind};
use rustc_hir::def_id::{DefId, CRATE_DEF_INDEX, LOCAL_CRATE};
use rustc_hir::PrimTy;
use rustc_session::config::nightly_options;
use rustc_session::parse::feature_err;
use rustc_span::hygiene::MacroKind;
use rustc_span::symbol::{kw, sym, Ident, Symbol};
use rustc_span::{BytePos, Span, DUMMY_SP};
@ -1599,4 +1600,32 @@ impl<'tcx> LifetimeContext<'_, 'tcx> {
_ => {}
}
}
/// Non-static lifetimes are prohibited in anonymous constants under `min_const_generics` so
/// this function will emit an error if `min_const_generics` is enabled, the body identified by
/// `body_id` is an anonymous constant and `lifetime_ref` is non-static.
crate fn maybe_emit_forbidden_non_static_lifetime_error(
&self,
body_id: hir::BodyId,
lifetime_ref: &'tcx hir::Lifetime,
) {
let is_anon_const = matches!(
self.tcx.def_kind(self.tcx.hir().body_owner_def_id(body_id)),
hir::def::DefKind::AnonConst
);
let is_allowed_lifetime = matches!(
lifetime_ref.name,
hir::LifetimeName::Implicit | hir::LifetimeName::Static | hir::LifetimeName::Underscore
);
if self.tcx.features().min_const_generics && is_anon_const && !is_allowed_lifetime {
feature_err(
&self.tcx.sess.parse_sess,
sym::const_generics,
lifetime_ref.span,
"a non-static lifetime is not allowed in a `const`",
)
.emit();
}
}
}

View File

@ -1777,6 +1777,10 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
let result = loop {
match *scope {
Scope::Body { id, s } => {
// Non-static lifetimes are prohibited in anonymous constants under
// `min_const_generics`.
self.maybe_emit_forbidden_non_static_lifetime_error(id, lifetime_ref);
outermost_body = Some(id);
scope = s;
}

View File

@ -1008,6 +1008,10 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
"a single extra argument to prepend the linker invocation (can be used several times)"),
pre_link_args: Vec<String> = (Vec::new(), parse_list, [UNTRACKED],
"extra arguments to prepend to the linker invocation (space separated)"),
precise_enum_drop_elaboration: bool = (true, parse_bool, [TRACKED],
"use a more precise version of drop elaboration for matches on enums (default: yes). \
This results in better codegen, but has caused miscompilations on some tier 2 platforms. \
See #77382 and #74551."),
print_fuel: Option<String> = (None, parse_opt_string, [TRACKED],
"make rustc print the total optimization fuel used by a crate"),
print_link_args: bool = (false, parse_bool, [UNTRACKED],

View File

@ -1901,9 +1901,10 @@ pub unsafe fn copy_nonoverlapping<T>(src: *const T, dst: *mut T, count: usize) {
/// ```
/// use std::ptr;
///
/// /// # Safety:
/// /// # Safety
/// ///
/// /// * `ptr` must be correctly aligned for its type and non-zero.
/// /// * `ptr` must be valid for reads of `elts` contiguous objects of type `T`.
/// /// * `ptr` must be valid for reads of `elts` contiguous elements of type `T`.
/// /// * Those elements must not be used after calling this function unless `T: Copy`.
/// # #[allow(dead_code)]
/// unsafe fn from_buf_raw<T>(ptr: *const T, elts: usize) -> Vec<T> {

View File

@ -6,6 +6,17 @@ use crate::usize;
///
/// This `struct` is created by [`Iterator::chain`]. See its documentation
/// for more.
///
/// # Examples
///
/// ```
/// use std::iter::Chain;
/// use std::slice::Iter;
///
/// let a1 = [1, 2, 3];
/// let a2 = [4, 5, 6];
/// let iter: Chain<Iter<_>, Iter<_>> = a1.iter().chain(a2.iter());
/// ```
#[derive(Clone, Debug)]
#[must_use = "iterators are lazy and do nothing unless consumed"]
#[stable(feature = "rust1", since = "1.0.0")]

View File

@ -123,7 +123,7 @@ pub trait DoubleEndedIterator: Iterator {
/// assert_eq!(iter.advance_back_by(100), Err(1)); // only `&3` was skipped
/// ```
#[inline]
#[unstable(feature = "iter_advance_by", reason = "recently added", issue = "none")]
#[unstable(feature = "iter_advance_by", reason = "recently added", issue = "77404")]
fn advance_back_by(&mut self, n: usize) -> Result<(), usize> {
for i in 0..n {
self.next_back().ok_or(i)?;

View File

@ -314,7 +314,7 @@ pub trait Iterator {
/// assert_eq!(iter.advance_by(100), Err(1)); // only `&4` was skipped
/// ```
#[inline]
#[unstable(feature = "iter_advance_by", reason = "recently added", issue = "none")]
#[unstable(feature = "iter_advance_by", reason = "recently added", issue = "77404")]
fn advance_by(&mut self, n: usize) -> Result<(), usize> {
for i in 0..n {
self.next().ok_or(i)?;

View File

@ -252,7 +252,8 @@ impl Command {
#[cfg(not(any(
target_os = "macos",
target_os = "freebsd",
all(target_os = "linux", target_env = "gnu")
all(target_os = "linux", target_env = "gnu"),
all(target_os = "linux", target_env = "musl"),
)))]
fn posix_spawn(
&mut self,
@ -267,7 +268,8 @@ impl Command {
#[cfg(any(
target_os = "macos",
target_os = "freebsd",
all(target_os = "linux", target_env = "gnu")
all(target_os = "linux", target_env = "gnu"),
all(target_os = "linux", target_env = "musl"),
))]
fn posix_spawn(
&mut self,
@ -297,10 +299,10 @@ impl Command {
}
}
// Solaris and glibc 2.29+ can set a new working directory, and maybe
// others will gain this non-POSIX function too. We'll check for this
// weak symbol as soon as it's needed, so we can return early otherwise
// to do a manual chdir before exec.
// Solaris, glibc 2.29+, and musl 1.24+ can set a new working directory,
// and maybe others will gain this non-POSIX function too. We'll check
// for this weak symbol as soon as it's needed, so we can return early
// otherwise to do a manual chdir before exec.
weak! {
fn posix_spawn_file_actions_addchdir_np(
*mut libc::posix_spawn_file_actions_t,

View File

@ -18,45 +18,9 @@ trigger:
- auto
jobs:
- job: macOS
- job: Dummy
timeoutInMinutes: 600
pool:
vmImage: macos-10.15
vmImage: ubuntu-16.04
steps:
- template: steps/run.yml
variables:
# We're still uploading macOS builds from Azure Pipelines.
- group: prod-credentials
strategy:
matrix:
# OSX builders running tests, these run the full test suite.
# NO_DEBUG_ASSERTIONS=1 to make them go faster, but also do have some
# runners that run `//ignore-debug` tests.
#
# Note that the compiler is compiled to target 10.8 here because the Xcode
# version that we're using, 8.2, cannot compile LLVM for OSX 10.7.
x86_64-apple:
SCRIPT: ./x.py --stage 2 test
INITIAL_RUST_CONFIGURE_ARGS: --build=x86_64-apple-darwin --enable-sanitizers --enable-profiler --set rust.jemalloc --set llvm.ninja=false
RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
MACOSX_DEPLOYMENT_TARGET: 10.8
MACOSX_STD_DEPLOYMENT_TARGET: 10.7
NO_LLVM_ASSERTIONS: 1
NO_DEBUG_ASSERTIONS: 1
dist-x86_64-apple:
SCRIPT: ./x.py dist
INITIAL_RUST_CONFIGURE_ARGS: --host=x86_64-apple-darwin --target=x86_64-apple-darwin,aarch64-apple-ios,x86_64-apple-ios --enable-full-tools --enable-sanitizers --enable-profiler --set rust.jemalloc --set llvm.ninja=false
RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
MACOSX_DEPLOYMENT_TARGET: 10.7
NO_LLVM_ASSERTIONS: 1
NO_DEBUG_ASSERTIONS: 1
DIST_REQUIRE_ALL_TOOLS: 1
dist-x86_64-apple-alt:
SCRIPT: ./x.py dist
INITIAL_RUST_CONFIGURE_ARGS: --enable-extended --enable-profiler --set rust.jemalloc --set llvm.ninja=false
RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
MACOSX_DEPLOYMENT_TARGET: 10.7
NO_LLVM_ASSERTIONS: 1
NO_DEBUG_ASSERTIONS: 1
- bash: echo "We're running this job since bors is still gating on Azure"

View File

@ -1,142 +0,0 @@
#####################################
## READ BEFORE CHANGING THIS ##
#####################################
# We're in the process of evaluating GitHub Actions as a possible replacement
# for Azure Pipelines, and at the moment the configuration is duplicated
# between the two CI providers. Be sure to also change the configuration in
# src/ci/github-actions when changing this file.
#####################################
# FIXME(linux): need to configure core dumps, enable them, and then dump
# backtraces on failure from all core dumps:
#
# - bash: sudo apt install gdb
# - bash: sudo sh -c 'echo "/checkout/obj/cores/core.%p.%E" > /proc/sys/kernel/core_pattern'
#
# Check travis config for `gdb --batch` command to print all crash logs
steps:
# Configure our CI_JOB_NAME variable which log analyzers can use for the main
# step to see what's going on.
- bash: |
builder=$(echo $AGENT_JOBNAME | cut -d ' ' -f 2)
echo "##vso[task.setvariable variable=CI_JOB_NAME]$builder"
displayName: Configure Job Name
# Disable automatic line ending conversion, which is enabled by default on
# Azure's Windows image. Having the conversion enabled caused regressions both
# in our test suite (it broke miri tests) and in the ecosystem, since we
# started shipping install scripts with CRLF endings instead of the old LF.
#
# Note that we do this a couple times during the build as the PATH and current
# user/directory change, e.g. when mingw is enabled.
- bash: git config --global core.autocrlf false
displayName: "Disable git automatic line ending conversion"
- checkout: self
fetchDepth: 2
- bash: src/ci/scripts/setup-environment.sh
displayName: Setup environment
- bash: src/ci/scripts/clean-disk.sh
displayName: Clean disk
- bash: src/ci/scripts/should-skip-this.sh
displayName: Decide whether to run this job
- bash: src/ci/scripts/collect-cpu-stats.sh
displayName: Collect CPU-usage statistics in the background
- bash: src/ci/scripts/dump-environment.sh
displayName: Show the current environment
- bash: src/ci/scripts/install-sccache.sh
displayName: Install sccache
condition: and(succeeded(), not(variables.SKIP_JOB))
- bash: src/ci/scripts/install-clang.sh
displayName: Install clang
condition: and(succeeded(), not(variables.SKIP_JOB))
- bash: src/ci/scripts/install-wix.sh
displayName: Install wix
condition: and(succeeded(), not(variables.SKIP_JOB))
- bash: src/ci/scripts/symlink-build-dir.sh
displayName: Ensure the build happens on a partition with enough space
condition: and(succeeded(), not(variables.SKIP_JOB))
- bash: src/ci/scripts/disable-git-crlf-conversion.sh
displayName: "Disable git automatic line ending conversion (on C:/)"
condition: and(succeeded(), not(variables.SKIP_JOB))
- bash: src/ci/scripts/install-msys2.sh
displayName: Install msys2
condition: and(succeeded(), not(variables.SKIP_JOB))
- bash: src/ci/scripts/install-mingw.sh
displayName: Install MinGW
condition: and(succeeded(), not(variables.SKIP_JOB))
- bash: src/ci/scripts/install-ninja.sh
displayName: Install ninja
condition: and(succeeded(), not(variables.SKIP_JOB))
- bash: src/ci/scripts/enable-docker-ipv6.sh
displayName: Enable IPv6 on Docker
condition: and(succeeded(), not(variables.SKIP_JOB))
# Disable automatic line ending conversion (again). On Windows, when we're
# installing dependencies, something switches the git configuration directory or
# re-enables autocrlf. We've not tracked down the exact cause -- and there may
# be multiple -- but this should ensure submodules are checked out with the
# appropriate line endings.
- bash: src/ci/scripts/disable-git-crlf-conversion.sh
displayName: Disable git automatic line ending conversion
condition: and(succeeded(), not(variables.SKIP_JOB))
- bash: src/ci/scripts/checkout-submodules.sh
displayName: Checkout submodules
condition: and(succeeded(), not(variables.SKIP_JOB))
- bash: src/ci/scripts/verify-line-endings.sh
displayName: Verify line endings
condition: and(succeeded(), not(variables.SKIP_JOB))
# Ensure the `aws` CLI is installed so we can deploy later on, cache docker
# images, etc.
- bash: src/ci/scripts/install-awscli.sh
condition: and(succeeded(), not(variables.SKIP_JOB))
displayName: Install awscli
- bash: src/ci/scripts/run-build-from-ci.sh
timeoutInMinutes: 600
env:
AWS_ACCESS_KEY_ID: $(SCCACHE_AWS_ACCESS_KEY_ID)
AWS_SECRET_ACCESS_KEY: $(SCCACHE_AWS_SECRET_ACCESS_KEY)
TOOLSTATE_REPO_ACCESS_TOKEN: $(TOOLSTATE_REPO_ACCESS_TOKEN)
condition: and(succeeded(), not(variables.SKIP_JOB))
displayName: Run build
- bash: src/ci/scripts/upload-artifacts.sh
env:
AWS_ACCESS_KEY_ID: $(UPLOAD_AWS_ACCESS_KEY_ID)
AWS_SECRET_ACCESS_KEY: $(UPLOAD_AWS_SECRET_ACCESS_KEY)
displayName: Upload artifacts
# Adding a condition on DEPLOY=1 or DEPLOY_ALT=1 is not needed as all deploy
# builders *should* have the AWS credentials available. Still, explicitly
# adding the condition is helpful as this way CI will not silently skip
# deploying artifacts from a dist builder if the variables are misconfigured,
# erroring about invalid credentials instead.
condition: |
and(
succeeded(), not(variables.SKIP_JOB),
or(
variables.UPLOAD_AWS_SECRET_ACCESS_KEY,
eq(variables.DEPLOY, '1'), eq(variables.DEPLOY_ALT, '1')
)
)

View File

@ -46,3 +46,5 @@ pub struct BigX;
Then, when looking for it through the `rustdoc` search, if you enter "x" or
"big", search will show the `BigX` struct first.
There are some limitations on the doc alias names though: you can't use `"` or whitespace.

View File

@ -695,7 +695,7 @@ impl Attributes {
self.other_attrs
.lists(sym::doc)
.filter(|a| a.has_name(sym::alias))
.filter_map(|a| a.value_str().map(|s| s.to_string().replace("\"", "")))
.filter_map(|a| a.value_str().map(|s| s.to_string()))
.filter(|v| !v.is_empty())
.collect::<FxHashSet<_>>()
}

@ -1 +1 @@
Subproject commit 2c56ba7db75b536b0432228b4760ed79174eca30
Subproject commit e8b556b6a8836147429abe391d6ed18806867b45

View File

@ -7,4 +7,10 @@ pub struct Bar;
#[doc(alias)] //~ ERROR
#[doc(alias = 0)] //~ ERROR
#[doc(alias("bar"))] //~ ERROR
#[doc(alias = "\"")] //~ ERROR
#[doc(alias = "\n")] //~ ERROR
#[doc(alias = "
")] //~^ ERROR
#[doc(alias = " ")] //~ ERROR
#[doc(alias = "\t")] //~ ERROR
pub struct Foo;

View File

@ -16,5 +16,37 @@ error: doc alias attribute expects a string: #[doc(alias = "0")]
LL | #[doc(alias("bar"))]
| ^^^^^^^^^^^^
error: aborting due to 3 previous errors
error: '\"' character isn't allowed in `#[doc(alias = "...")]`
--> $DIR/check-doc-alias-attr.rs:10:7
|
LL | #[doc(alias = "\"")]
| ^^^^^^^^^^^^
error: '\n' character isn't allowed in `#[doc(alias = "...")]`
--> $DIR/check-doc-alias-attr.rs:11:7
|
LL | #[doc(alias = "\n")]
| ^^^^^^^^^^^^
error: '\n' character isn't allowed in `#[doc(alias = "...")]`
--> $DIR/check-doc-alias-attr.rs:12:7
|
LL | #[doc(alias = "
| _______^
LL | | ")]
| |_^
error: ' ' character isn't allowed in `#[doc(alias = "...")]`
--> $DIR/check-doc-alias-attr.rs:14:7
|
LL | #[doc(alias = " ")]
| ^^^^^^^^^^^
error: '\t' character isn't allowed in `#[doc(alias = "...")]`
--> $DIR/check-doc-alias-attr.rs:15:7
|
LL | #[doc(alias = "\t")]
| ^^^^^^^^^^^^
error: aborting due to 8 previous errors

View File

@ -7,4 +7,10 @@ pub struct Bar;
#[doc(alias)] //~ ERROR
#[doc(alias = 0)] //~ ERROR
#[doc(alias("bar"))] //~ ERROR
#[doc(alias = "\"")] //~ ERROR
#[doc(alias = "\n")] //~ ERROR
#[doc(alias = "
")] //~^ ERROR
#[doc(alias = " ")] //~ ERROR
#[doc(alias = "\t")] //~ ERROR
pub struct Foo;

View File

@ -16,5 +16,37 @@ error: doc alias attribute expects a string: #[doc(alias = "0")]
LL | #[doc(alias("bar"))]
| ^^^^^^^^^^^^
error: aborting due to 3 previous errors
error: '\"' character isn't allowed in `#[doc(alias = "...")]`
--> $DIR/check-doc-alias-attr.rs:10:7
|
LL | #[doc(alias = "\"")]
| ^^^^^^^^^^^^
error: '\n' character isn't allowed in `#[doc(alias = "...")]`
--> $DIR/check-doc-alias-attr.rs:11:7
|
LL | #[doc(alias = "\n")]
| ^^^^^^^^^^^^
error: '\n' character isn't allowed in `#[doc(alias = "...")]`
--> $DIR/check-doc-alias-attr.rs:12:7
|
LL | #[doc(alias = "
| _______^
LL | | ")]
| |_^
error: ' ' character isn't allowed in `#[doc(alias = "...")]`
--> $DIR/check-doc-alias-attr.rs:14:7
|
LL | #[doc(alias = " ")]
| ^^^^^^^^^^^
error: '\t' character isn't allowed in `#[doc(alias = "...")]`
--> $DIR/check-doc-alias-attr.rs:15:7
|
LL | #[doc(alias = "\t")]
| ^^^^^^^^^^^^
error: aborting due to 8 previous errors

View File

@ -0,0 +1,27 @@
#![feature(min_const_generics)]
// This test checks that non-static lifetimes are prohibited under `min_const_generics`. It
// currently emits an error with `min_const_generics`. This will ICE under `const_generics`.
fn test<const N: usize>() {}
fn issue_75323_and_74447_1<'a>() -> &'a () {
test::<{ let _: &'a (); 3 },>();
//~^ ERROR a non-static lifetime is not allowed in a `const`
&()
}
fn issue_75323_and_74447_2() {
test::<{ let _: &(); 3 },>();
}
fn issue_75323_and_74447_3() {
test::<{ let _: &'static (); 3 },>();
}
fn issue_73375<'a>() {
[(); (|_: &'a u8| (), 0).1];
//~^ ERROR a non-static lifetime is not allowed in a `const`
}
fn main() {}

View File

@ -0,0 +1,21 @@
error[E0658]: a non-static lifetime is not allowed in a `const`
--> $DIR/forbid-non-static-lifetimes.rs:9:22
|
LL | test::<{ let _: &'a (); 3 },>();
| ^^
|
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
= help: add `#![feature(const_generics)]` to the crate attributes to enable
error[E0658]: a non-static lifetime is not allowed in a `const`
--> $DIR/forbid-non-static-lifetimes.rs:23:16
|
LL | [(); (|_: &'a u8| (), 0).1];
| ^^
|
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
= help: add `#![feature(const_generics)]` to the crate attributes to enable
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0658`.

View File

@ -0,0 +1,8 @@
// From <https://github.com/rust-lang/rust/issues/77361>
// edition:2018
const _: i32 = { core::mem::ManuallyDrop::new(async { 0 }); 4 };
//~^ `async` block
fn main() {}

View File

@ -0,0 +1,8 @@
error: `async` blocks are not allowed in constants
--> $DIR/async-block.rs:5:47
|
LL | const _: i32 = { core::mem::ManuallyDrop::new(async { 0 }); 4 };
| ^^^^^^^^^^^
error: aborting due to previous error

View File

@ -1,8 +1,10 @@
error: expected `,`
--> $DIR/bind-struct-early-modifiers.rs:4:19
--> $DIR/bind-struct-early-modifiers.rs:4:20
|
LL | Foo { ref x: ref x } => {},
| ^
| --- ^
| |
| while parsing the fields for this pattern
error: aborting due to previous error

View File

@ -2,7 +2,9 @@ error: expected identifier, found `,`
--> $DIR/issue-10392.rs:6:13
|
LL | let A { , } = a();
| ^ expected identifier
| - ^ expected identifier
| |
| while parsing the fields for this pattern
error: aborting due to previous error

View File

@ -35,7 +35,9 @@ error: expected one of `!` or `[`, found `}`
--> $DIR/issue-63135.rs:3:16
|
LL | fn i(n{...,f #
| ^ expected one of `!` or `[`
| - ^ expected one of `!` or `[`
| |
| while parsing the fields for this pattern
error: aborting due to 5 previous errors

View File

@ -8,10 +8,12 @@ LL | MyStruct { .., Some(_) } => {},
| `..` must be at the end and cannot have a trailing comma
error: expected `,`
--> $DIR/issue-54379.rs:9:24
--> $DIR/issue-54379.rs:9:28
|
LL | MyStruct { .., Some(_) } => {},
| ^^^^
| -------- ^
| |
| while parsing the fields for this pattern
error: aborting due to 2 previous errors