Skip to content

Commit 583f358

Browse files
committed
Auto merge of #3885 - rust-lang:rustup-2024-09-14, r=RalfJung
Automatic Rustup
2 parents 20862e4 + 94d4991 commit 583f358

File tree

423 files changed

+5453
-2989
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

423 files changed

+5453
-2989
lines changed

.gitmodules

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,7 @@
5151
path = src/tools/enzyme
5252
url = https://github.com/EnzymeAD/Enzyme.git
5353
shallow = true
54+
[submodule "src/gcc"]
55+
path = src/gcc
56+
url = https://github.com/rust-lang/gcc.git
57+
shallow = true

LICENSES/GCC-exception-3.1.txt

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
GCC RUNTIME LIBRARY EXCEPTION
2+
3+
Version 3.1, 31 March 2009
4+
5+
Copyright © 2009 Free Software Foundation, Inc. <https://fsf.org/>
6+
7+
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
8+
9+
This GCC Runtime Library Exception ("Exception") is an additional permission under section 7 of the GNU General Public License, version 3 ("GPLv3"). It applies to a given file (the "Runtime Library") that bears a notice placed by the copyright holder of the file stating that the file is governed by GPLv3 along with this Exception.
10+
11+
When you use GCC to compile a program, GCC may combine portions of certain GCC header files and runtime libraries with the compiled program. The purpose of this Exception is to allow compilation of non-GPL (including proprietary) programs to use, in this way, the header files and runtime libraries covered by this Exception.
12+
0. Definitions.
13+
14+
A file is an "Independent Module" if it either requires the Runtime Library for execution after a Compilation Process, or makes use of an interface provided by the Runtime Library, but is not otherwise based on the Runtime Library.
15+
16+
"GCC" means a version of the GNU Compiler Collection, with or without modifications, governed by version 3 (or a specified later version) of the GNU General Public License (GPL) with the option of using any subsequent versions published by the FSF.
17+
18+
"GPL-compatible Software" is software whose conditions of propagation, modification and use would permit combination with GCC in accord with the license of GCC.
19+
20+
"Target Code" refers to output from any compiler for a real or virtual target processor architecture, in executable form or suitable for input to an assembler, loader, linker and/or execution phase. Notwithstanding that, Target Code does not include data in any format that is used as a compiler intermediate representation, or used for producing a compiler intermediate representation.
21+
22+
The "Compilation Process" transforms code entirely represented in non-intermediate languages designed for human-written code, and/or in Java Virtual Machine byte code, into Target Code. Thus, for example, use of source code generators and preprocessors need not be considered part of the Compilation Process, since the Compilation Process can be understood as starting with the output of the generators or preprocessors.
23+
24+
A Compilation Process is "Eligible" if it is done using GCC, alone or with other GPL-compatible software, or if it is done without using any work based on GCC. For example, using non-GPL-compatible Software to optimize any GCC intermediate representations would not qualify as an Eligible Compilation Process.
25+
1. Grant of Additional Permission.
26+
27+
You have permission to propagate a work of Target Code formed by combining the Runtime Library with Independent Modules, even if such propagation would otherwise violate the terms of GPLv3, provided that all Target Code was generated by Eligible Compilation Processes. You may then convey such a combination under terms of your choice, consistent with the licensing of the Independent Modules.
28+
2. No Weakening of GCC Copyleft.
29+
30+
The availability of this Exception does not imply any general presumption that third-party software is unaffected by the copyleft requirements of the license of GCC.

LICENSES/GPL-2.0-only.txt

Lines changed: 133 additions & 0 deletions
Large diffs are not rendered by default.

LICENSES/GPL-3.0-or-later.txt

Lines changed: 202 additions & 0 deletions
Large diffs are not rendered by default.

LICENSES/ISC.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
ISC License
2+
3+
<copyright notice>
4+
5+
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
6+
7+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

REUSE.toml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,3 +168,37 @@ SPDX-FileCopyrightText = [
168168
"2003-2019 University of Illinois at Urbana-Champaign.",
169169
]
170170
SPDX-License-Identifier = "NCSA AND Apache-2.0 WITH LLVM-exception"
171+
172+
[[annotations]]
173+
path = "src/gcc/**"
174+
precedence = "override"
175+
SPDX-FileCopyrightText = [
176+
"Copyright (C) 1997-2024 Free Software Foundation, Inc.",
177+
]
178+
SPDX-License-Identifier = "GPL-3.0-or-later"
179+
180+
[[annotations]]
181+
path = "src/gcc/gcc/testsuite/**"
182+
precedence = "override"
183+
SPDX-FileCopyrightText = [
184+
"Copyright (C) 2000-2024 Free Software Foundation, Inc.",
185+
]
186+
SPDX-License-Identifier = "GPL-2.0-only"
187+
188+
[[annotations]]
189+
path = "src/gcc/gcc/testsuite/c-c++-common/analyzer/*.c"
190+
precedence = "override"
191+
SPDX-FileCopyrightText = [
192+
"Copyright (c) 2007-2011 Atheros Communications Inc.",
193+
"Copyright (c) 2011-2012,2017 Qualcomm Atheros, Inc.",
194+
"Copyright (c) 2016-2017 Erik Stromdahl <erik.stromdahl@gmail.com>",
195+
]
196+
SPDX-License-Identifier = "ISC"
197+
198+
[[annotations]]
199+
path = "src/gcc/libstdc++-v3/config/os/aix/os_defines.h"
200+
precedence = "override"
201+
SPDX-FileCopyrightText = [
202+
"Copyright (C) 2000-2024 Free Software Foundation, Inc.",
203+
]
204+
SPDX-License-Identifier = "GCC-exception-3.1"

compiler/rustc_ast/src/ast.rs

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,14 +1188,7 @@ impl Expr {
11881188
///
11891189
/// Does not ensure that the path resolves to a const param, the caller should check this.
11901190
pub fn is_potential_trivial_const_arg(&self) -> bool {
1191-
let this = if let ExprKind::Block(block, None) = &self.kind
1192-
&& let [stmt] = block.stmts.as_slice()
1193-
&& let StmtKind::Expr(expr) = &stmt.kind
1194-
{
1195-
expr
1196-
} else {
1197-
self
1198-
};
1191+
let this = self.maybe_unwrap_block();
11991192

12001193
if let ExprKind::Path(None, path) = &this.kind
12011194
&& path.is_potential_trivial_const_arg()
@@ -1206,6 +1199,17 @@ impl Expr {
12061199
}
12071200
}
12081201

1202+
pub fn maybe_unwrap_block(&self) -> &Expr {
1203+
if let ExprKind::Block(block, None) = &self.kind
1204+
&& let [stmt] = block.stmts.as_slice()
1205+
&& let StmtKind::Expr(expr) = &stmt.kind
1206+
{
1207+
expr
1208+
} else {
1209+
self
1210+
}
1211+
}
1212+
12091213
pub fn to_bound(&self) -> Option<GenericBound> {
12101214
match &self.kind {
12111215
ExprKind::Path(None, path) => Some(GenericBound::Trait(
@@ -2602,12 +2606,12 @@ impl CoroutineKind {
26022606
}
26032607
}
26042608

2605-
pub fn is_async(self) -> bool {
2606-
matches!(self, CoroutineKind::Async { .. })
2607-
}
2608-
2609-
pub fn is_gen(self) -> bool {
2610-
matches!(self, CoroutineKind::Gen { .. })
2609+
pub fn as_str(self) -> &'static str {
2610+
match self {
2611+
CoroutineKind::Async { .. } => "async",
2612+
CoroutineKind::Gen { .. } => "gen",
2613+
CoroutineKind::AsyncGen { .. } => "async gen",
2614+
}
26112615
}
26122616

26132617
pub fn closure_id(self) -> NodeId {
@@ -3486,7 +3490,7 @@ impl From<ForeignItemKind> for ItemKind {
34863490
fn from(foreign_item_kind: ForeignItemKind) -> ItemKind {
34873491
match foreign_item_kind {
34883492
ForeignItemKind::Static(box static_foreign_item) => {
3489-
ItemKind::Static(Box::new(static_foreign_item.into()))
3493+
ItemKind::Static(Box::new(static_foreign_item))
34903494
}
34913495
ForeignItemKind::Fn(fn_kind) => ItemKind::Fn(fn_kind),
34923496
ForeignItemKind::TyAlias(ty_alias_kind) => ItemKind::TyAlias(ty_alias_kind),
@@ -3500,9 +3504,7 @@ impl TryFrom<ItemKind> for ForeignItemKind {
35003504

35013505
fn try_from(item_kind: ItemKind) -> Result<ForeignItemKind, ItemKind> {
35023506
Ok(match item_kind {
3503-
ItemKind::Static(box static_item) => {
3504-
ForeignItemKind::Static(Box::new(static_item.into()))
3505-
}
3507+
ItemKind::Static(box static_item) => ForeignItemKind::Static(Box::new(static_item)),
35063508
ItemKind::Fn(fn_kind) => ForeignItemKind::Fn(fn_kind),
35073509
ItemKind::TyAlias(ty_alias_kind) => ForeignItemKind::TyAlias(ty_alias_kind),
35083510
ItemKind::MacCall(a) => ForeignItemKind::MacCall(a),

compiler/rustc_ast/src/entry.rs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,16 @@ pub fn entry_point_type(
4545
EntryPointType::Start
4646
} else if attr::contains_name(attrs, sym::rustc_main) {
4747
EntryPointType::RustcMainAttr
48-
} else {
49-
if let Some(name) = name
50-
&& name == sym::main
51-
{
52-
if at_root {
53-
// This is a top-level function so it can be `main`.
54-
EntryPointType::MainNamed
55-
} else {
56-
EntryPointType::OtherMain
57-
}
48+
} else if let Some(name) = name
49+
&& name == sym::main
50+
{
51+
if at_root {
52+
// This is a top-level function so it can be `main`.
53+
EntryPointType::MainNamed
5854
} else {
59-
EntryPointType::None
55+
EntryPointType::OtherMain
6056
}
57+
} else {
58+
EntryPointType::None
6159
}
6260
}

compiler/rustc_ast_lowering/src/asm.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
220220
let parent_def_id = self.current_def_id_parent;
221221
let node_id = self.next_node_id();
222222
// HACK(min_generic_const_args): see lower_anon_const
223-
if !self.tcx.features().const_arg_path
224-
|| !expr.is_potential_trivial_const_arg()
225-
{
223+
if !expr.is_potential_trivial_const_arg() {
226224
self.create_def(
227225
parent_def_id,
228226
node_id,

compiler/rustc_ast_lowering/src/expr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
387387
let node_id = self.next_node_id();
388388

389389
// HACK(min_generic_const_args): see lower_anon_const
390-
if !self.tcx.features().const_arg_path || !arg.is_potential_trivial_const_arg() {
390+
if !arg.is_potential_trivial_const_arg() {
391391
// Add a definition for the in-band const def.
392392
self.create_def(parent_def_id, node_id, kw::Empty, DefKind::AnonConst, f.span);
393393
}

0 commit comments

Comments
 (0)