Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 5 additions & 1 deletion compiler/rustc_expand/src/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1382,7 +1382,11 @@ impl InvocationCollectorNode for Box<ast::Item> {
// This lets `parse_external_mod` catch cycles if it's self-referential.
let file_path = match inline {
Inline::Yes => None,
Inline::No { .. } => mod_file_path_from_attr(ecx.sess, &node.attrs, &dir_path),
Inline::No { .. } => mod_file_path_from_attr(
ecx.sess,
&node.attrs,
&ecx.current_expansion.module.dir_path,
),
};
(file_path, dir_path, dir_ownership)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ pub(crate) fn target() -> Target {
base.features = "+cmpxchg16b,+lahfsahf,+popcnt,+sse3,+sse4.1,+sse4.2,+ssse3".into();
base.max_atomic_width = Some(128);
base.stack_probes = StackProbeType::Inline;
base.supported_sanitizers =
SanitizerSet::ADDRESS | SanitizerSet::CFI | SanitizerSet::LEAK | SanitizerSet::SAFESTACK;
base.default_sanitizers = SanitizerSet::SAFESTACK;
base.supported_sanitizers = SanitizerSet::ADDRESS | SanitizerSet::CFI | SanitizerSet::LEAK;
base.supports_xray = true;

Target {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -519,11 +519,13 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
};

let mut local_visitor = FindInferSourceVisitor::new(self, typeck_results, term, ty);
let mut body_from_expansion = false;
if let Some(body) =
self.tcx.hir_maybe_body_owned_by(self.tcx.typeck_root_def_id_local(body_def_id))
{
let expr = body.value;
local_visitor.visit_expr(expr);
body_from_expansion = body.value.span.from_expansion();
}

let Some(InferSource { span, kind }) = local_visitor.infer_source else {
Expand Down Expand Up @@ -566,6 +568,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
term,
&arg_data,
typeck_results,
body_from_expansion,
span,
);

Expand Down Expand Up @@ -705,6 +708,7 @@ impl<'tcx> InferSourceKind<'tcx> {
term: Term<'tcx>,
arg_data: &'local InferenceDiagnosticsData,
typeck_results: &TypeckResults<'tcx>,
body_from_expansion: bool,
span: Span,
) -> Option<SourceKindSubdiag<'local>>
where
Expand Down Expand Up @@ -799,7 +803,7 @@ impl<'tcx> InferSourceKind<'tcx> {
p.into_buffer()
};

let suggestion = if have_turbofish {
let suggestion = if have_turbofish || body_from_expansion {
None
} else if generic_args.len() == 1 && used_fallback {
match param.kind {
Expand Down
5 changes: 5 additions & 0 deletions src/tools/compiletest/src/runtest/run_make.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,11 @@ impl TestCx<'_> {
// through a specific CI runner).
.env("LLVM_COMPONENTS", &self.config.llvm_components);

if let Some(codegen_backend) = &self.config.override_codegen_backend {
// In case it's a different codegen backend than LLVM.
cmd.env("RUSTC_CODEGEN_BACKEND", codegen_backend.as_str());
}

// The `run-make-cargo` and `build-std` suites need an in-tree `cargo`, `run-make` does not.
if matches!(self.config.suite, TestSuite::RunMakeCargo | TestSuite::BuildStd) {
cmd.env(
Expand Down
3 changes: 3 additions & 0 deletions src/tools/run-make-support/src/external_deps/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ pub fn rustc_path() -> String {
fn setup_common() -> Command {
let mut cmd = Command::new(rustc_path());
set_host_compiler_dylib_path(&mut cmd);
if let Ok(codegen_backend) = std::env::var("RUSTC_CODEGEN_BACKEND") {
cmd.arg(format!("-Zcodegen-backend={codegen_backend}"));
}
cmd
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,15 +177,13 @@
//@ compile-flags: -C opt-level=2

#![crate_type = "lib"]
#![feature(no_core, lang_items, sanitize)]
#![feature(no_core, lang_items)]
#![crate_type = "lib"]
#![no_core]

extern crate minicore;
use minicore::*;

// We only do this because we can't disable default sanitizers via compile-flags.
#[sanitize(safestack = "off")]
#[no_mangle]
pub fn foo() {
// CHECK: foo{{:|()}}
Expand Down
10 changes: 10 additions & 0 deletions tests/crashes/140693.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//@ known-bug: #140693
#![crate_type = "sdylib"]

pub trait Trait {
type Type;
}
pub struct S;

#[export_stable]
pub extern "C" fn foo1(_x: <S as Trait>::Type) {}
10 changes: 10 additions & 0 deletions tests/crashes/146210.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//@ known-bug: #146210
//@ edition: 2024
//@ compile-flags: -Zvalidate-mir --crate-type lib
use core::pin::Pin;

fn bar<T>(non_send: T) -> Pin<Box<dyn Future<Output = ()> + Send>> {
Box::pin(async {
non_send;
})
}
4 changes: 4 additions & 0 deletions tests/crashes/146353.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
//@ known-bug: #146353
const BIG_CHAIN: u8 = ();
trait NeverSend = !Send;
fn main() {}
10 changes: 10 additions & 0 deletions tests/crashes/149015.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//@ known-bug: #149015
trait Trait1 {
type Assoc;
}

trait Trait2 {}

impl Trait1 for <dyn Trait2 as Trait1>::Assoc {
type Assoc = ();
}
9 changes: 9 additions & 0 deletions tests/crashes/152204.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//@ known-bug: #152204
//@ compile-flags: -Copt-level=0
#![feature(portable_simd)]

fn main() {
if false {
let _ = core::simd::Simd::<u8, 256>::splat(0);
}
}
10 changes: 10 additions & 0 deletions tests/crashes/153368.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//@ known-bug: #153368
//@ compile-flags: -Znext-solver=globally
trait Foo: Bar<T> + Bar<u32> {}
trait Bar<T> {
fn bar(self) -> T;
}

fn test_infer_version(x: &dyn Foo) {
x.bar()
}
6 changes: 6 additions & 0 deletions tests/crashes/154367.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
//@ known-bug: #154367
//@ compile-flags: -Copt-level=0
#![feature(unsafe_binders)]

fn main() { panic::<unsafe<'a> &'a ()>(); }
fn panic<T>() { panic!() }
7 changes: 7 additions & 0 deletions tests/crashes/155482.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//@ known-bug: #155482
trait TraitA < AsA = impl TraitB < {
#[derive(Hash)]
enum A;
struct A<A>;
}
>> ;
13 changes: 13 additions & 0 deletions tests/crashes/155497.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//@ known-bug: #155497
//@ compile-flags: -Wrust-2021-incompatible-closure-captures
struct Foo((u32, i128));

fn main() {
type T = impl async FnOnce() -> T;
let foo: T = Foo();
let x = move || {
let x = move || {
let Foo((a, b)) = foo;
};
};
}
3 changes: 3 additions & 0 deletions tests/crashes/157197.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
//@ known-bug: #157197
static C: &'static usize = &(0 | E);
static E: usize = E;
12 changes: 12 additions & 0 deletions tests/crashes/158243.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//@ known-bug: #158243
macro_rules! id {
($x:expr) => { $x };
}
fn main() {
|id!(
(|| {
use std::ops::Add;
1.add(3);
})
)| {};
}
16 changes: 16 additions & 0 deletions tests/crashes/158773.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//@ known-bug: #158773
//@ needs-rustc-debug-assertions
//@ compile-flags: -Znext-solver=globally
trait HasLifetime {
type AtLifetime<'a>;
}

pub struct ExistentialLifetime<S: HasLifetime>(S::AtLifetime<'static>);

impl<S: HasLifetime> ExistentialLifetime<S> {
fn new() -> ExistentialLifetime<S> {
ExistentialLifetime(ExistentialLifetime(()))
}
}

fn main() {}
14 changes: 14 additions & 0 deletions tests/crashes/158797.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//@ known-bug: #158797
#![feature(coroutines)]
#![feature(const_async_blocks)]
#![feature(yield_expr)]
enum Foo {
Bar = (
#[coroutine]
|| yield,
2,
)
.1,
}

fn main() {}
4 changes: 4 additions & 0 deletions tests/crashes/160329.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
//@ known-bug: #160329
#![feature(autodiff)]
#[core::autodiff::autodiff_forward(fd_inner, Dual)]
fn f(_x: struct S<B, T>) {}
2 changes: 2 additions & 0 deletions tests/crashes/160490.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
//@ known-bug: #160490
fn f(...: u8) {}
1 change: 1 addition & 0 deletions tests/run-make/amdgpu-kd/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

//@ needs-llvm-components: amdgpu
//@ needs-rust-lld
//@ ignore-backends: gcc

use run_make_support::targets::is_windows_gnu;
use run_make_support::{llvm_readobj, rustc};
Expand Down
2 changes: 2 additions & 0 deletions tests/run-make/atomic-lock-free/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// guaranteed to be lock-free.

//@ only-linux
// FIXME: Once GCC backend is fixed, remove this `ignore-backends`.
//@ ignore-backends: gcc

use run_make_support::{llvm_components_contain, llvm_readobj, rustc};

Expand Down
1 change: 1 addition & 0 deletions tests/run-make/avr-custom-target-missing-cpu/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Make sure that reports the normal missing-CPU diagnostic instead of ICEing
//
//@ needs-llvm-components: avr
//@ ignore-backends: gcc

use run_make_support::rustc;

Expand Down
2 changes: 2 additions & 0 deletions tests/run-make/avr-rjmp-offset/rmake.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
//@ needs-llvm-components: avr
//@ needs-rust-lld
//@ ignore-backends: gcc

//! Regression test for #129301/llvm-project#106722 within `rustc`.
//!
//! Some LLVM-versions had wrong offsets in the local labels, causing the first
Expand Down
1 change: 1 addition & 0 deletions tests/run-make/branch-protection-check-IBT/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
// FIXME(#93754): increase the test coverage of this test.
//@ only-x86_64-unknown-linux-gnu
//@ ignore-cross-compile
//@ ignore-backends: gcc

use run_make_support::{bare_rustc, llvm_readobj};

Expand Down
2 changes: 2 additions & 0 deletions tests/run-make/c-link-to-rust-va-list-fn/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
//@ ignore-sgx: (x86 machine code cannot be directly executed)
//@ ignore-pauthtest: (it requires non-trivial compilation of c sources, and only supports dynamic
// linking, ignore the test).
// FIXME: Once GCC backend is fixed, remove this `ignore-backends`.
//@ ignore-backends: gcc

use run_make_support::{cc, extra_c_flags, run, rustc, static_lib_name};

Expand Down
2 changes: 2 additions & 0 deletions tests/run-make/cdylib/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
// - `bar()` which implements basic addition.

//@ ignore-cross-compile
// FIXME: Once GCC backend is fixed, remove this `ignore-backends`.
//@ ignore-backends: gcc

use run_make_support::{cc, cwd, dynamic_lib_name, is_windows_msvc, rfs, run, rustc};

Expand Down
2 changes: 2 additions & 0 deletions tests/run-make/codegen-options-parsing/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// contain specific helpful indications.

//@ ignore-cross-compile
// FIXME: Once GCC backend is fixed, remove this `ignore-backends`.
//@ ignore-backends: gcc

use run_make_support::regex::Regex;
use run_make_support::rustc;
Expand Down
2 changes: 2 additions & 0 deletions tests/run-make/compressed-debuginfo/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

//@ only-linux
//@ ignore-cross-compile
// FIXME: Once GCC backend is fixed, remove this `ignore-backends`.
//@ ignore-backends: gcc

// FIXME: This test isn't comprehensive and isn't covering all possible combinations.

Expand Down
4 changes: 3 additions & 1 deletion tests/run-make/const-destruct-stable-toolchain/rmake.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
//@ needs-target-std
//
// FIXME: Once GCC backend is fixed, remove this `ignore-backends`.
//@ ignore-backends: gcc

// Test that the suggestion to constrain a type parameter that is dropped in a const
// function with a `[const] Destruct` bound is only offered on nightly, since the bound
// requires an unstable feature.
Expand Down
4 changes: 3 additions & 1 deletion tests/run-make/const-trait-stable-toolchain/rmake.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
//@ needs-target-std
//
// FIXME: Once GCC backend is fixed, remove this `ignore-backends`.
//@ ignore-backends: gcc

// Test output of const super trait errors in both stable and nightly.
// We don't want to provide suggestions on stable that only make sense in nightly.

Expand Down
4 changes: 3 additions & 1 deletion tests/run-make/cross-lang-lto-upstream-rlibs/rmake.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
//@ needs-target-std
//
// FIXME: Once GCC backend is fixed, remove this `ignore-backends`.
//@ ignore-backends: gcc

// When using the flag -C linker-plugin-lto, static libraries could lose their upstream object
// files during compilation. This bug was fixed in #53031, and this test compiles a staticlib
// dependent on upstream, checking that the upstream object file still exists after no LTO and
Expand Down
4 changes: 3 additions & 1 deletion tests/run-make/cross-lang-lto/rmake.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
//@ needs-target-std
//
// FIXME: Once GCC backend is fixed, remove this `ignore-backends`.
//@ ignore-backends: gcc

// This test checks that the object files we generate are actually
// LLVM bitcode files (as used by linker LTO plugins) when compiling with
// -Clinker-plugin-lto.
Expand Down
2 changes: 2 additions & 0 deletions tests/run-make/embed-source-dwarf/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
//@ ignore-apple
//@ ignore-wasm (`object` doesn't handle wasm object files)
//@ ignore-cross-compile
// FIXME: Once GCC backend is fixed, remove this `ignore-backends`.
//@ ignore-backends: gcc

// This test should be replaced with one in tests/debuginfo once we can easily
// tell via GDB or LLDB if debuginfo contains source code. Cheap tricks in LLDB
Expand Down
2 changes: 2 additions & 0 deletions tests/run-make/emit-stack-sizes/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
//@ only-elf
// Reason: this feature only works when the output object format is ELF.
// This won't be the case on Windows/OSX - for example, OSX produces a Mach-O binary.
// FIXME: Once GCC backend is fixed, remove this `ignore-backends`.
//@ ignore-backends: gcc

use run_make_support::{llvm_readobj, rustc};

Expand Down
2 changes: 2 additions & 0 deletions tests/run-make/extern-fn-explicit-align/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

//@ ignore-cross-compile
// Reason: the compiled binary is executed
// FIXME: Once GCC backend is fixed, remove this `ignore-backends`.
//@ ignore-backends: gcc

use run_make_support::{build_native_static_lib, run, rustc};

Expand Down
3 changes: 3 additions & 0 deletions tests/run-make/fat-lto-module-summary/rmake.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// FIXME: Once GCC backend is fixed, remove this `ignore-backends`.
//@ ignore-backends: gcc

use run_make_support::{llvm_bcanalyzer, rustc};

fn main() {
Expand Down
Loading
Loading