Skip to content

Rollup of 11 pull requests #98632

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 25 commits into from
Jun 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
89a23bf
add regression test for #85907
TaKO8Ki Jun 27, 2022
d16187c
Remove references to `./tmp` in-tree
jyn514 Jun 27, 2022
05263f0
add regression test for #80074
TaKO8Ki Jun 28, 2022
396342a
:arrow_up: rust-analyzer
lnicola Jun 28, 2022
ae4b929
rustdoc-json: Add assoc type ICE regression test
Enselic Jun 26, 2022
2888e76
test/rustdoc-json/assoc_type.rs: Maximize chance of detecting future …
Enselic Jun 28, 2022
8c7d9f6
fix ice for associated constant generics
TaKO8Ki Jun 28, 2022
b7e6200
Fix glob import ICE in rustdoc JSON format
GuillaumeGomez Jun 28, 2022
c2221ef
Add regression test for glob import ICE in rustdoc JSON
GuillaumeGomez Jun 28, 2022
2ee9241
Remove feature `const_option` from std
ChrisDenton Jun 28, 2022
720c430
Add a fixme comment
ChrisDenton Jun 28, 2022
d6b9c10
Fix mir-opt wg name
Mark-Simulacrum Jun 28, 2022
fe02ee8
llvm-wrapper: adapt for an LLVM API change
krasimirgg Jun 28, 2022
8c22b6b
fix typo in comment
pro465 Jun 28, 2022
3991e73
Rollup merge of #98548 - Enselic:allow-typedef-diff-for-rustdoc-json,…
matthiaskrgr Jun 28, 2022
5c7a045
Rollup merge of #98560 - TaKO8Ki:add-regression-test-for-85907, r=Mar…
matthiaskrgr Jun 28, 2022
6cb46ca
Rollup merge of #98564 - jyn514:remove-tmp-dir, r=Mark-Simulacrum
matthiaskrgr Jun 28, 2022
70b4e04
Rollup merge of #98602 - TaKO8Ki:add-regression-test-for-issue-80074,…
matthiaskrgr Jun 28, 2022
28d2c4b
Rollup merge of #98606 - lnicola:rust-analyzer-2022-06-28, r=lnicola
matthiaskrgr Jun 28, 2022
a1b0638
Rollup merge of #98609 - TaKO8Ki:fix-ice-for-associated-constant-gene…
matthiaskrgr Jun 28, 2022
956a9f5
Rollup merge of #98611 - GuillaumeGomez:rustdoc-json-glob-ice, r=notr…
matthiaskrgr Jun 28, 2022
a3bdd46
Rollup merge of #98617 - ChrisDenton:const-unwrap, r=Mark-Simulacrum
matthiaskrgr Jun 28, 2022
62a787c
Rollup merge of #98619 - Mark-Simulacrum:fix-triagebot, r=Dylan-DPC
matthiaskrgr Jun 28, 2022
db872ee
Rollup merge of #98621 - krasimirgg:llvm-15-wrapper, r=nikic
matthiaskrgr Jun 28, 2022
164c98e
Rollup merge of #98623 - pro465:patch-1, r=Dylan-DPC
matthiaskrgr Jun 28, 2022
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
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ no_llvm_build
/unicode-downloads
/target
/src/tools/x/target
# Generated by compiletest for incremental
/tmp/
# Created by default with `src/ci/docker/run.sh`
/obj/

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_lexer/src/unescape.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ fn scan_escape(chars: &mut Chars<'_>, mode: Mode) -> Result<char, EscapeError> {
c.to_digit(16).ok_or(EscapeError::InvalidCharInUnicodeEscape)?;
n_digits += 1;
if n_digits > 6 {
// Stop updating value since we're sure that it's is incorrect already.
// Stop updating value since we're sure that it's incorrect already.
continue;
}
let digit = digit as u32;
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -985,7 +985,9 @@ LLVMRustOptimizeWithNewPassManager(
if (SanitizerOptions->SanitizeAddress) {
OptimizerLastEPCallbacks.push_back(
[SanitizerOptions](ModulePassManager &MPM, OptimizationLevel Level) {
#if LLVM_VERSION_LT(15, 0)
MPM.addPass(RequireAnalysisPass<ASanGlobalsMetadataAnalysis, Module>());
#endif
#if LLVM_VERSION_GE(14, 0)
AddressSanitizerOptions opts = AddressSanitizerOptions{
/*CompileKernel=*/false,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_span/src/source_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -956,7 +956,7 @@ impl SourceMap {
}

pub fn generate_fn_name_span(&self, span: Span) -> Option<Span> {
let prev_span = self.span_extend_to_prev_str(span, "fn", true, true).unwrap_or(span);
let prev_span = self.span_extend_to_prev_str(span, "fn", true, true)?;
if let Ok(snippet) = self.span_to_snippet(prev_span) {
debug!(
"generate_fn_name_span: span={:?}, prev_span={:?}, snippet={:?}",
Expand Down
1 change: 0 additions & 1 deletion library/std/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,6 @@
#![feature(const_ip)]
#![feature(const_ipv4)]
#![feature(const_ipv6)]
#![feature(const_option)]
#![feature(const_socketaddr)]
#![feature(thread_local_internals)]
//
Expand Down
19 changes: 15 additions & 4 deletions library/std/src/sys/windows/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,17 @@ use crate::vec;

use core::iter;

/// This is the const equivalent to `NonZeroU16::new(n).unwrap()`
///
/// FIXME: This can be removed once `Option::unwrap` is stably const.
/// See the `const_option` feature (#67441).
const fn non_zero_u16(n: u16) -> NonZeroU16 {
match NonZeroU16::new(n) {
Some(n) => n,
None => panic!("called `unwrap` on a `None` value"),
}
}

pub fn args() -> Args {
// SAFETY: `GetCommandLineW` returns a pointer to a null terminated UTF-16
// string so it's safe for `WStrUnits` to use.
Expand Down Expand Up @@ -58,10 +69,10 @@ fn parse_lp_cmd_line<'a, F: Fn() -> OsString>(
lp_cmd_line: Option<WStrUnits<'a>>,
exe_name: F,
) -> Vec<OsString> {
const BACKSLASH: NonZeroU16 = NonZeroU16::new(b'\\' as u16).unwrap();
const QUOTE: NonZeroU16 = NonZeroU16::new(b'"' as u16).unwrap();
const TAB: NonZeroU16 = NonZeroU16::new(b'\t' as u16).unwrap();
const SPACE: NonZeroU16 = NonZeroU16::new(b' ' as u16).unwrap();
const BACKSLASH: NonZeroU16 = non_zero_u16(b'\\' as u16);
const QUOTE: NonZeroU16 = non_zero_u16(b'"' as u16);
const TAB: NonZeroU16 = non_zero_u16(b'\t' as u16);
const SPACE: NonZeroU16 = non_zero_u16(b' ' as u16);

let mut ret_val = Vec::new();
// If the cmd line pointer is null or it points to an empty string then
Expand Down
6 changes: 5 additions & 1 deletion src/librustdoc/clean/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2161,8 +2161,12 @@ impl Path {
self.res.def_id()
}

pub(crate) fn last_opt(&self) -> Option<Symbol> {
self.segments.last().map(|s| s.name)
}

pub(crate) fn last(&self) -> Symbol {
self.segments.last().expect("segments were empty").name
self.last_opt().expect("segments were empty")
}

pub(crate) fn whole_name(&self) -> String {
Expand Down
7 changes: 6 additions & 1 deletion src/librustdoc/json/conversions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,12 @@ impl FromWithTcx<clean::Import> for Import {
},
Glob => Import {
source: import.source.path.whole_name(),
name: import.source.path.last().to_string(),
name: import
.source
.path
.last_opt()
.unwrap_or_else(|| Symbol::intern("*"))
.to_string(),
id: import.source.did.map(ItemId::from).map(|i| from_item_id(i, tcx)),
glob: true,
},
Expand Down
22 changes: 22 additions & 0 deletions src/test/rustdoc-json/assoc_type.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Regression test for <https://github.com/rust-lang/rust/issues/98547>.

// @has assoc_type.json
// @has - "$.index[*][?(@.name=='Trait')]"
// @has - "$.index[*][?(@.name=='AssocType')]"
// @has - "$.index[*][?(@.name=='S')]"
// @has - "$.index[*][?(@.name=='S2')]"

pub trait Trait {
type AssocType;
}

impl<T> Trait for T {
type AssocType = Self;
}

pub struct S;

/// Not needed for the #98547 ICE to occur, but added to maximize the chance of
/// getting an ICE in the future. See
/// <https://github.com/rust-lang/rust/pull/98548#discussion_r908219164>
pub struct S2;
24 changes: 24 additions & 0 deletions src/test/rustdoc-json/glob_import.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// This is a regression test for <https://github.com/rust-lang/rust/issues/98003>.

#![feature(no_core)]
#![no_std]
#![no_core]

// @has glob_import.json
// @has - "$.index[*][?(@.name=='glob')]"
// @has - "$.index[*][?(@.kind=='import')].inner.name" \"*\"


mod m1 {
pub fn f() {}
}
mod m2 {
pub fn f(_: u8) {}
}

pub use m1::*;
pub use m2::*;

pub mod glob {
pub use *;
}
7 changes: 7 additions & 0 deletions src/test/ui/consts/const-eval/issue-85907.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const fn hey() -> usize {
panic!(123); //~ ERROR argument to `panic!()` in a const context must have type `&str`
}

fn main() {
let _: [u8; hey()] = todo!();
}
10 changes: 10 additions & 0 deletions src/test/ui/consts/const-eval/issue-85907.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
error: argument to `panic!()` in a const context must have type `&str`
--> $DIR/issue-85907.rs:2:5
|
LL | panic!(123);
| ^^^^^^^^^^^
|
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to previous error

4 changes: 4 additions & 0 deletions src/test/ui/extern/auxiliary/issue-80074-macro.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// edition:2018

macro_rules! foo_ { () => {}; }
use foo_ as foo;
10 changes: 10 additions & 0 deletions src/test/ui/extern/issue-80074.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// edition:2018
// build-pass
// aux-crate:issue_80074=issue-80074-macro.rs

#[macro_use]
extern crate issue_80074;

fn main() {
foo!();
}
9 changes: 9 additions & 0 deletions src/test/ui/generics/issue-98432.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
struct Struct<T>(T);

impl<T> Struct<T> {
const CONST: fn() = || {
struct _Obligation where T:; //~ ERROR can't use generic parameters from outer function
};
}

fn main() {}
14 changes: 14 additions & 0 deletions src/test/ui/generics/issue-98432.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
error[E0401]: can't use generic parameters from outer function
--> $DIR/issue-98432.rs:5:34
|
LL | impl<T> Struct<T> {
| - type parameter from outer function
LL | const CONST: fn() = || {
LL | struct _Obligation where T:;
| ^ use of generic parameter from outer function
|
= help: try using a local generic parameter instead

error: aborting due to previous error

For more information about this error, try `rustc --explain E0401`.
5 changes: 0 additions & 5 deletions src/tools/compiletest/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -351,11 +351,6 @@ pub fn opt_str2(maybestr: Option<String>) -> String {
}

pub fn run_tests(config: Config) {
// FIXME(#33435) Avoid spurious failures in codegen-units/partitioning tests.
if let Mode::CodegenUnits = config.mode {
let _ = fs::remove_dir_all("tmp/partitioning-tests");
}

// If we want to collect rustfix coverage information,
// we first make sure that the coverage file does not exist.
// It will be created later on.
Expand Down
2 changes: 1 addition & 1 deletion src/tools/rust-analyzer
2 changes: 1 addition & 1 deletion triagebot.toml
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ cc = ["@rust-lang/miri"]

[mentions."compiler/rustc_mir_transform/src/"]
message = "Some changes occurred to MIR optimizations"
cc = ["@rust-lang/mir-opt"]
cc = ["@rust-lang/wg-mir-opt"]

[mentions."compiler/rustc_trait_selection/src/traits/const_evaluatable.rs"]
message = "Some changes occurred in const_evaluatable.rs"
Expand Down