Skip to content
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

[beta] backport #110871

Merged
merged 7 commits into from
Apr 30, 2023
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: 3 additions & 3 deletions compiler/rustc_metadata/src/rmeta/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -823,6 +823,8 @@ fn should_encode_span(def_kind: DefKind) -> bool {
| DefKind::TraitAlias
| DefKind::AssocTy
| DefKind::TyParam
| DefKind::ConstParam
| DefKind::LifetimeParam
| DefKind::Fn
| DefKind::Const
| DefKind::Static(_)
Expand All @@ -837,12 +839,10 @@ fn should_encode_span(def_kind: DefKind) -> bool {
| DefKind::Impl { .. }
| DefKind::Closure
| DefKind::Generator => true,
DefKind::ConstParam
| DefKind::ExternCrate
DefKind::ExternCrate
| DefKind::Use
| DefKind::ForeignMod
| DefKind::ImplTraitPlaceholder
| DefKind::LifetimeParam
| DefKind::GlobalAsm => false,
}
}
Expand Down
35 changes: 18 additions & 17 deletions compiler/rustc_session/src/filesearch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,28 +227,29 @@ pub fn get_or_default_sysroot() -> Result<PathBuf, String> {
))?;

// if `dir` points target's dir, move up to the sysroot
if dir.ends_with(crate::config::host_triple()) {
let mut sysroot_dir = if dir.ends_with(crate::config::host_triple()) {
dir.parent() // chop off `$target`
.and_then(|p| p.parent()) // chop off `rustlib`
.and_then(|p| {
// chop off `lib` (this could be also $arch dir if the host sysroot uses a
// multi-arch layout like Debian or Ubuntu)
match p.parent() {
Some(p) => match p.file_name() {
Some(f) if f == "lib" => p.parent(), // first chop went for $arch, so chop again for `lib`
_ => Some(p),
},
None => None,
}
})
.and_then(|p| p.parent()) // chop off `lib`
.map(|s| s.to_owned())
.ok_or(format!(
"Could not move 3 levels upper using `parent()` on {}",
dir.display()
))
.ok_or_else(|| {
format!("Could not move 3 levels upper using `parent()` on {}", dir.display())
})?
} else {
Ok(dir.to_owned())
dir.to_owned()
};

// On multiarch linux systems, there will be multiarch directory named
// with the architecture(e.g `x86_64-linux-gnu`) under the `lib` directory.
// Which cause us to mistakenly end up in the lib directory instead of the sysroot directory.
if sysroot_dir.ends_with("lib") {
sysroot_dir =
sysroot_dir.parent().map(|real_sysroot| real_sysroot.to_owned()).ok_or_else(
|| format!("Could not move to parent path of {}", sysroot_dir.display()),
)?
}

Ok(sysroot_dir)
}

// Use env::args().next() to get the path of the executable without
Expand Down
7 changes: 4 additions & 3 deletions src/ci/scripts/install-awscli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@
#
# Before compressing please make sure all the wheels end with `-none-any.whl`.
# If that's not the case you'll need to remove the non-cross-platform ones and
# replace them with the .tar.gz downloaded from https://pypi.org. Also make
# sure it's possible to call this script with both Python 2 and Python 3.
# replace them with the .tar.gz downloaded from https://pypi.org.

set -euo pipefail
IFS=$'\n\t'

source "$(cd "$(dirname "$0")" && pwd)/../shared.sh"

MIRROR="${MIRRORS_BASE}/2019-07-27-awscli.tar"
MIRROR="${MIRRORS_BASE}/2023-04-28-awscli.tar"
DEPS_DIR="/tmp/awscli-deps"

pip="pip"
Expand All @@ -29,6 +28,8 @@ if isLinux; then

sudo apt-get install -y python3-setuptools python3-wheel
ciCommandAddPath "${HOME}/.local/bin"
elif isMacOS; then
pip="pip3"
fi

mkdir -p "${DEPS_DIR}"
Expand Down
693 changes: 291 additions & 402 deletions src/stage0.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions tests/run-make/jobserver-error/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
include ../tools.mk

# only-linux
# ignore-test: This test randomly fails, see https://github.com/rust-lang/rust/issues/110321

# Test compiler behavior in case: `jobserver-auth` points to correct pipe which is not jobserver.

Expand Down
3 changes: 3 additions & 0 deletions tests/ui/generics/auxiliary/foreign-generic-mismatch.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pub fn const_arg<const N: usize, T>() {}

pub fn lt_arg<'a: 'a>() {}
10 changes: 10 additions & 0 deletions tests/ui/generics/foreign-generic-mismatch.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// aux-build: foreign-generic-mismatch.rs

extern crate foreign_generic_mismatch;

fn main() {
foreign_generic_mismatch::const_arg::<()>();
//~^ ERROR function takes 2 generic arguments but 1 generic argument was supplied
foreign_generic_mismatch::lt_arg::<'static, 'static>();
//~^ ERROR function takes 1 lifetime argument but 2 lifetime arguments were supplied
}
35 changes: 35 additions & 0 deletions tests/ui/generics/foreign-generic-mismatch.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
error[E0107]: function takes 2 generic arguments but 1 generic argument was supplied
--> $DIR/foreign-generic-mismatch.rs:6:31
|
LL | foreign_generic_mismatch::const_arg::<()>();
| ^^^^^^^^^ -- supplied 1 generic argument
| |
| expected 2 generic arguments
|
note: function defined here, with 2 generic parameters: `N`, `T`
--> $DIR/auxiliary/foreign-generic-mismatch.rs:1:8
|
LL | pub fn const_arg<const N: usize, T>() {}
| ^^^^^^^^^ -------------- -
help: add missing generic argument
|
LL | foreign_generic_mismatch::const_arg::<(), T>();
| +++

error[E0107]: function takes 1 lifetime argument but 2 lifetime arguments were supplied
--> $DIR/foreign-generic-mismatch.rs:8:31
|
LL | foreign_generic_mismatch::lt_arg::<'static, 'static>();
| ^^^^^^ ------- help: remove this lifetime argument
| |
| expected 1 lifetime argument
|
note: function defined here, with 1 lifetime parameter: `'a`
--> $DIR/auxiliary/foreign-generic-mismatch.rs:3:8
|
LL | pub fn lt_arg<'a: 'a>() {}
| ^^^^^^ --

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0107`.