Skip to content
Open
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
29 changes: 20 additions & 9 deletions compiler/rustc_attr_parsing/src/attributes/link_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,22 @@ impl<S: Stage> CombineAttributeParser<S> for LinkParser {
cx: &'c mut AcceptContext<'_, '_, S>,
args: &'c ArgParser<'_>,
) -> impl IntoIterator<Item = Self::Item> + 'c {
let mut result = None;
let Some(items) = args.list() else {
cx.expected_list(cx.attr_span);
return result;
let items = match args {
ArgParser::List(list) => list,
// This is an edgecase added because making this a hard error would break too many crates
// Specifically `#[link = "dl"]` is accepted with a FCW
// For more information, see https://github.com/rust-lang/rust/pull/143193
ArgParser::NameValue(nv) if nv.value_as_str().is_some_and(|v| v == sym::dl) => {
let suggestions = <Self as CombineAttributeParser<S>>::TEMPLATE
.suggestions(cx.attr_style, "link");
let span = cx.attr_span;
cx.emit_lint(AttributeLintKind::IllFormedAttributeInput { suggestions }, span);
return None;
}
_ => {
cx.expected_list(cx.attr_span);
return None;
}
};

let sess = cx.sess();
Expand Down Expand Up @@ -113,7 +125,7 @@ impl<S: Stage> CombineAttributeParser<S> for LinkParser {
}
};
if !cont {
return result;
return None;
}
}

Expand Down Expand Up @@ -202,7 +214,7 @@ impl<S: Stage> CombineAttributeParser<S> for LinkParser {
}
let Some((name, name_span)) = name else {
cx.emit_err(LinkRequiresName { span: cx.attr_span });
return result;
return None;
};

// Do this outside of the loop so that `import_name_type` can be specified before `kind`.
Expand All @@ -218,15 +230,14 @@ impl<S: Stage> CombineAttributeParser<S> for LinkParser {
cx.emit_err(RawDylibNoNul { span: name_span });
}

result = Some(LinkEntry {
Some(LinkEntry {
span: cx.attr_span,
kind: kind.unwrap_or(NativeLibKind::Unspecified),
name,
cfg,
verbatim,
import_name_type,
});
result
})
}
}

Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_span/src/symbol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -871,6 +871,7 @@ symbols! {
div,
div_assign,
diverging_block_default,
dl,
do_not_recommend,
doc,
doc_alias,
Expand Down
14 changes: 1 addition & 13 deletions compiler/rustc_trait_selection/src/infer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use rustc_middle::infer::canonical::{
Canonical, CanonicalQueryInput, CanonicalQueryResponse, QueryResponse,
};
use rustc_middle::traits::query::NoSolution;
use rustc_middle::ty::{self, GenericArg, Ty, TyCtxt, TypeFoldable, TypeVisitableExt, Upcast};
use rustc_middle::ty::{self, GenericArg, Ty, TyCtxt, TypeFoldable, Upcast};
use rustc_span::DUMMY_SP;
use tracing::instrument;

Expand All @@ -31,19 +31,7 @@ impl<'tcx> InferCtxt<'tcx> {

fn type_is_copy_modulo_regions(&self, param_env: ty::ParamEnv<'tcx>, ty: Ty<'tcx>) -> bool {
let ty = self.resolve_vars_if_possible(ty);

// FIXME(#132279): This should be removed as it causes us to incorrectly
// handle opaques in their defining scope, and stalled coroutines.
if !self.next_trait_solver() && !(param_env, ty).has_infer() && !ty.has_coroutines() {
return self.tcx.type_is_copy_modulo_regions(self.typing_env(param_env), ty);
}

let copy_def_id = self.tcx.require_lang_item(LangItem::Copy, DUMMY_SP);

// This can get called from typeck (by euv), and `moves_by_default`
// rightly refuses to work with inference variables, but
// moves_by_default has a cache, which we want to use in other
// cases.
traits::type_known_to_meet_bound_modulo_regions(self, param_env, ty, copy_def_id)
}

Expand Down
12 changes: 6 additions & 6 deletions library/std/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2107,31 +2107,31 @@ impl PartialEq for PathBuf {
impl cmp::PartialEq<str> for PathBuf {
#[inline]
fn eq(&self, other: &str) -> bool {
Path::eq(self, other)
self.as_path() == other
}
}

#[stable(feature = "eq_str_for_path", since = "1.91.0")]
impl cmp::PartialEq<PathBuf> for str {
#[inline]
fn eq(&self, other: &PathBuf) -> bool {
other == self
self == other.as_path()
}
}

#[stable(feature = "eq_str_for_path", since = "1.91.0")]
impl cmp::PartialEq<String> for PathBuf {
#[inline]
fn eq(&self, other: &String) -> bool {
**self == **other
self.as_path() == other.as_str()
}
}

#[stable(feature = "eq_str_for_path", since = "1.91.0")]
impl cmp::PartialEq<PathBuf> for String {
#[inline]
fn eq(&self, other: &PathBuf) -> bool {
other == self
self.as_str() == other.as_path()
}
}

Expand Down Expand Up @@ -3426,15 +3426,15 @@ impl cmp::PartialEq<Path> for str {
impl cmp::PartialEq<String> for Path {
#[inline]
fn eq(&self, other: &String) -> bool {
self == &*other
self == other.as_str()
}
}

#[stable(feature = "eq_str_for_path", since = "1.91.0")]
impl cmp::PartialEq<Path> for String {
#[inline]
fn eq(&self, other: &Path) -> bool {
other == self
self.as_str() == other
}
}

Expand Down
16 changes: 13 additions & 3 deletions library/std/tests/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2528,7 +2528,17 @@ fn normalize_lexically() {
}

#[test]
/// See issue#146183
fn compare_path_to_str() {
assert!(&PathBuf::from("x") == "x");
/// See issue#146183 and issue#146940
fn compare_path_like_to_str_like() {
let path_buf = PathBuf::from("x");
let path = Path::new("x");
let s = String::from("x");
assert!(path == "x");
assert!("x" == path);
assert!(path == &s);
assert!(&s == path);
assert!(&path_buf == "x");
assert!("x" == &path_buf);
assert!(path_buf == s);
assert!(s == path_buf);
}
2 changes: 1 addition & 1 deletion src/llvm-project
Submodule llvm-project updated 68 files
+77 −858 clang/include/clang/Basic/riscv_vector.td
+2 −0 clang/lib/Basic/Targets/X86.h
+945 −4 clang/lib/CodeGen/TargetBuiltins/RISCV.cpp
+1 −0 clang/lib/Format/Format.cpp
+2 −0 clang/lib/Sema/SemaExprCXX.cpp
+4 −2 clang/test/CodeGen/mangle-windows.c
+3 −0 clang/test/CodeGenCXX/mangle-windows.cpp
+15 −0 clang/test/SemaTemplate/destructor-template.cpp
+7 −0 clang/unittests/Format/TokenAnnotatorTest.cpp
+1 −1 cmake/Modules/LLVMVersion.cmake
+12 −8 lld/ELF/LinkerScript.cpp
+31 −0 lld/test/ELF/linkerscript/orphan-relocation.s
+3 −0 lldb/include/lldb/Target/InstrumentationRuntimeStopInfo.h
+12 −0 lldb/include/lldb/Target/StackFrameList.h
+5 −0 lldb/include/lldb/Target/Thread.h
+42 −0 lldb/source/Target/InstrumentationRuntimeStopInfo.cpp
+8 −0 lldb/source/Target/Process.cpp
+2 −0 lldb/source/Target/StackFrameList.cpp
+11 −1 lldb/test/API/functionalities/asan/TestMemoryHistory.py
+6 −1 lldb/test/API/functionalities/asan/TestReportData.py
+5 −2 lldb/test/API/functionalities/tsan/basic/TestTsanBasic.py
+5 −2 lldb/test/API/functionalities/ubsan/basic/TestUbsanBasic.py
+2 −0 llvm/docs/LangRef.rst
+25 −3 llvm/include/llvm/BinaryFormat/ELF.h
+3 −0 llvm/include/llvm/CodeGen/MachineOperand.h
+4 −0 llvm/include/llvm/MC/MCContext.h
+3 −0 llvm/include/llvm/MC/MCParser/MCAsmParser.h
+1 −0 llvm/include/llvm/Object/ELFObjectFile.h
+4 −1 llvm/lib/Analysis/Loads.cpp
+7 −2 llvm/lib/Analysis/ScalarEvolution.cpp
+13 −0 llvm/lib/CodeGen/MachineOperand.cpp
+28 −21 llvm/lib/MC/MCContext.cpp
+24 −41 llvm/lib/MC/MCParser/AsmParser.cpp
+22 −44 llvm/lib/MC/MCParser/COFFAsmParser.cpp
+9 −8 llvm/lib/MC/MCParser/COFFMasmParser.cpp
+14 −30 llvm/lib/MC/MCParser/DarwinAsmParser.cpp
+13 −21 llvm/lib/MC/MCParser/ELFAsmParser.cpp
+9 −0 llvm/lib/MC/MCParser/MCAsmParser.cpp
+2 −2 llvm/lib/MC/MCParser/MCAsmParserExtension.cpp
+13 −19 llvm/lib/MC/MCParser/MasmParser.cpp
+6 −9 llvm/lib/MC/MCParser/WasmAsmParser.cpp
+30 −2 llvm/lib/Object/ELFObjectFile.cpp
+1 −1 llvm/lib/Target/LoongArch/LoongArchAsmPrinter.cpp
+4 −0 llvm/lib/Target/LoongArch/LoongArchMergeBaseOffset.cpp
+6 −4 llvm/lib/Target/PowerPC/PPCISelLowering.cpp
+4 −0 llvm/lib/Target/RISCV/RISCVCallingConv.td
+50 −37 llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+10 −1 llvm/lib/Target/RISCV/RISCVRegisterInfo.cpp
+7 −1 llvm/lib/Target/X86/X86ISelLowering.cpp
+6 −2 llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
+9 −2 llvm/lib/Transforms/Vectorize/VectorCombine.cpp
+38 −0 llvm/test/CodeGen/LoongArch/inline-asm-constraint-m.ll
+24 −0 llvm/test/CodeGen/PowerPC/pr160040.ll
+449 −0 llvm/test/CodeGen/RISCV/calling-conv-preserve-most.ll
+23 −0 llvm/test/CodeGen/RISCV/rvv/fixed-vectors-vw-web-simplification.ll
+51 −0 llvm/test/CodeGen/X86/kmov.ll
+5 −0 llvm/test/CodeGen/X86/symbol-name.ll
+5 −5 llvm/test/MC/ELF/cgprofile.s
+3 −0 llvm/test/MC/ELF/symbol-names.s
+79 −0 llvm/test/Transforms/LoopVectorize/AArch64/transform-narrow-interleave-to-widen-memory-with-wide-ops.ll
+73 −0 llvm/test/Transforms/LoopVectorize/AArch64/transform-narrow-interleave-to-widen-memory.ll
+130 −0 llvm/test/Transforms/LoopVectorize/load-deref-pred-align.ll
+36 −0 llvm/test/Transforms/VectorCombine/AArch64/scalarize-ext-extract-endian.ll
+2 −0 llvm/test/Transforms/VectorCombine/PowerPC/lit.local.cfg
+22 −0 llvm/test/Transforms/VectorCombine/PowerPC/scalarize-ext-extract.ll
+82 −32 llvm/tools/llvm-readobj/ELFDumper.cpp
+15 −8 offload/plugins-nextgen/common/src/Utils/ELF.cpp
+5 −1 offload/plugins-nextgen/cuda/src/rtl.cpp
10 changes: 10 additions & 0 deletions tests/ui/attributes/link-dl.allowed.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Future incompatibility report: Future breakage diagnostic:
warning: valid forms for the attribute are `#[link(name = "...")]`, `#[link(name = "...", import_name_type = "decorated|noprefix|undecorated")]`, `#[link(name = "...", kind = "dylib|static|...")]`, `#[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")]`, and `#[link(name = "...", wasm_import_module = "...")]`
--> $DIR/link-dl.rs:14:1
|
LL | #[link="dl"]
| ^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>

23 changes: 23 additions & 0 deletions tests/ui/attributes/link-dl.default_fcw.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
error: valid forms for the attribute are `#[link(name = "...")]`, `#[link(name = "...", import_name_type = "decorated|noprefix|undecorated")]`, `#[link(name = "...", kind = "dylib|static|...")]`, `#[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")]`, and `#[link(name = "...", wasm_import_module = "...")]`
--> $DIR/link-dl.rs:14:1
|
LL | #[link="dl"]
| ^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
= note: `#[deny(ill_formed_attribute_input)]` (part of `#[deny(future_incompatible)]`) on by default

error: aborting due to 1 previous error

Future incompatibility report: Future breakage diagnostic:
error: valid forms for the attribute are `#[link(name = "...")]`, `#[link(name = "...", import_name_type = "decorated|noprefix|undecorated")]`, `#[link(name = "...", kind = "dylib|static|...")]`, `#[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")]`, and `#[link(name = "...", wasm_import_module = "...")]`
--> $DIR/link-dl.rs:14:1
|
LL | #[link="dl"]
| ^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
= note: `#[deny(ill_formed_attribute_input)]` (part of `#[deny(future_incompatible)]`) on by default

19 changes: 19 additions & 0 deletions tests/ui/attributes/link-dl.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Regression test for an issue discovered in https://github.com/rust-lang/rust/pull/143193/files and rediscovered in https://github.com/rust-lang/rust/issues/147254#event-20049906781
// Malformed #[link] attribute was supposed to be deny-by-default report-in-deps FCW,
// but accidentally was landed as a hard error.
//
// revision `default_fcw` tests that with `ill_formed_attribute_input` (the default) denied,
// the attribute produces an FCW
// revision `allowed` tests that with `ill_formed_attribute_input` allowed the test passes

//@ revisions: default_fcw allowed
//@[allowed] check-pass

#[cfg_attr(allowed, allow(ill_formed_attribute_input))]

#[link="dl"]
//[default_fcw]~^ ERROR valid forms for the attribute are
//[default_fcw]~| WARN previously accepted
extern "C" { }

fn main() {}
40 changes: 40 additions & 0 deletions tests/ui/coroutine/copy-fast-path-query-cycle.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
//@ edition: 2024
//@ revisions: current next
//@[next] compile-flags: -Znext-solver
//@ check-pass

// Regression test for #146813. We previously used a pseudo-canonical
// query during HIR typeck which caused a query cycle when looking at the
// witness of a coroutine.

use std::future::Future;

trait ConnectMiddleware {}

trait ConnectHandler: Sized {
fn with<M>(self, _: M) -> impl ConnectHandler
where
M: ConnectMiddleware,
{
LayeredConnectHandler
}
}

struct LayeredConnectHandler;
impl ConnectHandler for LayeredConnectHandler {}
impl<F> ConnectHandler for F where F: FnOnce() {}

impl<F, Fut> ConnectMiddleware for F
where
F: FnOnce() -> Fut,
Fut: Future<Output = ()> + Send,
{
}

pub async fn fails() {
{ || {} }
.with(async || ())
.with(async || ())
.with(async || ());
}
fn main() {}
19 changes: 0 additions & 19 deletions tests/ui/lang-items/missing-copy-lang-item-issue-19660.rs

This file was deleted.

8 changes: 0 additions & 8 deletions tests/ui/lang-items/missing-copy-lang-item-issue-19660.stderr

This file was deleted.

Loading